bundler 0.9.23 → 0.9.24

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.24 (April 22, 2010)
2
+
3
+ Features:
4
+
5
+ - fetch submodules for git sources
6
+ - limit the bundled version of bundler to the same as the one installing
7
+ - force relative paths in git gemspecs to avoid raising Gem::NameTooLong
8
+ - serialize GemCache sources correctly, so locking works
9
+ - raise Bundler::GemNotFound instead of calling exit! inside library code
10
+ - Rubygems 1.3.5 compatibility for the adventurous, not supported by me :)
11
+
12
+ Bugfixes:
13
+
14
+ - don't try to regenerate environment.rb if it is read-only
15
+ - prune outdated gems with the platform "ruby"
16
+ - prune cache without errors when there are directories or non-gem files
17
+ - don't re-write environment.rb if running after it has been loaded
18
+ - do not monkeypatch Specification#load_paths twice when inside a bundle
19
+
1
20
  ## 0.9.23 (April 20, 2010)
2
21
 
3
22
  Bugfixes:
@@ -5,8 +5,6 @@ require 'bundler/rubygems_ext'
5
5
  require 'bundler/version'
6
6
 
7
7
  module Bundler
8
- ORIGINAL_ENV = ENV.to_hash
9
-
10
8
  autoload :Definition, 'bundler/definition'
11
9
  autoload :Dependency, 'bundler/dependency'
12
10
  autoload :Dsl, 'bundler/dsl'
@@ -23,6 +21,9 @@ module Bundler
23
21
  autoload :Specification, 'bundler/shared_helpers'
24
22
  autoload :UI, 'bundler/ui'
25
23
 
24
+ GEM_LOADED = true
25
+ ORIGINAL_ENV = ENV.to_hash
26
+
26
27
  class BundlerError < StandardError
27
28
  def self.status_code(code = nil)
28
29
  return @code unless code
@@ -70,22 +71,16 @@ module Bundler
70
71
  def gem_setup(*groups)
71
72
  return @setup if @setup
72
73
 
73
- begin
74
- if groups.empty?
75
- # Load all groups, but only once
76
- @setup = load.setup
77
- else
78
- # Figure out which groups haven't been loaded yet
79
- unloaded = groups - (@completed_groups || [])
80
- # Record groups that are now loaded
81
- @completed_groups = groups | (@completed_groups || [])
82
- # Load any groups that are not yet loaded
83
- unloaded.any? ? load.setup(*unloaded) : load
84
- end
85
- rescue Bundler::GemNotFound => e
86
- STDERR.puts e.message
87
- STDERR.puts "Try running `bundle install`."
88
- exit!
74
+ if groups.empty?
75
+ # Load all groups, but only once
76
+ @setup = load.setup
77
+ else
78
+ # Figure out which groups haven't been loaded yet
79
+ unloaded = groups - (@completed_groups || [])
80
+ # Record groups that are now loaded
81
+ @completed_groups = groups | (@completed_groups || [])
82
+ # Load any groups that are not yet loaded
83
+ unloaded.any? ? load.setup(*unloaded) : load
89
84
  end
90
85
  end
91
86
  alias setup gem_setup unless defined?(Bundler::ENV_LOADED)
@@ -97,8 +92,7 @@ module Bundler
97
92
 
98
93
  def load
99
94
  @load ||= begin
100
- if current_env_file?
101
- @gem_loaded = true
95
+ if !update_env_file?
102
96
  Kernel.require env_file
103
97
  Bundler
104
98
  else
@@ -176,8 +170,17 @@ module Bundler
176
170
  Gem.clear_paths
177
171
  end
178
172
 
