bundler 1.1.pre.2 → 1.1.pre.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/.travis.yml +7 -0
- data/CHANGELOG.md +24 -3
- data/Rakefile +38 -29
- data/lib/bundler.rb +16 -1
- data/lib/bundler/cli.rb +36 -1
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/gem_helper.rb +10 -3
- data/lib/bundler/rubygems_ext.rb +5 -0
- data/lib/bundler/rubygems_integration.rb +4 -20
- data/lib/bundler/setup.rb +9 -5
- data/lib/bundler/shared_helpers.rb +0 -2
- data/lib/bundler/source.rb +15 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
- data/lib/bundler/vendor/net/http/persistent.rb +2 -2
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +2 -2
- data/lib/bundler/vendor/thor/parser/option.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/man/bundle.ronn +3 -0
- data/spec/install/gems/flex_spec.rb +2 -2
- data/spec/other/newgem_spec.rb +39 -0
- data/spec/other/outdated_spec.rb +46 -0
- data/spec/runtime/with_clean_env_spec.rb +60 -7
- data/spec/spec_helper.rb +6 -1
- data/spec/support/builders.rb +10 -0
- metadata +7 -4
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 1.1.pre.3 (4 May, 2011)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- Add `bundle outdated` to show outdated gems (@joelmoss)
|
6
|
+
- Remove BUNDLE_* from `Bundler.with_clean_env` (@wuputah)
|
7
|
+
- Add Bundler.clean_system, and clean_exec (@wuputah)
|
8
|
+
- Use git config for gem author name and email (@krekoten)
|
9
|
+
|
10
|
+
Bugfixes:
|
11
|
+
|
12
|
+
- Fix error calling Bundler.rubygems.gem_path
|
13
|
+
- Fix error when Gem.path returns Gem::FS instead of String
|
14
|
+
|
1
15
|
## 1.1.pre.2 (April 28, 2011)
|
2
16
|
|
3
17
|
Features:
|
@@ -29,13 +43,20 @@ Removed:
|
|
29
43
|
- Removed bundle install --production
|
30
44
|
- Removed bundle install --disable-shared-gems
|
31
45
|
|
32
|
-
## 1.0.13 (
|
46
|
+
## 1.0.13 (May 4, 2011)
|
33
47
|
|
34
48
|
Features:
|
35
49
|
|
36
|
-
- Compatibility with Rubygems master (soon to be v1.8)
|
37
|
-
- Check for Rubygems features before overriding them
|
50
|
+
- Compatibility with Rubygems master (soon to be v1.8) (@evanphx)
|
38
51
|
- Informative error when --path points to a broken symlink
|
52
|
+
- Support Rake 0.9 and greater (@e2)
|
53
|
+
- Output full errors for non-TTYs e.g. pow (@josh)
|
54
|
+
|
55
|
+
Bugfixes:
|
56
|
+
|
57
|
+
- Allow spaces in gem path names for gem tasks (@rslifka)
|
58
|
+
- Have cap run bundle install from release_path (@martinjagusch)
|
59
|
+
- Quote git refspec so zsh doesn't expand it (@goneflyin)
|
39
60
|
|
40
61
|
## 1.0.12 (April 8, 2011)
|
41
62
|
|
data/Rakefile
CHANGED
@@ -8,8 +8,8 @@ def sudo?
|
|
8
8
|
end
|
9
9
|
|
10
10
|
begin
|
11
|
+
# set up rspec tasks
|
11
12
|
require 'rspec/core/rake_task'
|
12
|
-
require 'ronn'
|
13
13
|
|
14
14
|
desc "Run specs"
|
15
15
|
RSpec::Core::RakeTask.new do |t|
|
@@ -71,12 +71,16 @@ begin
|
|
71
71
|
unless File.directory?("tmp/rubygems")
|
72
72
|
system("git clone git://github.com/rubygems/rubygems.git tmp/rubygems")
|
73
73
|
end
|
74
|
+
hash = nil
|
75
|
+
|
74
76
|
Dir.chdir("tmp/rubygems") do
|
75
77
|
system("git remote update")
|
76
78
|
system("git checkout #{rg}")
|
77
79
|
system("git pull origin master") if rg == "master"
|
80
|
+
hash = `git rev-parse HEAD`.strip
|
78
81
|
end
|
79
|
-
|
82
|
+
|
83
|
+
puts "Running bundler specs against rubygems '#{rg}' at #{hash}"
|
80
84
|
ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
|
81
85
|
end
|
82
86
|
|
@@ -125,6 +129,38 @@ begin
|
|
125
129
|
|
126
130
|
end
|
127
131
|
|
132
|
+
|
133
|
+
# set up man tasks that use ronn
|
134
|
+
require 'ronn'
|
135
|
+
|
136
|
+
namespace :man do
|
137
|
+
directory "lib/bundler/man"
|
138
|
+
|
139
|
+
Dir["man/*.ronn"].each do |ronn|
|
140
|
+
basename = File.basename(ronn, ".ronn")
|
141
|
+
roff = "lib/bundler/man/#{basename}"
|
142
|
+
|
143
|
+
file roff => ["lib/bundler/man", ronn] do
|
144
|
+
sh "ronn --roff --pipe #{ronn} > #{roff}"
|
145
|
+
end
|
146
|
+
|
147
|
+
file "#{roff}.txt" => roff do
|
148
|
+
sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
|
149
|
+
end
|
150
|
+
|
151
|
+
task :build_all_pages => "#{roff}.txt"
|
152
|
+
end
|
153
|
+
|
154
|
+
desc "Build the man pages"
|
155
|
+
task :build => "man:build_all_pages"
|
156
|
+
|
157
|
+
desc "Clean up from the built man pages"
|
158
|
+
task :clean do
|
159
|
+
rm_rf "lib/bundler/man"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
|
128
164
|
rescue LoadError
|
129
165
|
task :spec do
|
130
166
|
abort "Run `rake spec:deps` to be able to run the specs"
|
@@ -140,33 +176,6 @@ rescue LoadError
|
|
140
176
|
|
141
177
|
end
|
142
178
|
|
143
|
-
namespace :man do
|
144
|
-
directory "lib/bundler/man"
|
145
|
-
|
146
|
-
Dir["man/*.ronn"].each do |ronn|
|
147
|
-
basename = File.basename(ronn, ".ronn")
|
148
|
-
roff = "lib/bundler/man/#{basename}"
|
149
|
-
|
150
|
-
file roff => ["lib/bundler/man", ronn] do
|
151
|
-
sh "ronn --roff --pipe #{ronn} > #{roff}"
|
152
|
-
end
|
153
|
-
|
154
|
-
file "#{roff}.txt" => roff do
|
155
|
-
sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
|
156
|
-
end
|
157
|
-
|
158
|
-
task :build_all_pages => "#{roff}.txt"
|
159
|
-
end
|
160
|
-
|
161
|
-
desc "Build the man pages"
|
162
|
-
task :build => "man:build_all_pages"
|
163
|
-
|
164
|
-
desc "Clean up from the built man pages"
|
165
|
-
task :clean do
|
166
|
-
rm_rf "lib/bundler/man"
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
179
|
namespace :vendor do
|
171
180
|
desc "Build the vendor dir"
|
172
181
|
task :build => :clean do
|
data/lib/bundler.rb
CHANGED
@@ -185,7 +185,7 @@ module Bundler
|
|
185
185
|
@settings ||= Settings.new(app_config_path)
|
186
186
|
end
|
187
187
|
|
188
|
-
def
|
188
|
+
def with_original_env
|
189
189
|
bundled_env = ENV.to_hash
|
190
190
|
ENV.replace(ORIGINAL_ENV)
|
191
191
|
yield
|
@@ -193,6 +193,21 @@ module Bundler
|
|
193
193
|
ENV.replace(bundled_env.to_hash)
|
194
194
|
end
|
195
195
|
|
196
|
+
def with_clean_env
|
197
|
+
with_original_env do
|
198
|
+
ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }
|
199
|
+
yield
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def clean_system(*args)
|
204
|
+
with_clean_env { Kernel.system(*args) }
|
205
|
+
end
|
206
|
+
|
207
|
+
def clean_exec(*args)
|
208
|
+
with_clean_env { Kernel.exec(*args) }
|
209
|
+
end
|
210
|
+
|
196
211
|
def default_gemfile
|
197
212
|
SharedHelpers.default_gemfile
|
198
213
|
end
|
data/lib/bundler/cli.rb
CHANGED
@@ -272,6 +272,33 @@ module Bundler
|
|
272
272
|
end
|
273
273
|
map %w(list) => "show"
|
274
274
|
|
275
|
+
desc "outdated", "Returns a list of installed gems that are outdated."
|
276
|
+
long_desc <<-D
|
277
|
+
Outdated lists the names and versions of all gems that are outdated when compared to the source.
|
278
|
+
Calling outdated with [GEM [GEM]] will check only the given gems.
|
279
|
+
D
|
280
|
+
method_option "source", :type => :array, :banner => "Check against a specific source"
|
281
|
+
method_option "local", :type => :boolean, :banner =>
|
282
|
+
"Do not attempt to fetch gems remotely and use the gem cache instead"
|
283
|
+
def outdated(*gems)
|
284
|
+
sources = Array(options[:source])
|
285
|
+
|
286
|
+
if gems.empty? && sources.empty?
|
287
|
+
# We're doing a full update
|
288
|
+
definition = Bundler.definition(true)
|
289
|
+
else
|
290
|
+
definition = Bundler.definition(:gems => gems, :sources => sources)
|
291
|
+
end
|
292
|
+
|
293
|
+
options["local"] ? definition.resolve_with_cache! : definition.resolve_remotely!
|
294
|
+
|
295
|
+
definition.specs.each do |spec|
|
296
|
+
spec.source.fetch(spec) if spec.source.respond_to?(:fetch)
|
297
|
+
spec.source.outdated(spec)
|
298
|
+
Bundler.ui.debug "from #{spec.loaded_from} "
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
275
302
|
desc "cache", "Cache all the gems to vendor/cache", :hide => true
|
276
303
|
method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
|
277
304
|
def cache
|
@@ -450,7 +477,15 @@ module Bundler
|
|
450
477
|
constant_name = constant_name.split('-').map{|q| q.capitalize}.join('::') if constant_name =~ /-/
|
451
478
|
constant_array = constant_name.split('::')
|
452
479
|
FileUtils.mkdir_p(File.join(target, 'lib', name))
|
453
|
-
|
480
|
+
git_user_name = `git config user.name`.chomp
|
481
|
+
git_user_email = `git config user.email`.chomp
|
482
|
+
opts = {
|
483
|
+
:name => name,
|
484
|
+
:constant_name => constant_name,
|
485
|
+
:constant_array => constant_array,
|
486
|
+
:author => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
|
487
|
+
:email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email
|
488
|
+
}
|
454
489
|
template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts)
|
455
490
|
template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts)
|
456
491
|
template(File.join("newgem/gitignore.tt"), File.join(target, ".gitignore"), opts)
|
data/lib/bundler/deployment.rb
CHANGED
@@ -45,7 +45,7 @@ module Bundler
|
|
45
45
|
args << bundle_flags.to_s
|
46
46
|
args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
|
47
47
|
|
48
|
-
run "#{bundle_cmd} install #{args.join(' ')}"
|
48
|
+
run "cd #{context.fetch(:current_release)} && #{bundle_cmd} install #{args.join(' ')}"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/lib/bundler/gem_helper.rb
CHANGED
@@ -2,6 +2,13 @@ $:.unshift File.expand_path('../vendor', __FILE__)
|
|
2
2
|
require 'thor'
|
3
3
|
require 'bundler'
|
4
4
|
|
5
|
+
begin
|
6
|
+
# Support Rake > 0.8.7
|
7
|
+
require 'rake/dsl_definition'
|
8
|
+
include Rake::DSL
|
9
|
+
rescue LoadError
|
10
|
+
end
|
11
|
+
|
5
12
|
module Bundler
|
6
13
|
class GemHelper
|
7
14
|
def self.install_tasks(opts = {})
|
@@ -39,7 +46,7 @@ module Bundler
|
|
39
46
|
|
40
47
|
def build_gem
|
41
48
|
file_name = nil
|
42
|
-
sh("gem build #{spec_path}") { |out, code|
|
49
|
+
sh("gem build '#{spec_path}'") { |out, code|
|
43
50
|
raise out unless out[/Successfully/]
|
44
51
|
file_name = File.basename(built_gem_path)
|
45
52
|
FileUtils.mkdir_p(File.join(base, 'pkg'))
|
@@ -51,7 +58,7 @@ module Bundler
|
|
51
58
|
|
52
59
|
def install_gem
|
53
60
|
built_gem_path = build_gem
|
54
|
-
out, _ = sh_with_code("gem install #{built_gem_path}")
|
61
|
+
out, _ = sh_with_code("gem install '#{built_gem_path}'")
|
55
62
|
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
|
56
63
|
Bundler.ui.confirm "#{name} (#{version}) installed"
|
57
64
|
end
|
@@ -68,7 +75,7 @@ module Bundler
|
|
68
75
|
|
69
76
|
protected
|
70
77
|
def rubygem_push(path)
|
71
|
-
out, _ = sh("gem push #{path}")
|
78
|
+
out, _ = sh("gem push '#{path}'")
|
72
79
|
raise "Gem push failed due to lack of RubyGems.org credentials." if out[/Enter your RubyGems.org credentials/]
|
73
80
|
Bundler.ui.confirm "Pushed #{name} #{version} to rubygems.org"
|
74
81
|
end
|
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -5,16 +5,6 @@ module Bundler
|
|
5
5
|
configuration
|
6
6
|
end
|
7
7
|
|
8
|
-
def is_19?
|
9
|
-
false
|
10
|
-
end
|
11
|
-
|
12
|
-
# Make sure that rubygems has fully loaded (1.9 partially loads
|
13
|
-
# sometimes)
|
14
|
-
def fully_load!
|
15
|
-
Gem.source_index if is_19?
|
16
|
-
end
|
17
|
-
|
18
8
|
def loaded_specs(name)
|
19
9
|
Gem.loaded_specs[name]
|
20
10
|
end
|
@@ -24,7 +14,7 @@ module Bundler
|
|
24
14
|
end
|
25
15
|
|
26
16
|
def path(obj)
|
27
|
-
|
17
|
+
obj.to_s
|
28
18
|
end
|
29
19
|
|
30
20
|
def platforms
|
@@ -68,7 +58,9 @@ module Bundler
|
|
68
58
|
end
|
69
59
|
|
70
60
|
def gem_path
|
71
|
-
Gem.path
|
61
|
+
# Make sure that Gem.path is an array of Strings, not some
|
62
|
+
# internal Rubygems object
|
63
|
+
Gem.path.map { |x| x.to_s }
|
72
64
|
end
|
73
65
|
|
74
66
|
def marshal_spec_dir
|
@@ -260,10 +252,6 @@ module Bundler
|
|
260
252
|
stub_source_index137(specs)
|
261
253
|
end
|
262
254
|
|
263
|
-
def path(obj)
|
264
|
-
obj.to_s
|
265
|
-
end
|
266
|
-
|
267
255
|
def all_specs
|
268
256
|
Gem.source_index.all_gems.values
|
269
257
|
end
|
@@ -277,10 +265,6 @@ module Bundler
|
|
277
265
|
def stub_rubygems(specs)
|
278
266
|
stub_source_index170(specs)
|
279
267
|
end
|
280
|
-
|
281
|
-
def path(obj)
|
282
|
-
obj.to_s
|
283
|
-
end
|
284
268
|
end
|
285
269
|
|
286
270
|
end
|
data/lib/bundler/setup.rb
CHANGED
@@ -2,12 +2,16 @@ require 'bundler/shared_helpers'
|
|
2
2
|
|
3
3
|
if Bundler::SharedHelpers.in_bundle?
|
4
4
|
require 'bundler'
|
5
|
-
|
5
|
+
if STDOUT.tty?
|
6
|
+
begin
|
7
|
+
Bundler.setup
|
8
|
+
rescue Bundler::BundlerError => e
|
9
|
+
puts "\e[31m#{e.message}\e[0m"
|
10
|
+
puts e.backtrace.join("\n") if ENV["DEBUG"]
|
11
|
+
exit e.status_code
|
12
|
+
end
|
13
|
+
else
|
6
14
|
Bundler.setup
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
puts "\e[31m#{e.message}\e[0m"
|
9
|
-
puts e.backtrace.join("\n") if ENV["DEBUG"]
|
10
|
-
exit e.status_code
|
11
15
|
end
|
12
16
|
|
13
17
|
# Add bundler to the load path after disabling system gems
|
data/lib/bundler/source.rb
CHANGED
@@ -78,6 +78,18 @@ module Bundler
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
def outdated(spec)
|
82
|
+
installed_spec = installed_specs[spec.name]
|
83
|
+
installed_spec = installed_spec.first
|
84
|
+
|
85
|
+
if installed_spec && spec.version == installed_spec.version
|
86
|
+
Bundler.ui.debug "Up to date: #{spec.name} (#{installed_spec.version}) "
|
87
|
+
return
|
88
|
+
end
|
89
|
+
|
90
|
+
Bundler.ui.info "#{spec.name} (#{spec.version} > #{installed_spec.version}) "
|
91
|
+
end
|
92
|
+
|
81
93
|
def install(spec)
|
82
94
|
path = cached_gem(spec)
|
83
95
|
|
@@ -104,7 +116,7 @@ module Bundler
|
|
104
116
|
sudo "cp -R #{Bundler.tmp}/gems/#{spec.full_name} #{Bundler.rubygems.gem_dir}/gems/"
|
105
117
|
sudo "cp -R #{Bundler.tmp}/specifications/#{spec.full_name}.gemspec #{Bundler.rubygems.gem_dir}/specifications/"
|
106
118
|
spec.executables.each do |exe|
|
107
|
-
sudo "mkdir -p #{Bundler.rubygems.
|
119
|
+
sudo "mkdir -p #{Bundler.rubygems.gem_bindir}"
|
108
120
|
sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Bundler.rubygems.gem_bindir}"
|
109
121
|
end
|
110
122
|
end
|
@@ -179,6 +191,7 @@ module Bundler
|
|
179
191
|
s.version = VERSION
|
180
192
|
s.platform = Gem::Platform::RUBY
|
181
193
|
s.source = self
|
194
|
+
s.authors = ["bundler team"]
|
182
195
|
s.loaded_from = File.expand_path("..", __FILE__)
|
183
196
|
end
|
184
197
|
idx << bundler
|
@@ -342,6 +355,7 @@ module Bundler
|
|
342
355
|
s.platform = Gem::Platform::RUBY
|
343
356
|
s.summary = "Fake gemspec for #{@name}"
|
344
357
|
s.relative_loaded_from = "#{@name}.gemspec"
|
358
|
+
s.authors = ["no one"]
|
345
359
|
if expanded_path.join("bin").exist?
|
346
360
|
binaries = expanded_path.join("bin").children
|
347
361
|
binaries.reject!{|p| File.directory?(p) }
|
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = <%=config[:name].inspect%>
|
7
7
|
s.version = <%=config[:constant_name]%>::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = [
|
10
|
-
s.email = [
|
9
|
+
s.authors = [<%=config[:author].inspect%>]
|
10
|
+
s.email = [<%=config[:email].inspect%>]
|
11
11
|
s.homepage = ""
|
12
12
|
s.summary = %q{TODO: Write a gem summary}
|
13
13
|
s.description = %q{TODO: Write a gem description}
|
@@ -393,7 +393,7 @@ class Net::HTTP::Persistent
|
|
393
393
|
|
394
394
|
##
|
395
395
|
# Shuts down all connections for +thread+.
|
396
|
-
#
|
396
|
+
#
|
397
397
|
# Uses the current thread by default.
|
398
398
|
#
|
399
399
|
# If you've used Net::HTTP::Persistent across multiple threads you should
|
@@ -427,7 +427,7 @@ class Net::HTTP::Persistent
|
|
427
427
|
# connections! Call #shutdown at the appropriate time instead!
|
428
428
|
#
|
429
429
|
# Use this method only as a last resort!
|
430
|
-
|
430
|
+
|
431
431
|
def shutdown_in_all_threads
|
432
432
|
Thread.list.each do |thread|
|
433
433
|
shutdown thread
|
@@ -10,9 +10,9 @@ class Thor
|
|
10
10
|
# destination<String>:: Relative path to the destination root
|
11
11
|
# data<String>:: Data to add to the file. Can be given as a block.
|
12
12
|
# config<Hash>:: give :verbose => false to not log the status and the flag
|
13
|
-
# for injection (:after or :before) or :force => true for
|
13
|
+
# for injection (:after or :before) or :force => true for
|
14
14
|
# insert two or more times the same content.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# ==== Examples
|
17
17
|
#
|
18
18
|
# inject_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
|
data/lib/bundler/version.rb
CHANGED
@@ -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.1.pre.
|
5
|
+
VERSION = "1.1.pre.3" unless defined?(::Bundler::VERSION)
|
6
6
|
end
|
data/man/bundle.ronn
CHANGED
@@ -55,6 +55,9 @@ We divide `bundle` subcommands into primary commands and utilities.
|
|
55
55
|
* `bundle show(1)`:
|
56
56
|
Show the source location of a particular gem in the bundle
|
57
57
|
|
58
|
+
* `bundle outdated(1)`:
|
59
|
+
Show all of the outdated gems in the current bundle
|
60
|
+
|
58
61
|
* `bundle console(1)`:
|
59
62
|
Start an IRB session in the context of the current bundle
|
60
63
|
|
@@ -185,10 +185,10 @@ describe "bundle flex_install" do
|
|
185
185
|
|
186
186
|
it "does not install gems whose dependencies are not met" do
|
187
187
|
bundle :install
|
188
|
-
ruby <<-RUBY
|
188
|
+
ruby <<-RUBY, :expect_err => true
|
189
189
|
require 'bundler/setup'
|
190
190
|
RUBY
|
191
|
-
|
191
|
+
err.should =~ /could not find gem 'rack-obama/i
|
192
192
|
end
|
193
193
|
|
194
194
|
it "suggests bundle update when the Gemfile requires different versions than the lock" do
|
data/spec/other/newgem_spec.rb
CHANGED
@@ -2,9 +2,20 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "bundle gem" do
|
4
4
|
before :each do
|
5
|
+
@git_name = `git config --global user.name`.chomp
|
6
|
+
`git config --global user.name "Bundler User"`
|
7
|
+
@git_email = `git config --global user.email`.chomp
|
8
|
+
`git config --global user.email user@example.com`
|
5
9
|
bundle 'gem test-gem'
|
6
10
|
end
|
7
11
|
|
12
|
+
after :each do
|
13
|
+
`git config --global user.name "#{@git_name}"`
|
14
|
+
`git config --global user.email #{@git_email}`
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:generated_gem) { Bundler::GemHelper.new(bundled_app("test-gem").to_s) }
|
18
|
+
|
8
19
|
it "generates a gem skeleton" do
|
9
20
|
bundled_app("test-gem/test-gem.gemspec").should exist
|
10
21
|
bundled_app("test-gem/Gemfile").should exist
|
@@ -21,4 +32,32 @@ describe "bundle gem" do
|
|
21
32
|
bundled_app("test-gem/lib/test-gem/version.rb").read.should =~ /module Test\n module Gem/
|
22
33
|
bundled_app("test-gem/lib/test-gem.rb").read.should =~ /module Test\n module Gem/
|
23
34
|
end
|
35
|
+
|
36
|
+
context "git config user.{name,email} present" do
|
37
|
+
it "sets gemspec author to git user.name if available" do
|
38
|
+
generated_gem.gemspec.authors.first.should == "Bundler User"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "sets gemspec email to git user.email if available" do
|
42
|
+
generated_gem.gemspec.email.first.should == "user@example.com"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "git config user.{name,email} is not set" do
|
47
|
+
before :each do
|
48
|
+
`git config --global --unset user.name`
|
49
|
+
`git config --global --unset user.email`
|
50
|
+
reset!
|
51
|
+
in_app_root
|
52
|
+
bundle 'gem test-gem'
|
53
|
+
end
|
54
|
+
|
55
|
+
it "sets gemspec author to default message if git user.name is not set or empty" do
|
56
|
+
generated_gem.gemspec.authors.first.should == "TODO: Write your name"
|
57
|
+
end
|
58
|
+
|
59
|
+
it "sets gemspec email to default message if git user.email is not set or empty" do
|
60
|
+
generated_gem.gemspec.email.first.should == "TODO: Write your email address"
|
61
|
+
end
|
62
|
+
end
|
24
63
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle outdated" do
|
4
|
+
before :each do
|
5
|
+
build_repo2
|
6
|
+
|
7
|
+
install_gemfile <<-G
|
8
|
+
source "file://#{gem_repo2}"
|
9
|
+
gem "activesupport"
|
10
|
+
gem "rack-obama"
|
11
|
+
G
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "with no arguments" do
|
15
|
+
it "returns list of outdated gems" do
|
16
|
+
update_repo2 do
|
17
|
+
build_gem "activesupport", "3.0"
|
18
|
+
end
|
19
|
+
|
20
|
+
bundle "outdated"
|
21
|
+
out.should include("activesupport (3.0 > 2.3.5)")
|
22
|
+
out.should include("rack (1.2 > 1.0.0)")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "with --local option" do
|
27
|
+
it "doesn't hit repo2" do
|
28
|
+
FileUtils.rm_rf(gem_repo2)
|
29
|
+
|
30
|
+
bundle "outdated --local"
|
31
|
+
out.should_not match(/Fetching source index/)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "with specified gems" do
|
36
|
+
it "returns list of outdated gems" do
|
37
|
+
update_repo2 do
|
38
|
+
build_gem "activesupport", "3.0"
|
39
|
+
end
|
40
|
+
|
41
|
+
bundle "outdated rack"
|
42
|
+
out.should_not include("activesupport (3.0 > 2.3.5)")
|
43
|
+
out.should include("rack (1.2 > 1.0.0)")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,15 +1,68 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe "Bundler.
|
3
|
+
describe "Bundler.with_env helpers" do
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
shared_examples_for "Bundler.with_*_env" do
|
6
|
+
it "should reset and restore the environment" do
|
7
|
+
gem_path = ENV['GEM_PATH']
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
`echo $GEM_PATH`.strip.should_not == gem_path
|
11
|
+
end
|
12
|
+
|
13
|
+
ENV['GEM_PATH'].should == gem_path
|
10
14
|
end
|
15
|
+
end
|
16
|
+
|
17
|
+
around do |example|
|
18
|
+
bundle_path = Bundler::ORIGINAL_ENV['BUNDLE_PATH']
|
19
|
+
Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = "./Gemfile"
|
20
|
+
example.run
|
21
|
+
Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = bundle_path
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "Bundler.with_clean_env" do
|
25
|
+
|
26
|
+
it_should_behave_like "Bundler.with_*_env"
|
11
27
|
|
12
|
-
|
28
|
+
it "should not pass any bundler environment variables" do
|
29
|
+
Bundler.with_clean_env do
|
30
|
+
`echo $BUNDLE_PATH`.strip.should_not == './Gemfile'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should not change ORIGINAL_ENV" do
|
35
|
+
Bundler::ORIGINAL_ENV['BUNDLE_PATH'].should == './Gemfile'
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "Bundler.with_original_env" do
|
41
|
+
|
42
|
+
it_should_behave_like "Bundler.with_*_env"
|
43
|
+
|
44
|
+
it "should pass bundler environment variables set before Bundler was run" do
|
45
|
+
Bundler.with_original_env do
|
46
|
+
`echo $BUNDLE_PATH`.strip.should == './Gemfile'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "Bundler.clean_system" do
|
52
|
+
it "runs system inside with_clean_env" do
|
53
|
+
Bundler.clean_system(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
|
54
|
+
$?.exitstatus.should == 42
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "Bundler.clean_exec" do
|
59
|
+
it "runs exec inside with_clean_env" do
|
60
|
+
pid = Kernel.fork do
|
61
|
+
Bundler.clean_exec(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
|
62
|
+
end
|
63
|
+
Process.wait(pid)
|
64
|
+
$?.exitstatus.should == 42
|
65
|
+
end
|
13
66
|
end
|
14
67
|
|
15
|
-
end
|
68
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -39,8 +39,13 @@ RSpec.configure do |config|
|
|
39
39
|
config.include Spec::Platforms
|
40
40
|
config.include Spec::Sudo
|
41
41
|
|
42
|
+
if Spec::Sudo.test_sudo?
|
43
|
+
config.filter_run :sudo => true
|
44
|
+
else
|
45
|
+
config.filter_run_excluding :sudo => true
|
46
|
+
end
|
47
|
+
|
42
48
|
config.filter_run :focused => true unless ENV['CI']
|
43
|
-
config.filter_run_excluding :sudo => true unless Spec::Sudo.test_sudo?
|
44
49
|
config.run_all_when_everything_filtered = true
|
45
50
|
config.alias_example_to :fit, :focused => true
|
46
51
|
|
data/spec/support/builders.rb
CHANGED
@@ -322,6 +322,9 @@ module Spec
|
|
322
322
|
|
323
323
|
Array(versions).each do |version|
|
324
324
|
spec = builder.new(self, name, version)
|
325
|
+
if !spec.authors or spec.authors.empty?
|
326
|
+
spec.authors = ["no one"]
|
327
|
+
end
|
325
328
|
yield spec if block_given?
|
326
329
|
spec._build(options)
|
327
330
|
end
|
@@ -454,6 +457,8 @@ module Spec
|
|
454
457
|
@files = _default_files.merge(@files)
|
455
458
|
end
|
456
459
|
|
460
|
+
@spec.authors = ["no one"]
|
461
|
+
|
457
462
|
@files.each do |file, source|
|
458
463
|
file = Pathname.new(path).join(file)
|
459
464
|
FileUtils.mkdir_p(file.dirname)
|
@@ -563,6 +568,11 @@ module Spec
|
|
563
568
|
Dir.chdir(lib_path) do
|
564
569
|
destination = opts[:path] || _default_path
|
565
570
|
FileUtils.mkdir_p(destination)
|
571
|
+
|
572
|
+
if !@spec.authors or @spec.authors.empty?
|
573
|
+
@spec.authors = ["that guy"]
|
574
|
+
end
|
575
|
+
|
566
576
|
Gem::Builder.new(@spec).build
|
567
577
|
if opts[:to_system]
|
568
578
|
`gem install --ignore-dependencies #{@spec.full_name}.gem`
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1923831879
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
9
|
- pre
|
10
|
-
-
|
11
|
-
version: 1.1.pre.
|
10
|
+
- 3
|
11
|
+
version: 1.1.pre.3
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- "Andr\xC3\xA9 Arko"
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2011-04
|
22
|
+
date: 2011-05-04 00:00:00 -07:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
@@ -62,6 +62,7 @@ extra_rdoc_files: []
|
|
62
62
|
|
63
63
|
files:
|
64
64
|
- .gitignore
|
65
|
+
- .travis.yml
|
65
66
|
- CHANGELOG.md
|
66
67
|
- ISSUES.md
|
67
68
|
- LICENSE
|
@@ -178,6 +179,7 @@ files:
|
|
178
179
|
- spec/other/init_spec.rb
|
179
180
|
- spec/other/newgem_spec.rb
|
180
181
|
- spec/other/open_spec.rb
|
182
|
+
- spec/other/outdated_spec.rb
|
181
183
|
- spec/other/show_spec.rb
|
182
184
|
- spec/pack/gems_spec.rb
|
183
185
|
- spec/quality_spec.rb
|
@@ -296,6 +298,7 @@ test_files:
|
|
296
298
|
- spec/other/init_spec.rb
|
297
299
|
- spec/other/newgem_spec.rb
|
298
300
|
- spec/other/open_spec.rb
|
301
|
+
- spec/other/outdated_spec.rb
|
299
302
|
- spec/other/show_spec.rb
|
300
303
|
- spec/pack/gems_spec.rb
|
301
304
|
- spec/quality_spec.rb
|