bundler 1.0.0.beta.9 → 1.0.0.beta.10

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,18 @@
1
+ ## 1.0.0.beta.10 (July 25, 2010)
2
+
3
+ - Last release before 1.0.0.rc.1
4
+ - Added :mri as a valid platform (platforms :mri { gem "ruby-debug" })
5
+ - Fix `bundle install` immediately after modifying the :submodule option
6
+ - Don't write to Gemfile.lock if nothing has changed, fixing situations
7
+ where bundle install was run with a different user than the app
8
+ itself
9
+ - Fix a bug where other platforms were being wiped on `bundle update`
10
+ - Don't ask for root password on `bundle install` if not needed
11
+ - Avoid setting `$GEM_HOME` where not needed
12
+ - First solid pass of `bundle config`
13
+ - Add build options
14
+ - `bundle config build.mysql --with-mysql-config=/path/to/config`
15
+
1
16
  ## 1.0.0.beta.9 (July 21, 2010)
2
17
 
3
18
  - Fix install failure when switching from a path to git source
@@ -208,7 +208,7 @@ module Bundler
208
208
  if settings[:disable_shared_gems]
209
209
  ENV['GEM_PATH'] = ''
210
210
  ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
211
- else
211
+ elsif Gem.dir != bundle_path.to_s
212
212
  paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? }
213
213
  ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
214
214
  ENV["GEM_HOME"] = bundle_path.to_s
@@ -238,17 +238,34 @@ module Bundler
238
238
  will show the current value, as well as any superceded values and
239
239
  where they were specified.
240
240
  D
241
- def config(name, *values)
242
- locations = Bundler.settings.locations(name)
241
+ def config(name = nil, *args)
242
+ values = ARGV.dup
243
+ values.shift # remove config
244
+ values.shift # remove the name
245
+
246
+ unless name
247
+ Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
248
+
249
+ Bundler.settings.all.each do |setting|
250
+ Bundler.ui.confirm "#{setting}"
251
+ with_padding do
252
+ Bundler.settings.pretty_values_for(setting).each do |line|
253
+ Bundler.ui.info line
254
+ end
255
+ end
256
+ Bundler.ui.confirm ""
257
+ end
258
+ return
259
+ end
243
260
 
244
261
  if values.empty?
245
- # TODO: Say something more useful here
246
- locations.each do |location, value|
247
- if value
248
- Bundler.ui.info "#{location}: #{value}"
249
- end
262
+ Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
263
+ with_padding do
264
+ Bundler.settings.pretty_values_for(name).each { |line| Bundler.ui.info line }
250
265
  end
251
266
  else
267
+ locations = Bundler.settings.locations(name)
268
+
252
269
  if local = locations[:local]
253
270
  Bundler.ui.info "Your application has set #{name} to #{local.inspect}. This will override the " \
254
271
  "system value you are currently setting"
@@ -2,6 +2,8 @@ require "digest/sha1"
2
2
 
3
3
  module Bundler
4
4
  class Definition
5
+ include GemHelpers
6
+
5
7
  attr_reader :dependencies, :platforms, :sources
6
8
 
7
9
  def self.build(gemfile, lockfile, unlock)
@@ -34,13 +36,23 @@ module Bundler
34
36
  @dependencies, @sources, @unlock = dependencies, sources, unlock
35
37
  @remote = false
36
38
  @specs = nil
39
+ @lockfile_contents = ""
37
40
 
38
- if lockfile && File.exists?(lockfile) && unlock != true
39
- locked = LockfileParser.new(File.read(lockfile))
41
+ if lockfile && File.exists?(lockfile)
42
+ @lockfile_contents = File.read(lockfile)
43
+ locked = LockfileParser.new(@lockfile_contents)
40
44
  @platforms = locked.platforms
41
- @locked_deps = locked.dependencies
42
- @last_resolve = SpecSet.new(locked.specs)
43
- @locked_sources = locked.sources
45
+
46
+ if unlock != true
47
+ @locked_deps = locked.dependencies
48
+ @last_resolve = SpecSet.new(locked.specs)
49
+ @locked_sources = locked.sources
50
+ else
51
+ @unlock = {}
52
+ @locked_deps = []
53
+ @last_resolve = SpecSet.new([])
54
+ @locked_sources = []
55
+ end
44
56
  else
45
57
  @unlock = {}
46
58
  @platforms = []
@@ -52,7 +64,7 @@ module Bundler
52
64
  @unlock[:gems] ||= []
53
65
  @unlock[:sources] ||= []
54
66
 
55
- current_platform = Gem.platforms.map { |p| p.to_generic }.compact.last
67
+ current_platform = Gem.platforms.map { |p| generic(p) }.compact.last
56
68
  @platforms |= [current_platform]
