Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use the Gemfile's name as a base for Gemfile.lock

  • Loading branch information...
commit 251b9c78cdb1c1cd04de57965752373fd37856df 1 parent 37ee757
Carl Lerche authored
9 lib/bundler.rb
View
@@ -127,8 +127,7 @@ def definition(unlock = nil)
@definition ||= begin
configure
upgrade_lockfile
- lockfile = root.join("Gemfile.lock")
- Definition.build(default_gemfile, lockfile, unlock)
+ Definition.build(default_gemfile, default_lockfile, unlock)
end
end
@@ -184,6 +183,10 @@ def default_gemfile
SharedHelpers.default_gemfile
end
+ def default_lockfile
+ SharedHelpers.default_lockfile
+ end
+
WINDOWS = Config::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
NULL = WINDOWS ? "NUL" : "/dev/null"
@@ -223,7 +226,7 @@ def configure_gem_home_and_path
end
def upgrade_lockfile
- lockfile = root.join("Gemfile.lock")
+ lockfile = default_lockfile
if lockfile.exist? && lockfile.read(3) == "---"
Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
lockfile.rmtree
4 lib/bundler/cli.rb
View
@@ -141,7 +141,7 @@ def install(path = nil)
if opts[:production]
Bundler.production = true
- unless Bundler.root.join("Gemfile.lock").exist?
+ unless Bundler.default_lockfile.exist?
raise ProductionError, "The --production flag requires a Gemfile.lock. Please\n" \
"make sure you have checked your Gemfile.lock into version\n" \
"control before deploying."
@@ -153,7 +153,7 @@ def install(path = nil)
end
# Can't use Bundler.settings for this because settings needs gemfile.dirname
- ENV['BUNDLE_GEMFILE'] = opts[:gemfile] if opts[:gemfile]
+ ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
Bundler.settings[:path] = nil if options[:system]
Bundler.settings[:path] = "vendor/bundle" if options[:production]
Bundler.settings[:path] = path if path
2  lib/bundler/environment.rb
View
@@ -36,7 +36,7 @@ def current_dependencies
end
def lock
- @definition.lock(root.join('Gemfile.lock'))
+ @definition.lock(Bundler.default_lockfile)
end
def update(*gems)
4 lib/bundler/installer.rb
View
@@ -15,9 +15,9 @@ def run(options)
return
end
- if Bundler.root.join("Gemfile.lock").exist? && !options["update"]
+ if Bundler.default_lockfile.exist? && !options["update"]
begin
- tmpdef = Definition.build(Bundler.default_gemfile, Bundler.root.join("Gemfile.lock"), nil)
+ tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil)
local = true unless tmpdef.new_platform? || tmpdef.missing_specs.any?
rescue BundlerError
end
4 lib/bundler/shared_helpers.rb
View
@@ -22,6 +22,10 @@ def default_gemfile
Pathname.new(gemfile)
end
+ def default_lockfile
+ Pathname.new("#{default_gemfile}.lock")
+ end
+
def in_bundle?
find_gemfile
end
20 spec/install/gems/simple_case_spec.rb
View
@@ -20,6 +20,26 @@
bundled_app("Gemfile.lock").should_not exist
end
+ it "creates a Gemfile.lock" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ bundled_app('Gemfile.lock').should exist
+ end
+
+ it "creates lock files based on the Gemfile name" do
+ gemfile bundled_app('OmgFile'), <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0"
+ G
+
+ bundle 'install --gemfile OmgFile'
+
+ bundled_app("OmgFile.lock").should exist
+ end
+
it "doesn't delete the lockfile if one already exists" do
install_gemfile <<-G
source "file://#{gem_repo1}"
Please sign in to comment.
Something went wrong with that request. Please try again.