bundler 1.0.2 → 1.0.3

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.

data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 1.0.3 (October 15, 2010)
2
+
3
+ Bugfixes:
4
+
5
+ - Use bitwise or in #hash to reduce the chance of overflow
6
+ - `bundle update` now works with :git + :tag updates
7
+ - Record relative :path options in the Gemfile.lock
8
+ - :groups option on gem method in Gemfile now works
9
+ - Add #platform method and :platform option to Gemfile DSL
10
+ - --without now accepts a quoted, space-separated list
11
+ - Installing after --deployment with no lock is now possible
12
+ - Binstubs can now be symlinked
13
+ - Print warning if cache for --local install is missing gems
14
+ - Improve output when installing to a path
15
+ - The tests all pass! Yay!
16
+
17
+ ## 1.0.2 (October 2, 2010)
18
+
19
+ Bugfix:
20
+
21
+ - Actually include the man pages in the gem, so help works
22
+
1
23
  ## 1.0.1 (October 1, 2010)
2
24
 
3
25
  Features:
data/Rakefile CHANGED
@@ -1,16 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.unshift File.expand_path("../lib", __FILE__)
3
-
4
- require 'rubygems'
5
- require 'rubygems/specification'
6
- require 'bundler'
7
-
8
- def gemspec
9
- @gemspec ||= begin
10
- file = File.expand_path('../bundler.gemspec', __FILE__)
11
- eval(File.read(file), binding, file)
12
- end
13
- end
3
+ require 'bundler/gem_helper'
4
+ Bundler::GemHelper.install_tasks
14
5
 
15
6
  def sudo?
16
7
  ENV['BUNDLER_SUDO_TESTS']
@@ -32,7 +23,7 @@ begin
32
23
  task :spec => :build
33
24
 
34
25
  namespace :spec do
35
- task :sudo do
26
+ task :set_sudo do
36
27
  ENV['BUNDLER_SUDO_TESTS'] = '1'
37
28
  end
38
29
 
@@ -44,52 +35,58 @@ begin
44
35
  end
45
36
  end
46
37
 
47
- desc "Run the full spec suite including SUDO tests"
48
- task :full => ["sudo", "clean", "spec"]
49
- end
50
-
51
- # Rubygems 1.3.5, 1.3.6, and HEAD specs
52
- rubyopt = ENV["RUBYOPT"]
53
- %w(master REL_1_3_5 REL_1_3_6).each do |rg|
54
- desc "Run specs with Rubygems #{rg}"
55
- RSpec::Core::RakeTask.new("spec_gems_#{rg}") do |t|
56
- t.rspec_opts = %w(-fs --color)
57
- t.ruby_opts = %w(-w)
58
- end
59
-
60
- task "rubygems_#{rg}" do
61
- unless File.directory?("tmp/rubygems_#{rg}")
62
- system("git clone git://github.com/jbarnette/rubygems.git tmp/rubygems_#{rg} && cd tmp/rubygems_#{rg} && git reset --hard #{rg}")
38
+ desc "Run the spec suite with the sudo tests"
39
+ task :sudo => ["set_sudo", "clean", "spec"]
40
+
41
+ namespace :rubygems do
42
+ # Rubygems 1.3.5, 1.3.6, and HEAD specs
43
+ rubyopt = ENV["RUBYOPT"]
44
+ %w(master REL_1_3_5 REL_1_3_6).each do |rg|
45
+ desc "Run specs with Rubygems #{rg}"
46
+ RSpec::Core::RakeTask.new(rg) do |t|
47
+ t.rspec_opts = %w(-fs --color)
48
+ t.ruby_opts = %w(-w)
49
+ end
50
+
51
+ task "clone_rubygems_#{rg}" do
52
+ unless File.directory?("tmp/rubygems_#{rg}")
53
+ system("git clone git://github.com/jbarnette/rubygems.git tmp/rubygems_#{rg} && cd tmp/rubygems_#{rg} && git reset --hard #{rg}")
54
+ end
55
+ ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems_#{rg}/lib")} #{rubyopt}"
56
+ end
57
+
58
+ task rg => "clone_rubygems_#{rg}"
59
+ task "rubygems:all" => rg
63
60
  end
64
- ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems_#{rg}/lib")} #{rubyopt}"
65
61
  end
66
62
 
67
- task "spec_gems_#{rg}" => "rubygems_#{rg}"
68
- task :ci => "spec_gems_#{rg}"
69
- end
63
+ namespace :ruby do
64
+ # Ruby 1.8.6, 1.8.7, and 1.9.2 specs
65
+ task "ensure_rvm" do
66
+ raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
67
+ end
70
68
 
71
- # Ruby 1.8.6, 1.8.7, and 1.9.2 specs
72
- task "ensure_rvm" do
73
- raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
74
- end
69
+ %w(1.8.6-p399 1.8.7-p302 1.9.2-p0).each do |ruby|
70
+ ruby_cmd = File.expand_path("~/.rvm/bin/ruby-#{ruby}")
75
71
 
76
- %w(1.8.6-p399 1.8.7-p249 1.9.2-head).each do |ruby|
77
- ruby_cmd = File.expand_path("~/.rvm/bin/ruby-#{ruby}")
72
+ desc "Run specs on Ruby #{ruby}"
73
+ RSpec::Core::RakeTask.new(ruby) do |t|
74
+ t.rspec_opts = %w(-fs --color)
75
+ t.ruby_opts = %w(-w)
76
+ end
78
77
 
79
- desc "Run specs on Ruby #{ruby}"
80
- RSpec::Core::RakeTask.new("spec_ruby_#{ruby}") do |t|
81
- t.rspec_opts = %w(-fs --color)
82
- t.ruby_opts = %w(-w)
83
- end
78
+ task "ensure_ruby_#{ruby}" do
79
+ raise "Could not find Ruby #{ruby} at #{ruby_cmd}" unless File.exist?(ruby_cmd)
80
+ end
84
81
 
