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.

Files changed (146) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +8 -1
  3. data/ChangeLog +164 -0
  4. data/History.txt +52 -1
  5. data/Manifest.txt +8 -8
  6. data/README +3 -2
  7. data/Rakefile +49 -5
  8. data/bin/gem +2 -2
  9. data/bin/update_rubygems +9 -11
  10. data/cruise_config.rb +4 -3
  11. data/hide_lib_for_update/note.txt +5 -0
  12. data/lib/rbconfig/datadir.rb +10 -14
  13. data/lib/rubygems.rb +117 -140
  14. data/lib/rubygems/builder.rb +4 -2
  15. data/lib/rubygems/command.rb +51 -48
  16. data/lib/rubygems/command_manager.rb +2 -0
  17. data/lib/rubygems/commands/dependency_command.rb +10 -5
  18. data/lib/rubygems/commands/environment_command.rb +1 -1
  19. data/lib/rubygems/commands/fetch_command.rb +6 -5
  20. data/lib/rubygems/commands/install_command.rb +1 -0
  21. data/lib/rubygems/commands/mirror_command.rb +8 -8
  22. data/lib/rubygems/commands/owner_command.rb +75 -0
  23. data/lib/rubygems/commands/pristine_command.rb +1 -1
  24. data/lib/rubygems/commands/push_command.rb +45 -0
  25. data/lib/rubygems/commands/query_command.rb +4 -1
  26. data/lib/rubygems/commands/rdoc_command.rb +24 -9
  27. data/lib/rubygems/commands/server_command.rb +6 -0
  28. data/lib/rubygems/commands/setup_command.rb +14 -4
  29. data/lib/rubygems/commands/unpack_command.rb +2 -2
  30. data/lib/rubygems/commands/update_command.rb +2 -2
  31. data/lib/rubygems/commands/which_command.rb +7 -9
  32. data/lib/rubygems/config_file.rb +100 -26
  33. data/lib/rubygems/defaults.rb +1 -1
  34. data/lib/rubygems/dependency.rb +133 -75
  35. data/lib/rubygems/dependency_installer.rb +28 -10
  36. data/lib/rubygems/dependency_list.rb +41 -12
  37. data/lib/rubygems/doc_manager.rb +7 -0
  38. data/lib/rubygems/format.rb +16 -20
  39. data/lib/rubygems/gem_openssl.rb +1 -1
  40. data/lib/rubygems/gem_path_searcher.rb +10 -12
  41. data/lib/rubygems/gemcutter_utilities.rb +49 -0
  42. data/lib/rubygems/indexer.rb +2 -2
  43. data/lib/rubygems/install_update_options.rb +1 -9
  44. data/lib/rubygems/installer.rb +35 -76
  45. data/lib/rubygems/local_remote_options.rb +1 -2
  46. data/lib/rubygems/package.rb +0 -1
  47. data/lib/rubygems/package/tar_input.rb +3 -1
  48. data/lib/rubygems/package_task.rb +16 -11
  49. data/lib/rubygems/remote_fetcher.rb +22 -8
  50. data/lib/rubygems/requirement.rb +78 -100
  51. data/lib/rubygems/server.rb +41 -10
  52. data/lib/rubygems/source_index.rb +5 -5
  53. data/lib/rubygems/spec_fetcher.rb +2 -2
  54. data/lib/rubygems/specification.rb +66 -16
  55. data/lib/rubygems/test_utilities.rb +33 -4
  56. data/lib/rubygems/uninstaller.rb +3 -3
  57. data/lib/rubygems/user_interaction.rb +45 -0
  58. data/lib/rubygems/validator.rb +6 -7
  59. data/lib/rubygems/version.rb +206 -149
  60. data/lib/rubygems/version_option.rb +16 -0
  61. data/test/fake_certlib/openssl.rb +1 -1
  62. data/test/functional.rb +0 -7
  63. data/test/gem_installer_test_case.rb +4 -4
  64. data/test/gem_package_tar_test_case.rb +1 -1
  65. data/test/gemutilities.rb +35 -31
  66. data/test/insure_session.rb +0 -8
  67. data/test/mockgemui.rb +0 -8
  68. data/test/simple_gem.rb +2 -8
  69. data/test/test_config.rb +3 -10
  70. data/test/test_gem.rb +9 -14
  71. data/test/test_gem_builder.rb +1 -7
  72. data/test/test_gem_command.rb +1 -8
  73. data/test/test_gem_command_manager.rb +1 -7
  74. data/test/test_gem_commands_build_command.rb +4 -4
  75. data/test/test_gem_commands_cert_command.rb +1 -2
  76. data/test/test_gem_commands_check_command.rb +1 -7
  77. data/test/test_gem_commands_contents_command.rb +1 -1
  78. data/test/test_gem_commands_dependency_command.rb +17 -31
  79. data/test/test_gem_commands_environment_command.rb +1 -1
  80. data/test/test_gem_commands_fetch_command.rb +14 -12
  81. data/test/test_gem_commands_generate_index_command.rb +1 -1
  82. data/test/test_gem_commands_install_command.rb +22 -20
  83. data/test/test_gem_commands_list_command.rb +1 -1
  84. data/test/test_gem_commands_lock_command.rb +1 -1
  85. data/test/test_gem_commands_mirror_command.rb +5 -5
  86. data/test/test_gem_commands_outdated_command.rb +3 -5
  87. data/test/test_gem_commands_owner_command.rb +105 -0
  88. data/test/test_gem_commands_pristine_command.rb +2 -2
  89. data/test/test_gem_commands_push_command.rb +61 -0
  90. data/test/test_gem_commands_query_command.rb +23 -56
  91. data/test/test_gem_commands_server_command.rb +1 -1
  92. data/test/test_gem_commands_sources_command.rb +1 -70
  93. data/test/test_gem_commands_specification_command.rb +3 -4
  94. data/test/test_gem_commands_stale_command.rb +1 -1
  95. data/test/test_gem_commands_uninstall_command.rb +3 -4
  96. data/test/test_gem_commands_unpack_command.rb +1 -1
  97. data/test/test_gem_commands_update_command.rb +13 -13
  98. data/test/test_gem_commands_which_command.rb +66 -0
  99. data/test/test_gem_config_file.rb +13 -7
  100. data/test/test_gem_dependency.rb +82 -134
  101. data/test/test_gem_dependency_installer.rb +55 -30
  102. data/test/test_gem_dependency_list.rb +28 -7
  103. data/test/test_gem_doc_manager.rb +1 -7
  104. data/test/test_gem_ext_configure_builder.rb +2 -2
  105. data/test/test_gem_ext_ext_conf_builder.rb +1 -1
  106. data/test/test_gem_ext_rake_builder.rb +1 -1
  107. data/test/test_gem_format.rb +14 -11
  108. data/test/test_gem_gem_path_searcher.rb +12 -1
  109. data/test/test_gem_gem_runner.rb +1 -1
  110. data/test/test_gem_gemcutter_utilities.rb +103 -0
  111. data/test/test_gem_indexer.rb +44 -51
  112. data/test/test_gem_install_update_options.rb +1 -7
  113. data/test/test_gem_installer.rb +22 -82
  114. data/test/test_gem_local_remote_options.rb +1 -1
  115. data/test/test_gem_package_tar_header.rb +1 -8
  116. data/test/test_gem_package_tar_input.rb +1 -8
  117. data/test/test_gem_package_tar_output.rb +1 -8
  118. data/test/test_gem_package_tar_reader.rb +1 -8
  119. data/test/test_gem_package_tar_reader_entry.rb +1 -8
  120. data/test/test_gem_package_tar_writer.rb +1 -8
  121. data/test/test_gem_package_task.rb +1 -25
  122. data/test/test_gem_platform.rb +4 -4
  123. data/test/test_gem_remote_fetcher.rb +31 -21
  124. data/test/test_gem_requirement.rb +210 -140
  125. data/test/test_gem_server.rb +36 -1
  126. data/test/test_gem_source_index.rb +7 -13
  127. data/test/test_gem_spec_fetcher.rb +17 -47
  128. data/test/test_gem_specification.rb +7 -20
  129. data/test/test_gem_stream_ui.rb +21 -1
  130. data/test/test_gem_uninstaller.rb +1 -2
  131. data/test/test_gem_validator.rb +2 -8
  132. data/test/test_gem_version.rb +110 -254
  133. data/test/test_gem_version_option.rb +1 -1
  134. data/test/test_kernel.rb +1 -7
  135. data/util/CL2notes +1 -1
  136. data/util/gem_prelude.rb.template +64 -41
  137. metadata +33 -71
  138. metadata.gz.sig +0 -0
  139. data/lib/rubygems/digest/digest_adapter.rb +0 -49
  140. data/lib/rubygems/digest/md5.rb +0 -23
  141. data/lib/rubygems/digest/sha1.rb +0 -22
  142. data/lib/rubygems/digest/sha2.rb +0 -22
  143. data/lib/rubygems/timer.rb +0 -28
  144. data/test/test_gem_digest.rb +0 -46
  145. data/test/test_gem_source_info_cache.rb +0 -447
  146. data/test/test_gem_source_info_cache_entry.rb +0 -78
