Skip to content
This repository has been archived by the owner on Jul 2, 2018. It is now read-only.

Commit

Permalink
Merge pull request #7 from devxoul/exception-github-username
Browse files Browse the repository at this point in the history
Raise an exception when the name of github seeds are invalid.
  • Loading branch information
devxoul committed Jun 13, 2015
2 parents 7748532 + 9c620fc commit 164d6fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cocoaseeds/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def github(repo, tag, options={})
target *self.project.targets.map(&:name) do
send(__callee__, repo, tag, options)
end
elsif repo.split('/').count != 2
raise Seeds::Exception.new\
"#{repo}: GitHub should have both username and repo name.\n"\
" (e.g. `devxoul/JLToast`)"
else
seed = Seeds::Seed::GitHub.new
seed.url = "https://github.com/#{repo}"
Expand Down
7 changes: 7 additions & 0 deletions test/test_core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ def test_raise_invalid_target
assert_raises Seeds::Exception do @seed.install end
end

def test_raise_invalid_github_reponame
seedfile %{
github "JLToast", "1.2.2"
}
assert_raises Seeds::Exception do @seed.install end
end

def test_install
seedfile %{
github "devxoul/JLToast", "1.2.2", :files => "JLToast/*.{h,swift}"
Expand Down

0 comments on commit 164d6fe

Please sign in to comment.