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
data/lib/rubygems/command.rb
CHANGED
@@ -148,6 +148,8 @@ class Gem::Command
|
|
148
148
|
|
149
149
|
##
|
150
150
|
# Display to the user that a gem couldn't be found and reasons why
|
151
|
+
#--
|
152
|
+
# TODO: replace +domain+ with a parameter to suppress suggestions
|
151
153
|
|
152
154
|
def show_lookup_failure(gem_name, version, errors, domain)
|
153
155
|
if errors and !errors.empty?
|
@@ -557,7 +559,8 @@ basic help message containing pointers to more information.
|
|
557
559
|
Further help:
|
558
560
|
gem help commands list all 'gem' commands
|
559
561
|
gem help examples show some examples of usage
|
560
|
-
gem help
|
562
|
+
gem help gem_dependencies gem dependencies file guide
|
563
|
+
gem help platforms gem platforms guide
|
561
564
|
gem help <COMMAND> show help on COMMAND
|
562
565
|
(e.g. 'gem help install')
|
563
566
|
gem server present a web page at
|
@@ -129,23 +129,21 @@ class Gem::Commands::CertCommand < Gem::Command
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def build_key # :nodoc:
|
132
|
-
if options[:key]
|
133
|
-
options[:key]
|
134
|
-
else
|
135
|
-
passphrase = ask_for_password 'Passphrase for your Private Key:'
|
136
|
-
say "\n"
|
132
|
+
return options[:key] if options[:key]
|
137
133
|
|
138
|
-
|
139
|
-
|
134
|
+
passphrase = ask_for_password 'Passphrase for your Private Key:'
|
135
|
+
say "\n"
|
140
136
|
|
141
|
-
|
142
|
-
|
137
|
+
passphrase_confirmation = ask_for_password 'Please repeat the passphrase for your Private Key:'
|
138
|
+
say "\n"
|
143
139
|
|
144
|
-
|
145
|
-
|
140
|
+
raise Gem::CommandLineError,
|
141
|
+
"Passphrase and passphrase confirmation don't match" unless passphrase == passphrase_confirmation
|
146
142
|
|
147
|
-
|
148
|
-
|
143
|
+
key = Gem::Security.create_key
|
144
|
+
key_path = Gem::Security.write key, "gem-private_key.pem", 0600, passphrase
|
145
|
+
|
146
|
+
return key, key_path
|
149
147
|
end
|
150
148
|
|
151
149
|
def certificates_matching filter
|
@@ -67,10 +67,10 @@ If no gems are named all gems in GEM_HOME are cleaned.
|
|
67
67
|
|
68
68
|
say "Clean Up Complete"
|
69
69
|
|
70
|
-
|
70
|
+
verbose do
|
71
71
|
skipped = @default_gems.map { |spec| spec.full_name }
|
72
72
|
|
73
|
-
|
73
|
+
"Skipped default gems: #{skipped.join ', '}"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -31,7 +31,7 @@ class Gem::Commands::DependencyCommand < Gem::Command
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def arguments # :nodoc:
|
34
|
-
"
|
34
|
+
"REGEXP show dependencies for gems whose names start with REGEXP"
|
35
35
|
end
|
36
36
|
|
37
37
|
def defaults_str # :nodoc:
|
@@ -50,7 +50,7 @@ use with other commands.
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def usage # :nodoc:
|
53
|
-
"#{program_name}
|
53
|
+
"#{program_name} REGEXP"
|
54
54
|
end
|
55
55
|
|
56
56
|
def fetch_remote_specs dependency # :nodoc:
|
@@ -28,8 +28,9 @@ The RubyGems environment can be controlled through command line arguments,
|
|
28
28
|
gemrc files, environment variables and built-in defaults.
|
29
29
|
|
30
30
|
Command line argument defaults and some RubyGems defaults can be set in a
|
31
|
-
~/.gemrc file for individual users and a
|
32
|
-
files are YAML files with the following YAML
|
31
|
+
~/.gemrc file for individual users and a gemrc in the SYSTEM CONFIGURATION
|
32
|
+
DIRECTORY for all users. These files are YAML files with the following YAML
|
33
|
+
keys:
|
33
34
|
|
34
35
|
:sources: A YAML array of remote gem repositories to install gems from
|
35
36
|
:verbose: Verbosity of the gem command. false, true, and :really are the
|
@@ -120,6 +121,8 @@ lib/rubygems/defaults/operating_system.rb
|
|
120
121
|
|
121
122
|
out << " - SPEC CACHE DIRECTORY: #{Gem.spec_cache_dir}\n"
|
122
123
|
|
124
|
+
out << " - SYSTEM CONFIGURATION DIRECTORY: #{Gem::ConfigFile::SYSTEM_CONFIG_PATH}\n"
|
125
|
+
|
123
126
|
out << " - RUBYGEMS PLATFORMS:\n"
|
124
127
|
Gem.platforms.each do |platform|
|
125
128
|
out << " - #{platform}\n"
|
@@ -52,6 +52,183 @@ Some examples of 'gem' usage.
|
|
52
52
|
gem update --system
|
53
53
|
EOF
|
54
54
|
|
55
|
+
GEM_DEPENDENCIES = <<-EOF
|
56
|
+
A gem dependencies file allows installation of a consistent set of gems across
|
57
|
+
multiple environments. The RubyGems implementation is designed to be
|
58
|
+
compatible with Bundler's Gemfile format. You can see additional
|
59
|
+
documentation on the format at:
|
60
|
+
|
61
|
+
http://bundler.io
|
62
|
+
|
63
|
+
RubyGems automatically looks for these gem dependencies files:
|
64
|
+
|
65
|
+
* gem.deps.rb
|
66
|
+
* Gemfile
|
67
|
+
* Isolate
|
68
|
+
|
69
|
+
These files are looked up automatically using `gem install -g`, or you can
|
70
|
+
specify a custom file.
|
71
|
+
|
72
|
+
When the RUBYGEMS_GEMDEPS environment variable is set to a gem dependencies
|
73
|
+
file the gems from that file will be activated at startup time. Set it to a
|
74
|
+
specific filename or to "-" to have RubyGems automatically discover the gem
|
75
|
+
dependencies file by walking up from the current directory.
|
76
|
+
|
77
|
+
You can also activate gem dependencies at program startup using
|
78
|
+
Gem.use_gemdeps.
|
79
|
+
|
80
|
+
NOTE: Enabling automatic discovery on multiuser systems can lead to execution
|
81
|
+
of arbitrary code when used from directories outside your control.
|
82
|
+
|
83
|
+
Gem Dependencies
|
84
|
+
================
|
85
|
+
|
86
|
+
Use #gem to declare which gems you directly depend upon:
|
87
|
+
|
88
|
+
gem 'rake'
|
89
|
+
|
90
|
+
To depend on a specific set of versions:
|
91
|
+
|
92
|
+
gem 'rake', '~> 10.3', '>= 10.3.2'
|
93
|
+
|
94
|
+
RubyGems will require the gem name when activating the gem using
|
95
|
+
the RUBYGEMS_GEMDEPS environment variable or Gem::use_gemdeps. Use the
|
96
|
+
require: option to override this behavior if the gem does not have a file of
|
97
|
+
that name or you don't want to require those files:
|
98
|
+
|
99
|
+
gem 'my_gem', require: 'other_file'
|
100
|
+
|
101
|
+
To prevent RubyGems from requiring any files use:
|
102
|
+
|
103
|
+
gem 'my_gem', require: false
|
104
|
+
|
105
|
+
To load dependencies from a .gemspec file:
|
106
|
+
|
107
|
+
gemspec
|
108
|
+
|
109
|
+
RubyGems looks for the first .gemspec file in the current directory. To
|
110
|
+
override this use the name: option:
|
111
|
+
|
112
|
+
gemspec name: 'specific_gem'
|
113
|
+
|
114
|
+
To look in a different directory use the path: option:
|
115
|
+
|
116
|
+
gemspec name: 'specific_gem', path: 'gemspecs'
|
117
|
+
|
118
|
+
To depend on a gem unpacked into a local directory:
|
119
|
+
|
120
|
+
gem 'modified_gem', path: 'vendor/modified_gem'
|
121
|
+
|
122
|
+
To depend on a gem from git:
|
123
|
+
|
124
|
+
gem 'private_gem', git: 'git@my.company.example:private_gem.git'
|
125
|
+
|
126
|
+
To depend on a gem from github:
|
127
|
+
|
128
|
+
gem 'private_gem', github: 'my_company/private_gem'
|
129
|
+
|
130
|
+
To depend on a gem from a github gist:
|
131
|
+
|
132
|
+
gem 'bang', gist: '1232884'
|
133
|
+
|
134
|
+
Git, github and gist support the ref:, branch: and tag: options to specify a
|
135
|
+
commit reference or hash, branch or tag respectively to use for the gem.
|
136
|
+
|
137
|
+
Setting the submodules: option to true for git, github and gist dependencies
|
138
|
+
causes fetching of submodules when fetching the repository.
|
139
|
+
|
140
|
+
You can depend on multiple gems from a single repository with the git method:
|
141
|
+
|
142
|
+
git 'https://github.com/rails/rails.git' do
|
143
|
+
gem 'activesupport'
|
144
|
+
gem 'activerecord'
|
145
|
+
end
|
146
|
+
|
147
|
+
Gem Sources
|
148
|
+
===========
|
149
|
+
|
150
|
+
RubyGems uses the default sources for regular `gem install` for gem
|
151
|
+
dependencies files. Unlike bundler, you do need to specify a source.
|
152
|
+
|
153
|
+
You can override the sources used for downloading gems with:
|
154
|
+
|
155
|
+
source 'https://gem_server.example'
|
156
|
+
|
157
|
+
You may specify multiple sources. Unlike bundler the prepend: option is not
|
158
|
+
supported. Sources are used in-order, to prepend a source place it at the
|
159
|
+
front of the list.
|
160
|
+
|
161
|
+
Gem Platform
|
162
|
+
============
|
163
|
+
|
164
|
+
You can restrict gem dependencies to specific platforms with the #platform
|
165
|
+
and #platforms methods:
|
166
|
+
|
167
|
+
platform :ruby_21 do
|
168
|
+
gem 'debugger'
|
169
|
+
end
|
170
|
+
|
171
|
+
See the bundler Gemfile manual page for a list of platforms supported in a gem
|
172
|
+
dependencies file.:
|
173
|
+
|
174
|
+
http://bundler.io/v1.6/man/gemfile.5.html
|
175
|
+
|
176
|
+
Ruby Version and Engine Dependency
|
177
|
+
==================================
|
178
|
+
|
179
|
+
You can specifiy the version, engine and engine version of ruby to use with
|
180
|
+
your gem dependencies file. If you are not running the specified version
|
181
|
+
RubyGems will raise an exception.
|
182
|
+
|
183
|
+
To depend on a specific version of ruby:
|
184
|
+
|
185
|
+
ruby '2.1.2'
|
186
|
+
|
187
|
+
To depend on a specific ruby engine:
|
188
|
+
|
189
|
+
ruby '1.9.3', engine: 'jruby'
|
190
|
+
|
191
|
+
To depend on a specific ruby engine version:
|
192
|
+
|
193
|
+
ruby '1.9.3', engine: 'jruby', engine_version: '1.7.11'
|
194
|
+
|
195
|
+
Grouping Dependencies
|
196
|
+
=====================
|
197
|
+
|
198
|
+
Gem dependencies may be placed in groups that can be excluded from install.
|
199
|
+
Dependencies required for development or testing of your code may be excluded
|
200
|
+
when installed in a production environment.
|
201
|
+
|
202
|
+
A #gem dependency may be placed in a group using the group: option:
|
203
|
+
|
204
|
+
gem 'minitest', group: :test
|
205
|
+
|
206
|
+
To install dependencies from a gemfile without specific groups use the
|
207
|
+
`--without` option for `gem install -g`:
|
208
|
+
|
209
|
+
$ gem install -g --without test
|
210
|
+
|
211
|
+
The group: option also accepts multiple groups if the gem fits in multiple
|
212
|
+
categories.
|
213
|
+
|
214
|
+
Multiple groups may be excluded during install by comma-separating the groups for `--without` or by specifying `--without` multiple times.
|
215
|
+
|
216
|
+
The #group method can also be used to place gems in groups:
|
217
|
+
|
218
|
+
group :test do
|
219
|
+
gem 'minitest'
|
220
|
+
gem 'minitest-emoji'
|
221
|
+
end
|
222
|
+
|
223
|
+
The #group method allows multiple groups.
|
224
|
+
|
225
|
+
The #gemspec development dependencies are placed in the :development group by
|
226
|
+
default. This may be overriden with the :development_group option:
|
227
|
+
|
228
|
+
gemspec development_group: :other
|
229
|
+
|
230
|
+
EOF
|
231
|
+
|
55
232
|
PLATFORMS = <<-'EOF'
|
56
233
|
RubyGems platforms are composed of three parts, a CPU, an OS, and a
|
57
234
|
version. These values are taken from values in rbconfig.rb. You can view
|
@@ -90,6 +267,16 @@ When building platform gems, set the platform in the gem specification to
|
|
90
267
|
Gem::Platform::CURRENT. This will correctly mark the gem with your ruby's
|
91
268
|
platform.
|
92
269
|
EOF
|
270
|
+
|
271
|
+
# NOTE when updating also update Gem::Command::HELP
|
272
|
+
|
273
|
+
SUBCOMMANDS = [
|
274
|
+
["commands", :show_commands],
|
275
|
+
["options", Gem::Command::HELP],
|
276
|
+
["examples", EXAMPLES],
|
277
|
+
["gem_dependencies", GEM_DEPENDENCIES],
|
278
|
+
["platforms", PLATFORMS],
|
279
|
+
]
|
93
280
|
# :startdoc:
|
94
281
|
|
95
282
|
def initialize
|
@@ -98,15 +285,6 @@ platform.
|
|
98
285
|
@command_manager = Gem::CommandManager.instance
|
99
286
|
end
|
100
287
|
|
101
|
-
def arguments # :nodoc:
|
102
|
-
args = <<-EOF
|
103
|
-
commands List all 'gem' commands
|
104
|
-
examples Show examples of 'gem' usage
|
105
|
-
<command> Show specific help for <command>
|
106
|
-
EOF
|
107
|
-
return args.gsub(/^\s+/, '')
|
108
|
-
end
|
109
|
-
|
110
288
|
def usage # :nodoc:
|
111
289
|
"#{program_name} ARGUMENT"
|
112
290
|
end
|
@@ -114,19 +292,20 @@ platform.
|
|
114
292
|
def execute
|
115
293
|
arg = options[:args][0]
|
116
294
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
elsif begins? "options", arg then
|
121
|
-
say Gem::Command::HELP
|
122
|
-
|
123
|
-
elsif begins? "examples", arg then
|
124
|
-
say EXAMPLES
|
295
|
+
_, help = SUBCOMMANDS.find do |command,|
|
296
|
+
begins? command, arg
|
297
|
+
end
|
125
298
|
|
126
|
-
|
127
|
-
|
299
|
+
if help then
|
300
|
+
if Symbol === help then
|
301
|
+
send help
|
302
|
+
else
|
303
|
+
say help
|
304
|
+
end
|
305
|
+
return
|
306
|
+
end
|
128
307
|
|
129
|
-
|
308
|
+
if options[:help] then
|
130
309
|
show_help
|
131
310
|
|
132
311
|
elsif arg then
|
@@ -21,6 +21,8 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|
21
21
|
def initialize
|
22
22
|
defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
|
23
23
|
:format_executable => false,
|
24
|
+
:lock => true,
|
25
|
+
:suggest_alternate => true,
|
24
26
|
:version => Gem::Requirement.default,
|
25
27
|
:without_groups => [],
|
26
28
|
})
|
@@ -69,6 +71,16 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|
69
71
|
o[:explain] = v
|
70
72
|
end
|
71
73
|
|
74
|
+
add_option(:"Install/Update", '--[no-]lock',
|
75
|
+
'Create a lock file (when used with -g/--file)') do |v,o|
|
76
|
+
o[:lock] = v
|
77
|
+
end
|
78
|
+
|
79
|
+
add_option(:"Install/Update", '--[no-]suggestions',
|
80
|
+
'Suggest alternates when gems are not found') do |v,o|
|
81
|
+
o[:suggest_alternate] = v
|
82
|
+
end
|
83
|
+
|
72
84
|
@installed_specs = []
|
73
85
|
end
|
74
86
|
|
@@ -78,7 +90,7 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|
78
90
|
|
79
91
|
def defaults_str # :nodoc:
|
80
92
|
"--both --version '#{Gem::Requirement.default}' --document --no-force\n" +
|
81
|
-
"--install-dir #{Gem.dir}"
|
93
|
+
"--install-dir #{Gem.dir} --lock"
|
82
94
|
end
|
83
95
|
|
84
96
|
def description # :nodoc:
|
@@ -92,6 +104,25 @@ The wrapper allows you to choose among alternate gem versions using _version_.
|
|
92
104
|
For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer
|
93
105
|
version is also installed.
|
94
106
|
|
107
|
+
Gem Dependency Files
|
108
|
+
====================
|
109
|
+
|
110
|
+
RubyGems can install a consistent set of gems across multiple environments
|
111
|
+
using `gem install -g` when a gem dependencies file (gem.deps.rb, Gemfile or
|
112
|
+
Isolate) is present. If no explicit file is given RubyGems attempts to find
|
113
|
+
one in the current directory.
|
114
|
+
|
115
|
+
When the RUBYGEMS_GEMDEPS environment variable is set to a gem dependencies
|
116
|
+
file the gems from that file will be activated at startup time. Set it to a
|
117
|
+
specific filename or to "-" to have RubyGems automatically discover the gem
|
118
|
+
dependencies file by walking up from the current directory.
|
119
|
+
|
120
|
+
NOTE: Enabling automatic discovery on multiuser systems can lead to
|
121
|
+
execution of arbitrary code when used from directories outside your control.
|
122
|
+
|
123
|
+
Extension Install Failures
|
124
|
+
==========================
|
125
|
+
|
95
126
|
If an extension fails to compile during gem installation the gem
|
96
127
|
specification is not written out, but the gem remains unpacked in the
|
97
128
|
repository. You may need to specify the path to the library's headers and
|
@@ -204,23 +235,20 @@ to write the specification by hand. For example:
|
|
204
235
|
install_gem_without_dependencies name, req
|
205
236
|
else
|
206
237
|
inst = Gem::DependencyInstaller.new options
|
238
|
+
request_set = inst.resolve_dependencies name, req
|
207
239
|
|
208
240
|
if options[:explain]
|
209
|
-
request_set = inst.resolve_dependencies name, req
|
210
|
-
|
211
241
|
puts "Gems to install:"
|
212
242
|
|
213
|
-
request_set.
|
214
|
-
puts " #{s}"
|
243
|
+
request_set.sorted_requests.each do |s|
|
244
|
+
puts " #{s.full_name}"
|
215
245
|
end
|
216
246
|
|
217
247
|
return
|
218
248
|
else
|
219
|
-
|
249
|
+
@installed_specs.concat request_set.install options
|
220
250
|
end
|
221
251
|
|
222
|
-
@installed_specs.push(*inst.installed_gems)
|
223
|
-
|
224
252
|
show_install_errors inst.errors
|
225
253
|
end
|
226
254
|
end
|
@@ -264,8 +292,10 @@ to write the specification by hand. For example:
|
|
264
292
|
rescue Gem::InstallError => e
|
265
293
|
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
|
266
294
|
exit_code |= 1
|
267
|
-
rescue Gem::GemNotFoundException => e
|
268
|
-
|
295
|
+
rescue Gem::GemNotFoundException, Gem::UnsatisfiableDependencyError => e
|
296
|
+
domain = options[:domain]
|
297
|
+
domain = :local unless options[:suggest_alternate]
|
298
|
+
show_lookup_failure e.name, e.version, e.errors, domain
|
269
299
|
|
270
300
|
exit_code |= 2
|
271
301
|
end
|