bundler 1.7.15 → 1.8.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +5 -14
- data/.rspec +1 -0
- data/.travis.yml +22 -15
- data/CHANGELOG.md +43 -13
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +14 -12
- data/DEVELOPMENT.md +4 -2
- data/ISSUES.md +1 -1
- data/README.md +10 -14
- data/Rakefile +10 -10
- data/bin/bundle +1 -1
- data/bundler.gemspec +5 -4
- data/lib/bundler.rb +22 -3
- data/lib/bundler/anonymizable_uri.rb +24 -8
- data/lib/bundler/cli.rb +103 -66
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/clean.rb +11 -4
- data/lib/bundler/cli/common.rb +2 -0
- data/lib/bundler/cli/console.rb +22 -26
- data/lib/bundler/cli/exec.rb +29 -22
- data/lib/bundler/cli/gem.rb +125 -37
- data/lib/bundler/cli/install.rb +22 -9
- data/lib/bundler/cli/outdated.rb +1 -1
- data/lib/bundler/cli/package.rb +8 -1
- data/lib/bundler/cli/show.rb +29 -3
- data/lib/bundler/cli/update.rb +2 -2
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/definition.rb +14 -22
- data/lib/bundler/dependency.rb +8 -1
- data/lib/bundler/dsl.rb +17 -4
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +44 -25
- data/lib/bundler/fetcher.rb +33 -25
- data/lib/bundler/friendly_errors.rb +38 -5
- data/lib/bundler/gem_helper.rb +16 -10
- data/lib/bundler/gem_helpers.rb +1 -0
- data/lib/bundler/graph.rb +4 -1
- data/lib/bundler/index.rb +15 -25
- data/lib/bundler/installer.rb +6 -6
- data/lib/bundler/lockfile_parser.rb +7 -7
- data/lib/bundler/resolver.rb +2 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +1 -0
- data/lib/bundler/rubygems_integration.rb +1 -1
- data/lib/bundler/runtime.rb +22 -40
- data/lib/bundler/settings.rb +14 -5
- data/lib/bundler/setup.rb +2 -1
- data/lib/bundler/shared_helpers.rb +56 -4
- data/lib/bundler/source.rb +8 -9
- data/lib/bundler/source/git.rb +5 -1
- data/lib/bundler/source/git/git_proxy.rb +4 -0
- data/lib/bundler/source/path.rb +8 -11
- data/lib/bundler/source/path/installer.rb +0 -2
- data/lib/bundler/source/rubygems.rb +58 -72
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
- data/lib/bundler/templates/newgem/README.md.tt +9 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
- data/lib/bundler/ui/shell.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +73 -0
- data/man/bundle-config.ronn +17 -15
- data/man/bundle-install.ronn +102 -93
- data/man/bundle-update.ronn +39 -30
- data/man/bundle.ronn +6 -0
- data/man/gemfile.5.ronn +74 -13
- metadata +10 -231
- data/lib/bundler/parallel_workers.rb +0 -18
- data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
- data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
- data/lib/bundler/parallel_workers/worker.rb +0 -69
- data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
- data/spec/bundler/anonymizable_uri_spec.rb +0 -32
- data/spec/bundler/bundler_spec.rb +0 -72
- data/spec/bundler/cli_spec.rb +0 -16
- data/spec/bundler/definition_spec.rb +0 -22
- data/spec/bundler/dsl_spec.rb +0 -82
- data/spec/bundler/friendly_errors_spec.rb +0 -13
- data/spec/bundler/gem_helper_spec.rb +0 -226
- data/spec/bundler/psyched_yaml_spec.rb +0 -8
- data/spec/bundler/retry_spec.rb +0 -59
- data/spec/bundler/settings_spec.rb +0 -13
- data/spec/bundler/source/rubygems_spec.rb +0 -25
- data/spec/bundler/source_list_spec.rb +0 -361
- data/spec/cache/gems_spec.rb +0 -284
- data/spec/cache/git_spec.rb +0 -188
- data/spec/cache/path_spec.rb +0 -121
- data/spec/cache/platform_spec.rb +0 -57
- data/spec/commands/binstubs_spec.rb +0 -219
- data/spec/commands/check_spec.rb +0 -278
- data/spec/commands/clean_spec.rb +0 -592
- data/spec/commands/config_spec.rb +0 -263
- data/spec/commands/console_spec.rb +0 -76
- data/spec/commands/exec_spec.rb +0 -309
- data/spec/commands/help_spec.rb +0 -39
- data/spec/commands/init_spec.rb +0 -39
- data/spec/commands/inject_spec.rb +0 -78
- data/spec/commands/licenses_spec.rb +0 -18
- data/spec/commands/newgem_spec.rb +0 -428
- data/spec/commands/open_spec.rb +0 -68
- data/spec/commands/outdated_spec.rb +0 -156
- data/spec/commands/package_spec.rb +0 -114
- data/spec/commands/show_spec.rb +0 -125
- data/spec/install/binstubs_spec.rb +0 -24
- data/spec/install/bundler_spec.rb +0 -146
- data/spec/install/deploy_spec.rb +0 -250
- data/spec/install/gemfile/gemspec_spec.rb +0 -170
- data/spec/install/gemfile/git_spec.rb +0 -967
- data/spec/install/gemfile/path_spec.rb +0 -500
- data/spec/install/gemfile_spec.rb +0 -44
- data/spec/install/gems/c_ext_spec.rb +0 -48
- data/spec/install/gems/dependency_api_spec.rb +0 -652
- data/spec/install/gems/env_spec.rb +0 -107
- data/spec/install/gems/flex_spec.rb +0 -314
- data/spec/install/gems/groups_spec.rb +0 -308
- data/spec/install/gems/mirror_spec.rb +0 -39
- data/spec/install/gems/platform_spec.rb +0 -195
- data/spec/install/gems/post_install_spec.rb +0 -121
- data/spec/install/gems/resolving_spec.rb +0 -124
- data/spec/install/gems/simple_case_spec.rb +0 -377
- data/spec/install/gems/sources_spec.rb +0 -386
- data/spec/install/gems/standalone_spec.rb +0 -260
- data/spec/install/gems/sudo_spec.rb +0 -136
- data/spec/install/gems/win32_spec.rb +0 -26
- data/spec/install/gemspecs_spec.rb +0 -50
- data/spec/install/path_spec.rb +0 -150
- data/spec/install/post_bundle_message_spec.rb +0 -142
- data/spec/install/prereleases_spec.rb +0 -43
- data/spec/install/security_policy_spec.rb +0 -77
- data/spec/install/upgrade_spec.rb +0 -26
- data/spec/lock/git_spec.rb +0 -34
- data/spec/lock/lockfile_spec.rb +0 -924
- data/spec/other/bundle_ruby_spec.rb +0 -142
- data/spec/other/cli_dispatch_spec.rb +0 -21
- data/spec/other/ext_spec.rb +0 -60
- data/spec/other/platform_spec.rb +0 -1285
- data/spec/other/ssl_cert_spec.rb +0 -23
- data/spec/quality_spec.rb +0 -88
- data/spec/realworld/dependency_api_spec.rb +0 -60
- data/spec/realworld/edgecases_spec.rb +0 -212
- data/spec/realworld/parallel_spec.rb +0 -71
- data/spec/resolver/basic_spec.rb +0 -66
- data/spec/resolver/platform_spec.rb +0 -88
- data/spec/runtime/executable_spec.rb +0 -149
- data/spec/runtime/load_spec.rb +0 -107
- data/spec/runtime/platform_spec.rb +0 -90
- data/spec/runtime/require_spec.rb +0 -332
- data/spec/runtime/setup_spec.rb +0 -853
- data/spec/runtime/with_clean_env_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -123
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint.rb +0 -71
- data/spec/support/artifice/endpoint_500.rb +0 -37
- data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
- data/spec/support/artifice/endpoint_api_missing.rb +0 -16
- data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
- data/spec/support/artifice/endpoint_extra.rb +0 -31
- data/spec/support/artifice/endpoint_extra_api.rb +0 -32
- data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
- data/spec/support/artifice/endpoint_fallback.rb +0 -17
- data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
- data/spec/support/artifice/endpoint_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
- data/spec/support/artifice/endpoint_timeout.rb +0 -13
- data/spec/support/builders.rb +0 -693
- data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
- data/spec/support/fakeweb/windows.rb +0 -23
- data/spec/support/hax.rb +0 -22
- data/spec/support/helpers.rb +0 -361
- data/spec/support/indexes.rb +0 -280
- data/spec/support/matchers.rb +0 -77
- data/spec/support/path.rb +0 -85
- data/spec/support/permissions.rb +0 -10
- data/spec/support/platforms.rb +0 -94
- data/spec/support/ruby_ext.rb +0 -20
- data/spec/support/rubygems_ext.rb +0 -39
- data/spec/support/streams.rb +0 -13
- data/spec/support/sudo.rb +0 -16
- data/spec/update/gems_spec.rb +0 -201
- data/spec/update/git_spec.rb +0 -283
- data/spec/update/path_spec.rb +0 -18
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.expand_path("../../path.rb", __FILE__)
|
2
|
-
include Spec::Path
|
3
|
-
|
4
|
-
files = [ 'specs.4.8.gz',
|
5
|
-
'prerelease_specs.4.8.gz',
|
6
|
-
'quick/Marshal.4.8/rcov-1.0-mswin32.gemspec.rz',
|
7
|
-
'gems/rcov-1.0-mswin32.gem' ]
|
8
|
-
|
9
|
-
# Set up pretend http gem server with FakeWeb
|
10
|
-
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/fakeweb*/lib")].first}"
|
11
|
-
require 'fakeweb'
|
12
|
-
|
13
|
-
FakeWeb.allow_net_connect = false
|
14
|
-
|
15
|
-
files.each do |file|
|
16
|
-
FakeWeb.register_uri(:get, "http://localgemserver.test/#{file}",
|
17
|
-
:body => File.read("#{gem_repo1}/#{file}"))
|
18
|
-
end
|
19
|
-
FakeWeb.register_uri(:get, "http://localgemserver.test/gems/rcov-1.0-x86-mswin32.gem",
|
20
|
-
:status => ["404", "Not Found"])
|
21
|
-
|
22
|
-
FakeWeb.register_uri(:get, "http://localgemserver.test/api/v1/dependencies",
|
23
|
-
:status => ["404", "Not Found"])
|
data/spec/support/hax.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
class Gem::Platform
|
4
|
-
@local = new(ENV['BUNDLER_SPEC_PLATFORM']) if ENV['BUNDLER_SPEC_PLATFORM']
|
5
|
-
end
|
6
|
-
|
7
|
-
if ENV['BUNDLER_SPEC_VERSION']
|
8
|
-
module Bundler
|
9
|
-
VERSION = ENV['BUNDLER_SPEC_VERSION'].dup
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Object
|
14
|
-
if ENV['BUNDLER_SPEC_RUBY_ENGINE']
|
15
|
-
remove_const :RUBY_ENGINE if defined?(RUBY_ENGINE)
|
16
|
-
RUBY_ENGINE = ENV['BUNDLER_SPEC_RUBY_ENGINE']
|
17
|
-
|
18
|
-
if RUBY_ENGINE == "jruby"
|
19
|
-
JRUBY_VERSION = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/spec/support/helpers.rb
DELETED
@@ -1,361 +0,0 @@
|
|
1
|
-
module Spec
|
2
|
-
module Helpers
|
3
|
-
def reset!
|
4
|
-
@in_p, @out_p, @err_p = nil, nil, nil
|
5
|
-
Dir["#{tmp}/{gems/*,*}"].each do |dir|
|
6
|
-
next if %(base remote1 gems rubygems).include?(File.basename(dir))
|
7
|
-
unless ENV['BUNDLER_SUDO_TESTS']
|
8
|
-
FileUtils.rm_rf(dir)
|
9
|
-
else
|
10
|
-
`sudo rm -rf #{dir}`
|
11
|
-
end
|
12
|
-
end
|
13
|
-
FileUtils.mkdir_p(tmp)
|
14
|
-
FileUtils.mkdir_p(home)
|
15
|
-
end
|
16
|
-
|
17
|
-
attr_reader :out, :err, :exitstatus
|
18
|
-
|
19
|
-
def in_app_root(&blk)
|
20
|
-
Dir.chdir(bundled_app, &blk)
|
21
|
-
end
|
22
|
-
|
23
|
-
def in_app_root2(&blk)
|
24
|
-
Dir.chdir(bundled_app2, &blk)
|
25
|
-
end
|
26
|
-
|
27
|
-
def in_app_root_custom(root, &blk)
|
28
|
-
Dir.chdir(root, &blk)
|
29
|
-
end
|
30
|
-
|
31
|
-
def run(cmd, *args)
|
32
|
-
opts = args.last.is_a?(Hash) ? args.pop : {}
|
33
|
-
expect_err = opts.delete(:expect_err)
|
34
|
-
env = opts.delete(:env)
|
35
|
-
groups = args.map {|a| a.inspect }.join(", ")
|
36
|
-
setup = "require 'rubygems' ; require 'bundler' ; Bundler.setup(#{groups})\n"
|
37
|
-
@out = ruby(setup + cmd, :expect_err => expect_err, :env => env)
|
38
|
-
end
|
39
|
-
|
40
|
-
def load_error_run(ruby, name, *args)
|
41
|
-
cmd = <<-RUBY
|
42
|
-
begin
|
43
|
-
#{ruby}
|
44
|
-
rescue LoadError => e
|
45
|
-
$stderr.puts "ZOMG LOAD ERROR" if e.message.include?("-- #{name}")
|
46
|
-
end
|
47
|
-
RUBY
|
48
|
-
opts = args.last.is_a?(Hash) ? args.pop : {}
|
49
|
-
opts.merge!(:expect_err => true)
|
50
|
-
args += [opts]
|
51
|
-
run(cmd, *args)
|
52
|
-
end
|
53
|
-
|
54
|
-
def lib
|
55
|
-
File.expand_path('../../../lib', __FILE__)
|
56
|
-
end
|
57
|
-
|
58
|
-
def bundle(cmd, options = {})
|
59
|
-
expect_err = options.delete(:expect_err)
|
60
|
-
exitstatus = options.delete(:exitstatus)
|
61
|
-
sudo = "sudo" if options.delete(:sudo)
|
62
|
-
options["no-color"] = true unless options.key?("no-color") || %w(exec conf).include?(cmd.to_s[0..3])
|
63
|
-
|
64
|
-
bundle_bin = File.expand_path('../../../bin/bundle', __FILE__)
|
65
|
-
|
66
|
-
requires = options.delete(:requires) || []
|
67
|
-
requires << File.expand_path('../fakeweb/'+options.delete(:fakeweb)+'.rb', __FILE__) if options.key?(:fakeweb)
|
68
|
-
requires << File.expand_path('../artifice/'+options.delete(:artifice)+'.rb', __FILE__) if options.key?(:artifice)
|
69
|
-
requires_str = requires.map{|r| "-r#{r}"}.join(" ")
|
70
|
-
|
71
|
-
env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}'"}.join(" ")
|
72
|
-
args = options.map do |k,v|
|
73
|
-
v == true ? " --#{k}" : " --#{k} #{v}" if v
|
74
|
-
end.join
|
75
|
-
|
76
|
-
cmd = "#{env} #{sudo} #{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin} #{cmd}#{args}"
|
77
|
-
|
78
|
-
if exitstatus
|
79
|
-
sys_status(cmd)
|
80
|
-
else
|
81
|
-
sys_exec(cmd, expect_err){|i| yield i if block_given? }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def bundle_ruby(options = {})
|
86
|
-
expect_err = options.delete(:expect_err)
|
87
|
-
exitstatus = options.delete(:exitstatus)
|
88
|
-
options["no-color"] = true unless options.key?("no-color")
|
89
|
-
|
90
|
-
bundle_bin = File.expand_path('../../../bin/bundle_ruby', __FILE__)
|
91
|
-
|
92
|
-
requires = options.delete(:requires) || []
|
93
|
-
requires << File.expand_path('../fakeweb/'+options.delete(:fakeweb)+'.rb', __FILE__) if options.key?(:fakeweb)
|
94
|
-
requires << File.expand_path('../artifice/'+options.delete(:artifice)+'.rb', __FILE__) if options.key?(:artifice)
|
95
|
-
requires_str = requires.map{|r| "-r#{r}"}.join(" ")
|
96
|
-
|
97
|
-
env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}' "}.join
|
98
|
-
cmd = "#{env}#{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin}"
|
99
|
-
|
100
|
-
if exitstatus
|
101
|
-
sys_status(cmd)
|
102
|
-
else
|
103
|
-
sys_exec(cmd, expect_err){|i| yield i if block_given? }
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def ruby(ruby, options = {})
|
108
|
-
expect_err = options.delete(:expect_err)
|
109
|
-
env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}' "}.join
|
110
|
-
ruby.gsub!(/["`\$]/) {|m| "\\#{m}" }
|
111
|
-
lib_option = options[:no_lib] ? "" : " -I#{lib}"
|
112
|
-
sys_exec(%{#{env}#{Gem.ruby}#{lib_option} -e "#{ruby}"}, expect_err)
|
113
|
-
end
|
114
|
-
|
115
|
-
def load_error_ruby(ruby, name, opts = {})
|
116
|
-
cmd = <<-R
|
117
|
-
begin
|
118
|
-
#{ruby}
|
119
|
-
rescue LoadError => e
|
120
|
-
$stderr.puts "ZOMG LOAD ERROR"# if e.message.include?("-- #{name}")
|
121
|
-
end
|
122
|
-
R
|
123
|
-
ruby(cmd, opts.merge(:expect_err => true))
|
124
|
-
end
|
125
|
-
|
126
|
-
def gembin(cmd)
|
127
|
-
lib = File.expand_path("../../../lib", __FILE__)
|
128
|
-
old, ENV['RUBYOPT'] = ENV['RUBYOPT'], "#{ENV['RUBYOPT']} -I#{lib}"
|
129
|
-
cmd = bundled_app("bin/#{cmd}") unless cmd.to_s.include?("/")
|
130
|
-
sys_exec(cmd.to_s)
|
131
|
-
ensure
|
132
|
-
ENV['RUBYOPT'] = old
|
133
|
-
end
|
134
|
-
|
135
|
-
def sys_exec(cmd, expect_err = false)
|
136
|
-
Open3.popen3(cmd.to_s) do |stdin, stdout, stderr|
|
137
|
-
@in_p, @out_p, @err_p = stdin, stdout, stderr
|
138
|
-
|
139
|
-
yield @in_p if block_given?
|
140
|
-
@in_p.close
|
141
|
-
|
142
|
-
@out = @out_p.read_available_bytes.strip
|
143
|
-
@err = @err_p.read_available_bytes.strip
|
144
|
-
end
|
145
|
-
|
146
|
-
puts @err unless expect_err || @err.empty? || !$show_err
|
147
|
-
@out
|
148
|
-
end
|
149
|
-
|
150
|
-
def sys_status(cmd)
|
151
|
-
@err = nil
|
152
|
-
@out = %x{#{cmd}}.strip
|
153
|
-
@exitstatus = $?.exitstatus
|
154
|
-
end
|
155
|
-
|
156
|
-
def config(config = nil, path = bundled_app('.bundle/config'))
|
157
|
-
return YAML.load_file(path) unless config
|
158
|
-
FileUtils.mkdir_p(File.dirname(path))
|
159
|
-
File.open(path, 'w') do |f|
|
160
|
-
f.puts config.to_yaml
|
161
|
-
end
|
162
|
-
config
|
163
|
-
end
|
164
|
-
|
165
|
-
def global_config(config = nil)
|
166
|
-
config(config, home(".bundle/config"))
|
167
|
-
end
|
168
|
-
|
169
|
-
def gemfile(*args)
|
170
|
-
create_file("Gemfile", *args)
|
171
|
-
end
|
172
|
-
|
173
|
-
def lockfile(*args)
|
174
|
-
create_file("Gemfile.lock", *args)
|
175
|
-
end
|
176
|
-
|
177
|
-
def create_file(*args)
|
178
|
-
path = bundled_app(args.shift)
|
179
|
-
path = args.shift if args.first.is_a?(Pathname)
|
180
|
-
str = args.shift || ""
|
181
|
-
path.dirname.mkpath
|
182
|
-
File.open(path.to_s, 'w') do |f|
|
183
|
-
f.puts strip_whitespace(str)
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
def strip_whitespace(str)
|
188
|
-
# Trim the leading spaces
|
189
|
-
spaces = str[/\A\s+/, 0] || ""
|
190
|
-
str.gsub(/^#{spaces}/, '')
|
191
|
-
end
|
192
|
-
|
193
|
-
def install_gemfile(*args)
|
194
|
-
gemfile(*args)
|
195
|
-
opts = args.last.is_a?(Hash) ? args.last : {}
|
196
|
-
opts[:retry] ||= 0
|
197
|
-
bundle :install, opts
|
198
|
-
end
|
199
|
-
|
200
|
-
def install_gems(*gems)
|
201
|
-
gems.each do |g|
|
202
|
-
path = "#{gem_repo1}/gems/#{g}.gem"
|
203
|
-
|
204
|
-
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
|
205
|
-
|
206
|
-
gem_command :install, "--no-rdoc --no-ri --ignore-dependencies #{path}"
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
alias install_gem install_gems
|
211
|
-
|
212
|
-
def with_gem_path_as(path)
|
213
|
-
gem_home, gem_path = ENV['GEM_HOME'], ENV['GEM_PATH']
|
214
|
-
ENV['GEM_HOME'], ENV['GEM_PATH'] = path.to_s, path.to_s
|
215
|
-
yield
|
216
|
-
ensure
|
217
|
-
ENV['GEM_HOME'], ENV['GEM_PATH'] = gem_home, gem_path
|
218
|
-
end
|
219
|
-
|
220
|
-
def break_git!
|
221
|
-
FileUtils.mkdir_p(tmp("broken_path"))
|
222
|
-
File.open(tmp("broken_path/git"), "w", 0755) do |f|
|
223
|
-
f.puts "#!/usr/bin/env ruby\nSTDERR.puts 'This is not the git you are looking for'\nexit 1"
|
224
|
-
end
|
225
|
-
|
226
|
-
ENV["PATH"] = "#{tmp("broken_path")}:#{ENV["PATH"]}"
|
227
|
-
end
|
228
|
-
|
229
|
-
def fake_man!
|
230
|
-
FileUtils.mkdir_p(tmp("fake_man"))
|
231
|
-
File.open(tmp("fake_man/man"), "w", 0755) do |f|
|
232
|
-
f.puts "#!/usr/bin/env ruby\nputs ARGV.inspect\n"
|
233
|
-
end
|
234
|
-
|
235
|
-
ENV["PATH"] = "#{tmp("fake_man")}:#{ENV["PATH"]}"
|
236
|
-
end
|
237
|
-
|
238
|
-
def kill_path!
|
239
|
-
ENV["PATH"] = ""
|
240
|
-
end
|
241
|
-
|
242
|
-
def system_gems(*gems)
|
243
|
-
gems = gems.flatten
|
244
|
-
|
245
|
-
FileUtils.rm_rf(system_gem_path)
|
246
|
-
FileUtils.mkdir_p(system_gem_path)
|
247
|
-
|
248
|
-
Gem.clear_paths
|
249
|
-
|
250
|
-
gem_home, gem_path, path = ENV['GEM_HOME'], ENV['GEM_PATH'], ENV['PATH']
|
251
|
-
ENV['GEM_HOME'], ENV['GEM_PATH'] = system_gem_path.to_s, system_gem_path.to_s
|
252
|
-
|
253
|
-
install_gems(*gems)
|
254
|
-
if block_given?
|
255
|
-
begin
|
256
|
-
yield
|
257
|
-
ensure
|
258
|
-
ENV['GEM_HOME'], ENV['GEM_PATH'] = gem_home, gem_path
|
259
|
-
ENV['PATH'] = path
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
def realworld_system_gems(*gems)
|
265
|
-
gems = gems.flatten
|
266
|
-
|
267
|
-
FileUtils.rm_rf(system_gem_path)
|
268
|
-
FileUtils.mkdir_p(system_gem_path)
|
269
|
-
|
270
|
-
Gem.clear_paths
|
271
|
-
|
272
|
-
gem_home, gem_path, path = ENV['GEM_HOME'], ENV['GEM_PATH'], ENV['PATH']
|
273
|
-
ENV['GEM_HOME'], ENV['GEM_PATH'] = system_gem_path.to_s, system_gem_path.to_s
|
274
|
-
|
275
|
-
gems.each do |gem|
|
276
|
-
gem_command :install, "--no-rdoc --no-ri #{gem}"
|
277
|
-
end
|
278
|
-
if block_given?
|
279
|
-
begin
|
280
|
-
yield
|
281
|
-
ensure
|
282
|
-
ENV['GEM_HOME'], ENV['GEM_PATH'] = gem_home, gem_path
|
283
|
-
ENV['PATH'] = path
|
284
|
-
end
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
def cache_gems(*gems)
|
289
|
-
gems = gems.flatten
|
290
|
-
|
291
|
-
FileUtils.rm_rf("#{bundled_app}/vendor/cache")
|
292
|
-
FileUtils.mkdir_p("#{bundled_app}/vendor/cache")
|
293
|
-
|
294
|
-
gems.each do |g|
|
295
|
-
path = "#{gem_repo1}/gems/#{g}.gem"
|
296
|
-
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
|
297
|
-
FileUtils.cp(path, "#{bundled_app}/vendor/cache")
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
def simulate_new_machine
|
302
|
-
system_gems []
|
303
|
-
FileUtils.rm_rf default_bundle_path
|
304
|
-
FileUtils.rm_rf bundled_app('.bundle')
|
305
|
-
end
|
306
|
-
|
307
|
-
def simulate_platform(platform)
|
308
|
-
old, ENV['BUNDLER_SPEC_PLATFORM'] = ENV['BUNDLER_SPEC_PLATFORM'], platform.to_s
|
309
|
-
yield if block_given?
|
310
|
-
ensure
|
311
|
-
ENV['BUNDLER_SPEC_PLATFORM'] = old if block_given?
|
312
|
-
end
|
313
|
-
|
314
|
-
def simulate_ruby_engine(engine, version = "1.6.0")
|
315
|
-
return if engine == local_ruby_engine
|
316
|
-
|
317
|
-
old, ENV['BUNDLER_SPEC_RUBY_ENGINE'] = ENV['BUNDLER_SPEC_RUBY_ENGINE'], engine
|
318
|
-
old_version, ENV['BUNDLER_SPEC_RUBY_ENGINE_VERSION'] = ENV['BUNDLER_SPEC_RUBY_ENGINE_VERSION'], version
|
319
|
-
yield if block_given?
|
320
|
-
ensure
|
321
|
-
ENV['BUNDLER_SPEC_RUBY_ENGINE'] = old if block_given?
|
322
|
-
ENV['BUNDLER_SPEC_RUBY_ENGINE_VERSION'] = old_version if block_given?
|
323
|
-
end
|
324
|
-
|
325
|
-
def simulate_bundler_version(version)
|
326
|
-
old, ENV['BUNDLER_SPEC_VERSION'] = ENV['BUNDLER_SPEC_VERSION'], version.to_s
|
327
|
-
yield if block_given?
|
328
|
-
ensure
|
329
|
-
ENV['BUNDLER_SPEC_VERSION'] = old if block_given?
|
330
|
-
end
|
331
|
-
|
332
|
-
def revision_for(path)
|
333
|
-
Dir.chdir(path) { `git rev-parse HEAD`.strip }
|
334
|
-
end
|
335
|
-
|
336
|
-
def capture_output
|
337
|
-
fake_stdout = StringIO.new
|
338
|
-
actual_stdout = $stdout
|
339
|
-
$stdout = fake_stdout
|
340
|
-
yield
|
341
|
-
fake_stdout.rewind
|
342
|
-
fake_stdout.read
|
343
|
-
ensure
|
344
|
-
$stdout = actual_stdout
|
345
|
-
end
|
346
|
-
|
347
|
-
def with_read_only(pattern)
|
348
|
-
chmod = lambda do |dirmode, filemode|
|
349
|
-
lambda do |f|
|
350
|
-
mode = File.directory?(f) ? dirmode : filemode
|
351
|
-
File.chmod(mode, f)
|
352
|
-
end
|
353
|
-
end
|
354
|
-
|
355
|
-
Dir[pattern].each(&chmod[0555, 0444])
|
356
|
-
yield
|
357
|
-
ensure
|
358
|
-
Dir[pattern].each(&chmod[0755, 0644])
|
359
|
-
end
|
360
|
-
end
|
361
|
-
end
|
data/spec/support/indexes.rb
DELETED
@@ -1,280 +0,0 @@
|
|
1
|
-
module Spec
|
2
|
-
module Indexes
|
3
|
-
def dep(name, reqs = nil)
|
4
|
-
@deps ||= []
|
5
|
-
@deps << Bundler::Dependency.new(name, reqs)
|
6
|
-
end
|
7
|
-
|
8
|
-
def platform(*args)
|
9
|
-
@platforms ||= []
|
10
|
-
@platforms.concat args.map { |p| Gem::Platform.new(p) }
|
11
|
-
end
|
12
|
-
|
13
|
-
alias platforms platform
|
14
|
-
|
15
|
-
def resolve
|
16
|
-
@platforms ||= ['ruby']
|
17
|
-
deps = []
|
18
|
-
@deps.each do |d|
|
19
|
-
@platforms.each do |p|
|
20
|
-
deps << Bundler::DepProxy.new(d, p)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
Bundler::Resolver.resolve(deps, @index)
|
24
|
-
end
|
25
|
-
|
26
|
-
def should_resolve_as(specs)
|
27
|
-
got = resolve
|
28
|
-
got = got.map { |s| s.full_name }.sort
|
29
|
-
expect(got).to eq(specs.sort)
|
30
|
-
end
|
31
|
-
|
32
|
-
def should_conflict_on(names)
|
33
|
-
begin
|
34
|
-
got = resolve
|
35
|
-
flunk "The resolve succeeded with: #{got.map { |s| s.full_name }.sort.inspect}"
|
36
|
-
rescue Bundler::VersionConflict => e
|
37
|
-
expect(Array(names).sort).to eq(e.conflicts.sort)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def gem(*args, &blk)
|
42
|
-
build_spec(*args, &blk).first
|
43
|
-
end
|
44
|
-
|
45
|
-
def an_awesome_index
|
46
|
-
build_index do
|
47
|
-
gem "rack", %w(0.8 0.9 0.9.1 0.9.2 1.0 1.1)
|
48
|
-
gem "rack-mount", %w(0.4 0.5 0.5.1 0.5.2 0.6)
|
49
|
-
|
50
|
-
# --- Rails
|
51
|
-
versions "1.2.3 2.2.3 2.3.5 3.0.0.beta 3.0.0.beta1" do |version|
|
52
|
-
gem "activesupport", version
|
53
|
-
gem "actionpack", version do
|
54
|
-
dep "activesupport", version
|
55
|
-
if version >= v('3.0.0.beta')
|
56
|
-
dep "rack", '~> 1.1'
|
57
|
-
dep "rack-mount", ">= 0.5"
|
58
|
-
elsif version > v('2.3') then dep "rack", '~> 1.0.0'
|
59
|
-
elsif version > v('2.0.0') then dep "rack", '~> 0.9.0'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
gem "activerecord", version do
|
63
|
-
dep "activesupport", version
|
64
|
-
dep "arel", ">= 0.2" if version >= v('3.0.0.beta')
|
65
|
-
end
|
66
|
-
gem "actionmailer", version do
|
67
|
-
dep "activesupport", version
|
68
|
-
dep "actionmailer", version
|
69
|
-
end
|
70
|
-
if version < v('3.0.0.beta')
|
71
|
-
gem "railties", version do
|
72
|
-
dep "activerecord", version
|
73
|
-
dep "actionpack", version
|
74
|
-
dep "actionmailer", version
|
75
|
-
dep "activesupport", version
|
76
|
-
end
|
77
|
-
else
|
78
|
-
gem "railties", version
|
79
|
-
gem "rails", version do
|
80
|
-
dep "activerecord", version
|
81
|
-
dep "actionpack", version
|
82
|
-
dep "actionmailer", version
|
83
|
-
dep "activesupport", version
|
84
|
-
dep "railties", version
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
versions '1.0 1.2 1.2.1 1.2.2 1.3 1.3.0.1 1.3.5 1.4.0 1.4.2 1.4.2.1' do |version|
|
90
|
-
platforms "ruby java mswin32 mingw32 x64-mingw32" do |platform|
|
91
|
-
next if version == v('1.4.2.1') && platform != pl('x86-mswin32')
|
92
|
-
next if version == v('1.4.2') && platform == pl('x86-mswin32')
|
93
|
-
gem "nokogiri", version, platform do
|
94
|
-
dep "weakling", ">= 0.0.3" if platform =~ pl('java')
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
versions '0.0.1 0.0.2 0.0.3' do |version|
|
100
|
-
gem "weakling", version
|
101
|
-
end
|
102
|
-
|
103
|
-
# --- Rails related
|
104
|
-
versions '1.2.3 2.2.3 2.3.5' do |version|
|
105
|
-
gem "activemerchant", version do
|
106
|
-
dep "activesupport", ">= #{version}"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# Builder 3.1.4 will activate first, but if all
|
113
|
-
# goes well, it should resolve to 3.0.4
|
114
|
-
def a_conflict_index
|
115
|
-
build_index do
|
116
|
-
gem "builder", %w(3.0.4 3.1.4)
|
117
|
-
gem("grape", '0.2.6') do
|
118
|
-
dep "builder", ">= 0"
|
119
|
-
end
|
120
|
-
|
121
|
-
versions '3.2.8 3.2.9 3.2.10 3.2.11' do |version|
|
122
|
-
gem("activemodel", version) do
|
123
|
-
dep "builder", "~> 3.0.0"
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
gem("my_app", '1.0.0') do
|
128
|
-
dep "activemodel", ">= 0"
|
129
|
-
dep "grape", ">= 0"
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def a_complex_conflict_index
|
135
|
-
build_index do
|
136
|
-
gem("a", %w(1.0.2 1.1.4 1.2.0 1.4.0)) do
|
137
|
-
dep "d", ">= 0"
|
138
|
-
end
|
139
|
-
|
140
|
-
gem("d", %w(1.3.0 1.4.1)) do
|
141
|
-
dep "x", ">= 0"
|
142
|
-
end
|
143
|
-
|
144
|
-
gem "d", "0.9.8"
|
145
|
-
|
146
|
-
gem("b", '0.3.4') do
|
147
|
-
dep "a", ">= 1.5.0"
|
148
|
-
end
|
149
|
-
|
150
|
-
gem("b", '0.3.5') do
|
151
|
-
dep "a", ">= 1.2"
|
152
|
-
end
|
153
|
-
|
154
|
-
gem("b", '0.3.3') do
|
155
|
-
dep "a", "> 1.0"
|
156
|
-
end
|
157
|
-
|
158
|
-
versions '3.2 3.3' do |version|
|
159
|
-
gem("c", version) do
|
160
|
-
dep "a", "~> 1.0"
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
gem("my_app", '1.3.0') do
|
165
|
-
dep "c", ">= 4.0"
|
166
|
-
dep "b", ">= 0"
|
167
|
-
end
|
168
|
-
|
169
|
-
gem("my_app", '1.2.0') do
|
170
|
-
dep "c", "~> 3.3.0"
|
171
|
-
dep "b", "0.3.4"
|
172
|
-
end
|
173
|
-
|
174
|
-
gem("my_app", '1.1.0') do
|
175
|
-
dep "c", "~> 3.2.0"
|
176
|
-
dep "b", "0.3.5"
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def index_with_conflict_on_child
|
182
|
-
build_index do
|
183
|
-
gem "json", %w(1.6.5 1.7.7 1.8.0)
|
184
|
-
|
185
|
-
gem("chef", '10.26') do
|
186
|
-
dep "json", [">= 1.4.4", "<= 1.7.7"]
|
187
|
-
end
|
188
|
-
|
189
|
-
gem("berkshelf", "2.0.7") do
|
190
|
-
dep "json", ">= 1.7.7"
|
191
|
-
end
|
192
|
-
|
193
|
-
gem("chef_app", '1.0.0') do
|
194
|
-
dep "berkshelf", "~> 2.0"
|
195
|
-
dep "chef", "~> 10.26"
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
def a_unresovable_child_index
|
201
|
-
build_index do
|
202
|
-
gem "json", %w(1.8.0)
|
203
|
-
|
204
|
-
gem("chef", '10.26') do
|
205
|
-
dep "json", [">= 1.4.4", "<= 1.7.7"]
|
206
|
-
end
|
207
|
-
|
208
|
-
gem("berkshelf", "2.0.7") do
|
209
|
-
dep "json", ">= 1.7.7"
|
210
|
-
end
|
211
|
-
|
212
|
-
gem("chef_app_error", '1.0.0') do
|
213
|
-
dep "berkshelf", "~> 2.0"
|
214
|
-
dep "chef", "~> 10.26"
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
def a_index_with_root_conflict_on_child
|
220
|
-
build_index do
|
221
|
-
gem "builder", %w(2.1.2 3.0.1 3.1.3)
|
222
|
-
gem "i18n", %w(0.4.1 0.4.2)
|
223
|
-
|
224
|
-
gem "activesupport", %w(3.0.0 3.0.1 3.0.5 3.1.7)
|
225
|
-
|
226
|
-
gem("activemodel", '3.0.5') do
|
227
|
-
dep "activesupport", "= 3.0.5"
|
228
|
-
dep "builder", "~> 2.1.2"
|
229
|
-
dep 'i18n', '~> 0.4'
|
230
|
-
end
|
231
|
-
|
232
|
-
gem("activemodel", '3.0.0') do
|
233
|
-
dep "activesupport", "= 3.0.0"
|
234
|
-
dep "builder", "~> 2.1.2"
|
235
|
-
dep 'i18n', '~> 0.4.1'
|
236
|
-
end
|
237
|
-
|
238
|
-
gem("activemodel", '3.1.3') do
|
239
|
-
dep "activesupport", "= 3.1.3"
|
240
|
-
dep "builder", "~> 2.1.2"
|
241
|
-
dep 'i18n', '~> 0.5'
|
242
|
-
end
|
243
|
-
|
244
|
-
gem("activerecord", '3.0.0') do
|
245
|
-
dep "activesupport", "= 3.0.0"
|
246
|
-
dep "activemodel", "= 3.0.0"
|
247
|
-
end
|
248
|
-
|
249
|
-
gem("activerecord", '3.0.5') do
|
250
|
-
dep "activesupport", "= 3.0.5"
|
251
|
-
dep "activemodel", "= 3.0.5"
|
252
|
-
end
|
253
|
-
|
254
|
-
gem("activerecord", '3.0.9') do
|
255
|
-
dep "activesupport", "= 3.1.5"
|
256
|
-
dep "activemodel", "= 3.1.5"
|
257
|
-
end
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
def a_circular_index
|
262
|
-
build_index do
|
263
|
-
gem "rack", "1.0.1"
|
264
|
-
gem("foo", '0.2.6') do
|
265
|
-
dep "bar", ">= 0"
|
266
|
-
end
|
267
|
-
|
268
|
-
gem("bar", "1.0.0") do
|
269
|
-
dep "foo", ">= 0"
|
270
|
-
end
|
271
|
-
|
272
|
-
gem("circular_app", '1.0.0') do
|
273
|
-
dep "foo", ">= 0"
|
274
|
-
dep "bar", ">= 0"
|
275
|
-
end
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
end
|
280
|
-
end
|