summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-02-02 09:44:04 -0800
committerCarl Lerche <carllerche@mac.com>2010-02-02 09:44:04 -0800
commit2ea98280db69d412fc8bd54931329a3b524aef92 (patch)
treeef9502ffb7b11667f518c10e7a581bf5d3bc30b2
parent9542435cfcb7ea11c406594c16bfed677c89af62 (diff)
downloadbundler-2ea98280db69d412fc8bd54931329a3b524aef92.tar.gz
Improve `bundle install` outputv0.9.0.pre4
-rw-r--r--bundler.gemspec4
-rw-r--r--lib/bundler/environment.rb2
-rw-r--r--lib/bundler/index.rb9
-rw-r--r--lib/bundler/installer.rb9
-rw-r--r--lib/bundler/source.rb43
5 files changed, 45 insertions, 22 deletions
diff --git a/bundler.gemspec b/bundler.gemspec
index 05f5ccdaa4..974831878f 100644
--- a/bundler.gemspec
+++ b/bundler.gemspec
@@ -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"]
diff --git a/lib/bundler/environment.rb b/lib/bundler/environment.rb
index 2f60604a30..b446ac506a 100644
--- a/lib/bundler/environment.rb
+++ b/lib/bundler/environment.rb
@@ -66,7 +66,7 @@ module Bundler
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)}"
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 94a36bf3e2..cd7229a82c 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -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
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index f9379e4359..7be43faa63 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -19,9 +19,12 @@ module Bundler
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
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 105ce87639..ba1b1bcb86 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -19,12 +19,6 @@ module Bundler
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 @@ module Bundler
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 @@ module Bundler
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 @@ module Bundler
end
end
+ def install(spec)
+ Bundler.ui.info " * Using path `#{path}`..."
+ end
+
alias specs local_specs
end
@@ -198,7 +220,12 @@ module Bundler
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 @@ module Bundler
%x(git submodule init)
%x(git submodule update)
end
- true
+ @installed = true
end
end