57
69
 
58
70
  converge
@@ -141,6 +153,16 @@ module Bundler
141
153
  dependencies.map { |d| d.groups }.flatten.uniq
142
154
  end
143
155
 
156
+ def lock(file)
157
+ contents = to_lock
158
+
159
+ return if @lockfile_contents == contents
160
+
161
+ File.open(file, 'w') do |f|
162
+ f.puts contents
163
+ end
164
+ end
165
+
144
166
  def to_lock
145
167
  out = ""
146
168
 
@@ -267,7 +289,7 @@ module Bundler
267
289
  deps = []
268
290
  dependencies.each do |dep|
269
291
  dep.gem_platforms(@platforms).each do |p|
270
- deps << DepProxy.new(dep, p) if remote || p == Gem::Platform.local.to_generic
292
+ deps << DepProxy.new(dep, p) if remote || p == generic(Gem::Platform.local)
271
293
  end
272
294
  end
273
295
  deps
@@ -11,6 +11,9 @@ module Bundler
11
11
  :ruby => Gem::Platform::RUBY,
12
12
  :ruby_18 => Gem::Platform::RUBY,
13
13
  :ruby_19 => Gem::Platform::RUBY,
14
+ :mri => Gem::Platform::RUBY,
15
+ :mri_18 => Gem::Platform::RUBY,
16
+ :mri_19 => Gem::Platform::RUBY,
14
17
  :jruby => Gem::Platform::JAVA,
15
18
  :mswin => Gem::Platform::MSWIN
16
19
  }
@@ -87,6 +90,18 @@ module Bundler
87
90
  ruby? && RUBY_VERSION >= "1.9"
88
91
  end
89
92
 
93
+ def mri?
94
+ !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby")
95
+ end
96
+
97
+ def mri_18?
98
+ mri? && RUBY_VERSION < "1.9"
99
+ end
100
+
101
+ def mri_19?
102
+ mri? && RUBY_VERSION >= "1.9"
103
+ end
104
+
90
105
  def jruby?
91
106
  defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
92
107
  end
@@ -8,7 +8,7 @@ module Bundler
8
8
  builder.to_definition
9
9
  end
10
10
 
11
- VALID_PLATFORMS = [:ruby_18, :ruby_19, :ruby, :jruby, :mswin]
11
+ VALID_PLATFORMS = [:ruby, :ruby_18, :ruby_19, :mri, :mri_18, :mri19, :jruby, :mswin]
12
12
 
13
13
  def initialize
14
14
  @rubygems_source = Source::Rubygems.new
@@ -36,11 +36,7 @@ module Bundler
36
36
  end
37
37
 
38
38
  def lock
39
- contents = @definition.to_lock
40
-
41
- File.open(root.join('Gemfile.lock'), 'w') do |f|
42
- f.puts contents
43
- end
39
+ @definition.lock(root.join('Gemfile.lock'))
44
40
  end
45
41
 
46
42
  def update(*gems)
@@ -32,7 +32,7 @@ module Bundler
32
32
  end
33
33
 
34
34
  # Ensure that BUNDLE_PATH exists
35
- Bundler.mkdir_p(Bundler.bundle_path)
35
+ Bundler.mkdir_p(Bundler.bundle_path) unless File.exist?(Bundler.bundle_path)
36
36
 
37
37
  # Must install gems in the order that the resolver provides
38
38
  # as dependencies might actually affect the installation of
@@ -45,7 +45,14 @@ module Bundler
45
45
  # next
46
46
  # end
47
47
 
48
- spec.source.install(spec)
48
+ begin
49
+ old_args = Gem::Command.build_args
50
+ Gem::Command.build_args = [Bundler.settings["build.#{spec.name}"]]
51
+ spec.source.install(spec)
52
+ ensure
53
+ Gem::Command.build_args = old_args
54
+ end
55
+
49
56
  Bundler.ui.info ""
50
57
  generate_bundler_executable_stubs(spec) if Bundler.settings[:bin]
51
58
  FileUtils.rm_rf(Bundler.tmp)
@@ -3,7 +3,7 @@ require "rubygems/spec_fetcher"
3
3
 
4
4
  module Bundler
5
5
  class LazySpecification
6
- include Gem::MatchPlatform
6
+ include MatchPlatform
7
7
 
8
8
  attr_reader :name, :version, :dependencies, :platform
9
9
  attr_accessor :source
@@ -68,4 +68,4 @@ module Bundler
68
68
  end
69
69
 
70
70
  end
71
- end
71
+ end
@@ -7,7 +7,7 @@ module Bundler
7
7
  # be seeded with what we're given from the source's abbreviated index - the
8
8
  # full specification will only be fetched when necesary.
9
9
  class RemoteSpecification