85
- task "ensure_ruby_#{ruby}" do
86
- raise "Could not find Ruby #{ruby} at #{ruby_cmd}" unless File.exist?(ruby_cmd)
82
+ task "ensure_ruby_#{ruby}" => "ensure_rvm"
83
+ task ruby => "ensure_ruby_#{ruby}"
84
+ task "ruby:all" => ruby
85
+ end
87
86
  end
88
87
 
89
- task "ensure_ruby_#{ruby}" => "ensure_rvm"
90
- task "spec_ruby_#{ruby}" => "ensure_ruby_#{ruby}"
91
- task :ci => "spec_ruby_#{ruby}"
92
88
  end
89
+
93
90
  rescue LoadError
94
91
  task :spec do
95
92
  abort "Run `gem install rspec --pre` to be able to run specs"
@@ -111,16 +108,16 @@ namespace :man do
111
108
  sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
112
109
  end
113
110
 
114
- task :build => "#{roff}.txt"
111
+ task :build_pages => "#{roff}.txt"
115
112
  end
116
- end
117
113
 
118
- desc "Build the man pages"
119
- task :build => "man:build"
114
+ desc "Build the man pages"
115
+ task :build => "man:build_pages"
120
116
 
121
- desc "Clean up from the built man pages"
122
- task :clean do
123
- rm_rf "lib/bundler/man"
117
+ desc "Clean up from the built man pages"
118
+ task :clean do
119
+ rm_rf "lib/bundler/man"
120
+ end
124
121
  end
125
122
 
126
123
  namespace :vendor do
@@ -137,37 +134,6 @@ namespace :vendor do
137
134
  end
138
135
  end
139
136
 
140
- begin
141
- require 'rake/gempackagetask'
142
- rescue LoadError
143
- task(:gem) { $stderr.puts '`gem install rake` to package gems' }
144
- else
145
- Rake::GemPackageTask.new(gemspec) do |pkg|
146
- pkg.gem_spec = gemspec
147
- end
148
- task :gem => [:build, :gemspec]
149
- end
150
-
151
- desc "install the gem locally"
152
- task :install => :package do
153
- sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
154
- end
155
-
156
- desc "validate the gemspec"
157
- task :gemspec do
158
- gemspec.validate
159
- end
160
-
161
- desc "Build the gem"
162
- task :gem => [:gemspec, :build] do
163
- mkdir_p "pkg"
164
- sh "gem build bundler.gemspec"
165
- mv "#{gemspec.full_name}.gem", "pkg"
166
- end
167
-
168
- desc "Install bundler"
169
- task :install => :gem do
170
- sh "gem install pkg/#{gemspec.full_name}.gem"
171
- end
137
+ task :build => "man:build"
172
138
 
173
139
  task :default => :spec
data/bundler.gemspec CHANGED
@@ -20,7 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.add_development_dependency "ronn"
21
21
  s.add_development_dependency "rspec"
22
22
 
23
- s.files = `git ls-files`.split("\n") + Dir.glob("lib/bundler/man/**/*")
23
+ # Man files are required because they are ignored by git
24
+ man_files = Dir.glob("lib/bundler/man/**/*")
25
+ s.files = `git ls-files`.split("\n") + man_files
24
26
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
27
  s.executables = %w(bundle)
26
28
  s.default_executable = "bundle"
data/lib/bundler.rb CHANGED
@@ -212,7 +212,7 @@ module Bundler
212
212
  end
213
213
 
214
214
  def read_file(file)
215
- File.open(file, "rb") { |file| file.read }
215
+ File.open(file, "rb") { |f| f.read }
216
216
  end
217
217
 
218
218
  def load_gemspec(file)
data/lib/bundler/cli.rb CHANGED
@@ -156,7 +156,11 @@ module Bundler
156
156
  def install(path = nil)
157
157
  opts = options.dup
158
158
  opts[:without] ||= []
159
- opts[:without].map! { |g| g.to_sym }
159
+ if opts[:without].size == 1
160
+ opts[:without].map!{|g| g.split(" ") }
161
+ opts[:without].flatten!
162
+ end
163
+ opts[:without].map!{|g| g.to_sym }
160
164
 
161
165
 
162
166
  ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
@@ -190,8 +194,6 @@ module Bundler
190
194
  end
191
195
 
192
196
  if opts[:deployment] || opts[:frozen]
193
- Bundler.settings[:frozen] = '1'
194
-
195
197
  unless Bundler.default_lockfile.exist?
196
198
  flag = opts[:deployment] ? '--deployment' : '--frozen'
197
199
  raise ProductionError, "The #{flag} flag requires a Gemfile.lock. Please make " \
@@ -202,6 +204,8 @@ module Bundler
202
204
  if Bundler.root.join("vendor/cache").exist?
203
205
  opts[:local] = true
204
206
  end
207
+
208
+ Bundler.settings[:frozen] = '1'
205
209
  end
206
210
 
207
211
  # Can't use Bundler.settings for this because settings needs gemfile.dirname
@@ -216,18 +220,29 @@ module Bundler
216
220
 
217
221
  Installer.install(Bundler.root, Bundler.definition, opts)
218
222
  Bundler.load.cache if Bundler.root.join("vendor/cache").exist?
219
- Bundler.ui.confirm "Your bundle is complete! " +
220
- "Use `bundle show [gemname]` to see where a bundled gem is installed."
221
223
 
222
- Bundler.ui.confirm "\nYour bundle was installed to `#{Bundler.settings[:path]}`" if Bundler.settings[:path]
224
+ if Bundler.settings[:path]
225
+ relative_path = Bundler.settings[:path]
226
+ relative_path = "./" + relative_path unless relative_path[0] == ?/
227
+ Bundler.ui.confirm "Your bundle is complete! " +
228
+ "It was installed into #{relative_path}"
229
+ else
230
+ Bundler.ui.confirm "Your bundle is complete! " +
231
+ "Use `bundle show [gemname]` to see where a bundled gem is installed."
232
+ end
223
233
 