@@ -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.full_name+'.gem'}
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
 
@@ -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 the single gem name from the command line. Fail if there is no gem
164
- # name or if there is more than one gem name given.
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(args)
252
- if options[:help]
251
+ handle_options args
252
+
253
+ if options[:help] then
253
254
  show_help
254
- elsif @when_invoked
255
- @when_invoked.call(options)
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(" Arguments:")
380
+ @parser.separator nil
381
+ @parser.separator " Arguments:"
379
382
  arguments.split(/\n/).each do |arg_desc|
380
- @parser.separator(" #{arg_desc}")
383
+ @parser.separator " #{arg_desc}"
381
384
  end
382
- @parser.separator("")
383
385
  end
384
386
 
385
- @parser.separator(" Summary:")
387
+ @parser.separator nil
388
+ @parser.separator " Summary:"
386
389
  wrap(@summary, 80 - 4).split("\n").each do |line|
387
- @parser.separator(" #{line.strip}")
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(chunk, 80 - 4)
393
- end.join("\n")
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(" Defaults:")
406
+ @parser.separator nil
407
+ @parser.separator " Defaults:"
405
408
  defaults_str.split(/\n/).each do |line|
406
- @parser.separator(" #{line}")
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
- RubyGems is a sophisticated package manager for Ruby. This is a
476
- basic help message containing pointers to more information.
477
-
478
- Usage:
479
- gem -h/--help
480
- gem -v/--version
481
- gem command [arguments...] [options...]
482
-
483
- Examples:
484
- gem install rake
485
- gem list --local
486
- gem build package.gemspec
487
- gem help install
488
-
489
- Further help:
490
- gem help commands list all 'gem' commands
491
- gem help examples show some examples of usage
492
- gem help platforms show information about platforms
493
- gem help <COMMAND> show help on COMMAND
494
- (e.g. 'gem help install')
495
- gem server present a web page at
496
- http://localhost:8808/
497
- with info about installed gems
498
- Further information:
499
- http://rubygems.rubyforge.org
500
- }.gsub(/^ /, '')
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).each do |spec_tuple, source_uri|
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.version_requirements}'"
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.version_requirements.satisfied_by?(spec.version) then
171
+ dep.requirement.satisfied_by?(spec.version) then
167
172
  result << [sp.full_name, dep]
