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

Commit

Permalink
Raise an exception when failed to install seeds.
Browse files Browse the repository at this point in the history
  • Loading branch information
devxoul committed Oct 18, 2015
1 parent cab2f1e commit 02e51ce
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/cocoaseeds/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,18 @@ def install_seed(seed, dirname)

not_found = output.include?("not found")
if not_found and output.include?("repository")
say "[!] #{seed.name}: Couldn't find the repository.".red
raise Seeds::Exception.new\
"#{seed.name}: Couldn't find the repository."
elsif not_found and output.include?("upstream")
say "[!] #{seed.name}: Couldn't find the tag `#{seed.version}`.".red
raise Seeds::Exception.new\
"#{seed.name}: Couldn't find the tag `#{seed.version}`."
end

if seed.commit and not seed.version # checkout to commit
output = `cd #{dirname} 2>&1 && git checkout #{seed.commit} 2>&1`
if output.include?("did not match any")
say "[!] #{seed.name}: Couldn't find the commit "\
"`#{seed.commit}`.".red
raise Seeds::Exception.new\
"#{seed.name}: Couldn't find the commit `#{seed.commit}`."
end
end

Expand Down Expand Up @@ -383,10 +385,9 @@ def install_seed(seed, dirname)
output = `cd #{dirname} 2>&1 &&\
git fetch origin #{seed.version} --tags 2>&1 &&\
git checkout #{seed.version} 2>&1`
puts output
if output.include?("Couldn't find")
say "[!] #{seed.name}: Couldn't find the tag or branch named "\
"`#{seed.commit}`.".red
raise Seeds::Exception.new\
"#{seed.name}: Couldn't find the tag or branch `#{seed.version}`."
end

elsif seed.commit
Expand All @@ -397,8 +398,8 @@ def install_seed(seed, dirname)
git pull 2>&1 &&
git checkout #{seed.commit} 2>&1`
if output.include?("did not match any")
say "[!] #{seed.name}: Couldn't find the commit "\
"`#{seed.commit}`.".red
raise Seeds::Exception.new\
"#{seed.name}: Couldn't find the commit `#{seed.commit}`.".red
end
end

Expand Down

0 comments on commit 02e51ce

Please sign in to comment.