rubygems-update 1.3.3 → 1.3.4

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 (46) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +238 -184
  3. data/lib/rubygems.rb +11 -5
  4. data/lib/rubygems/command.rb +4 -1
  5. data/lib/rubygems/commands/install_command.rb +40 -0
  6. data/lib/rubygems/commands/query_command.rb +16 -1
  7. data/lib/rubygems/commands/setup_command.rb +1 -1
  8. data/lib/rubygems/commands/update_command.rb +1 -1
  9. data/lib/rubygems/config_file.rb +0 -1
  10. data/lib/rubygems/defaults.rb +2 -1
  11. data/lib/rubygems/dependency.rb +0 -2
  12. data/lib/rubygems/dependency_list.rb +36 -16
  13. data/lib/rubygems/exceptions.rb +0 -2
  14. data/lib/rubygems/ext/builder.rb +0 -2
  15. data/lib/rubygems/gem_openssl.rb +0 -1
  16. data/lib/rubygems/gem_path_searcher.rb +0 -2
  17. data/lib/rubygems/indexer.rb +1 -0
  18. data/lib/rubygems/package/f_sync_dir.rb +0 -2
  19. data/lib/rubygems/package/tar_header.rb +0 -2
  20. data/lib/rubygems/package/tar_input.rb +0 -2
  21. data/lib/rubygems/package/tar_output.rb +0 -2
  22. data/lib/rubygems/package/tar_reader.rb +2 -2
  23. data/lib/rubygems/package/tar_reader/entry.rb +0 -2
  24. data/lib/rubygems/package/tar_writer.rb +0 -2
  25. data/lib/rubygems/platform.rb +0 -2
  26. data/lib/rubygems/remote_fetcher.rb +5 -1
  27. data/lib/rubygems/requirement.rb +2 -4
  28. data/lib/rubygems/rubygems_version.rb +1 -1
  29. data/lib/rubygems/source_index.rb +19 -9
  30. data/lib/rubygems/spec_fetcher.rb +0 -1
  31. data/lib/rubygems/specification.rb +0 -1
  32. data/lib/rubygems/uninstaller.rb +4 -4
  33. data/lib/rubygems/version.rb +0 -2
  34. data/test/gemutilities.rb +13 -4
  35. data/test/test_gem.rb +54 -5
  36. data/test/test_gem_commands_install_command.rb +2 -0
  37. data/test/test_gem_commands_query_command.rb +68 -8
  38. data/test/test_gem_commands_unpack_command.rb +4 -4
  39. data/test/test_gem_dependency_installer.rb +3 -1
  40. data/test/test_gem_format.rb +1 -1
  41. data/test/test_gem_indexer.rb +5 -3
  42. data/test/test_gem_source_index.rb +14 -445
  43. data/test/test_gem_source_info_cache.rb +1 -1
  44. data/test/test_gem_specification.rb +2 -1
  45. metadata +4 -4
  46. metadata.gz.sig +0 -0
data/lib/rubygems.rb CHANGED
@@ -119,7 +119,7 @@ end
119
119
  # Gem::post_uninstall.
120
120
  #
121
121
  # == Bugs
122
- #
122
+ #
123
123
  # You can submit bugs to the
124
124
  # {RubyGems bug tracker}[http://rubyforge.org/tracker/?atid=575&group_id=126&func=browse]
125
125
  # on RubyForge
@@ -129,7 +129,7 @@ end
129
129
  # RubyGems is currently maintained by Eric Hodel.
130
130
  #
131
131
  # RubyGems was originally developed at RubyConf 2003 by:
132
- #
132
+ #
133
133
  # * Rich Kilmer -- rich(at)infoether.com
134
134
  # * Chad Fowler -- chad(at)chadfowler.com
135
135
  # * David Black -- dblack(at)wobblini.net
