Skip to content
Merged
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: 1 addition & 1 deletion .moban.cd/moban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- appdirs>=1.2.0
- crayons>= 0.1.0
- GitPython>=2.0.0
- giturlparse>=0.9.1
- git-url-parse>=1.2.2
description: Yet another jinja2 cli command for static text generation
scm_host: github.com
lint_command: make lint install_test format install update
1 change: 0 additions & 1 deletion .moban.d/travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ matrix:
{%block custom_python_versions%}
python:
- &pypy2 pypy2.7-6.0
- 3.8-dev
- 3.7
- 3.6
- 3.5
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ notifications:
email: false
python:
- &pypy2 pypy2.7-6.0
- 3.8-dev
- 3.7
- 3.6
- 3.5
Expand Down
2 changes: 1 addition & 1 deletion min_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ lml==0.0.9
appdirs==1.2.0
crayons== 0.1.0
GitPython==2.0.0
giturlparse==0.9.1
git-url-parse==1.2.2
10 changes: 4 additions & 6 deletions moban/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ def git_clone(requires):

def get_repo_name(repo_url):
import giturlparse
from giturlparse.parser import ParserError

try:
repo = giturlparse.parse(repo_url)
name = repo.repo
if name.endswith("/"):
name = name[:-1]
return name
except AttributeError:
repo = giturlparse.parse(repo_url.rstrip("/"))
return repo.name
except ParserError:
reporter.report_error_message(
constants.MESSAGE_INVALID_GIT_URL % repo_url
)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ lml>=0.0.9
appdirs>=1.2.0
crayons>= 0.1.0
GitPython>=2.0.0
giturlparse>=0.9.1
git-url-parse>=1.2.2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"appdirs>=1.2.0",
"crayons>= 0.1.0",
"GitPython>=2.0.0",
"giturlparse>=0.9.1",
"git-url-parse>=1.2.2",
]
SETUP_COMMANDS = {}

Expand Down
8 changes: 5 additions & 3 deletions tests/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ def test_update_existing_with_reference_parameter(

def test_get_repo_name():
repos = [
"https://github.com/sphinx-doc/sphinx",
"https://github.com/repo-abc-def/repo",
"https://github.com/abc/repo",
"https://github.com/abc/repo.git",
"https://github.com/abc/repo/",
"git@github.com:moremoban/moban.git",
"git@github.com:abc/repo.git",
"git@bitbucket.org:abc/repo.git",
"git://github.com/abc/repo.git",
]
actual = [get_repo_name(repo) for repo in repos]
expected = ["sphinx", "repo", "repo", "repo", "moban"]
expected = ["repo"] * len(repos)
eq_(expected, actual)


Expand Down