224
234
  if path
225
- Bundler.ui.warn "\nIf you meant to install it to your system, please remove the\n" \
226
- "`#{path}` directory and run `bundle install --system`"
235
+ Bundler.ui.warn "The path argument to `bundle install` is deprecated. " +
236
+ "It will be removed in version 1.1. " +
237
+ "Please use `bundle install --path #{path}` instead."
227
238
  end
228
239
  rescue GemNotFound => e
240
+ if opts[:local]
241
+ Bundler.ui.warn "Some gems seem to be missing from your vendor/cache directory."
242
+ end
243
+
229
244
  if Bundler.definition.no_sources?
230
- Bundler.ui.warn "Your Gemfile doesn't have any sources. You can add one with a line like 'source :gemcutter'"
245
+ Bundler.ui.warn "Your Gemfile doesn't have any sources. You can add one with a line like 'source :rubygems'"
231
246
  end
232
247
  raise e
233
248
  end
data/lib/bundler/dsl.rb CHANGED
@@ -53,9 +53,6 @@ module Bundler
53
53
 
54
54
  options = Hash === args.last ? args.pop : {}
55
55
  version = args || [">= 0"]
56
- if group = options[:groups] || options[:group]
57
- options[:group] = group
58
- end
59
56
 
60
57
  _deprecated_options(options)
61
58
  _normalize_options(name, version, options)
@@ -135,6 +132,7 @@ module Bundler
135
132
  ensure
136
133
  platforms.each { @platforms.pop }
137
134
  end
135
+ alias_method :platform, :platforms
138
136
 
139
137
  def env(name)
140
138
  @env, old = name, @env
@@ -187,7 +185,7 @@ module Bundler
187
185
  def _normalize_options(name, version, opts)
188
186
  _normalize_hash(opts)
189
187
 
190
- invalid_keys = opts.keys - %w(group git path name branch ref tag require submodules platforms)
188
+ invalid_keys = opts.keys - %w(group groups git path name branch ref tag require submodules platform platforms)
191
189
  if invalid_keys.any?
192
190
  plural = invalid_keys.size > 1
193
191
  message = "You passed #{invalid_keys.map{|k| ':'+k }.join(", ")} "
@@ -200,10 +198,12 @@ module Bundler
200
198
  end
201
199
 
202
200
  groups = @groups.dup
201
+ opts["group"] = opts.delete("groups") || opts["group"]
203
202
  groups.concat Array(opts.delete("group"))
204
203
  groups = [:default] if groups.empty?
205
204
 
206
205
  platforms = @platforms.dup
206
+ opts["platforms"] = opts["platform"] || opts["platforms"]
207
207
  platforms.concat Array(opts.delete("platforms"))
208
208
  platforms.map! { |p| p.to_sym }
209
209
  platforms.each do |p|
@@ -1,6 +1,7 @@
1
1
  $:.unshift File.expand_path('../vendor', __FILE__)
2
2
  require 'open3'
3
3
  require 'thor'
4
+ require 'bundler'
4
5
 
5
6
  module Bundler
6
7
  class GemHelper
@@ -124,7 +124,7 @@ module Gem
124
124
  MING = Gem::Platform.new('x86-mingw32')
125
125
 
126
126
  def hash
127
- @cpu.hash + @os.hash + @version.hash
127
+ @cpu.hash ^ @os.hash ^ @version.hash
128
128
  end
129
129
 
130
130
  alias eql? ==
@@ -76,11 +76,6 @@ module Bundler
76
76
  executables = specs.map { |s| s.executables }.flatten
77
77
  Gem.source_index # ensure RubyGems is fully loaded
78
78
 
79
- ::Kernel.class_eval do
80
- private
81
- def gem(*) ; end
82
- end
83
-
84
79
  ::Kernel.send(:define_method, :gem) do |dep, *reqs|
85
80
  if executables.include? File.basename(caller.first.split(':').first)
86
81
  return
@@ -113,6 +108,7 @@ module Bundler
113
108
 
114
109
  # Yeah, talk about a hack
115
110
  source_index_class = (class << Gem::SourceIndex ; self ; end)
111
+ source_index_class.send(:remove_method, :from_gems_in)
116
112
  source_index_class.send(:define_method, :from_gems_in) do |*args|
117
113
  source_index = Gem::SourceIndex.new
118
114
  source_index.spec_dirs = *args
@@ -122,7 +118,9 @@ module Bundler
122
118
 
123
119
  # OMG more hacks
124
120
  gem_class = (class << Gem ; self ; end)
121
+ gem_class.send(:remove_method, :refresh)
125
122
  gem_class.send(:define_method, :refresh) { }
123
+ gem_class.send(:remove_method, :bin_path)
126
124
  gem_class.send(:define_method, :bin_path) do |name, *args|
127
125
  exec_name, *reqs = args
128
126
 
@@ -276,7 +276,8 @@ module Bundler
276
276
  @allow_remote = false
277
277
 
278
278
  if options["path"]
279
- @path = Pathname.new(options["path"]).expand_path(Bundler.root)
279
+ @path = Pathname.new(options["path"])
280
+ @path = @path.expand_path(Bundler.root) unless @path.relative?
280
281
  end
281
282
 
282
283
  @name = options["name"]
@@ -326,8 +327,10 @@ module Bundler
326
327
  def load_spec_files
327
328
  index = Index.new
328
329
 
329
- if File.directory?(path)
330
- Dir["#{path}/#{@glob}"].each do |file|
330
+ expanded_path = path.expand_path
331
+
332
+ if File.directory?(expanded_path)
333
+ Dir["#{expanded_path}/#{@glob}"].each do |file|
331
334
  spec = Bundler.load_gemspec(file)
