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

Raise an exception when the name of github seeds are invalid. #7

Merged
merged 2 commits into from
Jun 13, 2015
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
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