@@ -137,7 +137,7 @@ end
137
137
  # * Jim Weirch -- {jim(at)weirichhouse.org}[mailto:jim@weirichhouse.org]
138
138
  #
139
139
  # Contributors:
140
- #
140
+ #
141
141
  # * Gavin Sinclair -- gsinclair(at)soyabean.com.au
142
142
  # * George Marrows -- george.marrows(at)ntlworld.com
143
143
  # * Dick Davies -- rasputnik(at)hellooperator.net
@@ -154,7 +154,7 @@ end
154
154
  # (If your name is missing, PLEASE let us know!)
155
155
  #
156
156
  # Thanks!
157
- #
157
+ #
158
158
  # -The RubyGems Team
159
159
 
160
160
  module Gem
@@ -870,7 +870,13 @@ module Gem
870
870
  def self.ruby_version
871
871
  return @ruby_version if defined? @ruby_version
872
872
  version = RUBY_VERSION.dup
873
- version << ".#{RUBY_PATCHLEVEL}" if defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL != -1
873
+
874
+ if defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL != -1 then
875
+ version << ".#{RUBY_PATCHLEVEL}"
876
+ elsif defined?(RUBY_REVISION) then
877
+ version << ".dev.#{RUBY_REVISION}"
878
+ end
879
+
874
880
  @ruby_version = Gem::Version.new version
875
881
  end
876
882
 
@@ -109,6 +109,9 @@ class Gem::Command
109
109
  #
110
110
  # When defining a new command subclass, use add_option to add command-line
111
111
  # switches.
112
+ #
113
+ # Unhandled arguments (gem names, files, etc.) are left in
114
+ # <tt>options[:args]</tt>.
112
115
 
113
116
  def initialize(command, summary=nil, defaults={})
114
117
  @command = command
@@ -275,7 +278,7 @@ class Gem::Command
275
278
  # +handler+ will be called with two values, the value of the argument and
276
279
  # the options hash.
277
280
  #
278
- # If the first argument of +add_option+ is a Symbol, it's used to group
281
+ # If the first argument of add_option is a Symbol, it's used to group
279
282
  # options in output. See `gem help list` for an example.
280
283
 
281
284
  def add_option(*opts, &handler) # :yields: value, options
@@ -53,6 +53,46 @@ The wrapper allows you to choose among alternate gem versions using _version_.
53
53
 
54
54
  For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer
55
55
  version is also installed.
56
+
57
+ If an extension fails to compile during gem installation the gem
58
+ specification is not written out, but the gem remains unpacked in the
59
+ repository. You may need to specify the path to the library's headers and
60
+ libraries to continue. You can do this by adding a -- between RubyGems'
61
+ options and the extension's build options:
62
+
63
+ $ gem install some_extension_gem
64
+ [build fails]
65
+ Gem files will remain installed in \\
66
+ /path/to/gems/some_extension_gem-1.0 for inspection.
67
+ Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
68
+ $ gem install some_extension_gem -- --with-extension-lib=/path/to/lib
69
+ [build succeeds]
70
+ $ gem list some_extension_gem
71
+
72
+ *** LOCAL GEMS ***
73
+
74
+ some_extension_gem (1.0)
75
+ $
76
+
77
+ If you correct the compilation errors by editing the gem files you will need
78
+ to write the specification by hand. For example:
79
+
80
+ $ gem install some_extension_gem
81
+ [build fails]
82
+ Gem files will remain installed in \\
83
+ /path/to/gems/some_extension_gem-1.0 for inspection.
84
+ Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
85
+ $ [cd /path/to/gems/some_extension_gem-1.0]
86
+ $ [edit files or what-have-you and run make]
87
+ $ gem spec ../../cache/some_extension_gem-1.0.gem --ruby > \\
88
+ ../../specifications/some_extension_gem-1.0.gemspec
89
+ $ gem list some_extension_gem
90
+
91
+ *** LOCAL GEMS ***
92
+
93
+ some_extension_gem (1.0)
94
+ $
95
+
56
96
  EOF