332
335
  if spec
333
336
  spec.loaded_from = file.to_s
@@ -344,14 +347,14 @@ module Bundler
344
347
  s.platform = Gem::Platform::RUBY
345
348
  s.summary = "Fake gemspec for #{@name}"
346
349
  s.relative_loaded_from = "#{@name}.gemspec"
347
- if path.join("bin").exist?
348
- binaries = path.join("bin").children.map{|c| c.basename.to_s }
350
+ if expanded_path.join("bin").exist?
351
+ binaries = expanded_path.join("bin").children.map{|c| c.basename.to_s }
349
352
  s.executables = binaries
350
353
  end
351
354
  end
352
355
  end
353
356
  else
354
- raise PathError, "The path `#{path}` does not exist."
357
+ raise PathError, "The path `#{expanded_path}` does not exist."
355
358
  end
356
359
 
357
360
  index
@@ -600,7 +603,7 @@ module Bundler
600
603
  if cached?
601
604
  return if has_revision_cached?
602
605
  Bundler.ui.info "Updating #{uri}"
603
- in_cache { git %|fetch --force --quiet "#{uri}" refs/heads/*:refs/heads/*| }
606
+ in_cache { git %|fetch --force --quiet --tags "#{uri}" refs/heads/*:refs/heads/*| }
604
607
  else
605
608
  Bundler.ui.info "Fetching #{uri}"
606
609
  FileUtils.mkdir_p(cache_path.dirname)
@@ -614,7 +617,7 @@ module Bundler
614
617
  git %|clone --no-checkout "#{cache_path}" "#{path}"|
615
618
  end
616
619
  Dir.chdir(path) do
617
- git %|fetch --force --quiet "#{cache_path}"|
620
+ git %|fetch --force --quiet --tags "#{cache_path}"|
618
621
  git "reset --hard #{revision}"
619
622
 
620
623
  if @submodules
@@ -6,7 +6,9 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../<%= relative_gemfile_path %>", __FILE__)
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../<%= relative_gemfile_path %>",
11
+ Pathname.new(__FILE__).realpath)
10
12
 
11
13
  require 'rubygems'
12
14
  require 'bundler/setup'
@@ -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.2" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.0.3" unless defined?(::Bundler::VERSION)
6
6
  end
data/man/gemfile.5.ronn CHANGED
@@ -240,6 +240,25 @@ In the case of the `git` block form, the `:ref`, `:branch`, `:tag`,
240
240
  and `:submodules` options may be passed to the `git` method, and
241
241
  all gems in the block will inherit those options.
242
242
 
243
+ ## GEMSPEC (#gemspec)
244
+
245
+ If you wish to use Bundler to help install dependencies for a gem while it is
246
+ being developed, use the `gemspec` method to pull in the dependencies listed in
247
+ the `.gemspec` file.
248
+
249
+ The `gemspec` method adds any runtime dependencies as gem requirements in the
250
+ default group. It also adds development dependencies as gem requirements in the
251
+ `development` group. Finally, it adds a gem requirement on your project (`:path
252
+ => '.'`). In conjunction with `Bundler.setup`, this allows you to require project
253
+ files in your test code as you would if the project were installed as a gem; you
254
+ need not manipulate the load path manually or require project files via relative
255
+ paths.
256
+
257
+ The `gemspec` method supports optional `:path`, `:name`, and `:development_group`
258
+ options, which control where bundler looks for the `.gemspec`, what named
259
+ `.gemspec` it uses (if more than one is present), and which group development
260
+ dependencies are included in.
261
+
243
262
  ## SOURCE PRIORITY
244
263
 
245
264
  When attempting to locate a gem to satisfy a gem requirement,
@@ -18,6 +18,13 @@ describe "install with --deployment or --frozen" do
18
18
  out.should include("The --frozen flag requires a Gemfile.lock")
19
19
  end
20
20
 
21
+ it "works after you try to deploy without a lock" do
22
+ bundle "install --deployment"
23
+ bundle :install, :exit_status => true
24
+ exitstatus.should == 0
25
+ should_be_installed "rack 1.0"
26
+ end
27
+
21
28
  it "still works if you are not in the app directory and specify --gemfile" do
22
29
  bundle "install"
23
30
  Dir.chdir tmp
@@ -10,6 +10,7 @@ describe "bundle install with gem sources" do
10
10
  group :emo do
11
11
  gem "activesupport", "2.3.5"
12
12
  end
13
+ gem "thin", :groups => [:emo]
13
14
  G
14
15
  end
15
16
 
@@ -17,8 +18,19 @@ describe "bundle install with gem sources" do
17
18
  should_be_installed "rack 1.0.0"
18
19
  end
19
20
 
20
- it "installs gems in other groups" do
21
+ it "installs gems in a group block into that group" do
21
22
  should_be_installed "activesupport 2.3.5"
23
+
24
+ run("require 'activesupport'; puts ACTIVESUPPORT",
25
+ :default, :expect_err => true)
26
+ @err.should =~ /no such file to load -- activesupport/
27
+ end
28
+
29
+ it "installs gems with inline :groups into those groups" do
30
+ should_be_installed "thin 1.0"
31
+
32
+ run("require 'thin'; puts THIN", :default, :expect_err => true)
33
+ @err.should =~ /no such file to load -- thin/
22
34
  end
23
35
 
24
36
  it "sets up everything if Bundler.setup is used with no groups" do
@@ -27,6 +39,9 @@ describe "bundle install with gem sources" do
27
39
 
28
40
  out = run("require 'activesupport'; puts ACTIVESUPPORT")
29
41
  out.should == '2.3.5'
42
+
43
+ out = run("require 'thin'; puts THIN")
44
+ out.should == '1.0'
30
45
  end
31
46
  end
32
47
 
@@ -83,9 +98,8 @@ describe "bundle install with gem sources" do
83
98
  should_be_installed "activesupport 2.3.2", :groups => [:default]
84
99
  end
85
100
 
86
- it "still works when locked" do
101
+ it "still works on a different machine and excludes gems" do
87
102
  bundle :install, :without => "emo"
88
- bundle :lock
89
103
 
90
104
  simulate_new_machine
91
105
  bundle :install, :without => "emo"
@@ -168,6 +182,11 @@ describe "bundle install with gem sources" do
168
182
  bundle "install --without emo lolercoaster"
169
183
  should_not_be_installed "activesupport 2.3.5"
170
184
  end
185
+
186
+ it "does not install the gem w/ option --without 'emo lolercoaster'" do
187
+ bundle "install --without 'emo lolercoaster'"
188
+ should_not_be_installed "activesupport 2.3.5"
189
+ end
171
190
  end
172
191
  end
173
192
 
@@ -206,4 +225,4 @@ describe "bundle install with gem sources" do
206
225
  end
207
226
  end
208
227
  end
209
- end
228
+ end
@@ -116,9 +116,8 @@ describe "bundle install across platforms" do
116
116
  end
117
117
  end
118
118
 
119
- # TODO: Don't make the tests hardcoded to a platform
120
119
  describe "bundle install with platform conditionals" do
121
- it "installs gems tagged w/ the current platform" do
120
+ it "installs gems tagged w/ the current platforms" do
122
121
  install_gemfile <<-G
123
122
  source "file://#{gem_repo1}"
124
123
 
@@ -130,7 +129,7 @@ describe "bundle install with platform conditionals" do
130
129
  should_be_installed "nokogiri 1.4.2"
131
130
  end
132
131
 
133
- it "does not install gems tagged w/ another platform" do
132
+ it "does not install gems tagged w/ another platforms" do
134
133
  install_gemfile <<-G
135
134
  source "file://#{gem_repo1}"
136
135
 
@@ -145,37 +144,52 @@ describe "bundle install with platform conditionals" do
145
144
  should_not_be_installed "nokogiri 1.4.2"
146
145
  end
147
146
 
148
- it "installs gems tagged w/ the current platform" do
147
+ it "does not install gems tagged w/ another platform" do
149
148
  install_gemfile <<-G
150
149
  source "file://#{gem_repo1}"
151
150
 
152
- gem "nokogiri", :platforms => :#{local_tag}
151
+ gem "rack"
152
+
153
+ platform :#{not_local_tag} do
154
+ gem "nokogiri"
155
+ end
153
156
  G
154
157
 
155
- should_be_installed "nokogiri 1.4.2"
158
+ should_be_installed "rack 1.0"
159
+ should_not_be_installed "nokogiri 1.4.2"
156
160
  end
157
161
 
158
- it "doesn't install gems tagged w/ a different platform" do
162
+ it "installs gems tagged w/ the current platforms inline" do
159
163
  install_gemfile <<-G
160
164
  source "file://#{gem_repo1}"
161
-
162
- platforms :#{not_local_tag} do
163
- gem "nokogiri"
164
- end
165
+ gem "nokogiri", :platforms => :#{local_tag}
165
166
  G
166
-
167
- should_not_be_installed "nokogiri"
167
+ should_be_installed "nokogiri 1.4.2"
168
168
  end
169
169
 
170
- it "does not install gems tagged w/ another platform" do
170
+ it "does not install gems tagged w/ another platforms inline" do
171
171
  install_gemfile <<-G
172
172
  source "file://#{gem_repo1}"
173
-
174
173
  gem "rack"
175
174
  gem "nokogiri", :platforms => :#{not_local_tag}
176
175
  G
177
-
178
176
  should_be_installed "rack 1.0"
179
177
  should_not_be_installed "nokogiri 1.4.2"
180
178
  end
179
+
180
+ it "installs gems tagged w/ the current platform inline" do
181
+ install_gemfile <<-G
182
+ source "file://#{gem_repo1}"
183
+ gem "nokogiri", :platform => :#{local_tag}
184
+ G
185
+ should_be_installed "nokogiri 1.4.2"
186
+ end
187
+
188
+ it "doesn't install gems tagged w/ another platform inline" do
189
+ install_gemfile <<-G
190
+ source "file://#{gem_repo1}"
191
+ gem "nokogiri", :platform => :#{not_local_tag}
192
+ G
193
+ should_not_be_installed "nokogiri 1.4.2"
194
+ end
181
195
  end
@@ -63,6 +63,7 @@ describe "bundle install with gem sources" do
63
63
 
64
64
  lambda { run '1' }.should_not change { File.mtime(bundled_app('Gemfile.lock')) }
65
65
  end
66
+
66
67
  it "fetches gems" do
67
68
  install_gemfile <<-G
68
69
  source "file://#{gem_repo1}"
@@ -706,4 +707,36 @@ describe "bundle install with gem sources" do
706
707
  end
707
708
  end
708
709
 
710
+ describe "when locked and installed with --without" do
711
+ before(:each) do
712
+ build_repo2
713
+ system_gems "rack-0.9.1" do
714
+ install_gemfile <<-G, :without => :rack
715
+ source "file://#{gem_repo2}"
716
+ gem "rack"
717
+
718
+ group :rack do
719
+ gem "rack_middleware"
720
+ end
721
+ G
722
+ end
723
+ end
724
+
725
+ it "uses the correct versions even if --without was used on the original" do
726
+ should_be_installed "rack 0.9.1"
727
+ should_not_be_installed "rack_middleware 1.0"
728
+ simulate_new_machine
729
+
730
+ bundle :install
731
+
732
+ should_be_installed "rack 0.9.1"
733
+ should_be_installed "rack_middleware 1.0"
734
+ end
735
+
736
+ it "does not hit the remote a second time" do
737
+ FileUtils.rm_rf gem_repo2
738
+ bundle "install --without rack"
739
+ err.should be_empty
740
+ end
741
+ end
709
742
  end
@@ -331,7 +331,8 @@ describe "bundle install with git sources" do
331
331
  bundle :install, :expect_err => true
332
332
 
333
333
  out.should include("An error has occurred in git")
334
- err.should include("fatal: 'omgomg'")
334
+ err.should include("fatal")
335
+ err.should include("omgomg")
335
336
  err.should include("fatal: The remote end hung up unexpectedly")
336
337
  end
337
338
 
@@ -471,12 +472,12 @@ describe "bundle install with git sources" do
471
472
  end
472
473
 
473
474
  install_gemfile <<-G
474
- source "http://#{gem_repo1}"
475
+ source "file://#{gem_repo1}"
475
476
  gem "bar", :path => "#{lib_path('bar')}"
476
477
  G
477
478
 
478
479
  install_gemfile <<-G
479
- source "http://#{gem_repo1}"
480
+ source "file://#{gem_repo1}"
480
481
  gem "bar", :git => "#{lib_path('bar')}"
481
482
  G
482
483
 
@@ -37,7 +37,7 @@ describe "bundle install with explicit source paths" do
37
37
  it "expands paths" do
38
38
  build_lib "foo"
39
39
 
40
- relative_path = lib_path('foo-1.0').relative_path_from(Pathname.new("~").expand_path)
40
+ relative_path = lib_path('foo-1.0').relative_path_from(Pathname.new('~').expand_path)
41
41
 
42
42
  install_gemfile <<-G
43
43
  gem 'foo', :path => "~/#{relative_path}"
@@ -184,37 +184,31 @@ describe "bundle install with explicit source paths" do
184
184
  end
185
185
  end
186
186
 
187
- describe "when locked" do
188
- it "keeps source pinning" do
189
- build_lib "foo", "1.0", :path => lib_path('foo')
190
- build_lib "omg", "1.0", :path => lib_path('omg')
191
- build_lib "foo", "1.0", :path => lib_path('omg/foo') do |s|
192
- s.write "lib/foo.rb", "puts 'FAIL'"
193
- end
194
-
195
- install_gemfile <<-G
196
- gem "foo", :path => "#{lib_path('foo')}"
197
- gem "omg", :path => "#{lib_path('omg')}"
198
- G
199
-
200
- bundle :lock
201
-
202
- should_be_installed "foo 1.0"
187
+ it "keeps source pinning" do
188
+ build_lib "foo", "1.0", :path => lib_path('foo')
189
+ build_lib "omg", "1.0", :path => lib_path('omg')
190
+ build_lib "foo", "1.0", :path => lib_path('omg/foo') do |s|
191
+ s.write "lib/foo.rb", "puts 'FAIL'"
203
192
  end
204
193
 
205
- it "works when the path does not have a gemspec" do
206
- build_lib "foo", :gemspec => false
194
+ install_gemfile <<-G
195
+ gem "foo", :path => "#{lib_path('foo')}"
196
+ gem "omg", :path => "#{lib_path('omg')}"
197
+ G
198
+
199
+ should_be_installed "foo 1.0"
200
+ end
207
201
 
208
- gemfile <<-G
209
- gem "foo", "1.0", :path => "#{lib_path('foo-1.0')}"
210
- G
202
+ it "works when the path does not have a gemspec" do
203
+ build_lib "foo", :gemspec => false
211
204
 
212
- should_be_installed "foo 1.0"
205
+ gemfile <<-G
206
+ gem "foo", "1.0", :path => "#{lib_path('foo-1.0')}"
207
+ G
213
208
 
214
- bundle :lock
209
+ should_be_installed "foo 1.0"
215
210
 
216
- should_be_installed "foo 1.0"
217
- end
211
+ should_be_installed "foo 1.0"
218
212
  end
219
213
 
220
214
  it "installs executable stubs" do
@@ -375,7 +375,7 @@ describe "the lockfile format" do
375
375
  G
376
376
  end
377
377
 
378
- it "stores relative paths when the path is provided in a relative fashion" do
378
+ it "stores relative paths when the path is provided in a relative fashion and in Gemfile dir" do
379
379
  build_lib "foo", :path => bundled_app('foo')
380
380
 
381
381
  install_gemfile <<-G
@@ -400,6 +400,31 @@ describe "the lockfile format" do
400
400
  G
401
401
  end
402
402
 
403
+ it "stores relative paths when the path is provided in a relative fashion and is above Gemfile dir" do
404
+ build_lib "foo", :path => bundled_app(File.join('..', 'foo'))
405
+
406
+ install_gemfile <<-G
407
+ path "../foo"
408
+ gem "foo"
409
+ G
410
+
411
+ lockfile_should_be <<-G
412
+ PATH
413
+ remote: ../foo
414
+ specs:
415
+ foo (1.0)
416
+
417
+ GEM
418
+ specs:
419
+
420
+ PLATFORMS
421
+ #{generic(Gem::Platform.local)}
422
+
423
+ DEPENDENCIES
424
+ foo
425
+ G
426
+ end
427
+
403
428
  it "stores relative paths when the path is provided in an absolute fashion but is relative" do
404
429
  build_lib "foo", :path => bundled_app('foo')
405
430
 
@@ -51,52 +51,4 @@ describe "bundle console" do
51
51
  out.should include("NameError")
52
52
  end
53
53
  end
54
-
55
- describe "when locked" do
56
- before :each do
57
- bundle :lock
58
- end
59
-
60
- it "starts IRB with the default group loaded" do
61
- bundle :console do |input|
62
- input.puts("puts RACK")
63
- input.puts("exit")
64
- end
65
- out.should include("0.9.1")
66
- end
67
-
68
- it "doesn't load any other groups" do
69
- bundle :console do |input|
70
- input.puts("puts ACTIVESUPPORT")
71
- input.puts("exit")
72
- end
73
- out.should include("NameError")
74
- end
75
-
76
- describe "and given a group" do
77
- it "loads the given group" do
78
- bundle "console test" do |input|
79
- input.puts("puts ACTIVESUPPORT")
80
- input.puts("exit")
81
- end
82
- out.should include("2.3.5")
83
- end
84
-
85
- it "loads the default group" do
86
- bundle "console test" do |input|
87
- input.puts("puts RACK")
88
- input.puts("exit")
89
- end
90
- out.should include("0.9.1")
91
- end
92
-
93
- it "doesn't load other groups" do
94
- bundle "console test" do |input|
95
- input.puts("puts RACK_MIDDLEWARE")
96
- input.puts("exit")
97
- end
98
- out.should include("NameError")
99
- end
100
- end
101
- end
102
- end
54
+ end
@@ -32,20 +32,4 @@ describe "bundle open" do
32
32
  bundle "open missing", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
33
33
  out.should match(/could not find gem 'missing'/i)
34
34
  end
35
-
36
- describe "while locked" do
37
- before :each do
38
- bundle :lock
39
- end
40
-
41
- it "opens the gem with EDITOR if set" do
42
- bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
43
- out.should == "editor #{default_bundle_path('gems', 'rails-2.3.2')}"
44
- end
45
-
46
- it "complains if gem not in bundle" do
47
- bundle "open missing", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
48
- out.should match(/could not find gem 'missing'/i)
49
- end
50
- end
51
35
  end
@@ -38,23 +38,6 @@ describe "bundle show" do
38
38
  bundle "show missing"
39
39
  out.should =~ /could not find gem 'missing'/i
40
40
  end
41
-
42
- describe "while locked" do
43
- before :each do
44
- bundle :lock
45
- end
46
-
47
- it "prints path if gem exists in bundle" do
48
- bundle "show rails"
49
- out.should == default_bundle_path('gems', 'rails-2.3.2').to_s
50
- end
51
-
52
- it "complains if gem not in bundle" do
53
- bundle "show missing"
54
- out.should =~ /could not find gem 'missing'/i
55
- end
56
- end
57
-
58
41
  end
59
42
 
60
43
  describe "bundle show with a git repo" do
@@ -9,12 +9,10 @@ describe "environment.rb file" do
9
9
  install_gemfile <<-G
10
10
  gem "no-gemspec", "1.0", :git => "#{lib_path('no-gemspec-1.0')}"
11
11
  G
12
-
13
- bundle :lock
14
12
  end
15
13
 
16
14
  it "loads the library via a virtual spec" do
17
- run <<-R, :lite_runtime => true
15
+ run <<-R
18
16
  require 'no-gemspec'
19
17
  puts NOGEMSPEC
20
18
  R
@@ -32,12 +30,10 @@ describe "environment.rb file" do
32
30
 
33
31
  gem "activesupport", "2.3.5"
34
32
  G
35
-
36
- bundle :lock
37
33
  end
38
34
 
39
35
  it "does not pull in system gems" do
40
- run <<-R, :lite_runtime => true
36
+ run <<-R
41
37
  require 'rubygems'
42
38
 
43
39
  begin;
@@ -51,7 +47,7 @@ describe "environment.rb file" do
51
47
  end
52
48
 
53
49
  it "provides a gem method" do
54
- run <<-R, :lite_runtime => true
50
+ run <<-R
55
51
  gem 'activesupport'
56
52
  require 'activesupport'
57
53
  puts ACTIVESUPPORT
@@ -61,7 +57,7 @@ describe "environment.rb file" do
61
57
  end
62
58
 
63
59
  it "raises an exception if gem is used to invoke a system gem not in the bundle" do
64
- run <<-R, :lite_runtime => true
60
+ run <<-R
65
61
  begin
66
62
  gem 'rack'
67
63
  rescue LoadError => e
@@ -73,7 +69,7 @@ describe "environment.rb file" do
73
69
  end
74
70
 
75
71
  it "sets GEM_HOME appropriately" do
76
- run "puts ENV['GEM_HOME']", :lite_runtime => true
72
+ run "puts ENV['GEM_HOME']"
77
73
  out.should == default_bundle_path.to_s
78
74
  end
79
75
  end
@@ -87,12 +83,10 @@ describe "environment.rb file" do
87
83
  gem "rack", "1.0.0"
88
84
  gem "activesupport", "2.3.5"
89
85
  G
90
-
91
- bundle :lock
92
86
  end
93
87
 
94
88
  it "sets GEM_PATH appropriately" do
95
- run "puts Gem.path", :lite_runtime => true
89
+ run "puts Gem.path"
96
90
  paths = out.split("\n")
97
91
  paths.should include(system_gem_path.to_s)
98
92
  paths.should include(default_bundle_path.to_s)
@@ -124,8 +118,7 @@ describe "environment.rb file" do
124
118
 
125
119
  it "evals each gemspec in the context of its parent directory" do
126
120
  bundle :install
127
- bundle :lock
128
- run "require 'bar'; puts BAR", :lite_runtime => true
121
+ run "require 'bar'; puts BAR"
129
122
  out.should == "1.0"
130
123
  end
131
124
 
@@ -161,7 +154,6 @@ describe "environment.rb file" do
161
154
  install_gemfile <<-G
162
155
  gem "bundler", :path => "#{File.expand_path("..", lib)}"
163
156
  G
164
- bundle :lock
165
157
 
166
158
  bundle %|exec ruby -e "require 'bundler'; Bundler.setup"|
167
159
  err.should be_empty
@@ -69,26 +69,21 @@ describe "Bundler.load" do
69
69
  end
70
70
  end
71
71
 
72
- describe "when locked" do
73
- before :each do
74
- install_gemfile <<-G
75
- source "file://#{gem_repo1}"
76
- gem "activesupport"
77
- G
78
- bundle :lock
79
- end
72
+ # This is obviously not true on 1.9 thanks to the AWEOME! gem prelude :'(
73
+ it "does not invoke setup inside env.rb" do
74
+ install_gemfile <<-G
75
+ source "file://#{gem_repo1}"
76
+ gem "activesupport"
77
+ G
80
78
 
81
- # This is obviously not true on 1.9 thanks to the AWEOME! gem prelude :'(
82
- it "does not invoke setup inside env.rb" do
83
- ruby <<-RUBY
84
- require 'bundler'
85
- Bundler.load
86
- puts $LOAD_PATH.grep(/activesupport/i)
87
- RUBY
79
+ ruby <<-RUBY
80
+ require 'bundler'
81
+ Bundler.load
82
+ puts $LOAD_PATH.grep(/activesupport/i)
83
+ RUBY
88
84
 
89
- out.should == ""
90
- end if RUBY_VERSION < "1.9"
91
- end
85
+ out.should == ""
86
+ end if RUBY_VERSION < "1.9"
92
87
 
93
88
  describe "not hurting brittle rubygems" do
94
89
  it "does not inject #source into the generated YAML of the gem specs" do
@@ -94,8 +94,6 @@ describe "Bundler.require" do
94
94
 
95
95
  describe "using bundle exec" do
96
96
  it "requires the locked gems" do
97
- bundle :lock
98
-
99
97
  bundle "exec ruby -e 'Bundler.require'"
100
98
  check out.should == "two"
101
99
 
@@ -183,34 +181,6 @@ describe "Bundler.require" do
183
181
  check out.should == "two_not_loaded\none\ntwo"
184
182
  end
185
183
 
186
- describe "when locked" do
187
- it "works when the gems are in the Gemfile in the correct order" do
188
- gemfile <<-G
189
- path "#{lib_path}"
190
- gem "two"
191
- gem "one"
192
- G
193
-
194
- bundle :lock
195
-
196
- run "Bundler.require"
197
- check out.should == "two\nmodule_two\none"
198
- end
199
-
200
- it "fails when the gems are in the Gemfile in the wrong order" do
201
- gemfile <<-G
202
- path "#{lib_path}"
203
- gem "one"
204
- gem "two"
205
- G
206
-
207
- bundle :lock
208
-
209
- run "Bundler.require"
210
- check out.should == "two_not_loaded\none\ntwo"
211
- end
212
- end
213
-
214
184
  describe "with busted gems" do
215
185
  it "should be busted" do
216
186
  build_gem "busted_require", :to_system => true do |s|
data/spec/spec_helper.rb CHANGED
@@ -38,8 +38,9 @@ RSpec.configure do |config|
38
38
  config.include Spec::Platforms
39
39
  config.include Spec::Sudo
40
40
 
41
- config.filter_run :focus => true
41
+ config.filter_run :focused => true
42
42
  config.run_all_when_everything_filtered = true
43
+ config.alias_example_to :fit, :focused => true
43
44
 
44
45
  original_wd = Dir.pwd
45
46
  original_path = ENV['PATH']
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Carl Lerche
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-10-02 00:00:00 -07:00
20
+ date: 2010-10-15 00:00:00 -07:00
21
21
  default_executable: bundle
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -145,7 +145,6 @@ files:
145
145
  - spec/install/gems/env_spec.rb
146
146
  - spec/install/gems/flex_spec.rb
147
147
  - spec/install/gems/groups_spec.rb
148
- - spec/install/gems/locked_spec.rb
149
148
  - spec/install/gems/packed_spec.rb
150
149
  - spec/install/gems/platform_spec.rb
151
150
  - spec/install/gems/resolving_spec.rb
@@ -256,7 +255,6 @@ test_files:
256
255
  - spec/install/gems/env_spec.rb
257
256
  - spec/install/gems/flex_spec.rb
258
257
  - spec/install/gems/groups_spec.rb
259
- - spec/install/gems/locked_spec.rb
260
258
  - spec/install/gems/packed_spec.rb
261
259
  - spec/install/gems/platform_spec.rb
262
260
  - spec/install/gems/resolving_spec.rb
@@ -1,48 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "bundle install with gem sources" do
4
- describe "when locked and installed with --without" do
5
- before(:each) do
6
- build_repo2
7
- system_gems "rack-0.9.1" do
8
- install_gemfile <<-G, :without => :rack
9
- source "file://#{gem_repo2}"
10
- gem "rack"
11
-
12
- group :rack do
13
- gem "rack_middleware"
14
- end
15
- G
16
-
17
- bundle :lock
18
- end
19
- end
20
-
21
- it "uses the correct versions even if --without was used on the original" do
22
- should_be_installed "rack 0.9.1"
23
- should_not_be_installed "rack_middleware 1.0"
24
- simulate_new_machine
25
-
26
- bundle :install
27
-
28
- should_be_installed "rack 0.9.1"
29
- should_be_installed "rack_middleware 1.0"
30
- end
31
-
32
- it "regenerates the environment.rb if install is called twice on a locked repo" do
33
- run "begin; require 'rack_middleware'; rescue LoadError; puts 'WIN'; end", :lite_runtime => true
34
- check out.should == "WIN"
35
-
36
- bundle :install
37
-
38
- run "require 'rack_middleware'; puts RACK_MIDDLEWARE", :lite_runtime => true
39
- out.should == "1.0"
40
- end
41
-
42
- it "does not hit the remote a second time" do
43
- FileUtils.rm_rf gem_repo2
44
- bundle "install --without rack"
45
- err.should be_empty
46
- end
47
- end
48
- end