diff --git a/lib/cocoaseeds/core.rb b/lib/cocoaseeds/core.rb index e6d2081..c22d07e 100644 --- a/lib/cocoaseeds/core.rb +++ b/lib/cocoaseeds/core.rb @@ -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}" diff --git a/test/test_core.rb b/test/test_core.rb index b5d06a7..97df625 100644 --- a/test/test_core.rb +++ b/test/test_core.rb @@ -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}"