57
97
  end
58
98
 
@@ -45,6 +45,11 @@ class Gem::Commands::QueryCommand < Gem::Command
45
45
  options[:all] = value
46
46
  end
47
47
 
48
+ add_option( '--prerelease',
49
+ 'Display prerelease versions') do |value, options|
50
+ options[:prerelease] = value
51
+ end
52
+
48
53
  add_local_remote_options
49
54
  end
50
55
 
@@ -56,6 +61,7 @@ class Gem::Commands::QueryCommand < Gem::Command
56
61
  exit_code = 0
57
62
 
58
63
  name = options[:name]
64
+ prerelease = options[:prerelease]
59
65
 
60
66
  if options[:installed] then
61
67
  if name.source.empty? then
@@ -74,6 +80,10 @@ class Gem::Commands::QueryCommand < Gem::Command
74
80
  dep = Gem::Dependency.new name, Gem::Requirement.default
75
81
 
76
82
  if local? then
83
+ if prerelease and not both? then
84
+ alert_warning "prereleases are always shown locally"
85
+ end
86
+
77
87
  if ui.outs.tty? or both? then
78
88
  say
79
89
  say "*** LOCAL GEMS ***"
@@ -100,8 +110,13 @@ class Gem::Commands::QueryCommand < Gem::Command
100
110
 
101
111
  begin
102
112
  fetcher = Gem::SpecFetcher.fetcher
103
- spec_tuples = fetcher.find_matching dep, all, false
113
+ spec_tuples = fetcher.find_matching dep, all, false, prerelease
104
114
  rescue Gem::RemoteFetcher::FetchError => e
115
+ if prerelease then
116
+ raise Gem::OperationNotSupportedError,
117
+ "Prereleases not supported on legacy repositories"
118
+ end
119
+
105
120
  raise unless fetcher.warn_legacy e do
106
121
  require 'rubygems/source_info_cache'
107
122
 
@@ -39,7 +39,7 @@ class Gem::Commands::SetupCommand < Gem::Command
39
39
  options[:site_or_vendor] = vendor ? :vendorlibdir : :sitelibdir
40
40
  end
41
41
 
42
- add_option '--[no-]format_executable',
42
+ add_option '--[no-]format-executable',
43
43
  'Makes `gem` match ruby',
44
44
  'If ruby is ruby18, gem will be gem18' do |value, options|
45
45
  options[:format_executable] = value
@@ -100,7 +100,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
100
100
  if gems_to_update.include? "rubygems-update" then
101
101
  Gem.source_index.refresh!
102
102
 
103
- update_gems = Gem.source_index.search 'rubygems-update'
103
+ update_gems = Gem.source_index.find_name 'rubygems-update'
104
104
 
105
105
  latest_update_gem = update_gems.sort_by { |s| s.version }.last
106
106
 
@@ -5,7 +5,6 @@
5
5
  #++
6
6
 
7
7
  require 'yaml'
8
- require 'rubygems'
9
8
 
10
9
  # Store the gem command options specified in the configuration file. The
11
10
  # config file object acts much like a hash.
@@ -20,7 +20,8 @@ module Gem
20
20
  if defined? RUBY_FRAMEWORK_VERSION then
21
21
  File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
22
22
  ConfigMap[:ruby_version]
23
- elsif RUBY_VERSION > '1.9' then
23
+ # 1.9.2dev reverted to 1.8 style path
24
+ elsif RUBY_VERSION > '1.9' and RUBY_VERSION < '1.9.2' then
24
25
  File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name], 'gems',
25
26
  ConfigMap[:ruby_version])
26
27
  else
@@ -4,8 +4,6 @@
4
4
  # See LICENSE.txt for permissions.
5
5
  #++
6
6
 
7
- require 'rubygems'
8
-
9
7
  ##
