bundler 0.9.21 → 0.9.22

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

@@ -1,3 +1,22 @@
1
+ ## 0.9.22 (April 20, 2010)
2
+
3
+ Features:
4
+
5
+ - cache command now prunes stale .gem files from vendor/cache
6
+ - init --gemspec command now generates development dependencies
7
+ - handle Polyglot's changes to Kernel#require with Bundler::ENV_LOADED (#287)
8
+ - remove .gem files generated after installing a gem from a :path (#286)
9
+ - improve install/lock messaging (#284)
10
+
11
+ Bugfixes:
12
+
13
+ - ignore cached gems that are for another platform (#288)
14
+ - install Windows gems that have no architecture set, like rcov (#277)
15
+ - exec command while locked now includes the bundler lib in $LOAD_PATH (#293)
16
+ - fix the `rake install` task
17
+ - add GemspecError so it can be raised without (further) error (#292)
18
+ - create a parent directory before cloning for git 1.5 compatibility (#285)
19
+
1
20
  ## 0.9.21 (April 16, 2010)
2
21
 
3
22
  Bugfixes:
@@ -41,6 +41,7 @@ module Bundler
41
41
  class GemfileChanged < GemfileError; status_code(4) ; end
42
42
  class PathError < BundlerError; status_code(13) ; end
43
43
  class GitError < BundlerError; status_code(11) ; end
44
+ class GemspecError < BundlerError; status_code(14) ; end
44
45
  class DeprecatedMethod < BundlerError; status_code(12) ; end
45
46
  class DeprecatedOption < BundlerError; status_code(12) ; end
46
47
  class InvalidOption < BundlerError; status_code(15) ; end
@@ -87,12 +88,12 @@ module Bundler
87
88
  exit!
88
89
  end
89
90
  end
90
- alias setup gem_setup unless Bundler.respond_to?(:setup)
91
+ alias setup gem_setup unless defined?(Bundler::ENV_LOADED)
91
92
 
92
93
  def gem_require(*groups)
93
94
  setup(*groups).require(*groups)
94
95
  end
95
- alias require gem_require unless Bundler.respond_to?(:require)
96
+ alias require gem_require unless defined?(Bundler::ENV_LOADED)
96
97
 
97
98
  def load
98
99
  @load ||= begin
@@ -88,8 +88,11 @@ module Bundler
88
88
  begin
89
89
  Installer.install(Bundler.root, Bundler.definition, opts)
90
90
  rescue GemfileChanged
91
- raise GemfileChanged, "You changed your Gemfile after locking. Please run `bundle install --relock`."
91
+ raise GemfileChanged, "You changed your Gemfile after locking. " +
92
+ "Please run `bundle install --relock`."
92
93
  end
94
+ Bundler.ui.confirm "Your bundle is complete! " +
95
+ "Use `bundle show [gemname]` to see where a bundled gem is installed."
93
96
 
94
97
  lock if options[:relock]
95
98
  cache if Bundler.root.join("vendor/cache").exist?
@@ -103,11 +106,13 @@ module Bundler
103
106
  desc "lock", "Locks the bundle to the current set of dependencies, including all child dependencies."
104
107
  def lock
105
108
  if locked?
106
- Bundler.ui.info("The bundle is already locked, relocking.")
109
+ Bundler.ui.info("Your bundle is already locked, relocking.")
107
110
  remove_lockfiles
108
111
  end
109
112
 
110
113
  Bundler.runtime.lock
114
+ Bundler.ui.confirm("Your bundle is now locked. " +
115
+ "Use `bundle show [gemname]` to list the gems in the environment.")
111
116
  rescue GemNotFound, VersionConflict => e
112
117
  Bundler.ui.error(e.message)
113
118
  Bundler.ui.warn "Run `bundle install` to install missing gems."
@@ -118,9 +123,9 @@ module Bundler
118
123
  def unlock
119
124
  if locked?
120
125
  remove_lockfiles
121
- Bundler.ui.info("The bundle is now unlocked. The dependencies may be changed.")
126
+ Bundler.ui.info("Your bundle is now unlocked. The dependencies may be changed.")
122
127
  else
123
- Bundler.ui.info("The bundle is not currently locked.")
128
+ Bundler.ui.info("Your bundle is not currently locked.")
124
129
  end
125
130
  end
126
131
 
@@ -138,8 +143,10 @@ module Bundler
138
143
  map %w(list) => "show"
139
144
 
140
145
  desc "cache", "Cache all the gems to vendor/cache"
146
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
141
147
  def cache
142
148
  Bundler.runtime.cache
149
+ Bundler.runtime.prune_cache unless options[:no_prune]
143
150
  rescue GemNotFound => e
144
151
  Bundler.ui.error(e.message)
145
152
  Bundler.ui.warn "Run `bundle install` to install missing gems."
@@ -147,6 +154,7 @@ module Bundler
147
154
  end
148
155
 
149
156
  desc "package", "Locks and then caches all of the gems into vendor/cache"
157
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
150
158
  def package
151
159
  lock
152
160
  cache
@@ -155,15 +163,15 @@ module Bundler
155
163
 
156
164
  desc "exec", "Run the command in context of the bundle"
157
165
  def exec(*)
158
- ARGV.delete('exec')
166
+ ARGV.delete("exec")
159
167
 
160
168
  # Set PATH
161
- paths = (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
169
+ paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
162
170
  paths.unshift "#{Bundler.bundle_path}/bin"
163
171
  ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR)
164
172
 
165
173
  # Set BUNDLE_GEMFILE
166
- ENV['BUNDLE_GEMFILE'] = Bundler::SharedHelpers.default_gemfile.to_s
174
+ ENV["BUNDLE_GEMFILE"] = Bundler::SharedHelpers.default_gemfile.to_s
167
175
 
168
176
  # Set RUBYOPT
169
177
  rubyopt = [ENV["RUBYOPT"]].compact
@@ -37,8 +37,6 @@ module Bundler
37
37
  if locked?
38
38
  write_rb_lock
39
39
  end
40
-
41
- Bundler.ui.confirm "Your bundle is complete! Use `bundle show gemname` to see where a bundled gem is installed."
42
40
  end
43
41
 
44
42
  def dependencies
@@ -17,6 +17,12 @@ module Bundler
17
17
  @source_uri = source_uri
18
18
  end
19
19
 
20
+ # Needed before installs, since the arch matters then and quick
21
+ # specs don't bother to include the arch in the platform string
22
+ def fetch_platform
23
+ @platform = _remote_specification.platform
24
+ end
25
+
20
26
  def full_name
21
27
  if platform == Gem::Platform::RUBY or platform.nil? then
22
28
  "#{@name}-#{@version}"
@@ -26,7 +32,7 @@ module Bundler
26
32
  end
27
33
 
28
34
  # Because Rubyforge cannot be trusted to provide valid specifications
29
- # once the remote gem is donwloaded, the backend specification will
35
+ # once the remote gem is downloaded, the backend specification will
30
36
  # be swapped out.
31
37
  def __swap__(spec)
32
38
  @specification = spec
@@ -36,6 +42,7 @@ module Bundler
36
42
 
37
43
  def _remote_specification
38
44
  @specification ||= begin
45
+ Bundler.ui.debug "Fetching spec for #{full_name}"
39
46
  Gem::SpecFetcher.new.fetch_spec([@name, @version, @platform], URI(@source_uri.to_s))
40
47
  end
41
48
  end
@@ -27,8 +27,16 @@ module Gem
27
27
 
28
28
  def to_gemfile(path = nil)
29
29
  gemfile = "source :gemcutter\n"
30
- gemfile << dependencies_to_gemfile(dependencies)
31
- gemfile << dependencies_to_gemfile(development_dependencies, :development)
30
+ gemfile << dependencies_to_gemfile(nondevelopment_dependencies)
31
+ unless development_dependencies.empty?
32
+ gemfile << "\n"
33
+ gemfile << dependencies_to_gemfile(development_dependencies, :development)
34
+ end
35
+ gemfile
36
+ end
37
+
38
+ def nondevelopment_dependencies
39
+ dependencies - development_dependencies
32
40
  end
33
41
 
34
42
  def add_bundler_dependencies(*groups)
@@ -47,7 +55,7 @@ module Gem
47
55
  def dependencies_to_gemfile(dependencies, group = nil)
48
56
  gemfile = ''
49
57
  if dependencies.any?
50
- gemfile << "group #{group} do\n" if group
58
+ gemfile << "group :#{group} do\n" if group
51
59
  dependencies.each do |dependency|
52
60
  gemfile << ' ' if group
53
61
  gemfile << %|gem "#{dependency.name}"|
@@ -62,12 +62,10 @@ module Bundler
62
62
  end
63
63
 
64
64
  def lock
65
- Bundler.ui.info("The bundle is already locked, relocking.") if locked?
66
65
  sources.each { |s| s.lock if s.respond_to?(:lock) }
67
66
  FileUtils.mkdir_p("#{root}/.bundle")
68
67
  write_yml_lock
69
68
  write_rb_lock
70
- Bundler.ui.confirm("The bundle is now locked. Use `bundle show` to list the gems in the environment.")
71
69
  end
72
70
 
73
71
  def dependencies_for(*groups)
@@ -81,7 +79,6 @@ module Bundler
81
79
  alias gems specs
82
80
 
83
81
  def cache
84
- cache_path = "#{root}/vendor/cache/"
85
82
  FileUtils.mkdir_p(cache_path)
86
83
 
87
84
  Bundler.ui.info "Copying .gem files into vendor/cache"
@@ -96,12 +93,26 @@ module Bundler
96
93
  end
97
94
  end
98
95
 
96
+ def prune_cache
97
+ FileUtils.mkdir_p(cache_path)
98
+
99
+ Bundler.ui.info "Removing outdated .gem files from vendor/cache"
100
+ cache_path.children.each do |gemfile|
101
+ spec = Gem::Format.from_file_by_path(gemfile).spec
102
+ gemfile.rmtree unless specs.include?(spec)
103
+ end
104
+ end
105
+
99
106
  private
100
107
 
101
108
  def load_paths
102
109
  specs.map { |s| s.load_paths }.flatten
103
110
  end
104
111
 
112
+ def cache_path
113
+ root.join("vendor/cache")
114
+ end
115
+
105
116
  def write_yml_lock
106
117
  yml = details.to_yaml
107
118
  File.open("#{root}/Gemfile.lock", 'w') do |f|
@@ -15,4 +15,8 @@ if Bundler::SharedHelpers.in_bundle?
15
15
  exit e.status_code
16
16
  end
17
17
  end
18
+
19
+ # Add bundler to the load path after disabling system gems
20
+ bundler_lib = File.expand_path("../..", __FILE__)
21
+ $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
18
22
  end
@@ -32,7 +32,6 @@ module Bundler
32
32
  def full_gem_path
33
33
  Pathname.new(loaded_from).dirname.expand_path.to_s
34
34
  end
35
-
36
35
  end
37
36
 
38
37
  module SharedHelpers
@@ -27,6 +27,7 @@ module Bundler
27
27
 
28
28
  def fetch(spec)
29
29
  Bundler.ui.debug " * Downloading"
30
+ spec.fetch_platform
30
31
  Gem::RemoteFetcher.fetcher.download(spec, uri, Gem.dir)
31
32
  end
32
33
 
@@ -143,6 +144,7 @@ module Bundler
143
144
 
144
145
  Dir["#{@path}/*.gem"].each do |gemfile|
145
146
  spec = Gem::Format.from_file_by_path(gemfile).spec
147
+ next unless Gem::Platform.match(spec.platform)
146
148
  spec.source = self
147
149
  index << spec
148
150
  end
@@ -250,11 +252,7 @@ module Bundler
250
252
 
251
253
  def generate_bin(spec)
252
254
  gem_dir = spec.full_gem_path
253
- gem_file = nil # so we have access after it's set in the block
254
-
255
- Dir.chdir(gem_dir) do
256
- gem_file = Gem::Builder.new(spec).build
257
- end
255
+ gem_file = Dir.chdir(gem_dir){ Gem::Builder.new(spec).build }
258
256
 
259
257
  installer = Gem::Installer.new File.join(gem_dir, gem_file),
260
258
  :bin_dir => "#{Gem.dir}/bin",
@@ -278,6 +276,8 @@ module Bundler
278
276
  end
279
277
 
280
278
  Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}"
279
+ ensure
280
+ Dir.chdir(gem_dir){ FileUtils.rm_rf(gem_file) if gem_file && File.exist?(gem_file) }
281
281
  end
282
282
 
283
283
  end
@@ -374,6 +374,7 @@ module Bundler
374
374
 
375
375
  def checkout
376
376
  unless File.exist?(path.join(".git"))
377
+ FileUtils.mkdir_p(path.dirname)
377
378
  git %|clone --no-checkout "#{cache_path}" "#{path}"|
378
379
  end
379
380
  Dir.chdir(path) do
@@ -6,6 +6,7 @@ require 'yaml'
6
6
  <%= shared_helpers %>
7
7
 
8
8
  module Bundler
9
+ ENV_LOADED = true
9
10
  LOCKED_BY = '<%= Bundler::VERSION %>'
10
11
  FINGERPRINT = <%= gemfile_fingerprint.inspect %>
11
12
  HOME = '<%= Bundler.home %>'
@@ -1,3 +1,3 @@
1
1
  module Bundler
2
- VERSION = "0.9.21"
2
+ VERSION = "0.9.22"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 21
9
- version: 0.9.21
8
+ - 22
9
+ version: 0.9.22
10
10
  platform: ruby
11
11
  authors:
12
12
  - Carl Lerche
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-04-16 00:00:00 -07:00
19
+ date: 2010-04-20 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency