Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve `bundle install` output

  • Loading branch information...
commit 2ea98280db69d412fc8bd54931329a3b524aef92 1 parent 9542435
Carl Lerche authored
4 bundler.gemspec
View
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{bundler}
- s.version = "0.9.0.pre3"
+ s.version = "0.9.0.pre4"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
s.authors = ["Carl Lerche", "Yehuda Katz"]
- s.date = %q{2010-02-01}
+ s.date = %q{2010-02-02}
s.default_executable = %q{bundle}
s.email = ["carlhuda@engineyard.com"]
s.executables = ["bundle"]
2  lib/bundler/environment.rb
View
@@ -66,7 +66,7 @@ def pack
Bundler.ui.info "Copying .gem files into vendor/cache"
specs.each do |spec|
- next if spec.source && !spec.source.is_a?(Source::Rubygems)
+ next unless spec.source.is_a?(Source::SystemGems) || spec.source.is_a?(Source::Rubygems)
possibilities = Gem.path.map { |p| "#{p}/cache/#{spec.full_name}.gem" }
cached_path = possibilities.find { |p| File.exist? p }
Bundler.ui.info " * #{File.basename(cached_path)}"
9 lib/bundler/index.rb
View
@@ -1,14 +1,7 @@
module Bundler
class Index
def self.from_installed_gems
- # TODO: Why can't we memoize this? It is being mutated somewhere
- from_gem_index(Gem::SourceIndex.from_installed_gems)
- end
-
- def self.from_gem_index(gem_index)
- index = new
- gem_index.each { |name, spec| index << spec }
- index
+ Source::SystemGems.new.specs
end
def initialize
9 lib/bundler/installer.rb
View
@@ -19,9 +19,12 @@ def run(options)
return
end
- specs.each do |spec|
- next unless spec.source.respond_to?(:install)
- next if (spec.groups & options[:without]).any?
+ specs.sort_by { |s| s.name }.each do |spec|
+ Bundler.ui.info "* #{spec.name} (#{spec.version})"
+ if (spec.groups & options[:without]).any?
+ Bundler.ui.info " * Not in requested group... skipping."
+ next
+ end
spec.source.install(spec)
end
43 lib/bundler/source.rb
View
@@ -19,12 +19,6 @@ def specs
end
def install(spec)
- Bundler.ui.info "* #{spec.name} (#{spec.version})"
- if Index.from_installed_gems[spec].any?
- Bundler.ui.info " * already installed... skipping"
- return
- end
-
destination = Gem.dir
Bundler.ui.info " * Downloading..."
@@ -66,6 +60,29 @@ def prerelease_specs
end
end
+ class SystemGems
+ def specs
+ @specs ||= begin
+ index = Index.new
+
+ Gem::SourceIndex.from_installed_gems.each do |name, spec|
+ spec.source = self
+ index << spec
+ end
+
+ index
+ end
+ end
+
+ def to_s
+ "System gem source"
+ end
+
+ def install(spec)
+ Bundler.ui.info " * already installed... skipping"
+ end
+ end
+
class GemCache
def initialize(options)
@path = options[:path]
@@ -88,6 +105,7 @@ def specs
def install(spec)
destination = Gem.dir
+ Bundler.ui.info " * Installing from pack..."
installer = Gem::Installer.new "#{@path}/#{spec.full_name}.gem",
:install_dir => Gem.dir,
:ignore_dependencies => true
@@ -141,6 +159,10 @@ def local_specs
end
end
+ def install(spec)
+ Bundler.ui.info " * Using path `#{path}`..."
+ end
+
alias specs local_specs
end
@@ -198,7 +220,12 @@ def specs
end
def install(spec)
- @installed ||= begin
+ Bundler.ui.info " * Using git `#{uri}`..."
+
+ if @installed
+ Bundler.ui.info " * Already checked out revision: #{ref}..."
+ else
+ Bundler.ui.info " * Checking out revision: #{ref}..."
FileUtils.mkdir_p(path)
Dir.chdir(path) do
unless File.exist?(".git")
@@ -209,7 +236,7 @@ def install(spec)
%x(git submodule init)
%x(git submodule update)
end
- true
+ @installed = true
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.