168
173
  end
169
174
  end
@@ -118,7 +118,7 @@ lib/rubygems/defaults/operating_system.rb
118
118
  end
119
119
 
120
120
  else
121
- fail Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
121
+ raise Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
122
122
  end
123
123
  say out
124
124
  true
@@ -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 dep, all
45
+ specs_and_sources = Gem::SpecFetcher.fetcher.fetch(dep, false, true,
46
+ dep.prerelease?)
44
47
 
45
- specs_and_sources.sort_by { |spec,| spec.version }
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, "#{spec.full_name}.gem"
56
+ FileUtils.mv path, spec.file_name
56
57
 
57
58
  say "Downloaded #{spec.full_name}"
58
59
  end
@@ -32,6 +32,7 @@ class Gem::Commands::InstallCommand < Gem::Command
32
32
  add_local_remote_options
33
33
  add_platform_option
34
34
  add_version_option
35
+ add_prerelease_option "to be installed. (Only for listed gems)"
35
36
  end
36
37
 
37
38
  def arguments # :nodoc:
@@ -51,7 +51,7 @@ Multiple sources and destinations may be specified.
51
51
  Dir.mkdir gems_dir
52
52
  end
53
53
 
54
- sourceindex_data = ''
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
- sourceindex_data = Zlib::Inflate.inflate y.read
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 sourceindex_data
75
+ out.write source_index_data
76
76
  end
77
77
  end
78
78
 
79
- sourceindex = Marshal.load(sourceindex_data)
79
+ source_index = Marshal.load source_index_data
80
80
 
81
- progress = ui.progress_reporter sourceindex.size,
82
- "Fetching #{sourceindex.size} gems"
83
- sourceindex.each do |fullname, gem|
84
- gem_file = "#{fullname}.gem"
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', "#{spec.full_name}.gem")].first
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
+