10
8
  # The Dependency class holds a Gem name and a Gem::Requirement
11
9
 
@@ -8,6 +8,7 @@ require 'tsort'
8
8
 
9
9
  class Gem::DependencyList
10
10
 
11
+ include Enumerable
11
12
  include TSort
12
13
 
13
14
  def self.from_source_index(src_index)
@@ -24,24 +25,27 @@ class Gem::DependencyList
24
25
  @specs = []
25
26
  end
26
27
 
28
+ ##
27
29
  # Adds +gemspecs+ to the dependency list.
30
+
28
31
  def add(*gemspecs)
29
32
  @specs.push(*gemspecs)
30
33
  end
31
34
 
32
- # Return a list of the specifications in the dependency list,
33
- # sorted in order so that no spec in the list depends on a gem
34
- # earlier in the list.
35
+ ##
36
+ # Return a list of the specifications in the dependency list, sorted in
37
+ # order so that no spec in the list depends on a gem earlier in the list.
35
38
  #
36
- # This is useful when removing gems from a set of installed gems.
37
- # By removing them in the returned order, you don't get into as
38
- # many dependency issues.
39
+ # This is useful when removing gems from a set of installed gems. By
40
+ # removing them in the returned order, you don't get into as many dependency
41
+ # issues.
39
42
  #
40
- # If there are circular dependencies (yuck!), then gems will be
41
- # returned in order until only the circular dependents and anything
42
- # they reference are left. Then arbitrary gemspecs will be returned
43
- # until the circular dependency is broken, after which gems will be
44
- # returned in dependency order again.
43
+ # If there are circular dependencies (yuck!), then gems will be returned in
44
+ # order until only the circular dependents and anything they reference are
45
+ # left. Then arbitrary gemspecs will be returned until the circular
46
+ # dependency is broken, after which gems will be returned in dependency
47
+ # order again.
48
+
45
49
  def dependency_order
46
50
  sorted = strongly_connected_components.flatten
47
51
 
@@ -62,11 +66,20 @@ class Gem::DependencyList
62
66
  result.reverse
63
67
  end
64
68
 
69
+ ##
70
+ # Iterator over dependency_order
71
+
72
+ def each(&block)
73
+ dependency_order.each(&block)
74
+ end
75
+
65
76
  def find_name(full_name)
66
77
  @specs.find { |spec| spec.full_name == full_name }
67
78
  end
68
79
 
80
+ ##
69
81
  # Are all the dependencies in the list satisfied?
82
+
70
83
  def ok?
71
84
  @specs.all? do |spec|
72
85
  spec.runtime_dependencies.all? do |dep|
@@ -75,10 +88,12 @@ class Gem::DependencyList
75
88
  end
76
89
  end
77
90
 
91
+ ##
78
92
  # Is is ok to remove a gem from the dependency list?
79
93
  #
80
- # If removing the gemspec creates breaks a currently ok dependency,
81
- # then it is NOT ok to remove the gem.
94
+ # If removing the gemspec creates breaks a currently ok dependency, then it
95
+ # is NOT ok to remove the gem.
96
+
82
97
  def ok_to_remove?(full_name)
83
98
  gem_to_remove = find_name full_name
84
99
 
@@ -106,9 +121,10 @@ class Gem::DependencyList
106
121
  @specs.delete_if { |spec| spec.full_name == full_name }
107
122
  end
108
123
 
109
- # Return a hash of predecessors. <tt>result[spec]</tt> is an
110
- # Array of gemspecs that have a dependency satisfied by the named
111
- # spec.
124
+ ##
125
+ # Return a hash of predecessors. <tt>result[spec]</tt> is an Array of
126
+ # gemspecs that have a dependency satisfied by the named spec.
127
+
112
128
  def spec_predecessors
113
129
  result = Hash.new { |h,k| h[k] = [] }
114
130
 
@@ -151,13 +167,17 @@ class Gem::DependencyList
151
167
 
