Skip to content

Commit

Permalink
Do not raise error when Gemfile does not exist
Browse files Browse the repository at this point in the history
This is to allow user to run `appraisal help` to get the help message.

Note that there is no test for this, as it's impossible to trick Bundler
to run the executable without a Gemfile. I tested it locally and it
works, so that has to be enough.

Fix #98
  • Loading branch information
sikachu committed Jun 26, 2015
1 parent 4993ccd commit 5d67de5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/appraisal/gemfile.rb
Expand Up @@ -10,7 +10,9 @@ module Appraisal
# Load bundler Gemfiles and merge dependencies
class Gemfile < BundlerDSL
def load(path)
run(IO.read(path))
if ::File.exist?(path)
run(IO.read(path))
end
end

def run(definitions)
Expand Down
1 change: 1 addition & 0 deletions spec/appraisal/file_spec.rb
Expand Up @@ -7,6 +7,7 @@

describe Appraisal::File do
it "complains when no Appraisals file is found" do
allow(::File).to receive(:exist?).with(/Gemfile/).and_return(true)
allow(::File).to receive(:exist?).with("Appraisals").and_return(false)
expect { described_class.new }.to raise_error(Appraisal::AppraisalsNotFound)
end
Expand Down

0 comments on commit 5d67de5

Please sign in to comment.