10
- include Gem::MatchPlatform
10
+ include MatchPlatform
11
11
 
12
12
  attr_reader :name, :version, :platform
13
13
  attr_accessor :source
@@ -56,4 +56,4 @@ module Bundler
56
56
  end
57
57
  end
58
58
  end
59
- end
59
+ end
@@ -27,6 +27,8 @@ module Bundler
27
27
  Gem::Platform::MING]
28
28
 
29
29
  class SpecGroup < Array
30
+ include GemHelpers
31
+
30
32
  attr_reader :activated, :required_by
31
33
 
32
34
  def initialize(a)
@@ -52,7 +54,7 @@ module Bundler
52
54
 
53
55
  @activated.each do |p|
54
56
  if s = @specs[p]
55
- platform = Gem::Platform.new(s.platform).to_generic
57
+ platform = generic(Gem::Platform.new(s.platform))
56
58
  next if specs[platform]
57
59
 
58
60
  lazy_spec = LazySpecification.new(name, version, platform, source)
@@ -8,61 +8,15 @@ end
8
8
  require 'rubygems'
9
9
  require 'rubygems/specification'
10
10
 
11
- module Bundler
12
- class DepProxy
13
-
14
- attr_reader :required_by, :__platform, :dep
15
-
16
- def initialize(dep, platform)
17
- @dep, @__platform, @required_by = dep, platform, []
18
- end
19
-
20
- def hash
21
- @hash ||= dep.hash
22
- end
23
-
24
- def ==(o)
25
- dep == o.dep && __platform == o.__platform
26
- end
27
-
28
- alias eql? ==
29
-
30
- def type
31
- @dep.type
32
- end
33
-
34
- def to_s
35
- @dep.to_s
36
- end
37
-
38
- private
39
-
40
- def method_missing(*args)
41
- @dep.send(*args)
42
- end
43
-
44
- end
45
- end
46
-
47
11
  module Gem
48
12
  @loaded_stacks = Hash.new { |h,k| h[k] = [] }
49
13
 
50
- module MatchPlatform
51
- def match_platform(p)
52
- Gem::Platform::RUBY == platform or
53
- platform.nil? or p == platform or
54
- Gem::Platform.new(platform).to_generic == p
55
- end
56
- end
57
-
58
14
  class Specification
59
15
  attr_accessor :source, :location, :relative_loaded_from
60
16
 
61
17
  alias_method :rg_full_gem_path, :full_gem_path
62
18
  alias_method :rg_loaded_from, :loaded_from
63
19
 
64
- include MatchPlatform
65
-
66
20
  def full_gem_path
67
21
  source.respond_to?(:path) ?
68
22
  Pathname.new(loaded_from).dirname.expand_path.to_s :
@@ -169,22 +123,81 @@ module Gem
169
123
  MSWIN = Gem::Platform.new('mswin32')
170
124
  MING = Gem::Platform.new('x86-mingw32')
171
125
 
172
- GENERIC_CACHE = {}
173
-
174
- class << RUBY
175
- def to_generic ; self ; end
126
+ def hash
127
+ @cpu.hash + @os.hash + @version.hash
176
128
  end
177
129
 
178
- GENERICS = [JAVA, MSWIN, MING, RUBY]
130
+ alias eql? ==
131
+ end
132
+ end
133
+
134
+ module Bundler
135
+ class DepProxy
136
+
137
+ attr_reader :required_by, :__platform, :dep
138
+
139
+ def initialize(dep, platform)
140
+ @dep, @__platform, @required_by = dep, platform, []
141
+ end
179
142
 
180
143
  def hash
181
- @cpu.hash + @os.hash + @version.hash
144
+ @hash ||= dep.hash
145
+ end
146
+
147
+ def ==(o)
148
+ dep == o.dep && __platform == o.__platform
182
149
  end
183
150
 
184
151
  alias eql? ==
185
152
 
186
- def to_generic
187
- GENERIC_CACHE[self] ||= GENERICS.find { |p| self =~ p } || RUBY
153
+ def type
154
+ @dep.type
155
+ end
156
+
157
+ def to_s
158
+ @dep.to_s
188
159
  end