152
168
  private
153
169
 
170
+ ##
154
171
  # Count the number of gemspecs in the list +specs+ that are not in
155
172
  # +ignored+.
173
+
156
174
  def active_count(specs, ignored)
157
175
  result = 0
176
+
158
177
  specs.each do |spec|
159
178
  result += 1 unless ignored[spec.full_name]
160
179
  end
180
+
161
181
  result
162
182
  end
163
183
 
@@ -1,5 +1,3 @@
1
- require 'rubygems'
2
-
3
1
  ##
4
2
  # Base exception class for RubyGems. All exception raised by RubyGems are a
5
3
  # subclass of this one.
@@ -4,8 +4,6 @@
4
4
  # See LICENSE.txt for permissions.
5
5
  #++
6
6
 
7
- require 'rubygems/ext'
8
-
9
7
  class Gem::Ext::Builder
10
8
 
11
9
  def self.class_name
@@ -17,7 +17,6 @@ module Gem
17
17
  # platform?
18
18
 
19
19
  def ssl_available?
20
- require 'rubygems/gem_openssl'
21
20
  @ssl_available
22
21
  end
23
22
 
@@ -4,8 +4,6 @@
4
4
  # See LICENSE.txt for permissions.
5
5
  #++
6
6
 
7
- require 'rubygems'
8
-
9
7
  ##
10
8
  # GemPathSearcher has the capability to find loadable files inside
11
9
  # gems. It generates data up front to speed up searches later.
@@ -6,6 +6,7 @@ require 'rubygems'
6
6
  require 'rubygems/format'
7
7
 
8
8
  begin
9
+ gem 'builder'
9
10
  require 'builder/xchar'
10
11
  rescue LoadError
11
12
  end
@@ -3,8 +3,6 @@
3
3
  # See LICENSE.txt for additional licensing information.
4
4
  #--
5
5
 
6
- require 'rubygems/package'
7
-
8
6
  module Gem::Package::FSyncDir
9
7
 
10
8
  private
@@ -3,8 +3,6 @@
3
3
  # See LICENSE.txt for additional licensing information.
4
4
  #--
5
5
 
6
- require 'rubygems/package'
7
-
8
6
  ##
9
7
  #--
10
8
  # struct tarfile_entry_posix {
@@ -3,8 +3,6 @@
3
3
  # See LICENSE.txt for additional licensing information.
4
4
  #--
5
5
 
6
- require 'rubygems/package'
7
-
8
6
  class Gem::Package::TarInput
9
7
 
10
8
  include Gem::Package::FSyncDir
@@ -3,8 +3,6 @@
3
3
  # See LICENSE.txt for additional licensing information.
4
4
  #--
5
5
 
6
- require 'rubygems/package'
7
-
8
6
  ##
9
7
  # TarOutput is a wrapper to TarWriter that builds gem-format tar file.
10
8
  #
@@ -3,8 +3,6 @@
3
3
  # See LICENSE.txt for additional licensing information.
4
4
  #--
5
5
 
6
- require 'rubygems/package'
7
-
8
6
  ##
9
7
  # TarReader reads tar files and allows iteration over their items
10
8
 
@@ -103,3 +101,5 @@ class Gem::Package::TarReader
103
101
 
104
102
  end
105
103
 
104
+ require 'rubygems/package/tar_reader/entry'
105
+
@@ -3,8 +3,6 @@
3
3
  # See LICENSE.txt for additional licensing information.
4
4
  #--
5
5
 
6
- require 'rubygems/package'
7
-
8
6
  ##
9
7
  # Class for reading entries out of a tar file
10
8
 
@@ -3,8 +3,6 @@
3
3
  # See LICENSE.txt for additional licensing information.
4
4
  #--
5
5
 
6
- require 'rubygems/package'
7
-
8
6
  ##
9
7
  # Allows writing of tar files
10
8