diff options
author | Stefan Lance <stefan@lances.net> | 2015-07-16 10:03:35 -0500 |
---|---|---|
committer | Stefan Lance <stefan@lances.net> | 2015-08-17 20:57:05 -0500 |
commit | 9dd8b35da6a371901de18f2aa1d59cb49c4801f8 (patch) | |
tree | 3f329aff01c698b8eda7e1e88a9fc7e9073184db | |
parent | e552f9635538ad7b53ee628af9668647649f76b8 (diff) | |
download | bundler-9dd8b35da6a371901de18f2aa1d59cb49c4801f8.tar.gz |
Make specs use gems.rb and gems.locked
Conflicts:
lib/bundler/cli/init.rb
lib/bundler/deployment.rb
lib/bundler/inline.rb
spec/bundler/definition_spec.rb
spec/commands/clean_spec.rb
spec/commands/exec_spec.rb
spec/commands/install_spec.rb
spec/commands/show_spec.rb
spec/install/gemfile/git_spec.rb
spec/install/gems/flex_spec.rb
spec/install/gems/win32_spec.rb
spec/lock/lockfile_spec.rb
spec/other/platform_spec.rb
spec/runtime/setup_spec.rb
spec/runtime/with_clean_env_spec.rb
spec/support/matchers.rb
29 files changed, 149 insertions, 143 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 2704bbec7c..a2764a85dd 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -50,7 +50,7 @@ module Bundler ensure_safe_gem_name(name, constant_array) templates = { - "Gemfile.tt" => "Gemfile", + "Gemfile.tt" => "gems.rb", "gitignore.tt" => ".gitignore", "lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb", "lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb", diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb index 1d201a90f5..94a86f70e9 100644 --- a/lib/bundler/cli/init.rb +++ b/lib/bundler/cli/init.rb @@ -6,9 +6,12 @@ module Bundler end def run - if File.exist?("Gemfile") - Bundler.ui.error "Gemfile already exists at #{SharedHelpers.pwd}/Gemfile" - exit 1 + + ["gems.rb", "Gemfile"].each do |f| + if File.exist?(f) + Bundler.ui.error "#{f} already exists at #{Dir.pwd}/#{f}" + exit 1 + end end if options[:gemspec] @@ -18,14 +21,15 @@ module Bundler exit 1 end spec = Gem::Specification.load(gemspec) - puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile" - File.open("Gemfile", "wb") do |file| + puts "Writing new gems.rb to #{Dir.pwd}/gems.rb" + + File.open('gems.rb', 'wb') do |file| file << "# Generated from #{gemspec}\n" file << spec.to_gemfile end else - puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile" - FileUtils.cp(File.expand_path("../../templates/Gemfile", __FILE__), "Gemfile") + puts "Writing new gems.rb to #{Dir.pwd}/gems.rb" + FileUtils.cp(File.expand_path('../../templates/gems.rb', __FILE__), 'gems.rb') end end end diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 9df19b02ad..72a23955b0 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -1,7 +1,7 @@ # Allows for declaring a Gemfile inline in a ruby script, optionally installing # any gems that aren't already installed on the user's system. # -# @note Every gem that is specified in this 'Gemfile' will be `require`d, as if +# @note Every gem that is specified in this 'gems.rb' will be `require`d, as if # the user had manually called `Bundler.require`. To avoid a requested gem # being automatically required, add the `:require => false` option to the # `gem` dependency declaration. @@ -10,7 +10,7 @@ # user's system should be installed. # Defaults to `false`. # -# @param gemfile [Proc] a block that is evaluated as a `Gemfile`. +# @param gemfile [Proc] a block that is evaluated as a `gems.rb`. # # @example Using an inline Gemfile # @@ -33,7 +33,7 @@ def gemfile(install = false, &gemfile) def Bundler.root Bundler::SharedHelpers.pwd.expand_path end - ENV["BUNDLE_GEMFILE"] ||= "Gemfile" + ENV['BUNDLE_GEMFILE'] ||= 'gems.rb' builder = Bundler::Dsl.new builder.instance_eval(&gemfile) diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 076f2c8632..7562a8b9f4 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -4,7 +4,7 @@ require "bundler/definition" describe Bundler::Definition do before do allow(Bundler).to receive(:settings) { Bundler::Settings.new(".") } - allow(Bundler).to receive(:default_gemfile) { Pathname.new("Gemfile") } + allow(Bundler).to receive(:default_gemfile) { Pathname.new("gems.rb") } allow(Bundler).to receive(:ui) { double("UI", :info => "") } end @@ -12,11 +12,11 @@ describe Bundler::Definition do context "when it's not possible to write to the file" do subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } - it "raises an PermissionError with explanation" do - expect(File).to receive(:open).with("Gemfile.lock", "wb"). + it "raises an InstallError with explanation" do + expect(File).to receive(:open).with("gems.locked", "wb"). and_raise(Errno::EACCES) - expect { subject.lock("Gemfile.lock") }. - to raise_error(Bundler::PermissionError, /Gemfile\.lock/) + expect { subject.lock("gems.locked") }. + to raise_error(Bundler::InstallError) end end end diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index 4f66edb7e8..debaae0951 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -66,20 +66,20 @@ describe Bundler::Dsl do describe "#method_missing" do it "raises an error for unknown DSL methods" do - expect(Bundler).to receive(:read_file).with("Gemfile"). + expect(Bundler).to receive(:read_file).with("gems.rb"). and_return("unknown") - error_msg = "There was an error parsing `Gemfile`: Undefined local variable or method `unknown' for Gemfile. Bundler cannot continue." - expect { subject.eval_gemfile("Gemfile") }. + error_msg = "There was an error parsing `gems.rb`: Undefined local variable or method `unknown' for Gemfile. Bundler cannot continue." + expect { subject.eval_gemfile("gems.rb") }. to raise_error(Bundler::GemfileError, Regexp.new(error_msg)) end end describe "#eval_gemfile" do it "handles syntax errors with a useful message" do - expect(Bundler).to receive(:read_file).with("Gemfile").and_return("}") - expect { subject.eval_gemfile("Gemfile") }. - to raise_error(Bundler::GemfileError, /There was an error parsing `Gemfile`: (syntax error, unexpected tSTRING_DEND|(compile error - )?syntax error, unexpected '}'). Bundler cannot continue./) + expect(Bundler).to receive(:read_file).with("gems.rb").and_return("}") + expect { subject.eval_gemfile("gems.rb") }. + to raise_error(Bundler::GemfileError, /There was an error parsing `gems.rb`: (syntax error, unexpected tSTRING_DEND|(compile error - )?syntax error, unexpected '}'). Bundler cannot continue./) end end @@ -175,16 +175,16 @@ describe Bundler::Dsl do describe "syntax errors" do it "will raise a Bundler::GemfileError" do gemfile "gem 'foo', :path => /unquoted/string/syntax/error" - expect { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }. - to raise_error(Bundler::GemfileError, /There was an error parsing `Gemfile`:( compile error -)? unknown regexp options - trg. Bundler cannot continue./) + expect { Bundler::Dsl.evaluate(bundled_app("gems.rb"), nil, true) }. + to raise_error(Bundler::GemfileError, /There was an error parsing `gems.rb`:( compile error -)? unknown regexp options - trg. Bundler cannot continue./) end end describe "Runtime errors", :unless => Bundler.current_ruby.on_18? do it "will raise a Bundler::GemfileError" do gemfile "s = 'foo'.freeze; s.strip!" - expect { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }. - to raise_error(Bundler::GemfileError, /There was an error parsing `Gemfile`: can't modify frozen String. Bundler cannot continue./i) + expect { Bundler::Dsl.evaluate(bundled_app("gems.rb"), nil, true) }. + to raise_error(Bundler::GemfileError, /There was an error parsing `gems.rb`: can't modify frozen String. Bundler cannot continue./i) end end end diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index 8e58937cd2..02d243abbe 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -69,7 +69,7 @@ describe "bundle cache" do bundle "cache" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end end @@ -152,11 +152,11 @@ describe "bundle cache" do end it "should not explode if the lockfile is not present" do - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) bundle :cache - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end end diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb index 6d3c19e41c..31f284da0f 100644 --- a/spec/commands/check_spec.rb +++ b/spec/commands/check_spec.rb @@ -19,7 +19,7 @@ describe "bundle check" do G Dir.chdir tmp - bundle "check --gemfile bundled_app/Gemfile" + bundle "check --gemfile bundled_app/gems.rb" expect(out).to include("The Gemfile's dependencies are satisfied") end @@ -29,11 +29,11 @@ describe "bundle check" do gem "rails" G - FileUtils.rm("Gemfile.lock") + FileUtils.rm("gems.locked") bundle "check" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end it "does not create a Gemfile.lock if --dry-run was passed" do @@ -42,11 +42,11 @@ describe "bundle check" do gem "rails" G - FileUtils.rm("Gemfile.lock") + FileUtils.rm("gems.locked") bundle "check --dry-run" - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist end it "prints a generic error if the missing gems are unresolvable" do @@ -222,7 +222,7 @@ describe "bundle check" do bundle "install" bundle "install --deployment" - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) bundle :check expect(exitstatus).not_to eq(0) if exitstatus diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index e2655d098c..06cac16b11 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -472,11 +472,11 @@ describe "bundle clean" do bundle "install --path vendor/bundle" # mimic 7 length git revisions in Gemfile.lock - gemfile_lock = File.read(bundled_app("Gemfile.lock")).split("\n") + gemfile_lock = File.read(bundled_app('gems.locked')).split("\n") gemfile_lock.each_with_index do |line, index| gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:") end - File.open(bundled_app("Gemfile.lock"), "w") do |file| + File.open(bundled_app('gems.locked'), 'w') do |file| file.print gemfile_lock.join("\n") end diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index aa9bc07373..d76bb3e062 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -123,7 +123,7 @@ describe "bundle exec" do G Dir.chdir bundled_app2 do - install_gemfile bundled_app2("Gemfile"), <<-G, :system => true + install_gemfile bundled_app2('gems.rb'), <<-G, :system => true source "file://#{gem_repo2}" gem "rack_two", "1.0.0" G diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb index 548033e40e..1d9883e512 100644 --- a/spec/commands/init_spec.rb +++ b/spec/commands/init_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" describe "bundle init" do it "generates a Gemfile" do bundle :init - expect(bundled_app("Gemfile")).to exist + expect(bundled_app("gems.rb")).to exist end it "does not change existing Gemfiles" do @@ -13,7 +13,7 @@ describe "bundle init" do expect { bundle :init - }.not_to change { File.read(bundled_app("Gemfile")) } + }.not_to change { File.read(bundled_app("gems.rb")) } end it "should generate from an existing gemspec" do @@ -30,7 +30,7 @@ describe "bundle init" do bundle :init, :gemspec => spec_file - gemfile = bundled_app("Gemfile").read + gemfile = bundled_app("gems.rb").read expect(gemfile).to match(%r{source 'https://rubygems.org'}) expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1) expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1) diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb index 9d454c0c22..92388b498f 100644 --- a/spec/commands/inject_spec.rb +++ b/spec/commands/inject_spec.rb @@ -10,9 +10,9 @@ describe "bundle inject" do context "without a lockfile" do it "locks with the injected gems" do - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist bundle "inject 'rack-obama' '> 0'" - expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/) + expect(bundled_app("gems.locked").read).to match(/rack-obama/) end end @@ -22,15 +22,15 @@ describe "bundle inject" do end it "adds the injected gems to the Gemfile" do - expect(bundled_app("Gemfile").read).not_to match(/rack-obama/) + expect(bundled_app("gems.rb").read).not_to match(/rack-obama/) bundle "inject 'rack-obama' '> 0'" - expect(bundled_app("Gemfile").read).to match(/rack-obama/) + expect(bundled_app("gems.rb").read).to match(/rack-obama/) end it "locks with the injected gems" do - expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/) + expect(bundled_app("gems.locked").read).not_to match(/rack-obama/) bundle "inject 'rack-obama' '> 0'" - expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/) + expect(bundled_app("gems.locked").read).to match(/rack-obama/) end end @@ -49,13 +49,13 @@ describe "bundle inject" do it "injects anyway" do bundle "inject 'rack-obama' '> 0'" - expect(bundled_app("Gemfile").read).to match(/rack-obama/) + expect(bundled_app("gems.rb").read).to match(/rack-obama/) end it "locks with the injected gems" do - expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/) + expect(bundled_app("gems.locked").read).not_to match(/rack-obama/) bundle "inject 'rack-obama' '> 0'" - expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/) + expect(bundled_app("gems.locked").read).to match(/rack-obama/) end it "restores frozen afterwards" do @@ -72,7 +72,7 @@ describe "bundle inject" do bundle "inject 'rack' '> 0'" expect(err).to match(/trying to install in deployment mode after changing/) - expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/) + expect(bundled_app("gems.locked").read).not_to match(/rack-obama/) end end end diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb index 12170fa1a0..a10a16c871 100644 --- a/spec/commands/install_spec.rb +++ b/spec/commands/install_spec.rb @@ -17,7 +17,7 @@ describe "bundle install with gem sources" do G expect(err).to match(/StandardError, "FAIL"/) - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist end it "creates a Gemfile.lock" do @@ -26,7 +26,7 @@ describe "bundle install with gem sources" do gem "rack" G - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app('gems.locked')).to exist end it "creates lock files based on the Gemfile name" do @@ -46,13 +46,13 @@ describe "bundle install with gem sources" do gem 'rack' G - lockfile = File.read(bundled_app("Gemfile.lock")) + lockfile = File.read(bundled_app("gems.locked")) install_gemfile <<-G, :expect_err => true raise StandardError, "FAIL" G - expect(File.read(bundled_app("Gemfile.lock"))).to eq(lockfile) + expect(File.read(bundled_app("gems.locked"))).to eq(lockfile) end it "does not touch the lockfile if nothing changed" do @@ -61,7 +61,7 @@ describe "bundle install with gem sources" do gem "rack" G - expect { run "1" }.not_to change { File.mtime(bundled_app("Gemfile.lock")) } + expect { run '1' }.not_to change { File.mtime(bundled_app('gems.locked')) } end it "fetches gems" do @@ -298,7 +298,7 @@ describe "bundle install with gem sources" do install_gemfile <<-G G - expect(File.exist?(bundled_app("Gemfile.lock"))).to eq(true) + expect(File.exist?(bundled_app("gems.locked"))).to eq(true) end it "gracefully handles error when rubygems server is unavailable" do @@ -352,7 +352,7 @@ describe "bundle install with gem sources" do gemfile = <<-G gem 'foo', :path => "#{lib_path("foo-1.0")}" G - File.open("Gemfile", "w") do |file| + File.open("gems.rb", "w") do |file| file.puts gemfile end diff --git a/spec/commands/lock_spec.rb b/spec/commands/lock_spec.rb index 5c7181c367..cda2d2f2c9 100644 --- a/spec/commands/lock_spec.rb +++ b/spec/commands/lock_spec.rb @@ -5,7 +5,7 @@ describe "bundle lock" do strip_whitespace(lockfile).sub(/\n\Z/, "") end - def read_lockfile(file = "Gemfile.lock") + def read_lockfile(file = "gems.locked") strip_lockfile bundled_app(file).read end diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 551a0cd982..9a0921ce96 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -136,7 +136,7 @@ describe "bundle gem" do it "generates a gem skeleton" do expect(bundled_app("test_gem/test_gem.gemspec")).to exist - expect(bundled_app("test_gem/Gemfile")).to exist + expect(bundled_app("test_gem/gems.rb")).to exist expect(bundled_app("test_gem/Rakefile")).to exist expect(bundled_app("test_gem/lib/test_gem.rb")).to exist expect(bundled_app("test_gem/lib/test_gem/version.rb")).to exist @@ -360,7 +360,7 @@ describe "bundle gem" do it "generates a gem skeleton with MIT license" do expect(bundled_app("test-gem/test-gem.gemspec")).to exist expect(bundled_app("test-gem/LICENSE.txt")).to exist - expect(bundled_app("test-gem/Gemfile")).to exist + expect(bundled_app("test-gem/gems.rb")).to exist expect(bundled_app("test-gem/Rakefile")).to exist expect(bundled_app("test-gem/lib/test/gem.rb")).to exist expect(bundled_app("test-gem/lib/test/gem/version.rb")).to exist @@ -382,7 +382,7 @@ describe "bundle gem" do it "generates a gem skeleton with Code of Conduct" do expect(bundled_app("test-gem/test-gem.gemspec")).to exist expect(bundled_app("test-gem/CODE_OF_CONDUCT.md")).to exist - expect(bundled_app("test-gem/Gemfile")).to exist + expect(bundled_app("test-gem/gems.rb")).to exist expect(bundled_app("test-gem/Rakefile")).to exist expect(bundled_app("test-gem/lib/test/gem.rb")).to exist expect(bundled_app("test-gem/lib/test/gem/version.rb")).to exist @@ -404,7 +404,7 @@ describe "bundle gem" do it "generates a gem skeleton" do expect(bundled_app("test-gem/test-gem.gemspec")).to exist # expect(bundled_app("test-gem/LICENSE.txt")).to exist - expect(bundled_app("test-gem/Gemfile")).to exist + expect(bundled_app("test-gem/gems.rb")).to exist expect(bundled_app("test-gem/Rakefile")).to exist expect(bundled_app("test-gem/lib/test/gem.rb")).to exist expect(bundled_app("test-gem/lib/test/gem/version.rb")).to exist diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index 80169a91ee..e5ea95bfe5 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -10,19 +10,19 @@ describe "bundle show" do end it "creates a Gemfile.lock if one did not exist" do - FileUtils.rm("Gemfile.lock") + FileUtils.rm("gems.locked") bundle "show" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end it "creates a Gemfile.lock when invoked with a gem name" do - FileUtils.rm("Gemfile.lock") + FileUtils.rm("gems.locked") bundle "show rails" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end it "prints path if gem exists in bundle" do @@ -115,7 +115,7 @@ describe "bundle show" do before :each do build_git "foo", :path => lib_path("foo") in_app_root_custom lib_path("foo") - File.open("Gemfile", "w") {|f| f.puts "gemspec" } + File.open("gems.rb", "w") {|f| f.puts "gemspec" } sys_exec "rm -rf .git && git init" end diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index dfc1f614eb..963207cdb7 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -29,7 +29,7 @@ describe "bundle update" do exit! G bundle "update" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end end diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb index aecaad7744..8332ef23f4 100644 --- a/spec/install/gemfile/gemspec_spec.rb +++ b/spec/install/gemfile/gemspec_spec.rb @@ -8,7 +8,7 @@ describe "bundle install from an existing gemspec" do it "should install runtime and development dependencies" do build_lib("foo", :path => tmp.join("foo")) do |s| - s.write("Gemfile", "source :rubygems\ngemspec") + s.write("gems.rb", "source :rubygems\ngemspec") s.add_dependency "bar", "=1.0.0" s.add_development_dependency "bar-dev", "=1.0.0" end @@ -23,7 +23,7 @@ describe "bundle install from an existing gemspec" do it "that is hidden should install runtime and development dependencies" do build_lib("foo", :path => tmp.join("foo")) do |s| - s.write("Gemfile", "source :rubygems\ngemspec") + s.write("gems.rb", "source :rubygems\ngemspec") s.add_dependency "bar", "=1.0.0" s.add_development_dependency "bar-dev", "=1.0.0" end @@ -43,7 +43,7 @@ describe "bundle install from an existing gemspec" do build_gem "baz", "1.1", :to_system => true build_lib("foo", :path => tmp.join("foo")) do |s| - s.write("Gemfile", "source :rubygems\ngemspec") + s.write("gems.rb", "source :rubygems\ngemspec") s.add_dependency "baz", ">= 1.0", "< 1.1" end install_gemfile <<-G @@ -111,7 +111,7 @@ describe "bundle install from an existing gemspec" do it "should match a lockfile even if the gemspec defines development dependencies" do build_lib("foo", :path => tmp.join("foo")) do |s| - s.write("Gemfile", "source 'file://#{gem_repo1}'\ngemspec") + s.write("gems.rb", "source 'file://#{gem_repo1}'\ngemspec") s.add_dependency "actionpack", "=2.3.2" s.add_development_dependency "rake", "=10.0.2" end diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index 953817d3d0..45c3a584df 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -51,7 +51,7 @@ describe "bundle install with git sources" do update_git "foo" in_app_root2 do - install_gemfile bundled_app2("Gemfile"), <<-G + install_gemfile bundled_app2("gems.rb"), <<-G git "#{lib_path("foo-1.0")}" do gem 'foo' end @@ -98,8 +98,8 @@ describe "bundle install with git sources" do update_git "foo", "1.1", :path => lib_path("foo-1.0") - Dir.chdir tmp("bundled_app.bck") - gemfile tmp("bundled_app.bck/Gemfile"), <<-G + Dir.chdir tmp('bundled_app.bck') + gemfile tmp('bundled_app.bck/gems.rb'), <<-G source "file://#{gem_repo1}" git "#{lib_path("foo-1.0")}" do gem 'foo' @@ -223,7 +223,7 @@ describe "bundle install with git sources" do gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master" G - lockfile0 = File.read(bundled_app("Gemfile.lock")) + lockfile0 = File.read(bundled_app("gems.locked")) FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) update_git "rack", "0.8", :path => lib_path("local-rack") do |s| @@ -233,7 +233,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path("local-rack")}| run "require 'rack'" - lockfile1 = File.read(bundled_app("Gemfile.lock")) + lockfile1 = File.read(bundled_app("gems.locked")) expect(lockfile1).not_to eq(lockfile0) end @@ -245,7 +245,7 @@ describe "bundle install with git sources" do gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master" G - lockfile0 = File.read(bundled_app("Gemfile.lock")) + lockfile0 = File.read(bundled_app("gems.locked")) FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) update_git "rack", "0.8", :path => lib_path("local-rack") @@ -253,7 +253,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path("local-rack")}| bundle :install - lockfile1 = File.read(bundled_app("Gemfile.lock")) + lockfile1 = File.read(bundled_app("gems.locked")) expect(lockfile1).not_to eq(lockfile0) end @@ -689,7 +689,7 @@ describe "bundle install with git sources" do G bundle "install" - expect(File.read(bundled_app("Gemfile.lock")).scan("GIT").size).to eq(1) + expect(File.read(bundled_app("gems.locked")).scan('GIT').size).to eq(1) end describe "switching sources" do @@ -749,8 +749,8 @@ describe "bundle install with git sources" do update_git "valim" new_revision = revision_for(lib_path("valim-1.0")) - lockfile = File.read(bundled_app("Gemfile.lock")) - File.open(bundled_app("Gemfile.lock"), "w") do |file| + lockfile = File.read(bundled_app("gems.locked")) + File.open(bundled_app("gems.locked"), "w") do |file| file.puts lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}") end diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index 8ab1788841..b75722b9cc 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -171,7 +171,7 @@ describe "bundle install with explicit source paths" do gemspec G - File.open(lib_path("foo/Gemfile"), "w") {|f| f.puts gemfile } + File.open(lib_path("foo/gems.rb"), "w") {|f| f.puts gemfile } Dir.chdir(lib_path("foo")) do bundle "install" @@ -201,7 +201,7 @@ describe "bundle install with explicit source paths" do Dir.chdir lib_path("foo") - install_gemfile lib_path("foo/Gemfile"), <<-G + install_gemfile lib_path("foo/gems.rb"), <<-G source "file://#{gem_repo1}" gemspec G @@ -222,7 +222,7 @@ describe "bundle install with explicit source paths" do Dir.chdir lib_path("foo") - install_gemfile lib_path("foo/Gemfile"), <<-G + install_gemfile lib_path("foo/gems.rb"), <<-G source "file://#{gem_repo1}" gemspec G @@ -464,7 +464,7 @@ describe "bundle install with explicit source paths" do gemspec gem 'rack' G - File.open(lib_path("private_lib/Gemfile"), "w") {|f| f.puts gemfile } + File.open(lib_path("private_lib/gems.rb"), "w") {|f| f.puts gemfile } Dir.chdir(lib_path("private_lib")) do bundle :install, :env => { "DEBUG" => 1 }, :artifice => "endpoint" diff --git a/spec/install/gems/flex_spec.rb b/spec/install/gems/flex_spec.rb index 1dd8cf5c28..3fdba0a69a 100644 --- a/spec/install/gems/flex_spec.rb +++ b/spec/install/gems/flex_spec.rb @@ -231,7 +231,7 @@ describe "bundle flex_install" do it "does something" do expect { bundle "install" - }.not_to change { File.read(bundled_app("Gemfile.lock")) } + }.not_to change { File.read(bundled_app('gems.locked')) } expect(err).to include("rack = 0.9.1") expect(err).to include("locked at 1.0.0") diff --git a/spec/install/gems/win32_spec.rb b/spec/install/gems/win32_spec.rb index e75177a0ce..52f3af78ed 100644 --- a/spec/install/gems/win32_spec.rb +++ b/spec/install/gems/win32_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" describe "bundle install with win32-generated lockfile" do it "should read lockfile" do - File.open(bundled_app("Gemfile.lock"), "wb") do |f| + File.open(bundled_app("gems.locked"), "wb") do |f| f << "GEM\r\n" f << " remote: file:#{gem_repo1}/\r\n" f << " specs:\r\n" diff --git a/spec/install/upgrade_spec.rb b/spec/install/upgrade_spec.rb index a57f974bbb..70d94a86af 100644 --- a/spec/install/upgrade_spec.rb +++ b/spec/install/upgrade_spec.rb @@ -11,9 +11,9 @@ describe "bundle install for the first time with v1.0" do end it "removes lockfiles in 0.9 YAML format" do - File.open("Gemfile.lock", "w") {|f| YAML.dump({}, f) } + File.open("gems.locked", "w") {|f| YAML.dump({}, f) } bundle :install - expect(File.read("Gemfile.lock")).not_to match(/^---/) + expect(File.read("gems.locked")).not_to match(/^---/) end it "removes env.rb if it exists" do diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index c5427ac097..6f3ae69104 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -1086,7 +1086,7 @@ describe "the lockfile format" do gem "rack", "1.1" G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist expect(err).to include "rack (= 1.0) and rack (= 1.1)" end @@ -1097,7 +1097,7 @@ describe "the lockfile format" do gem "rack", :git => "git://hubz.com" G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist expect(err).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)" end @@ -1177,7 +1177,7 @@ describe "the lockfile format" do should_be_installed "omg 1.0" # Confirm that duplicate specs do not appear - expect(File.read(bundled_app("Gemfile.lock"))).to eq(strip_whitespace(<<-L)) + expect(File.read(bundled_app("gems.locked"))).to eq(strip_whitespace(<<-L)) GIT remote: #{lib_path("omg")} revision: #{revision} @@ -1203,7 +1203,7 @@ describe "the lockfile format" do describe "a line ending" do def set_lockfile_mtime_to_known_value time = Time.local(2000, 1, 1, 0, 0, 0) - File.utime(time, time, bundled_app("Gemfile.lock")) + File.utime(time, time, bundled_app("gems.locked")) end before(:each) do build_repo2 @@ -1216,7 +1216,7 @@ describe "the lockfile format" do end it "generates Gemfile.lock with \\n line endings" do - expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n") + expect(File.read(bundled_app("gems.locked"))).not_to match("\r\n") should_be_installed "rack 1.0" end @@ -1224,19 +1224,21 @@ describe "the lockfile format" do it "preserves Gemfile.lock \\n line endings" do update_repo2 - expect { bundle "update" }.to change { File.mtime(bundled_app("Gemfile.lock")) } - expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n") + expect { bundle "update" }.to change { File.mtime(bundled_app("gems.locked")) } + expect(File.read(bundled_app("gems.locked"))).not_to match("\r\n") + should_be_installed "rack 1.2" end it "preserves Gemfile.lock \\n\\r line endings" do update_repo2 - win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n") - File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) } + win_lock = File.read(bundled_app("gems.locked")).gsub(/\n/, "\r\n") + File.open(bundled_app("gems.locked"), "wb") {|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value - expect { bundle "update" }.to change { File.mtime(bundled_app("Gemfile.lock")) } - expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n") + expect { bundle "update" }.to change { File.mtime(bundled_app("gems.locked")) } + expect(File.read(bundled_app("gems.locked"))).to match("\r\n") + should_be_installed "rack 1.2" end end @@ -1249,12 +1251,12 @@ describe "the lockfile format" do require 'bundler' Bundler.setup RUBY - }.not_to change { File.mtime(bundled_app("Gemfile.lock")) } + }.not_to change { File.mtime(bundled_app("gems.locked")) } end it "preserves Gemfile.lock \\n\\r line endings" do - win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n") - File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) } + win_lock = File.read(bundled_app("gems.locked")).gsub(/\n/, "\r\n") + File.open(bundled_app("gems.locked"), "wb") {|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value expect { @@ -1263,7 +1265,7 @@ describe "the lockfile format" do require 'bundler' Bundler.setup RUBY - }.not_to change { File.mtime(bundled_app("Gemfile.lock")) } + }.not_to change { File.mtime(bundled_app("gems.locked")) } end end end diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index 79c09573a6..f4daadb7b3 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -239,7 +239,7 @@ G #{ruby_version_correct} G - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end it "installs fine with any engine" do @@ -251,7 +251,7 @@ G #{ruby_version_correct_engineless} G - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end end @@ -263,7 +263,7 @@ G #{ruby_version_correct_patchlevel} G - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end it "doesn't install when the ruby version doesn't match" do @@ -274,7 +274,7 @@ G #{ruby_version_incorrect} G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist should_be_ruby_version_incorrect end @@ -286,7 +286,7 @@ G #{engine_incorrect} G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist should_be_engine_incorrect end @@ -299,7 +299,7 @@ G #{engine_version_incorrect} G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist should_be_engine_version_incorrect end end @@ -312,7 +312,7 @@ G #{patchlevel_incorrect} G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist should_be_patchlevel_incorrect end end @@ -997,10 +997,10 @@ G #{ruby_version_correct} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) run "1" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end it "makes a Gemfile.lock if setup succeeds for any engine" do @@ -1013,10 +1013,10 @@ G #{ruby_version_correct_engineless} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) run "1" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end end @@ -1029,14 +1029,14 @@ G #{ruby_version_incorrect} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) ruby <<-R require 'rubygems' require 'bundler/setup' R - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist should_be_ruby_version_incorrect end @@ -1049,14 +1049,14 @@ G #{engine_incorrect} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) ruby <<-R require 'rubygems' require 'bundler/setup' R - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist should_be_engine_incorrect end @@ -1070,14 +1070,14 @@ G #{engine_version_incorrect} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) ruby <<-R require 'rubygems' require 'bundler/setup' R - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist should_be_engine_version_incorrect end end @@ -1092,14 +1092,14 @@ G G should_be_patchlevel_incorrect - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) ruby <<-R require 'rubygems' require 'bundler/setup' R - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist should_be_patchlevel_incorrect end end diff --git a/spec/runtime/load_spec.rb b/spec/runtime/load_spec.rb index 950e8e9b18..54e7a8a46a 100644 --- a/spec/runtime/load_spec.rb +++ b/spec/runtime/load_spec.rb @@ -68,7 +68,7 @@ describe "Bundler.load" do end it "does not find a Gemfile above the testing directory" do - bundler_gemfile = tmp.join("../Gemfile") + bundler_gemfile = tmp.join("../gems.rb") unless File.exist?(bundler_gemfile) FileUtils.touch(bundler_gemfile) @remove_bundler_gemfile = true diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 2c9567f26a..f2845b2583 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -141,7 +141,7 @@ describe "Bundler.setup" do Bundler.setup R - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app("gems.locked")).not_to exist end it "doesn't change the Gemfile.lock if the setup fails" do @@ -150,7 +150,7 @@ describe "Bundler.setup" do gem "rack" G - lockfile = File.read(bundled_app("Gemfile.lock")) + lockfile = File.read(bundled_app("gems.locked")) gemfile <<-G source "file://#{gem_repo1}" @@ -165,7 +165,7 @@ describe "Bundler.setup" do Bundler.setup R - expect(File.read(bundled_app("Gemfile.lock"))).to eq(lockfile) + expect(File.read(bundled_app("gems.locked"))).to eq(lockfile) end it "makes a Gemfile.lock if setup succeeds" do @@ -174,12 +174,12 @@ describe "Bundler.setup" do gem "rack" G - File.read(bundled_app("Gemfile.lock")) + File.read(bundled_app("gems.locked")) - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) run "1" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end it "uses BUNDLE_GEMFILE to locate the gemfile if present" do @@ -355,7 +355,7 @@ describe "Bundler.setup" do it "provides a good exception if the lockfile is unavailable" do bundle "install" - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app("gems.locked")) break_git! @@ -707,7 +707,7 @@ describe "Bundler.setup" do G Dir.chdir(bundled_app.parent) do - run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("Gemfile") } + run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("gems.rb") } require 'foo' R end @@ -731,7 +731,7 @@ describe "Bundler.setup" do bundle :install Dir.chdir(bundled_app.parent) do - run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("Gemfile") } + run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("gems.rb") } require 'foo' R end diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index 13dd629a16..6dd9e56f2d 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -15,7 +15,7 @@ describe "Bundler.with_env helpers" do around do |example| env = Bundler::ORIGINAL_ENV.dup - Bundler::ORIGINAL_ENV["BUNDLE_PATH"] = "./Gemfile" + Bundler::ORIGINAL_ENV["BUNDLE_PATH"] = "./gems.rb" example.run Bundler::ORIGINAL_ENV.replace env end @@ -37,7 +37,7 @@ describe "Bundler.with_env helpers" do it "should not pass any bundler environment variables" do Bundler.with_clean_env do - expect(`echo $BUNDLE_PATH`.strip).not_to eq("./Gemfile") + expect(`echo $BUNDLE_PATH`.strip).not_to eq("./gems.rb") end end @@ -54,7 +54,7 @@ describe "Bundler.with_env helpers" do end it "should not change ORIGINAL_ENV" do - expect(Bundler::ORIGINAL_ENV["BUNDLE_PATH"]).to eq("./Gemfile") + expect(Bundler::ORIGINAL_ENV['BUNDLE_PATH']).to eq("./gems.rb") end end @@ -63,7 +63,7 @@ describe "Bundler.with_env helpers" do it "should pass bundler environment variables set before Bundler was run" do Bundler.with_original_env do - expect(`echo $BUNDLE_PATH`.strip).to eq("./Gemfile") + expect(`echo $BUNDLE_PATH`.strip).to eq("./gems.rb") end end end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 7fdb21a53f..d9e3f20732 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -154,11 +154,11 @@ module Spec end def gemfile(*args) - create_file("Gemfile", *args) + create_file("gems.rb", *args) end def lockfile(*args) - create_file("Gemfile.lock", *args) + create_file("gems.locked", *args) end def strip_whitespace(str) diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index c718c0985d..bd1e1f29f2 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -74,14 +74,14 @@ module Spec end def should_be_locked - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app("gems.locked")).to exist end def lockfile_should_be(expected) should_be_locked spaces = expected[/\A\s+/, 0] || "" expected.gsub!(/^#{spaces}/, "") - expect(bundled_app("Gemfile.lock").read).to eq(expected) + expect(bundled_app("gems.locked").read).to eq(expected) end end end |