Skip to content

add support for Gogs repository #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions giturlparse/platforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .bitbucket import BitbucketPlatform
from .friendcode import FriendCodePlatform
from .assembla import AssemblaPlatform
from .gogs import GogsPlatform
from .gitlab import GitLabPlatform


Expand All @@ -14,6 +15,7 @@
('bitbucket', BitbucketPlatform()),
('friendcode', FriendCodePlatform()),
('assembla', AssemblaPlatform()),
('gogs', GogsPlatform()),
('gitlab', GitLabPlatform()),

# Match url
Expand Down
11 changes: 11 additions & 0 deletions giturlparse/platforms/gogs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Imports
from .base import BasePlatform


class GogsPlatform(BasePlatform):
PATTERNS = {
'https': r'https://(?P<domain>.+)/(?P<owner>.+)/(?P<repo>.+).git',
}
FORMATS = {
'https': r'https://%(domain)s/%(owner)s/%(repo)s.git',
}
4 changes: 4 additions & 0 deletions giturlparse/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def assembla(self):
def gitlab(self):
return self.platform == 'gitlab'

@property
def gogs(self):
return self.platform == 'gogs'

##
# Get data as dict
##
Expand Down