aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/lazy_specification.rb
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-06-04 11:50:36 -0700
committerCarl Lerche <carllerche@mac.com>2010-06-04 11:50:36 -0700
commit60df08e450991c226b643abd515233c5aef37098 (patch)
tree44d3553c9672081745aa7cf4d66b7e6ff27fc6b6 /lib/bundler/lazy_specification.rb
parent092f169d01472336598e29b32550399991940d63 (diff)
downloadbundler-60df08e450991c226b643abd515233c5aef37098.tar.gz
Improve writing the lockfile
Diffstat (limited to 'lib/bundler/lazy_specification.rb')
-rw-r--r--lib/bundler/lazy_specification.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index 134f33ac..d348b648 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -27,6 +27,21 @@ module Bundler
@name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
end
+ def to_lock
+ if platform == Gem::Platform::RUBY or platform.nil?
+ out = " #{name} (#{version})\n"
+ else
+ out = " #{name} (#{version}-#{platform})\n"
+ end
+
+ dependencies.sort_by {|d| d.name }.each do |dep|
+ next if dep.type == :development
+ out << " #{dep.to_lock}\n"
+ end
+
+ out
+ end
+
def __materialize__(index)
@specification = index.search(Gem::Dependency.new(name, version)).last
raise "Could not materialize #{full_name}" unless @specification