summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2010-11-13 22:38:54 -0600
committerAndre Arko <andre@arko.net>2010-11-14 01:46:26 -0600
commit4139386351098883ec4634b1f7f7995149e91e0b (patch)
treec34407a5be3113690adf8a2d918776c5519318d3
parent0d3d1262898dd3700c7480b422b657576fd47623 (diff)
downloadbundler-4139386351098883ec4634b1f7f7995149e91e0b.tar.gz
mildly clean up locking with version, mostly whitespace and helpers
-rw-r--r--lib/bundler/definition.rb6
-rw-r--r--spec/bundler/lockfile_parser_spec.rb16
-rw-r--r--spec/lock/lockfile_spec.rb21
3 files changed, 20 insertions, 23 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 37e13ee649..82b87d9c2b 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -220,8 +220,7 @@ module Bundler
out << " #{p}\n"
end
- out << "\n"
- out << "DEPENDENCIES\n"
+ out << "\nDEPENDENCIES\n"
handled = []
dependencies.
@@ -232,8 +231,7 @@ module Bundler
handled << dep.name
end
- out << "\n"
- out << "METADATA\n"
+ out << "\nMETADATA\n"
out << " version: #{Bundler::VERSION}\n"
diff --git a/spec/bundler/lockfile_parser_spec.rb b/spec/bundler/lockfile_parser_spec.rb
index 0ff5425e71..0bd6c2bf0b 100644
--- a/spec/bundler/lockfile_parser_spec.rb
+++ b/spec/bundler/lockfile_parser_spec.rb
@@ -3,17 +3,17 @@ require "spec_helper"
describe Bundler::LockfileParser do
include Bundler::GemHelpers
- let(:gemfile_string) do
- <<-G
-source "file://#{gem_repo1}"
-
-gem "rack"
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
G
end
- before { install_gemfile gemfile_string }
-
- subject { Bundler::LockfileParser.new(File.read(bundled_app("Gemfile.lock"))) }
+ subject do
+ lockfile_contents = File.read(bundled_app("Gemfile.lock"))
+ Bundler::LockfileParser.new(lockfile_contents)
+ end
it "parses the bundler version" do
subject.metadata["version"].should == Bundler::VERSION
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index 5880a30195..790261b21b 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -753,27 +753,26 @@ describe "the lockfile format" do
end
end
- it "rewrites the lock file when it's missing/coming from an older version fo bundler" do
+ it "adds bundler version to the lock if it's missing" do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G
- lock_file = <<-G
-GEM
- remote: file:#{gem_repo1}/
- specs:
- rack (1.0.0)
+ lockfile <<-G
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+ rack (1.0.0)
-PLATFORMS
- #{generic(Gem::Platform.local)}
+ PLATFORMS
+ #{generic(Gem::Platform.local)}
-DEPENDENCIES
- rack
+ DEPENDENCIES
+ rack
G
- File.open(bundled_app('Gemfile.lock'), 'w') {|file| file.write(lock_file) }
bundle :install
lockfile_should_be <<-G