179
- def current_env_file?
180
- env_file.exist? && (env_file.read(100) =~ /Bundler #{Bundler::VERSION}/)
173
+ def update_env_file?
174
+ if env_file.exist?
175
+ outdated = (env_file.read(100) !~ /Bundler #{Bundler::VERSION}/)
176
+ writable = env_file.writable?
177
+ if outdated && !writable
178
+ STDERR.puts "Cannot write to outdated .bundle/environment.rb to update it"
179
+ end
180
+ outdated && writable
181
+ else
182
+ true
183
+ end
181
184
  end
182
185
  end
183
186
  end
@@ -1,4 +1,5 @@
1
1
  require 'rubygems/dependency'
2
+ require 'bundler/shared_helpers'
2
3
 
3
4
  module Bundler
4
5
  class Dependency < Gem::Dependency
@@ -98,8 +98,15 @@ module Bundler
98
98
  debug { "Requirements:\n" + reqs.map { |r| " #{r.name} (#{r.requirement})"}.join("\n") }
99
99
 
100
100
  activated = activated.dup
101
- # Pull off the first requirement so that we can resolve it
102
- current = reqs.shift
101
+
102
+ if reqs.first.name == "bundler" && !activated["bundler"]
103
+ # activate the current version of bundler before other versions
104
+ bundler_version = ENV["BUNDLER_VERSION"] || Bundler::VERSION
105
+ current = Gem::Dependency.new("bundler", bundler_version, reqs.first.type)
106
+ else
107
+ # Pull off the first requirement so that we can resolve it
108
+ current = reqs.shift
109
+ end
103
110
 
104
111
  debug { "Attempting:\n #{current.name} (#{current.requirement})"}
105
112
 
@@ -10,7 +10,13 @@ module Gem
10
10
  attr_accessor :source, :location
11
11
 
12
12
  def load_paths
13
- require_paths.map {|p| File.join(full_gem_path, p) }
13
+ require_paths.map do |require_path|
14
+ if require_path.include?(full_gem_path)
15
+ require_path
16
+ else
17
+ File.join(full_gem_path, require_path)
18
+ end
19
+ end
14
20
  end
15
21
 
16
22
  def groups
@@ -6,9 +6,7 @@ module Bundler
6
6
 
7
7
  def initialize(*)
8
8
  super
9
- if locked?
10
- write_rb_lock
11
- end
9
+ write_rb_lock if locked? && !defined?(Bundler::ENV_LOADED)
12
10
  end
13
11
 
14
12
  def setup(*groups)
@@ -97,9 +95,9 @@ module Bundler
97
95
  FileUtils.mkdir_p(cache_path)
98
96
 
99
97
  Bundler.ui.info "Removing outdated .gem files from vendor/cache"
100
- cache_path.children.each do |gem_path|
98
+ Pathname.glob(cache_path.join("*.gem")).each do |gem_path|
101
99
  cached_spec = Gem::Format.from_file_by_path(gem_path).spec
102
- next unless cached_spec.platform =~ Gem::Platform.local
100
+ next unless Gem::Platform.match(cached_spec.platform)
103
101
  unless specs.any?{|s| s.full_name == cached_spec.full_name }
104
102
  Bundler.ui.info " * #{File.basename(gem_path)}"
105
103
  gem_path.rmtree
@@ -6,6 +6,7 @@ if Bundler::SharedHelpers.in_bundle?
6
6
  env_file = Bundler::SharedHelpers.env_file
7
7
  if env_file.exist?
8
8
  require env_file
9
+ Bundler.setup if defined?(Bundler::GEM_LOADED)
9
10
  else
10
11
  require 'bundler'
11
12
  begin
@@ -130,7 +130,10 @@ module Bundler
130
130
  end
131
131
 
132
132
  class GemCache
133
+ attr_reader :options
134
+
133
135
  def initialize(options)
136
+ @options = options
134
137
  @path = options["path"]
135
138
  end
136
139
 
@@ -251,7 +254,19 @@ module Bundler
251
254
  private
252
255
 
253
256
  def generate_bin(spec)
254
- gem_dir = spec.full_gem_path
257
+ gem_dir = Pathname.new(spec.full_gem_path)
258
+
259
+ # Some gem authors put absolute paths in their gemspec
260
+ # and we have to save them from themselves
261
+ spec.files = spec.files.map do |p|
262
+ next if File.directory?(p)
263
+ begin
264
+ Pathname.new(p).relative_path_from(gem_dir).to_s
265
+ rescue ArgumentError
266
+ p
267
+ end
268
+ end.compact
269
+
255
270
  gem_file = Dir.chdir(gem_dir){ Gem::Builder.new(spec).build }
256
271
 
257
272
  installer = Gem::Installer.new File.join(gem_dir, gem_file),
@@ -380,6 +395,8 @@ module Bundler
380
395
  Dir.chdir(path) do
381
396
  git "fetch --force --quiet"
382
397
  git "reset --hard #{revision}"
398
+ git "submodule init"
399
+ git "submodule update"
383
400
  end
384
401
  end
385
402
 
@@ -87,5 +87,5 @@ module Bundler
87
87
  end
88
88
 
89
89
  # Set up load paths unless this file is being loaded after the Bundler gem
90
- setup unless @gem_loaded
90
+ setup unless defined?(Bundler::GEM_LOADED)
91
91
  end
@@ -1,3 +1,3 @@
1
1
  module Bundler
2
- VERSION = "0.9.23"
2
+ VERSION = "0.9.24"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 23
9
- version: 0.9.23
8
+ - 24
9
+ version: 0.9.24
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-20 00:00:00 -07:00
19
+ date: 2010-04-22 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency