rubygems-update 2.1.0.rc.1 → 2.1.0.rc.2

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 (63) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/History.txt +11 -3
  5. data/Manifest.txt +1 -0
  6. data/Rakefile +22 -18
  7. data/lib/rubygems.rb +8 -10
  8. data/lib/rubygems/basic_specification.rb +112 -108
  9. data/lib/rubygems/commands/build_command.rb +19 -0
  10. data/lib/rubygems/commands/check_command.rb +7 -0
  11. data/lib/rubygems/commands/cleanup_command.rb +5 -5
  12. data/lib/rubygems/commands/contents_command.rb +8 -0
  13. data/lib/rubygems/commands/dependency_command.rb +11 -0
  14. data/lib/rubygems/commands/environment_command.rb +3 -0
  15. data/lib/rubygems/commands/fetch_command.rb +10 -0
  16. data/lib/rubygems/commands/list_command.rb +12 -1
  17. data/lib/rubygems/commands/mirror_command.rb +6 -0
  18. data/lib/rubygems/commands/outdated_command.rb +9 -0
  19. data/lib/rubygems/commands/owner_command.rb +9 -2
  20. data/lib/rubygems/commands/pristine_command.rb +12 -11
  21. data/lib/rubygems/commands/push_command.rb +8 -2
  22. data/lib/rubygems/commands/query_command.rb +9 -0
  23. data/lib/rubygems/commands/rdoc_command.rb +6 -2
  24. data/lib/rubygems/commands/search_command.rb +14 -1
  25. data/lib/rubygems/commands/sources_command.rb +47 -0
  26. data/lib/rubygems/commands/specification_command.rb +16 -0
  27. data/lib/rubygems/commands/stale_command.rb +10 -0
  28. data/lib/rubygems/commands/uninstall_command.rb +19 -6
  29. data/lib/rubygems/commands/unpack_command.rb +18 -0
  30. data/lib/rubygems/commands/update_command.rb +9 -0
  31. data/lib/rubygems/commands/which_command.rb +11 -0
  32. data/lib/rubygems/commands/yank_command.rb +16 -2
  33. data/lib/rubygems/core_ext/kernel_require.rb +4 -4
  34. data/lib/rubygems/defaults.rb +7 -0
  35. data/lib/rubygems/dependency_installer.rb +1 -4
  36. data/lib/rubygems/ext/builder.rb +118 -0
  37. data/lib/rubygems/installer.rb +7 -60
  38. data/lib/rubygems/package_task.rb +5 -2
  39. data/lib/rubygems/remote_fetcher.rb +1 -1
  40. data/lib/rubygems/security/policy.rb +5 -0
  41. data/lib/rubygems/security/signer.rb +19 -1
  42. data/lib/rubygems/source.rb +7 -3
  43. data/lib/rubygems/source/local.rb +5 -4
  44. data/lib/rubygems/source/specific_file.rb +28 -0
  45. data/lib/rubygems/specification.rb +55 -44
  46. data/lib/rubygems/stub_specification.rb +93 -92
  47. data/lib/rubygems/test_case.rb +10 -9
  48. data/test/rubygems/test_gem.rb +27 -0
  49. data/test/rubygems/test_gem_commands_install_command.rb +1 -0
  50. data/test/rubygems/test_gem_commands_uninstall_command.rb +17 -8
  51. data/test/rubygems/test_gem_ext_builder.rb +97 -2
  52. data/test/rubygems/test_gem_installer.rb +0 -89
  53. data/test/rubygems/test_gem_package.rb +6 -8
  54. data/test/rubygems/test_gem_package_task.rb +23 -2
  55. data/test/rubygems/test_gem_security_policy.rb +11 -0
  56. data/test/rubygems/test_gem_security_signer.rb +6 -0
  57. data/test/rubygems/test_gem_source.rb +23 -0
  58. data/test/rubygems/test_gem_source_installed.rb +28 -0
  59. data/test/rubygems/test_gem_source_local.rb +29 -6
  60. data/test/rubygems/test_gem_source_specific_file.rb +38 -0
  61. data/test/rubygems/test_gem_specification.rb +10 -2
  62. metadata +7 -5
  63. metadata.gz.sig +0 -0
@@ -6,7 +6,7 @@ class Gem::Commands::CleanupCommand < Gem::Command
6
6
 
7
7
  def initialize
8
8
  super 'cleanup',
9
- 'Clean up old versions of installed gems in the local repository',
9
+ 'Clean up old versions of installed gems',
10
10
  :force => false, :install_dir => Gem.dir
11
11
 
12
12
  add_option('-n', '-d', '--dryrun',
@@ -33,11 +33,11 @@ class Gem::Commands::CleanupCommand < Gem::Command
33
33
 
34
34
  def description # :nodoc:
35
35
  <<-EOF
36
- The cleanup command removes old gems from GEM_HOME. If an older version is
37
- installed elsewhere in GEM_PATH the cleanup command won't touch it.
36
+ The cleanup command removes old versions of gems from GEM_HOME that are not
37
+ required to meet a dependency. If a gem is installed elsewhere in GEM_PATH
38
+ the cleanup command won't delete it.
38
39
 
39
- Older gems that are required to satisify the dependencies of gems
40
- are not removed.
40
+ If no gems are named all gems in GEM_HOME are cleaned.
41
41
  EOF
42
42
  end
43
43
 
@@ -45,6 +45,14 @@ class Gem::Commands::ContentsCommand < Gem::Command
45
45
  "--no-lib-only --prefix"
46
46
  end
47
47
 
48
+ def description # :nodoc:
49
+ <<-EOF
50
+ The contents command lists the files in an installed gem. The listing can
51
+ be given as full file names, file names without the installed directory
52
+ prefix or only the files that are requireable.
53
+ EOF
54
+ end
55
+
48
56
  def usage # :nodoc:
49
57
  "#{program_name} GEMNAME [GEMNAME ...]"
50
58
  end
@@ -38,6 +38,17 @@ class Gem::Commands::DependencyCommand < Gem::Command
38
38
  "--local --version '#{Gem::Requirement.default}' --no-reverse-dependencies"
39
39
  end
40
40
 
41
+ def description # :nodoc:
42
+ <<-EOF
43
+ The dependency commands lists which other gems a given gem depends on. For
44
+ local gems only the reverse dependencies can be shown (which gems depend on
45
+ the named gem).
46
+
47
+ The dependency list can be displayed in a format suitable for piping for
48
+ use with other commands.
49
+ EOF
50
+ end
51
+
41
52
  def usage # :nodoc:
42
53
  "#{program_name} GEMNAME"
43
54
  end
@@ -21,6 +21,9 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
21
21
 
22
22
  def description # :nodoc:
23
23
  <<-EOF
24
+ The environment command lets you query rubygems for its configuration for
25
+ use in shell scripts or as a debugging aid.
26
+
24
27
  The RubyGems environment can be controlled through command line arguments,
25
28
  gemrc files, environment variables and built-in defaults.
26
29
 
@@ -28,6 +28,16 @@ class Gem::Commands::FetchCommand < Gem::Command
28
28
  "--version '#{Gem::Requirement.default}'"
29
29
  end
30
30
 
31
+ def description # :nodoc:
32
+ <<-EOF
33
+ The fetch command fetches gem files that can be stored for later use or
34
+ unpacked to examine their contents.
35
+
36
+ See the build command help for an example of unpacking a gem, modifying it,
37
+ then repackaging it.
38
+ EOF
39
+ end
40
+
31
41
  def usage # :nodoc:
32
42
  "#{program_name} GEMNAME [GEMNAME ...]"
33
43
  end
@@ -8,7 +8,7 @@ require 'rubygems/commands/query_command'
8
8
  class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
9
9
 
10
10
  def initialize
11
- super 'list', 'Display gems whose name starts with STRING'
11
+ super 'list', 'Display local gems whose name starts with STRING'
12
12
 
13
13
  remove_option('--name-matches')
14
14
  end
@@ -21,6 +21,17 @@ class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
21
21
  "--local --no-details"
22
22
  end
23
23
 
24
+ def description # :nodoc:
25
+ <<-EOF
26
+ The list command is used to view the gems you have installed locally.
27
+
28
+ The --details option displays additional details including the summary, the
29
+ homepage, the author, the locations of different versions of the gem.
30
+
31
+ To search for remote gems use the search command.
32
+ EOF
33
+ end
34
+
24
35
  def usage # :nodoc:
25
36
  "#{program_name} [STRING]"
26
37
  end
@@ -10,6 +10,12 @@ class Gem::Commands::MirrorCommand < Gem::Command
10
10
  end
11
11
  end
12
12
 
13
+ def description # :nodoc:
14
+ <<-EOF
15
+ The mirror command has been moved to the rubygems-mirror gem.
16
+ EOF
17
+ end
18
+
13
19
  def execute
14
20
  alert_error "Install the rubygems-mirror gem for the mirror command"
15
21
  end
@@ -15,6 +15,15 @@ class Gem::Commands::OutdatedCommand < Gem::Command
15
15
  add_platform_option
16
16
  end
17
17
 
18
+ def description # :nodoc:
19
+ <<-EOF
20
+ The outdated command lists gems you way wish to upgrade to a newer version.
21
+
22
+ You can check for dependency mismatches using the dependency command and
23
+ update the gems with the update or install commands.
24
+ EOF
25
+ end
26
+
18
27
  def execute
19
28
  Gem::Specification.outdated_and_latest_version.each do |spec, remote_version|
20
29
  say "#{spec.name} (#{spec.version} < #{remote_version})"
@@ -7,7 +7,14 @@ class Gem::Commands::OwnerCommand < Gem::Command
7
7
  include Gem::GemcutterUtilities
8
8
 
9
9
  def description # :nodoc:
10
- 'Manage gem owners on RubyGems.org.'
10
+ <<-EOF
11
+ The owner command lets you add and remove owners of a gem on a push
12
+ server (the default is https://rubygems.org).
13
+
14
+ The owner of a gem has the permission to push new versions, yank existing
15
+ versions or edit the HTML page of the gem. Be careful of who you give push
16
+ permission to.
17
+ EOF
11
18
  end
12
19
 
13
20
  def arguments # :nodoc:
@@ -19,7 +26,7 @@ class Gem::Commands::OwnerCommand < Gem::Command
19
26
  end
20
27
 
21
28
  def initialize
22
- super 'owner', description
29
+ super 'owner', 'Manage gem owners of a gem on the push server'
23
30
  add_proxy_option
24
31
  add_key_option
25
32
  defaults.merge! :add => [], :remove => []
@@ -21,7 +21,8 @@ class Gem::Commands::PristineCommand < Gem::Command
21
21
  end
22
22
 
23
23
  add_option('--[no-]extensions',
24
- 'Restore gems with extensions') do |value, options|
24
+ 'Restore gems with extensions',
25
+ 'in addition to regular gems') do |value, options|
25
26
  options[:extensions] = value
26
27
  end
27
28
 
@@ -49,23 +50,23 @@ class Gem::Commands::PristineCommand < Gem::Command
49
50
 
50
51
  def description # :nodoc:
51
52
  <<-EOF
52
- The pristine command compares the installed gems with the contents of the
53
- cached gem and restores any files that don't match the cached gem's copy.
53
+ The pristine command compares an installed gem with the contents of its
54
+ cached .gem file and restores any files that don't match the cached .gem's
55
+ copy.
54
56
 
55
- If you have made modifications to your installed gems, the pristine command
56
- will revert them. After all the gem's files have been checked all bin stubs
57
- for the gem are regenerated.
57
+ If you have made modifications to an installed gem, the pristine command
58
+ will revert them. All extensions are rebuilt and all bin stubs for the gem
59
+ are regenerated after checking for modifications.
58
60
 
59
- If the cached gem cannot be found, you will need to use `gem install` to
60
- revert the gem.
61
+ If the cached gem cannot be found it will be downloaded.
61
62
 
62
- If --no-extensions is provided pristine will not attempt to restore gems
63
- with extensions.
63
+ If --no-extensions is provided pristine will not attempt to restore a gem
64
+ with an extension.
64
65
  EOF
65
66
  end
66
67
 
67
68
  def usage # :nodoc:
68
- "#{program_name} [args]"
69
+ "#{program_name} [GEMNAME ...]"
69
70
  end
70
71
 
71
72
  def execute
@@ -8,7 +8,13 @@ class Gem::Commands::PushCommand < Gem::Command
8
8
  include Gem::GemcutterUtilities
9
9
 
10
10
  def description # :nodoc:
11
- 'Push a gem up to RubyGems.org'
11
+ <<-EOF
12
+ The push command uploads a gem to the push server (the default is
13
+ https://rubygems.org) and adds it to the index.
14
+
15
+ The gem can be removed from the index (but only the index) using the yank
16
+ command. For further discussion see the help for the yank command.
17
+ EOF
12
18
  end
13
19
 
14
20
  def arguments # :nodoc:
@@ -20,7 +26,7 @@ class Gem::Commands::PushCommand < Gem::Command
20
26
  end
21
27
 
22
28
  def initialize
23
- super 'push', description, :host => self.host
29
+ super 'push', 'Push a gem up to the gem server', :host => self.host
24
30
 
25
31
  add_proxy_option
26
32
  add_key_option
@@ -61,6 +61,15 @@ class Gem::Commands::QueryCommand < Gem::Command
61
61
  "--local --name-matches // --no-details --versions --no-installed"
62
62
  end
63
63
 
64
+ def description # :nodoc:
65
+ <<-EOF
66
+ The query command is the basis for the list and search commands.
67
+
68
+ You should really use the list and search commands instead. This command
69
+ is too hard to use.
70
+ EOF
71
+ end
72
+
64
73
  def execute
65
74
  exit_code = 0
66
75
 
@@ -45,8 +45,12 @@ class Gem::Commands::RdocCommand < Gem::Command
45
45
 
46
46
  def description # :nodoc:
47
47
  <<-DESC
48
- The rdoc command builds RDoc and RI documentation for installed gems. Use
49
- --overwrite to force rebuilding of documentation.
48
+ The rdoc command builds documentation for installed gems. By default
49
+ only documentation is built using rdoc, but additional types of
50
+ documentation may be built through rubygems plugins and the
51
+ Gem.post_installs hook.
52
+
53
+ Use --overwrite to force rebuilding of documentation.
50
54
  DESC
51
55
  end
52
56
 
@@ -4,7 +4,7 @@ require 'rubygems/commands/query_command'
4
4
  class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
5
5
 
6
6
  def initialize
7
- super 'search', 'Display all gems whose name contains STRING'
7
+ super 'search', 'Display remote gems whose name contains STRING'
8
8
 
9
9
  remove_option '--name-matches'
10
10
 
@@ -19,6 +19,19 @@ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
19
19
  "--remote --no-details"
20
20
  end
21
21
 
22
+ def description # :nodoc:
23
+ <<-EOF
24
+ The search command displays remote gems whose name contains the given
25
+ string.
26
+
27
+ The --details option displays additional details from the gem but will
28
+ take a little longer to complete as it must download the information
29
+ individually from the index.
30
+
31
+ To list local gems use the list command.
32
+ EOF
33
+ end
34
+
22
35
  def usage # :nodoc:
23
36
  "#{program_name} [STRING]"
24
37
  end
@@ -97,6 +97,53 @@ Do you want to add this insecure source?
97
97
  '--list'
98
98
  end
99
99
 
100
+ def description # :nodoc:
101
+ <<-EOF
102
+ RubyGems fetches gems from the sources you have configured (stored in your
103
+ ~/.gemrc).
104
+
105
+ The default source is https://rubygems.org, but you may have older sources
106
+ configured. This guide will help you update your sources or configure
107
+ yourself to use your own gem server.
108
+
109
+ Without any arguments the sources lists your currently configured sources:
110
+
111
+ $ gem sources
112
+ *** CURRENT SOURCES ***
113
+
114
+ https://rubygems.org
115
+
116
+ This may list multiple sources or non-rubygems sources. You probably
117
+ configured them before or have an old `~/.gemrc`. If you have sources you
118
+ do not recognize you should remove them.
119
+
120
+ RubyGems has been configured to serve gems via the following URLs through
121
+ its history:
122
+
123
+ * http://gems.rubyforge.org (RubyGems 1.3.6 and earlier)
124
+ * http://rubygems.org (RubyGems 1.3.7 through 1.8.25)
125
+ * https://rubygems.org (RubyGems 2.0.1 and newer)
126
+
127
+ Since all of these sources point to the same set of gems you only need one
128
+ of them in your list. https://rubygems.org is recommended as it brings the
129
+ protections of an SSL connection to gem downloads.
130
+
131
+ To add a source use the --add argument:
132
+
133
+ $ gem sources --add https://rubygems.org
134
+ https://rubygems.org added to sources
135
+
136
+ RubyGems will check to see if gems can be installed from the source given
137
+ before it is added.
138
+
139
+ To remove a source use the --remove argument:
140
+
141
+ $ gem sources --remove http://rubygems.org
142
+ http://rubygems.org removed from sources
143
+
144
+ EOF
145
+ end
146
+
100
147
  def list # :nodoc:
101
148
  say "*** CURRENT SOURCES ***"
102
149
  say
@@ -50,6 +50,22 @@ FIELD name of gemspec field to show
50
50
  "--local --version '#{Gem::Requirement.default}' --yaml"
51
51
  end
52
52
 
53
+ def description # :nodoc:
54
+ <<-EOF
55
+ The specification command allows you to extract the specification from
56
+ a gem for examination.
57
+
58
+ The specification can be output in YAML, ruby or Marshal formats.
59
+
60
+ Specific fields in the specification can be extracted in YAML format:
61
+
62
+ $ gem spec rake summary
63
+ --- Ruby based make-like utility.
64
+ ...
65
+
66
+ EOF
67
+ end
68
+
53
69
  def usage # :nodoc:
54
70
  "#{program_name} [GEMFILE] [FIELD]"
55
71
  end
@@ -5,6 +5,16 @@ class Gem::Commands::StaleCommand < Gem::Command
5
5
  super('stale', 'List gems along with access times')
6
6
  end
7
7
 
8
+ def description # :nodoc:
9
+ <<-EOF
10
+ The stale command lists the latest access time for all the files in your
11
+ installed gems.
12
+
13
+ You can use this command to discover gems and gem versions you are no
14
+ longer using.
15
+ EOF
16
+ end
17
+
8
18
  def usage # :nodoc:
9
19
  "#{program_name}"
10
20
  end
@@ -88,6 +88,16 @@ class Gem::Commands::UninstallCommand < Gem::Command
88
88
  "--user-install"
89
89
  end
90
90
 
91
+ def description # :nodoc:
92
+ <<-EOF
93
+ The uninstall command removes a previously installed gem.
94
+
95
+ RubyGems will ask for confirmation if you are attempting to uninstall a gem
96
+ that is a dependency of an existing gem. You can use the
97
+ --ignore-dependencies option to skip this check.
98
+ EOF
99
+ end
100
+
91
101
  def usage # :nodoc:
92
102
  "#{program_name} GEMNAME [GEMNAME ...]"
93
103
  end
@@ -104,15 +114,18 @@ class Gem::Commands::UninstallCommand < Gem::Command
104
114
  end
105
115
 
106
116
  def uninstall_all
107
- install_dir = options[:install_dir]
117
+ _, specs = Gem::Specification.partition { |spec| spec.default_gem? }
108
118
 
109
- dirs_to_be_emptied = Dir[File.join(install_dir, '*')]
110
- dirs_to_be_emptied.delete_if { |dir| dir.end_with? 'build_info' }
119
+ specs.each do |spec|
120
+ options[:version] = spec.version
111
121
 
112
- dirs_to_be_emptied.each do |dir|
113
- FileUtils.rm_rf Dir[File.join(dir, '*')]
122
+ begin
123
+ Gem::Uninstaller.new(spec.name, options).uninstall
124
+ rescue Gem::InstallError
125
+ end
114
126
  end
115
- alert("Successfully uninstalled all gems in #{install_dir}")
127
+
128
+ alert "Uninstalled all gems in #{options[:install_dir]}"
116
129
  end
117
130
 
118
131
  def uninstall_specific
@@ -34,6 +34,24 @@ class Gem::Commands::UnpackCommand < Gem::Command
34
34
  "--version '#{Gem::Requirement.default}'"
35
35
  end
36
36
 
37
+ def description
38
+ <<-EOF
39
+ The unpack command allows you to examine the contents of a gem or modify
40
+ them to help diagnose a bug.
41
+
42
+ You can add the contents of the unpacked gem to the load path using the
43
+ RUBYLIB environment variable or -I:
44
+
45
+ $ gem unpack my_gem
46
+ Unpacked gem: '.../my_gem-1.0'
47
+ [edit my_gem-1.0/lib/my_gem.rb]
48
+ $ ruby -Imy_gem-1.0/lib -S other_program
49
+
50
+ You can repackage an unpacked gem using the build command. See the build
51
+ command help for an example.
52
+ EOF
53
+ end
54
+
37
55
  def usage # :nodoc:
38
56
  "#{program_name} GEMNAME"
39
57
  end