rubygems-update 2.2.5 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +4 -1
- data/CONTRIBUTING +20 -0
- data/History.txt +117 -14
- data/Manifest.txt +11 -2
- data/README.rdoc +1 -1
- data/Rakefile +0 -3
- data/lib/rubygems.rb +31 -11
- data/lib/rubygems/available_set.rb +1 -1
- data/lib/rubygems/basic_specification.rb +20 -10
- data/lib/rubygems/command.rb +4 -1
- data/lib/rubygems/commands/cert_command.rb +11 -13
- data/lib/rubygems/commands/cleanup_command.rb +2 -2
- data/lib/rubygems/commands/dependency_command.rb +2 -2
- data/lib/rubygems/commands/environment_command.rb +5 -2
- data/lib/rubygems/commands/help_command.rb +199 -20
- data/lib/rubygems/commands/install_command.rb +40 -10
- data/lib/rubygems/commands/list_command.rb +2 -2
- data/lib/rubygems/commands/open_command.rb +81 -0
- data/lib/rubygems/commands/search_command.rb +5 -5
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +8 -5
- data/lib/rubygems/commands/yank_command.rb +8 -13
- data/lib/rubygems/config_file.rb +13 -2
- data/lib/rubygems/dependency.rb +29 -16
- data/lib/rubygems/dependency_installer.rb +44 -10
- data/lib/rubygems/doctor.rb +1 -1
- data/lib/rubygems/errors.rb +30 -0
- data/lib/rubygems/exceptions.rb +20 -0
- data/lib/rubygems/ext/builder.rb +1 -1
- data/lib/rubygems/gemcutter_utilities.rb +1 -1
- data/lib/rubygems/installer.rb +4 -4
- data/lib/rubygems/name_tuple.rb +3 -1
- data/lib/rubygems/package.rb +27 -14
- data/lib/rubygems/package/file_source.rb +33 -0
- data/lib/rubygems/package/io_source.rb +45 -0
- data/lib/rubygems/package/old.rb +5 -5
- data/lib/rubygems/package/source.rb +3 -0
- data/lib/rubygems/platform.rb +2 -1
- data/lib/rubygems/rdoc.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +59 -18
- data/lib/rubygems/request.rb +71 -101
- data/lib/rubygems/request/connection_pools.rb +77 -0
- data/lib/rubygems/request/http_pool.rb +38 -0
- data/lib/rubygems/request/https_pool.rb +10 -0
- data/lib/rubygems/request_set.rb +65 -20
- data/lib/rubygems/request_set/gem_dependency_api.rb +234 -14
- data/lib/rubygems/request_set/lockfile.rb +65 -22
- data/lib/rubygems/requirement.rb +3 -0
- data/lib/rubygems/resolver.rb +33 -16
- data/lib/rubygems/resolver/activation_request.rb +7 -0
- data/lib/rubygems/resolver/api_set.rb +12 -2
- data/lib/rubygems/resolver/api_specification.rb +6 -0
- data/lib/rubygems/resolver/composed_set.rb +4 -0
- data/lib/rubygems/resolver/dependency_request.rb +20 -1
- data/lib/rubygems/resolver/git_set.rb +1 -1
- data/lib/rubygems/resolver/git_specification.rb +1 -1
- data/lib/rubygems/resolver/index_set.rb +3 -1
- data/lib/rubygems/resolver/installed_specification.rb +19 -1
- data/lib/rubygems/resolver/installer_set.rb +84 -4
- data/lib/rubygems/resolver/local_specification.rb +25 -0
- data/lib/rubygems/resolver/lock_set.rb +13 -9
- data/lib/rubygems/resolver/lock_specification.rb +1 -1
- data/lib/rubygems/resolver/set.rb +6 -0
- data/lib/rubygems/resolver/spec_specification.rb +0 -2
- data/lib/rubygems/resolver/specification.rb +23 -2
- data/lib/rubygems/resolver/vendor_set.rb +1 -1
- data/lib/rubygems/resolver/vendor_specification.rb +1 -1
- data/lib/rubygems/security/policy.rb +1 -0
- data/lib/rubygems/server.rb +36 -1
- data/lib/rubygems/source.rb +6 -2
- data/lib/rubygems/source/git.rb +1 -1
- data/lib/rubygems/source/installed.rb +4 -0
- data/lib/rubygems/source/specific_file.rb +6 -1
- data/lib/rubygems/spec_fetcher.rb +6 -13
- data/lib/rubygems/specification.rb +91 -63
- data/lib/rubygems/stub_specification.rb +9 -0
- data/lib/rubygems/test_case.rb +4 -2
- data/lib/rubygems/text.rb +15 -5
- data/lib/rubygems/uninstaller.rb +4 -1
- data/lib/rubygems/user_interaction.rb +8 -0
- data/lib/rubygems/version.rb +5 -1
- data/test/rubygems/test_gem.rb +88 -2
- data/test/rubygems/test_gem_available_set.rb +11 -8
- data/test/rubygems/test_gem_command.rb +55 -0
- data/test/rubygems/test_gem_commands_cert_command.rb +1 -0
- data/test/rubygems/test_gem_commands_environment_command.rb +1 -0
- data/test/rubygems/test_gem_commands_help_command.rb +7 -0
- data/test/rubygems/test_gem_commands_install_command.rb +71 -4
- data/test/rubygems/test_gem_commands_open_command.rb +46 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +9 -0
- data/test/rubygems/test_gem_commands_update_command.rb +48 -0
- data/test/rubygems/test_gem_commands_yank_command.rb +2 -2
- data/test/rubygems/test_gem_config_file.rb +19 -7
- data/test/rubygems/test_gem_dependency.rb +86 -2
- data/test/rubygems/test_gem_dependency_installer.rb +36 -164
- data/test/rubygems/test_gem_gemcutter_utilities.rb +9 -0
- data/test/rubygems/test_gem_installer.rb +6 -1
- data/test/rubygems/test_gem_name_tuple.rb +7 -0
- data/test/rubygems/test_gem_package.rb +17 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +65 -46
- data/test/rubygems/test_gem_request.rb +75 -61
- data/test/rubygems/test_gem_request_connection_pools.rb +83 -0
- data/test/rubygems/test_gem_request_set.rb +156 -1
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +72 -27
- data/test/rubygems/test_gem_request_set_lockfile.rb +335 -0
- data/test/rubygems/test_gem_requirement.rb +5 -0
- data/test/rubygems/test_gem_resolver.rb +91 -2
- data/test/rubygems/test_gem_resolver_activation_request.rb +10 -0
- data/test/rubygems/test_gem_resolver_api_set.rb +2 -2
- data/test/rubygems/test_gem_resolver_api_specification.rb +40 -0
- data/test/rubygems/test_gem_resolver_composed_set.rb +14 -0
- data/test/rubygems/test_gem_resolver_dependency_request.rb +55 -0
- data/test/rubygems/test_gem_resolver_git_set.rb +26 -0
- data/test/rubygems/test_gem_resolver_index_set.rb +28 -2
- data/test/rubygems/test_gem_resolver_installer_set.rb +143 -0
- data/test/rubygems/test_gem_resolver_lock_set.rb +12 -6
- data/test/rubygems/test_gem_resolver_lock_specification.rb +1 -1
- data/test/rubygems/test_gem_resolver_specification.rb +32 -0
- data/test/rubygems/test_gem_resolver_vendor_set.rb +14 -0
- data/test/rubygems/test_gem_security_policy.rb +2 -2
- data/test/rubygems/test_gem_server.rb +69 -4
- data/test/rubygems/test_gem_source.rb +4 -1
- data/test/rubygems/test_gem_source_git.rb +15 -0
- data/test/rubygems/test_gem_source_specific_file.rb +4 -0
- data/test/rubygems/test_gem_specification.rb +82 -27
- data/test/rubygems/test_gem_stub_specification.rb +61 -23
- data/test/rubygems/test_gem_uninstaller.rb +23 -0
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +32 -0
- metadata +187 -33
- metadata.gz.sig +0 -0
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +0 -32
@@ -1,5 +1,33 @@
|
|
1
1
|
##
|
2
|
-
# A semi-compatible DSL for the Bundler Gemfile and Isolate
|
2
|
+
# A semi-compatible DSL for the Bundler Gemfile and Isolate gem dependencies
|
3
|
+
# files.
|
4
|
+
#
|
5
|
+
# To work with both the Bundler Gemfile and Isolate formats this
|
6
|
+
# implementation takes some liberties to allow compatibility with each, most
|
7
|
+
# notably in #source.
|
8
|
+
#
|
9
|
+
# A basic gem dependencies file will look like the following:
|
10
|
+
#
|
11
|
+
# source 'https://rubygems.org'
|
12
|
+
#
|
13
|
+
# gem 'rails', '3.2.14a
|
14
|
+
# gem 'devise', '~> 2.1', '>= 2.1.3'
|
15
|
+
# gem 'cancan'
|
16
|
+
# gem 'airbrake'
|
17
|
+
# gem 'pg'
|
18
|
+
#
|
19
|
+
# RubyGems recommends saving this as gem.deps.rb over Gemfile or Isolate.
|
20
|
+
#
|
21
|
+
# To install the gems in this Gemfile use `gem install -g` to install it and
|
22
|
+
# create a lockfile. The lockfile will ensure that when you make changes to
|
23
|
+
# your gem dependencies file a minimum amount of change is made to the
|
24
|
+
# dependencies of your gems.
|
25
|
+
#
|
26
|
+
# RubyGems can activate all the gems in your dependencies file at startup
|
27
|
+
# using the RUBYGEMS_GEMDEPS environment variable or through Gem.use_gemdeps.
|
28
|
+
# See Gem.use_gemdeps for details and warnings.
|
29
|
+
#
|
30
|
+
# See `gem help install` and `gem help gem_dependencies` for further details.
|
3
31
|
|
4
32
|
class Gem::RequestSet::GemDependencyAPI
|
5
33
|
|
@@ -21,6 +49,8 @@ class Gem::RequestSet::GemDependencyAPI
|
|
21
49
|
:ruby_21 => %w[ruby rbx maglev],
|
22
50
|
}
|
23
51
|
|
52
|
+
mswin = Gem::Platform.new 'x86-mswin32'
|
53
|
+
mswin64 = Gem::Platform.new 'x64-mswin64'
|
24
54
|
x86_mingw = Gem::Platform.new 'x86-mingw32'
|
25
55
|
x64_mingw = Gem::Platform.new 'x64-mingw32'
|
26
56
|
|
@@ -39,7 +69,15 @@ class Gem::RequestSet::GemDependencyAPI
|
|
39
69
|
:mri_19 => Gem::Platform::RUBY,
|
40
70
|
:mri_20 => Gem::Platform::RUBY,
|
41
71
|
:mri_21 => Gem::Platform::RUBY,
|
42
|
-
:mswin =>
|
72
|
+
:mswin => mswin,
|
73
|
+
:mswin_18 => mswin,
|
74
|
+
:mswin_19 => mswin,
|
75
|
+
:mswin_20 => mswin,
|
76
|
+
:mswin_21 => mswin,
|
77
|
+
:mswin64 => mswin64,
|
78
|
+
:mswin64_19 => mswin64,
|
79
|
+
:mswin64_20 => mswin64,
|
80
|
+
:mswin64_21 => mswin64,
|
43
81
|
:rbx => Gem::Platform::RUBY,
|
44
82
|
:ruby => Gem::Platform::RUBY,
|
45
83
|
:ruby_18 => Gem::Platform::RUBY,
|
@@ -73,6 +111,14 @@ class Gem::RequestSet::GemDependencyAPI
|
|
73
111
|
:mri_20 => tilde_gt_2_0_0,
|
74
112
|
:mri_21 => tilde_gt_2_1_0,
|
75
113
|
:mswin => gt_eq_0,
|
114
|
+
:mswin_18 => tilde_gt_1_8_0,
|
115
|
+
:mswin_19 => tilde_gt_1_9_0,
|
116
|
+
:mswin_20 => tilde_gt_2_0_0,
|
117
|
+
:mswin_21 => tilde_gt_2_1_0,
|
118
|
+
:mswin64 => gt_eq_0,
|
119
|
+
:mswin64_19 => tilde_gt_1_9_0,
|
120
|
+
:mswin64_20 => tilde_gt_2_0_0,
|
121
|
+
:mswin64_21 => tilde_gt_2_1_0,
|
76
122
|
:rbx => gt_eq_0,
|
77
123
|
:ruby => gt_eq_0,
|
78
124
|
:ruby_18 => tilde_gt_1_8_0,
|
@@ -96,6 +142,14 @@ class Gem::RequestSet::GemDependencyAPI
|
|
96
142
|
:mri_20 => :never,
|
97
143
|
:mri_21 => :never,
|
98
144
|
:mswin => :only,
|
145
|
+
:mswin_18 => :only,
|
146
|
+
:mswin_19 => :only,
|
147
|
+
:mswin_20 => :only,
|
148
|
+
:mswin_21 => :only,
|
149
|
+
:mswin64 => :only,
|
150
|
+
:mswin64_19 => :only,
|
151
|
+
:mswin64_20 => :only,
|
152
|
+
:mswin64_21 => :only,
|
99
153
|
:rbx => :never,
|
100
154
|
:ruby => :never,
|
101
155
|
:ruby_18 => :never,
|
@@ -107,6 +161,11 @@ class Gem::RequestSet::GemDependencyAPI
|
|
107
161
|
:x64_mingw_21 => :only,
|
108
162
|
}
|
109
163
|
|
164
|
+
##
|
165
|
+
# The gems required by #gem statements in the gem.deps.rb file
|
166
|
+
|
167
|
+
attr_reader :dependencies
|
168
|
+
|
110
169
|
##
|
111
170
|
# A set of gems that are loaded via the +:git+ option to #gem
|
112
171
|
|
@@ -136,8 +195,9 @@ class Gem::RequestSet::GemDependencyAPI
|
|
136
195
|
@path = path
|
137
196
|
|
138
197
|
@current_groups = nil
|
139
|
-
@
|
198
|
+
@current_platforms = nil
|
140
199
|
@current_repository = nil
|
200
|
+
@dependencies = {}
|
141
201
|
@default_sources = true
|
142
202
|
@git_set = @set.git_set
|
143
203
|
@requires = Hash.new { |h, name| h[name] = [] }
|
@@ -187,14 +247,17 @@ class Gem::RequestSet::GemDependencyAPI
|
|
187
247
|
end
|
188
248
|
|
189
249
|
##
|
190
|
-
# Loads the gem dependency file
|
250
|
+
# Loads the gem dependency file and returns self.
|
191
251
|
|
192
252
|
def load
|
193
253
|
instance_eval File.read(@path).untaint, @path, 1
|
254
|
+
|
255
|
+
self
|
194
256
|
end
|
195
257
|
|
196
258
|
##
|
197
259
|
# :category: Gem Dependencies DSL
|
260
|
+
#
|
198
261
|
# :call-seq:
|
199
262
|
# gem(name)
|
200
263
|
# gem(name, *requirements)
|
@@ -202,6 +265,66 @@ class Gem::RequestSet::GemDependencyAPI
|
|
202
265
|
#
|
203
266
|
# Specifies a gem dependency with the given +name+ and +requirements+. You
|
204
267
|
# may also supply +options+ following the +requirements+
|
268
|
+
#
|
269
|
+
# +options+ include:
|
270
|
+
#
|
271
|
+
# require: ::
|
272
|
+
# RubyGems does not provide any autorequire features so requires in a gem
|
273
|
+
# dependencies file are recorded but ignored.
|
274
|
+
#
|
275
|
+
# In bundler the require: option overrides the file to require during
|
276
|
+
# Bundler.require. By default the name of the dependency is required in
|
277
|
+
# Bundler. A single file or an Array of files may be given.
|
278
|
+
#
|
279
|
+
# To disable requiring any file give +false+:
|
280
|
+
#
|
281
|
+
# gem 'rake', require: false
|
282
|
+
#
|
283
|
+
# group: ::
|
284
|
+
# Place the dependencies in the given dependency group. A single group or
|
285
|
+
# an Array of groups may be given.
|
286
|
+
#
|
287
|
+
# See also #group
|
288
|
+
#
|
289
|
+
# platform: ::
|
290
|
+
# Only install the dependency on the given platform. A single platform or
|
291
|
+
# an Array of platforms may be given.
|
292
|
+
#
|
293
|
+
# See #platform for a list of platforms available.
|
294
|
+
#
|
295
|
+
# path: ::
|
296
|
+
# Install this dependency from an unpacked gem in the given directory.
|
297
|
+
#
|
298
|
+
# gem 'modified_gem', path: 'vendor/modified_gem'
|
299
|
+
#
|
300
|
+
# git: ::
|
301
|
+
# Install this dependency from a git repository:
|
302
|
+
#
|
303
|
+
# gem 'private_gem', git: git@my.company.example:private_gem.git'
|
304
|
+
#
|
305
|
+
# gist: ::
|
306
|
+
# Install this dependency from the gist ID:
|
307
|
+
#
|
308
|
+
# gem 'bang', gist: '1232884'
|
309
|
+
#
|
310
|
+
# github: ::
|
311
|
+
# Install this dependency from a github git repository:
|
312
|
+
#
|
313
|
+
# gem 'private_gem', github: 'my_company/private_gem'
|
314
|
+
#
|
315
|
+
# submodules: ::
|
316
|
+
# Set to +true+ to include submodules when fetching the git repository for
|
317
|
+
# git:, gist: and github: dependencies.
|
318
|
+
#
|
319
|
+
# ref: ::
|
320
|
+
# Use the given commit name or SHA for git:, gist: and github:
|
321
|
+
# dependencies.
|
322
|
+
#
|
323
|
+
# branch: ::
|
324
|
+
# Use the given branch for git:, gist: and github: dependencies.
|
325
|
+
#
|
326
|
+
# tag: ::
|
327
|
+
# Use the given tag for git:, gist: and github: dependencies.
|
205
328
|
|
206
329
|
def gem name, *requirements
|
207
330
|
options = requirements.pop if requirements.last.kind_of?(Hash)
|
@@ -215,6 +338,15 @@ class Gem::RequestSet::GemDependencyAPI
|
|
215
338
|
source_set ||= gem_git name, options
|
216
339
|
source_set ||= gem_github name, options
|
217
340
|
|
341
|
+
@dependencies[name] =
|
342
|
+
if requirements.empty? and not source_set then
|
343
|
+
nil
|
344
|
+
elsif source_set then
|
345
|
+
'!'
|
346
|
+
else
|
347
|
+
requirements
|
348
|
+
end
|
349
|
+
|
218
350
|
return unless gem_platforms options
|
219
351
|
|
220
352
|
groups = gem_group name, options
|
@@ -315,7 +447,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
315
447
|
|
316
448
|
def gem_platforms options # :nodoc:
|
317
449
|
platform_names = Array(options.delete :platforms)
|
318
|
-
platform_names
|
450
|
+
platform_names.concat @current_platforms if @current_platforms
|
319
451
|
|
320
452
|
return true if platform_names.empty?
|
321
453
|
|
@@ -343,7 +475,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
343
475
|
private :gem_platforms
|
344
476
|
|
345
477
|
##
|
346
|
-
#
|
478
|
+
# Records the require: option from +options+ and adds those files, or the
|
347
479
|
# default file to the require list for +name+.
|
348
480
|
|
349
481
|
def gem_requires name, options # :nodoc:
|
@@ -362,6 +494,11 @@ class Gem::RequestSet::GemDependencyAPI
|
|
362
494
|
# :category: Gem Dependencies DSL
|
363
495
|
#
|
364
496
|
# Block form for specifying gems from a git +repository+.
|
497
|
+
#
|
498
|
+
# git 'https://github.com/rails/rails.git' do
|
499
|
+
# gem 'activesupport'
|
500
|
+
# gem 'activerecord'
|
501
|
+
# end
|
365
502
|
|
366
503
|
def git repository
|
367
504
|
@current_repository = repository
|
@@ -383,6 +520,23 @@ class Gem::RequestSet::GemDependencyAPI
|
|
383
520
|
# :category: Gem Dependencies DSL
|
384
521
|
#
|
385
522
|
# Loads dependencies from a gemspec file.
|
523
|
+
#
|
524
|
+
# +options+ include:
|
525
|
+
#
|
526
|
+
# name: ::
|
527
|
+
# The name portion of the gemspec file. Defaults to searching for any
|
528
|
+
# gemspec file in the current directory.
|
529
|
+
#
|
530
|
+
# gemspec name: 'my_gem'
|
531
|
+
#
|
532
|
+
# path: ::
|
533
|
+
# The path the gemspec lives in. Defaults to the current directory:
|
534
|
+
#
|
535
|
+
# gemspec 'my_gem', path: 'gemspecs', name: 'my_gem'
|
536
|
+
#
|
537
|
+
# development_group: ::
|
538
|
+
# The group to add development dependencies to. By default this is
|
539
|
+
# :development. Only one group may be specified.
|
386
540
|
|
387
541
|
def gemspec options = {}
|
388
542
|
name = options.delete(:name) || '{,*}'
|
@@ -404,7 +558,20 @@ class Gem::RequestSet::GemDependencyAPI
|
|
404
558
|
|
405
559
|
##
|
406
560
|
# :category: Gem Dependencies DSL
|
561
|
+
#
|
407
562
|
# Block form for placing a dependency in the given +groups+.
|
563
|
+
#
|
564
|
+
# group :development do
|
565
|
+
# gem 'debugger'
|
566
|
+
# end
|
567
|
+
#
|
568
|
+
# group :development, :test do
|
569
|
+
# gem 'minitest'
|
570
|
+
# end
|
571
|
+
#
|
572
|
+
# Groups can be excluded at install time using `gem install -g --without
|
573
|
+
# development`. See `gem help install` and `gem help gem_dependencies` for
|
574
|
+
# further details.
|
408
575
|
|
409
576
|
def group *groups
|
410
577
|
@current_groups = groups
|
@@ -440,28 +607,72 @@ class Gem::RequestSet::GemDependencyAPI
|
|
440
607
|
##
|
441
608
|
# :category: Gem Dependencies DSL
|
442
609
|
#
|
443
|
-
# Block form for restricting gems to a
|
610
|
+
# Block form for restricting gems to a set of platforms.
|
611
|
+
#
|
612
|
+
# The gem dependencies platform is different from Gem::Platform. A platform
|
613
|
+
# gem.deps.rb platform matches on the ruby engine, the ruby version and
|
614
|
+
# whether or not windows is allowed.
|
615
|
+
#
|
616
|
+
# :ruby, :ruby_XY ::
|
617
|
+
# Matches non-windows, non-jruby implementations where X and Y can be used
|
618
|
+
# to match releases in the 1.8, 1.9, 2.0 or 2.1 series.
|
619
|
+
#
|
620
|
+
# :mri, :mri_XY ::
|
621
|
+
# Matches non-windows C Ruby (Matz Ruby) or only the 1.8, 1.9, 2.0 or
|
622
|
+
# 2.1 series.
|
623
|
+
#
|
624
|
+
# :mingw, :mingw_XY ::
|
625
|
+
# Matches 32 bit C Ruby on MinGW or only the 1.8, 1.9, 2.0 or 2.1 series.
|
626
|
+
#
|
627
|
+
# :x64_mingw, :x64_mingw_XY ::
|
628
|
+
# Matches 64 bit C Ruby on MinGW or only the 1.8, 1.9, 2.0 or 2.1 series.
|
629
|
+
#
|
630
|
+
# :mswin, :mswin_XY ::
|
631
|
+
# Matches 32 bit C Ruby on Microsoft Windows or only the 1.8, 1.9, 2.0 or
|
632
|
+
# 2.1 series.
|
633
|
+
#
|
634
|
+
# :mswin64, :mswin64_XY ::
|
635
|
+
# Matches 64 bit C Ruby on Microsoft Windows or only the 1.8, 1.9, 2.0 or
|
636
|
+
# 2.1 series.
|
637
|
+
#
|
638
|
+
# :jruby, :jruby_XY ::
|
639
|
+
# Matches JRuby or JRuby in 1.8 or 1.9 mode.
|
640
|
+
#
|
641
|
+
# :maglev ::
|
642
|
+
# Matches Maglev
|
643
|
+
#
|
644
|
+
# :rbx ::
|
645
|
+
# Matches non-windows Rubinius
|
646
|
+
#
|
647
|
+
# NOTE: There is inconsistency in what environment a platform matches. You
|
648
|
+
# may need to read the source to know the exact details.
|
444
649
|
|
445
|
-
def platform
|
446
|
-
@
|
650
|
+
def platform *platforms
|
651
|
+
@current_platforms = platforms
|
447
652
|
|
448
653
|
yield
|
449
654
|
|
450
655
|
ensure
|
451
|
-
@
|
656
|
+
@current_platforms = nil
|
452
657
|
end
|
453
658
|
|
454
659
|
##
|
455
660
|
# :category: Gem Dependencies DSL
|
456
661
|
#
|
457
|
-
# Block form for restricting gems to a particular
|
662
|
+
# Block form for restricting gems to a particular set of platforms. See
|
663
|
+
# #platform.
|
458
664
|
|
459
665
|
alias :platforms :platform
|
460
666
|
|
461
667
|
##
|
462
668
|
# :category: Gem Dependencies DSL
|
463
|
-
#
|
464
|
-
#
|
669
|
+
#
|
670
|
+
# Restricts this gem dependencies file to the given ruby +version+.
|
671
|
+
#
|
672
|
+
# You may also provide +engine:+ and +engine_version:+ options to restrict
|
673
|
+
# this gem dependencies file to a particular ruby engine and its engine
|
674
|
+
# version. This matching is performed by using the RUBY_ENGINE and
|
675
|
+
# engine_specific VERSION constants. (For JRuby, JRUBY_VERSION).
|
465
676
|
|
466
677
|
def ruby version, options = {}
|
467
678
|
engine = options[:engine]
|
@@ -503,7 +714,16 @@ class Gem::RequestSet::GemDependencyAPI
|
|
503
714
|
##
|
504
715
|
# :category: Gem Dependencies DSL
|
505
716
|
#
|
506
|
-
# Sets +url+ as a source for gems for this dependency API.
|
717
|
+
# Sets +url+ as a source for gems for this dependency API. RubyGems uses
|
718
|
+
# the default configured sources if no source was given. If a source is set
|
719
|
+
# only that source is used.
|
720
|
+
#
|
721
|
+
# This method differs in behavior from Bundler:
|
722
|
+
#
|
723
|
+
# * The +:gemcutter+, # +:rubygems+ and +:rubyforge+ sources are not
|
724
|
+
# supported as they are deprecated in bundler.
|
725
|
+
# * The +prepend:+ option is not supported. If you wish to order sources
|
726
|
+
# then list them in your preferred order.
|
507
727
|
|
508
728
|
def source url
|
509
729
|
Gem.sources.clear if @default_sources
|
@@ -49,8 +49,9 @@ class Gem::RequestSet::Lockfile
|
|
49
49
|
# Creates a new Lockfile for the given +request_set+ and +gem_deps_file+
|
50
50
|
# location.
|
51
51
|
|
52
|
-
def initialize request_set, gem_deps_file
|
52
|
+
def initialize request_set, gem_deps_file, dependencies = nil
|
53
53
|
@set = request_set
|
54
|
+
@dependencies = dependencies
|
54
55
|
@gem_deps_file = File.expand_path(gem_deps_file)
|
55
56
|
@gem_deps_dir = File.dirname(@gem_deps_file)
|
56
57
|
|
@@ -64,19 +65,42 @@ class Gem::RequestSet::Lockfile
|
|
64
65
|
def add_DEPENDENCIES out # :nodoc:
|
65
66
|
out << "DEPENDENCIES"
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
dependencies =
|
69
|
+
if @dependencies then
|
70
|
+
@dependencies.sort_by { |name,| name }.map do |name, requirement|
|
71
|
+
requirement_string =
|
72
|
+
if '!' == requirement then
|
73
|
+
requirement
|
74
|
+
else
|
75
|
+
Gem::Requirement.new(requirement).for_lockfile
|
76
|
+
end
|
77
|
+
|
78
|
+
[name, requirement_string]
|
79
|
+
end
|
73
80
|
else
|
74
|
-
|
75
|
-
|
76
|
-
|
81
|
+
@requests.sort_by { |r| r.name }.map do |request|
|
82
|
+
spec = request.spec
|
83
|
+
name = request.name
|
84
|
+
requirement = request.request.dependency.requirement
|
85
|
+
|
86
|
+
requirement_string =
|
87
|
+
if [Gem::Resolver::VendorSpecification,
|
88
|
+
Gem::Resolver::GitSpecification].include? spec.class then
|
89
|
+
"!"
|
90
|
+
else
|
91
|
+
requirement.for_lockfile
|
92
|
+
end
|
93
|
+
|
94
|
+
[name, requirement_string]
|
95
|
+
end
|
77
96
|
end
|
97
|
+
|
98
|
+
dependencies = dependencies.map do |name, requirement_string|
|
99
|
+
" #{name}#{requirement_string}"
|
78
100
|
end
|
79
101
|
|
102
|
+
out.concat dependencies
|
103
|
+
|
80
104
|
out << nil
|
81
105
|
end
|
82
106
|
|
@@ -93,12 +117,15 @@ class Gem::RequestSet::Lockfile
|
|
93
117
|
out << " specs:"
|
94
118
|
|
95
119
|
requests.sort_by { |request| request.name }.each do |request|
|
120
|
+
next if request.spec.name == 'bundler'
|
96
121
|
platform = "-#{request.spec.platform}" unless
|
97
122
|
Gem::Platform::RUBY == request.spec.platform
|
98
123
|
|
99
124
|
out << " #{request.name} (#{request.version}#{platform})"
|
100
125
|
|
101
126
|
request.full_spec.dependencies.sort.each do |dependency|
|
127
|
+
next if dependency.type == :development
|
128
|
+
|
102
129
|
requirement = dependency.requirement
|
103
130
|
out << " #{dependency.name}#{requirement.for_lockfile}"
|
104
131
|
end
|
@@ -166,9 +193,8 @@ class Gem::RequestSet::Lockfile
|
|
166
193
|
out << "PLATFORMS"
|
167
194
|
|
168
195
|
platforms = @requests.map { |request| request.spec.platform }.uniq
|
169
|
-
platforms.delete Gem::Platform::RUBY if platforms.length > 1
|
170
196
|
|
171
|
-
platforms.each do |platform|
|
197
|
+
platforms.sort.each do |platform|
|
172
198
|
out << " #{platform}"
|
173
199
|
end
|
174
200
|
|
@@ -250,7 +276,7 @@ class Gem::RequestSet::Lockfile
|
|
250
276
|
Gem::Resolver::VendorSet === set
|
251
277
|
}.map { |set|
|
252
278
|
set.specs[name]
|
253
|
-
}.first
|
279
|
+
}.compact.first
|
254
280
|
|
255
281
|
requirements << spec.version
|
256
282
|
when :l_paren then
|
@@ -277,26 +303,33 @@ class Gem::RequestSet::Lockfile
|
|
277
303
|
end
|
278
304
|
|
279
305
|
def parse_GEM # :nodoc:
|
280
|
-
|
281
|
-
_, data, = get :text
|
306
|
+
sources = []
|
282
307
|
|
283
|
-
|
308
|
+
while [:entry, 'remote'] == peek.first(2) do
|
309
|
+
get :entry, 'remote'
|
310
|
+
_, data, = get :text
|
311
|
+
skip :newline
|
284
312
|
|
285
|
-
|
313
|
+
sources << Gem::Source.new(data)
|
314
|
+
end
|
315
|
+
|
316
|
+
sources << Gem::Source.new(Gem::DEFAULT_HOST) if sources.empty?
|
286
317
|
|
287
318
|
get :entry, 'specs'
|
288
319
|
|
289
320
|
skip :newline
|
290
321
|
|
291
|
-
set = Gem::Resolver::LockSet.new
|
292
|
-
|
322
|
+
set = Gem::Resolver::LockSet.new sources
|
323
|
+
last_specs = nil
|
293
324
|
|
294
325
|
while not @tokens.empty? and :text == peek.first do
|
295
326
|
_, name, column, = get :text
|
296
327
|
|
297
328
|
case peek[0]
|
298
329
|
when :newline then
|
299
|
-
|
330
|
+
last_specs.each do |spec|
|
331
|
+
spec.add_dependency Gem::Dependency.new name if column == 6
|
332
|
+
end
|
300
333
|
when :l_paren then
|
301
334
|
get :l_paren
|
302
335
|
|
@@ -308,11 +341,13 @@ class Gem::RequestSet::Lockfile
|
|
308
341
|
platform =
|
309
342
|
platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
|
310
343
|
|
311
|
-
|
344
|
+
last_specs = set.add name, version, platform
|
312
345
|
else
|
313
346
|
dependency = parse_dependency name, data
|
314
347
|
|
315
|
-
|
348
|
+
last_specs.each do |spec|
|
349
|
+
spec.add_dependency dependency
|
350
|
+
end
|
316
351
|
end
|
317
352
|
|
318
353
|
get :r_paren
|
@@ -337,6 +372,14 @@ class Gem::RequestSet::Lockfile
|
|
337
372
|
|
338
373
|
skip :newline
|
339
374
|
|
375
|
+
type, value = peek.first 2
|
376
|
+
if type == :entry and %w[branch ref tag].include? value then
|
377
|
+
get
|
378
|
+
get :text
|
379
|
+
|
380
|
+
skip :newline
|
381
|
+
end
|
382
|
+
|
340
383
|
get :entry, 'specs'
|
341
384
|
|
342
385
|
skip :newline
|