Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Improve `bundle install` output

  • Loading branch information...
commit 2ea98280db69d412fc8bd54931329a3b524aef92 1 parent 9542435
authored February 02, 2010
4  bundler.gemspec
@@ -2,11 +2,11 @@
2 2
 
3 3
 Gem::Specification.new do |s|
4 4
   s.name = %q{bundler}
5  
-  s.version = "0.9.0.pre3"
  5
+  s.version = "0.9.0.pre4"
6 6
 
7 7
   s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
8 8
   s.authors = ["Carl Lerche", "Yehuda Katz"]
9  
-  s.date = %q{2010-02-01}
  9
+  s.date = %q{2010-02-02}
10 10
   s.default_executable = %q{bundle}
11 11
   s.email = ["carlhuda@engineyard.com"]
12 12
   s.executables = ["bundle"]
2  lib/bundler/environment.rb
@@ -66,7 +66,7 @@ def pack
66 66
 
67 67
       Bundler.ui.info "Copying .gem files into vendor/cache"
68 68
       specs.each do |spec|
69  
-        next if spec.source && !spec.source.is_a?(Source::Rubygems)
  69
+        next unless spec.source.is_a?(Source::SystemGems) || spec.source.is_a?(Source::Rubygems)
70 70
         possibilities = Gem.path.map { |p| "#{p}/cache/#{spec.full_name}.gem" }
71 71
         cached_path = possibilities.find { |p| File.exist? p }
72 72
         Bundler.ui.info "  * #{File.basename(cached_path)}"
9  lib/bundler/index.rb
... ...
@@ -1,14 +1,7 @@
1 1
 module Bundler
2 2
   class Index
3 3
     def self.from_installed_gems
4  
-      # TODO: Why can't we memoize this? It is being mutated somewhere
5  
-      from_gem_index(Gem::SourceIndex.from_installed_gems)
6  
-    end
7  
-
8  
-    def self.from_gem_index(gem_index)
9  
-      index = new
10  
-      gem_index.each { |name, spec| index << spec }
11  
-      index
  4
+      Source::SystemGems.new.specs
12 5
     end
13 6
 
14 7
     def initialize
9  lib/bundler/installer.rb
@@ -19,9 +19,12 @@ def run(options)
19 19
         return
20 20
       end
21 21
 
22  
-      specs.each do |spec|
23  
-        next unless spec.source.respond_to?(:install)
24  
-        next if (spec.groups & options[:without]).any?
  22
+      specs.sort_by { |s| s.name }.each do |spec|
  23
+        Bundler.ui.info "* #{spec.name} (#{spec.version})"
  24
+        if (spec.groups & options[:without]).any?
  25
+          Bundler.ui.info "  * Not in requested group... skipping."
  26
+          next
  27
+        end
25 28
         spec.source.install(spec)
26 29
       end
27 30
 
43  lib/bundler/source.rb
@@ -19,12 +19,6 @@ def specs
19 19
       end
20 20
 
21 21
       def install(spec)
22  
-        Bundler.ui.info "* #{spec.name} (#{spec.version})"
23  
-        if Index.from_installed_gems[spec].any?
24  
-          Bundler.ui.info "  * already installed... skipping"
25  
-          return
26  
-        end
27  
-
28 22
         destination = Gem.dir
29 23
 
30 24
         Bundler.ui.info "  * Downloading..."
@@ -66,6 +60,29 @@ def prerelease_specs
66 60
       end
67 61
     end
68 62
 
  63
+    class SystemGems
  64
+      def specs
  65
+        @specs ||= begin
  66
+          index = Index.new
  67
+
  68
+          Gem::SourceIndex.from_installed_gems.each do |name, spec|
  69
+            spec.source = self
  70
+            index << spec
  71
+          end
  72
+
  73
+          index
  74
+        end
  75
+      end
  76
+
  77
+      def to_s
  78
+        "System gem source"
  79
+      end
  80
+
  81
+      def install(spec)
  82
+        Bundler.ui.info "  * already installed... skipping"
  83
+      end
  84
+    end
  85
+
69 86
     class GemCache
70 87
       def initialize(options)
71 88
         @path = options[:path]
@@ -88,6 +105,7 @@ def specs
88 105
       def install(spec)
89 106
         destination = Gem.dir
90 107
 
  108
+        Bundler.ui.info "  * Installing from pack..."
91 109
         installer = Gem::Installer.new "#{@path}/#{spec.full_name}.gem",
92 110
           :install_dir => Gem.dir,
93 111
           :ignore_dependencies => true
@@ -141,6 +159,10 @@ def local_specs
141 159
         end
142 160
       end
143 161
 
  162
+      def install(spec)
  163
+        Bundler.ui.info "  * Using path `#{path}`..."
  164
+      end
  165
+
144 166
       alias specs local_specs
145 167
 
146 168
     end
@@ -198,7 +220,12 @@ def specs
198 220
       end
199 221
 
200 222
       def install(spec)
201  
-        @installed ||= begin
  223
+        Bundler.ui.info "  * Using git `#{uri}`..."
  224
+
  225
+        if @installed
  226
+          Bundler.ui.info "  * Already checked out revision: #{ref}..."
  227
+        else
  228
+          Bundler.ui.info "  * Checking out revision: #{ref}..."
202 229
           FileUtils.mkdir_p(path)
203 230
           Dir.chdir(path) do
204 231
             unless File.exist?(".git")
@@ -209,7 +236,7 @@ def install(spec)
209 236
             %x(git submodule init)
210 237
             %x(git submodule update)
211 238
           end
212  
-          true
  239
+          @installed = true
213 240
         end
214 241
       end
215 242
 

0 notes on commit 2ea9828

Please sign in to comment.
Something went wrong with that request. Please try again.