rubygems-update 1.3.5 → 1.3.6
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.
- data.tar.gz.sig +0 -0
- data/.autotest +8 -1
- data/ChangeLog +164 -0
- data/History.txt +52 -1
- data/Manifest.txt +8 -8
- data/README +3 -2
- data/Rakefile +49 -5
- data/bin/gem +2 -2
- data/bin/update_rubygems +9 -11
- data/cruise_config.rb +4 -3
- data/hide_lib_for_update/note.txt +5 -0
- data/lib/rbconfig/datadir.rb +10 -14
- data/lib/rubygems.rb +117 -140
- data/lib/rubygems/builder.rb +4 -2
- data/lib/rubygems/command.rb +51 -48
- data/lib/rubygems/command_manager.rb +2 -0
- data/lib/rubygems/commands/dependency_command.rb +10 -5
- data/lib/rubygems/commands/environment_command.rb +1 -1
- data/lib/rubygems/commands/fetch_command.rb +6 -5
- data/lib/rubygems/commands/install_command.rb +1 -0
- data/lib/rubygems/commands/mirror_command.rb +8 -8
- data/lib/rubygems/commands/owner_command.rb +75 -0
- data/lib/rubygems/commands/pristine_command.rb +1 -1
- data/lib/rubygems/commands/push_command.rb +45 -0
- data/lib/rubygems/commands/query_command.rb +4 -1
- data/lib/rubygems/commands/rdoc_command.rb +24 -9
- data/lib/rubygems/commands/server_command.rb +6 -0
- data/lib/rubygems/commands/setup_command.rb +14 -4
- data/lib/rubygems/commands/unpack_command.rb +2 -2
- data/lib/rubygems/commands/update_command.rb +2 -2
- data/lib/rubygems/commands/which_command.rb +7 -9
- data/lib/rubygems/config_file.rb +100 -26
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency.rb +133 -75
- data/lib/rubygems/dependency_installer.rb +28 -10
- data/lib/rubygems/dependency_list.rb +41 -12
- data/lib/rubygems/doc_manager.rb +7 -0
- data/lib/rubygems/format.rb +16 -20
- data/lib/rubygems/gem_openssl.rb +1 -1
- data/lib/rubygems/gem_path_searcher.rb +10 -12
- data/lib/rubygems/gemcutter_utilities.rb +49 -0
- data/lib/rubygems/indexer.rb +2 -2
- data/lib/rubygems/install_update_options.rb +1 -9
- data/lib/rubygems/installer.rb +35 -76
- data/lib/rubygems/local_remote_options.rb +1 -2
- data/lib/rubygems/package.rb +0 -1
- data/lib/rubygems/package/tar_input.rb +3 -1
- data/lib/rubygems/package_task.rb +16 -11
- data/lib/rubygems/remote_fetcher.rb +22 -8
- data/lib/rubygems/requirement.rb +78 -100
- data/lib/rubygems/server.rb +41 -10
- data/lib/rubygems/source_index.rb +5 -5
- data/lib/rubygems/spec_fetcher.rb +2 -2
- data/lib/rubygems/specification.rb +66 -16
- data/lib/rubygems/test_utilities.rb +33 -4
- data/lib/rubygems/uninstaller.rb +3 -3
- data/lib/rubygems/user_interaction.rb +45 -0
- data/lib/rubygems/validator.rb +6 -7
- data/lib/rubygems/version.rb +206 -149
- data/lib/rubygems/version_option.rb +16 -0
- data/test/fake_certlib/openssl.rb +1 -1
- data/test/functional.rb +0 -7
- data/test/gem_installer_test_case.rb +4 -4
- data/test/gem_package_tar_test_case.rb +1 -1
- data/test/gemutilities.rb +35 -31
- data/test/insure_session.rb +0 -8
- data/test/mockgemui.rb +0 -8
- data/test/simple_gem.rb +2 -8
- data/test/test_config.rb +3 -10
- data/test/test_gem.rb +9 -14
- data/test/test_gem_builder.rb +1 -7
- data/test/test_gem_command.rb +1 -8
- data/test/test_gem_command_manager.rb +1 -7
- data/test/test_gem_commands_build_command.rb +4 -4
- data/test/test_gem_commands_cert_command.rb +1 -2
- data/test/test_gem_commands_check_command.rb +1 -7
- data/test/test_gem_commands_contents_command.rb +1 -1
- data/test/test_gem_commands_dependency_command.rb +17 -31
- data/test/test_gem_commands_environment_command.rb +1 -1
- data/test/test_gem_commands_fetch_command.rb +14 -12
- data/test/test_gem_commands_generate_index_command.rb +1 -1
- data/test/test_gem_commands_install_command.rb +22 -20
- data/test/test_gem_commands_list_command.rb +1 -1
- data/test/test_gem_commands_lock_command.rb +1 -1
- data/test/test_gem_commands_mirror_command.rb +5 -5
- data/test/test_gem_commands_outdated_command.rb +3 -5
- data/test/test_gem_commands_owner_command.rb +105 -0
- data/test/test_gem_commands_pristine_command.rb +2 -2
- data/test/test_gem_commands_push_command.rb +61 -0
- data/test/test_gem_commands_query_command.rb +23 -56
- data/test/test_gem_commands_server_command.rb +1 -1
- data/test/test_gem_commands_sources_command.rb +1 -70
- data/test/test_gem_commands_specification_command.rb +3 -4
- data/test/test_gem_commands_stale_command.rb +1 -1
- data/test/test_gem_commands_uninstall_command.rb +3 -4
- data/test/test_gem_commands_unpack_command.rb +1 -1
- data/test/test_gem_commands_update_command.rb +13 -13
- data/test/test_gem_commands_which_command.rb +66 -0
- data/test/test_gem_config_file.rb +13 -7
- data/test/test_gem_dependency.rb +82 -134
- data/test/test_gem_dependency_installer.rb +55 -30
- data/test/test_gem_dependency_list.rb +28 -7
- data/test/test_gem_doc_manager.rb +1 -7
- data/test/test_gem_ext_configure_builder.rb +2 -2
- data/test/test_gem_ext_ext_conf_builder.rb +1 -1
- data/test/test_gem_ext_rake_builder.rb +1 -1
- data/test/test_gem_format.rb +14 -11
- data/test/test_gem_gem_path_searcher.rb +12 -1
- data/test/test_gem_gem_runner.rb +1 -1
- data/test/test_gem_gemcutter_utilities.rb +103 -0
- data/test/test_gem_indexer.rb +44 -51
- data/test/test_gem_install_update_options.rb +1 -7
- data/test/test_gem_installer.rb +22 -82
- data/test/test_gem_local_remote_options.rb +1 -1
- data/test/test_gem_package_tar_header.rb +1 -8
- data/test/test_gem_package_tar_input.rb +1 -8
- data/test/test_gem_package_tar_output.rb +1 -8
- data/test/test_gem_package_tar_reader.rb +1 -8
- data/test/test_gem_package_tar_reader_entry.rb +1 -8
- data/test/test_gem_package_tar_writer.rb +1 -8
- data/test/test_gem_package_task.rb +1 -25
- data/test/test_gem_platform.rb +4 -4
- data/test/test_gem_remote_fetcher.rb +31 -21
- data/test/test_gem_requirement.rb +210 -140
- data/test/test_gem_server.rb +36 -1
- data/test/test_gem_source_index.rb +7 -13
- data/test/test_gem_spec_fetcher.rb +17 -47
- data/test/test_gem_specification.rb +7 -20
- data/test/test_gem_stream_ui.rb +21 -1
- data/test/test_gem_uninstaller.rb +1 -2
- data/test/test_gem_validator.rb +2 -8
- data/test/test_gem_version.rb +110 -254
- data/test/test_gem_version_option.rb +1 -1
- data/test/test_kernel.rb +1 -7
- data/util/CL2notes +1 -1
- data/util/gem_prelude.rb.template +64 -41
- metadata +33 -71
- metadata.gz.sig +0 -0
- data/lib/rubygems/digest/digest_adapter.rb +0 -49
- data/lib/rubygems/digest/md5.rb +0 -23
- data/lib/rubygems/digest/sha1.rb +0 -22
- data/lib/rubygems/digest/sha2.rb +0 -22
- data/lib/rubygems/timer.rb +0 -28
- data/test/test_gem_digest.rb +0 -46
- data/test/test_gem_source_info_cache.rb +0 -447
- data/test/test_gem_source_info_cache_entry.rb +0 -78
data/lib/rubygems/builder.rb
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
class Gem::Builder
|
12
12
|
|
13
13
|
include Gem::UserInteraction
|
14
|
+
|
14
15
|
##
|
15
16
|
# Constructs a builder instance for the provided specification
|
16
17
|
#
|
@@ -33,7 +34,7 @@ class Gem::Builder
|
|
33
34
|
@spec.validate
|
34
35
|
@signer = sign
|
35
36
|
write_package
|
36
|
-
say success
|
37
|
+
say success if Gem.configuration.verbose
|
37
38
|
@spec.file_name
|
38
39
|
end
|
39
40
|
|
@@ -42,7 +43,7 @@ class Gem::Builder
|
|
42
43
|
Successfully built RubyGem
|
43
44
|
Name: #{@spec.name}
|
44
45
|
Version: #{@spec.version}
|
45
|
-
File: #{@spec.
|
46
|
+
File: #{@spec.file_name}
|
46
47
|
EOM
|
47
48
|
end
|
48
49
|
|
@@ -86,5 +87,6 @@ EOM
|
|
86
87
|
end
|
87
88
|
end
|
88
89
|
end
|
90
|
+
|
89
91
|
end
|
90
92
|
|
data/lib/rubygems/command.rb
CHANGED
@@ -49,7 +49,7 @@ class Gem::Command
|
|
49
49
|
def self.build_args
|
50
50
|
@build_args ||= []
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def self.build_args=(value)
|
54
54
|
@build_args = value
|
55
55
|
end
|
@@ -160,8 +160,8 @@ class Gem::Command
|
|
160
160
|
end
|
161
161
|
|
162
162
|
##
|
163
|
-
# Get
|
164
|
-
#
|
163
|
+
# Get a single gem name from the command line. Fail if there is no gem name
|
164
|
+
# or if there is more than one gem name given.
|
165
165
|
|
166
166
|
def get_one_gem_name
|
167
167
|
args = options[:args]
|
@@ -197,7 +197,7 @@ class Gem::Command
|
|
197
197
|
# def usage
|
198
198
|
# "#{program_name} FILE [FILE ...]"
|
199
199
|
# end
|
200
|
-
#
|
200
|
+
#
|
201
201
|
# def arguments
|
202
202
|
# "FILE name of file to find"
|
203
203
|
# end
|
@@ -248,11 +248,12 @@ class Gem::Command
|
|
248
248
|
# Invoke the command with the given list of arguments.
|
249
249
|
|
250
250
|
def invoke(*args)
|
251
|
-
handle_options
|
252
|
-
|
251
|
+
handle_options args
|
252
|
+
|
253
|
+
if options[:help] then
|
253
254
|
show_help
|
254
|
-
elsif @when_invoked
|
255
|
-
@when_invoked.call
|
255
|
+
elsif @when_invoked then
|
256
|
+
@when_invoked.call options
|
256
257
|
else
|
257
258
|
execute
|
258
259
|
end
|
@@ -362,37 +363,39 @@ class Gem::Command
|
|
362
363
|
def create_option_parser
|
363
364
|
@parser = OptionParser.new
|
364
365
|
|
365
|
-
@parser.separator
|
366
|
+
@parser.separator nil
|
366
367
|
regular_options = @option_groups.delete :options
|
367
368
|
|
368
369
|
configure_options "", regular_options
|
369
370
|
|
370
371
|
@option_groups.sort_by { |n,_| n.to_s }.each do |group_name, option_list|
|
372
|
+
@parser.separator nil
|
371
373
|
configure_options group_name, option_list
|
372
374
|
end
|
373
375
|
|
376
|
+
@parser.separator nil
|
374
377
|
configure_options "Common", Gem::Command.common_options
|
375
378
|
|
376
|
-
@parser.separator("")
|
377
379
|
unless arguments.empty?
|
378
|
-
@parser.separator
|
380
|
+
@parser.separator nil
|
381
|
+
@parser.separator " Arguments:"
|
379
382
|
arguments.split(/\n/).each do |arg_desc|
|
380
|
-
@parser.separator
|
383
|
+
@parser.separator " #{arg_desc}"
|
381
384
|
end
|
382
|
-
@parser.separator("")
|
383
385
|
end
|
384
386
|
|
385
|
-
@parser.separator
|
387
|
+
@parser.separator nil
|
388
|
+
@parser.separator " Summary:"
|
386
389
|
wrap(@summary, 80 - 4).split("\n").each do |line|
|
387
|
-
@parser.separator
|
390
|
+
@parser.separator " #{line.strip}"
|
388
391
|
end
|
389
392
|
|
390
393
|
if description then
|
391
394
|
formatted = description.split("\n\n").map do |chunk|
|
392
|
-
wrap
|
393
|
-
end.join
|
395
|
+
wrap chunk, 80 - 4
|
396
|
+
end.join "\n"
|
394
397
|
|
395
|
-
@parser.separator
|
398
|
+
@parser.separator nil
|
396
399
|
@parser.separator " Description:"
|
397
400
|
formatted.split("\n").each do |line|
|
398
401
|
@parser.separator " #{line.rstrip}"
|
@@ -400,10 +403,10 @@ class Gem::Command
|
|
400
403
|
end
|
401
404
|
|
402
405
|
unless defaults_str.empty?
|
403
|
-
@parser.separator
|
404
|
-
@parser.separator
|
406
|
+
@parser.separator nil
|
407
|
+
@parser.separator " Defaults:"
|
405
408
|
defaults_str.split(/\n/).each do |line|
|
406
|
-
@parser.separator
|
409
|
+
@parser.separator " #{line}"
|
407
410
|
end
|
408
411
|
end
|
409
412
|
end
|
@@ -471,33 +474,33 @@ class Gem::Command
|
|
471
474
|
|
472
475
|
# :stopdoc:
|
473
476
|
|
474
|
-
HELP =
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
477
|
+
HELP = <<-HELP
|
478
|
+
RubyGems is a sophisticated package manager for Ruby. This is a
|
479
|
+
basic help message containing pointers to more information.
|
480
|
+
|
481
|
+
Usage:
|
482
|
+
gem -h/--help
|
483
|
+
gem -v/--version
|
484
|
+
gem command [arguments...] [options...]
|
485
|
+
|
486
|
+
Examples:
|
487
|
+
gem install rake
|
488
|
+
gem list --local
|
489
|
+
gem build package.gemspec
|
490
|
+
gem help install
|
491
|
+
|
492
|
+
Further help:
|
493
|
+
gem help commands list all 'gem' commands
|
494
|
+
gem help examples show some examples of usage
|
495
|
+
gem help platforms show information about platforms
|
496
|
+
gem help <COMMAND> show help on COMMAND
|
497
|
+
(e.g. 'gem help install')
|
498
|
+
gem server present a web page at
|
499
|
+
http://localhost:8808/
|
500
|
+
with info about installed gems
|
501
|
+
Further information:
|
502
|
+
http://rubygems.rubyforge.org
|
503
|
+
HELP
|
501
504
|
|
502
505
|
# :startdoc:
|
503
506
|
|
@@ -58,7 +58,9 @@ class Gem::CommandManager
|
|
58
58
|
register_command :lock
|
59
59
|
register_command :mirror
|
60
60
|
register_command :outdated
|
61
|
+
register_command :owner
|
61
62
|
register_command :pristine
|
63
|
+
register_command :push
|
62
64
|
register_command :query
|
63
65
|
register_command :rdoc
|
64
66
|
register_command :search
|
@@ -15,6 +15,7 @@ class Gem::Commands::DependencyCommand < Gem::Command
|
|
15
15
|
|
16
16
|
add_version_option
|
17
17
|
add_platform_option
|
18
|
+
add_prerelease_option
|
18
19
|
|
19
20
|
add_option('-R', '--[no-]reverse-dependencies',
|
20
21
|
'Include reverse dependencies in the output') do
|
@@ -59,6 +60,7 @@ class Gem::Commands::DependencyCommand < Gem::Command
|
|
59
60
|
end
|
60
61
|
|
61
62
|
dependency = Gem::Dependency.new pattern, options[:version]
|
63
|
+
dependency.prerelease = options[:prerelease]
|
62
64
|
|
63
65
|
if options[:reverse_dependencies] and remote? and not local? then
|
64
66
|
alert_error 'Only reverse dependencies for local gems are supported.'
|
@@ -75,7 +77,10 @@ class Gem::Commands::DependencyCommand < Gem::Command
|
|
75
77
|
fetcher = Gem::SpecFetcher.fetcher
|
76
78
|
|
77
79
|
begin
|
78
|
-
fetcher.find_matching(dependency
|
80
|
+
specs_and_sources = fetcher.find_matching(dependency, false, true,
|
81
|
+
dependency.prerelease?)
|
82
|
+
|
83
|
+
specs_and_sources.each do |spec_tuple, source_uri|
|
79
84
|
spec = fetcher.fetch_spec spec_tuple, URI.parse(source_uri)
|
80
85
|
|
81
86
|
source_indexes[source_uri].add_spec spec
|
@@ -120,8 +125,8 @@ class Gem::Commands::DependencyCommand < Gem::Command
|
|
120
125
|
if options[:pipe_format] then
|
121
126
|
specs.values.sort_by { |_, spec| spec }.each do |_, spec|
|
122
127
|
unless spec.dependencies.empty?
|
123
|
-
spec.dependencies.each do |dep|
|
124
|
-
say "#{dep.name} --version '#{dep.
|
128
|
+
spec.dependencies.sort_by { |dep| dep.name }.each do |dep|
|
129
|
+
say "#{dep.name} --version '#{dep.requirement}'"
|
125
130
|
end
|
126
131
|
end
|
127
132
|
end
|
@@ -147,7 +152,7 @@ class Gem::Commands::DependencyCommand < Gem::Command
|
|
147
152
|
response = ''
|
148
153
|
response << ' ' * level + "Gem #{spec.full_name}\n"
|
149
154
|
unless spec.dependencies.empty? then
|
150
|
-
spec.dependencies.each do |dep|
|
155
|
+
spec.dependencies.sort_by { |dep| dep.name }.each do |dep|
|
151
156
|
response << ' ' * level + " #{dep}\n"
|
152
157
|
end
|
153
158
|
end
|
@@ -163,7 +168,7 @@ class Gem::Commands::DependencyCommand < Gem::Command
|
|
163
168
|
dep = Gem::Dependency.new(*dep) unless Gem::Dependency === dep
|
164
169
|
|
165
170
|
if spec.name == dep.name and
|
166
|
-
dep.
|
171
|
+
dep.requirement.satisfied_by?(spec.version) then
|
167
172
|
result << [sp.full_name, dep]
|
168
173
|
end
|
169
174
|
end
|
@@ -17,6 +17,7 @@ class Gem::Commands::FetchCommand < Gem::Command
|
|
17
17
|
|
18
18
|
add_version_option
|
19
19
|
add_platform_option
|
20
|
+
add_prerelease_option
|
20
21
|
end
|
21
22
|
|
22
23
|
def arguments # :nodoc:
|
@@ -39,12 +40,12 @@ class Gem::Commands::FetchCommand < Gem::Command
|
|
39
40
|
|
40
41
|
gem_names.each do |gem_name|
|
41
42
|
dep = Gem::Dependency.new gem_name, version
|
43
|
+
dep.prerelease = options[:prerelease]
|
42
44
|
|
43
|
-
specs_and_sources = Gem::SpecFetcher.fetcher.fetch
|
45
|
+
specs_and_sources = Gem::SpecFetcher.fetcher.fetch(dep, false, true,
|
46
|
+
dep.prerelease?)
|
44
47
|
|
45
|
-
specs_and_sources.sort_by { |
|
46
|
-
|
47
|
-
spec, source_uri = specs_and_sources.last
|
48
|
+
spec, source_uri = specs_and_sources.sort_by { |s,| s.version }.last
|
48
49
|
|
49
50
|
if spec.nil? then
|
50
51
|
alert_error "Could not find #{gem_name} in any repository"
|
@@ -52,7 +53,7 @@ class Gem::Commands::FetchCommand < Gem::Command
|
|
52
53
|
end
|
53
54
|
|
54
55
|
path = Gem::RemoteFetcher.fetcher.download spec, source_uri
|
55
|
-
FileUtils.mv path,
|
56
|
+
FileUtils.mv path, spec.file_name
|
56
57
|
|
57
58
|
say "Downloaded #{spec.full_name}"
|
58
59
|
end
|
@@ -51,7 +51,7 @@ Multiple sources and destinations may be specified.
|
|
51
51
|
Dir.mkdir gems_dir
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
source_index_data = ''
|
55
55
|
|
56
56
|
say "fetching: #{get_from}/Marshal.#{Gem.marshal_version}.Z"
|
57
57
|
|
@@ -70,18 +70,18 @@ Multiple sources and destinations may be specified.
|
|
70
70
|
end
|
71
71
|
|
72
72
|
open File.join(get_from.to_s, "Marshal.#{Gem.marshal_version}.Z"), "rb" do |y|
|
73
|
-
|
73
|
+
source_index_data = Zlib::Inflate.inflate y.read
|
74
74
|
open File.join(save_to, "Marshal.#{Gem.marshal_version}"), "wb" do |out|
|
75
|
-
out.write
|
75
|
+
out.write source_index_data
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
|
79
|
+
source_index = Marshal.load source_index_data
|
80
80
|
|
81
|
-
progress = ui.progress_reporter
|
82
|
-
"Fetching #{
|
83
|
-
|
84
|
-
gem_file =
|
81
|
+
progress = ui.progress_reporter source_index.size,
|
82
|
+
"Fetching #{source_index.size} gems"
|
83
|
+
source_index.each do |fullname, gem|
|
84
|
+
gem_file = gem.file_name
|
85
85
|
gem_dest = File.join gems_dir, gem_file
|
86
86
|
|
87
87
|
unless File.exist? gem_dest then
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rubygems/command'
|
2
|
+
require 'rubygems/local_remote_options'
|
3
|
+
require 'rubygems/gemcutter_utilities'
|
4
|
+
|
5
|
+
class Gem::Commands::OwnerCommand < Gem::Command
|
6
|
+
include Gem::LocalRemoteOptions
|
7
|
+
include Gem::GemcutterUtilities
|
8
|
+
|
9
|
+
def description # :nodoc:
|
10
|
+
'Manage gem owners on RubyGems.org.'
|
11
|
+
end
|
12
|
+
|
13
|
+
def arguments # :nodoc:
|
14
|
+
"GEM gem to manage owners for"
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
super 'owner', description
|
19
|
+
add_proxy_option
|
20
|
+
defaults.merge! :add => [], :remove => []
|
21
|
+
|
22
|
+
add_option '-a', '--add EMAIL', 'Add an owner' do |value, options|
|
23
|
+
options[:add] << value
|
24
|
+
end
|
25
|
+
|
26
|
+
add_option '-r', '--remove EMAIL', 'Remove an owner' do |value, options|
|
27
|
+
options[:remove] << value
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute
|
32
|
+
sign_in
|
33
|
+
name = get_one_gem_name
|
34
|
+
|
35
|
+
add_owners name, options[:add]
|
36
|
+
remove_owners name, options[:remove]
|
37
|
+
show_owners name
|
38
|
+
end
|
39
|
+
|
40
|
+
def show_owners name
|
41
|
+
response = rubygems_api_request :get, "api/v1/gems/#{name}/owners.yaml" do |request|
|
42
|
+
request.add_field "Authorization", Gem.configuration.rubygems_api_key
|
43
|
+
end
|
44
|
+
|
45
|
+
with_response response do |resp|
|
46
|
+
owners = YAML.load resp.body
|
47
|
+
|
48
|
+
say "Owners for gem: #{name}"
|
49
|
+
owners.each do |owner|
|
50
|
+
say "- #{owner['email']}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def add_owners name, owners
|
56
|
+
manage_owners :post, name, owners
|
57
|
+
end
|
58
|
+
|
59
|
+
def remove_owners name, owners
|
60
|
+
manage_owners :delete, name, owners
|
61
|
+
end
|
62
|
+
|
63
|
+
def manage_owners method, name, owners
|
64
|
+
owners.each do |owner|
|
65
|
+
response = rubygems_api_request method, "api/v1/gems/#{name}/owners" do |request|
|
66
|
+
request.set_form_data 'email' => owner
|
67
|
+
request.add_field "Authorization", Gem.configuration.rubygems_api_key
|
68
|
+
end
|
69
|
+
|
70
|
+
with_response response
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
@@ -74,7 +74,7 @@ revert the gem.
|
|
74
74
|
say "Restoring gem(s) to pristine condition..."
|
75
75
|
|
76
76
|
specs.each do |spec|
|
77
|
-
gem = Dir[File.join(Gem.dir, 'cache',
|
77
|
+
gem = Dir[File.join(Gem.dir, 'cache', spec.file_name)].first
|
78
78
|
|
79
79
|
if gem.nil? then
|
80
80
|
alert_error "Cached gem for #{spec.full_name} not found, use `gem install` to restore"
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems/command'
|
2
|
+
require 'rubygems/local_remote_options'
|
3
|
+
require 'rubygems/gemcutter_utilities'
|
4
|
+
|
5
|
+
class Gem::Commands::PushCommand < Gem::Command
|
6
|
+
include Gem::LocalRemoteOptions
|
7
|
+
include Gem::GemcutterUtilities
|
8
|
+
|
9
|
+
def description # :nodoc:
|
10
|
+
'Push a gem up to RubyGems.org'
|
11
|
+
end
|
12
|
+
|
13
|
+
def arguments # :nodoc:
|
14
|
+
"GEM built gem to push up"
|
15
|
+
end
|
16
|
+
|
17
|
+
def usage # :nodoc:
|
18
|
+
"#{program_name} GEM"
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
super 'push', description
|
23
|
+
add_proxy_option
|
24
|
+
end
|
25
|
+
|
26
|
+
def execute
|
27
|
+
sign_in
|
28
|
+
send_gem get_one_gem_name
|
29
|
+
end
|
30
|
+
|
31
|
+
def send_gem name
|
32
|
+
say "Pushing gem to RubyGems.org..."
|
33
|
+
|
34
|
+
response = rubygems_api_request :post, "api/v1/gems" do |request|
|
35
|
+
request.body = Gem.read_binary name
|
36
|
+
request.add_field "Content-Length", request.body.size
|
37
|
+
request.add_field "Content-Type", "application/octet-stream"
|
38
|
+
request.add_field "Authorization", Gem.configuration.rubygems_api_key
|
39
|
+
end
|
40
|
+
|
41
|
+
with_response response
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|