160
+
161
+ private
162
+
163
+ def method_missing(*args)
164
+ @dep.send(*args)
165
+ end
166
+
167
+ end
168
+
169
+ module GemHelpers
170
+
171
+ GENERIC_CACHE = {}
172
+ GENERICS = [
173
+ Gem::Platform::JAVA,
174
+ Gem::Platform::MSWIN,
175
+ Gem::Platform::MING,
176
+ Gem::Platform::RUBY
177
+ ]
178
+
179
+ def generic(p)
180
+ if p == Gem::Platform::RUBY
181
+ return p
182
+ end
183
+
184
+ GENERIC_CACHE[p] ||= GENERICS.find { |p2| p =~ p2 } || Gem::Platform::RUBY
185
+ end
186
+ end
187
+
188
+ module MatchPlatform
189
+ include GemHelpers
190
+
191
+ def match_platform(p)
192
+ Gem::Platform::RUBY == platform or
193
+ platform.nil? or p == platform or
194
+ generic(Gem::Platform.new(platform)) == p
195
+ end
196
+ end
197
+ end
198
+
199
+ module Gem
200
+ class Specification
201
+ include Bundler::MatchPlatform
189
202
  end
190
203
  end
@@ -19,13 +19,41 @@ module Bundler
19
19
  set_key(key, value, @global_config, global_config_file)
20
20
  end
21
21
 
22
- def locations(key)
23
- key = key_for(key)
22
+ def all
23
+ env_keys = ENV.keys.select { |k| k =~ /BUNDLE_.*/ }
24
+ keys = @global_config.keys | @local_config.keys | env_keys
25
+
26
+ keys.map do |key|
27
+ key.sub(/^BUNDLE_/, '').gsub(/__/, ".").downcase
28
+ end
29
+ end
24
30
 
31
+ def locations(key)
25
32
  locations = {}
26
- locations[:local] = @local_config[key]
27
- locations[:env] = ENV[key]
28
- locations[:global] = @global_config[key]
33
+
34
+ locations[:local] = @local_config[key] if @local_config.key?(key)
35
+ locations[:env] = ENV[key] if ENV[key]
36
+ locations[:global] = @global_config[key] if @global_config.key?(key)
37
+ locations
38
+ end
39
+
40
+ def pretty_values_for(exposed_key)
41
+ key = key_for(exposed_key)
42
+
43
+ locations = []
44
+ if @local_config.key?(key)
45
+ locations << "Set for your local app (#{local_config_file}): #{@local_config[key].inspect}"
46
+ end
47
+
48
+ if value = ENV[key]
49
+ locations << "Set via $#{key_for(key)}: #{value.inspect}"
50
+ end
51
+
52
+ if @global_config.key?(key)
53
+ locations << "Set for the current user (#{global_config_file}): #{@global_config[key].inspect}"
54
+ end
55
+
56
+ return ["You have not configured a value for `#{exposed_key}`"] if locations.empty?
29
57
  locations
30
58
  end
31
59
 
@@ -52,6 +80,10 @@ module Bundler
52
80
  end
53
81
 
54
82
  private
83
+ def key_for(key)
84
+ key = key.to_s.sub(".", "__").upcase
85
+ "BUNDLE_#{key}"
86
+ end
55
87
 
56
88
  def set_key(key, value, hash, file)
57
89
  key = key_for(key)
@@ -64,10 +96,6 @@ module Bundler
64
96
  value
65
97
  end
66
98
 
67
- def key_for(key)
68
- "BUNDLE_#{key.to_s.upcase}"
69
- end
70
-
71
99
  def global_config_file
72
100
  file = ENV["BUNDLE_CONFIG"] || File.join(Gem.user_home, ".bundle/config")
73
101
  Pathname.new(file)
@@ -460,7 +460,7 @@ module Bundler
460
460
  end
461
461
 
462
462
  class Git < Path
463
- attr_reader :uri, :ref, :options
463
+ attr_reader :uri, :ref, :options, :submodules
464
464
 
465
465
  def initialize(options)
466
466
  super
@@ -491,7 +491,8 @@ module Bundler
491
491
  uri == o.uri &&
492
492
  ref == o.ref &&
493
493
  name == o.name &&
494
- version == o.version
494
+ version == o.version &&
495
+ submodules == o.submodules
495
496
  end
496
497
 
497
498
  alias == eql?
@@ -38,10 +38,12 @@ class Thor
38
38
  message = message.to_s
39
39
  message = set_color(message, color) if color
40
40
 
41
+ spaces = " " * padding
42
+
41
43
  if force_new_line
42
- $stdout.puts(message)
44
+ $stdout.puts(spaces + message)
43
45
  else
44
- $stdout.print(message)
46
+ $stdout.print(spaces + message)
45
47
  end
46
48
  $stdout.flush
47
49
  end
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.0.0.beta.9" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.0.0.beta.10" unless defined?(::Bundler::VERSION)
6
6
  end
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 0
9
9
  - beta
10
- - 9
11
- version: 1.0.0.beta.9
10
+ - 10
11
+ version: 1.0.0.beta.10
12
12
  platform: ruby
13
13
  authors:
14
14
  - Carl Lerche
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-07-21 00:00:00 -07:00
21
+ date: 2010-07-25 00:00:00 -07:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency