rubygems-update 1.6.2 → 1.7.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.

Files changed (40) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +0 -1
  3. data/History.txt +70 -4
  4. data/README.rdoc +3 -0
  5. data/Rakefile +76 -0
  6. data/lib/rubygems.rb +57 -27
  7. data/lib/rubygems/command.rb +6 -4
  8. data/lib/rubygems/commands/contents_command.rb +14 -11
  9. data/lib/rubygems/commands/fetch_command.rb +6 -3
  10. data/lib/rubygems/commands/outdated_command.rb +2 -1
  11. data/lib/rubygems/commands/pristine_command.rb +4 -3
  12. data/lib/rubygems/commands/unpack_command.rb +46 -4
  13. data/lib/rubygems/commands/update_command.rb +24 -10
  14. data/lib/rubygems/custom_require.rb +1 -2
  15. data/lib/rubygems/dependency_installer.rb +1 -1
  16. data/lib/rubygems/ext/rake_builder.rb +1 -1
  17. data/lib/rubygems/gem_runner.rb +1 -0
  18. data/lib/rubygems/mock_gem_ui.rb +2 -1
  19. data/lib/rubygems/package/tar_input.rb +1 -0
  20. data/lib/rubygems/remote_fetcher.rb +62 -39
  21. data/lib/rubygems/server.rb +1 -1
  22. data/lib/rubygems/source_index.rb +64 -43
  23. data/lib/rubygems/spec_fetcher.rb +5 -6
  24. data/lib/rubygems/specification.rb +375 -402
  25. data/lib/rubygems/test_case.rb +7 -8
  26. data/lib/rubygems/uninstaller.rb +2 -2
  27. data/lib/rubygems/user_interaction.rb +27 -31
  28. data/test/rubygems/test_gem.rb +2 -44
  29. data/test/rubygems/test_gem_commands_contents_command.rb +19 -30
  30. data/test/rubygems/test_gem_commands_unpack_command.rb +24 -0
  31. data/test/rubygems/test_gem_commands_update_command.rb +26 -1
  32. data/test/rubygems/test_gem_dependency_installer.rb +9 -5
  33. data/test/rubygems/test_gem_dependency_list.rb +2 -6
  34. data/test/rubygems/test_gem_gem_runner.rb +1 -4
  35. data/test/rubygems/test_gem_installer.rb +1 -2
  36. data/test/rubygems/test_gem_remote_fetcher.rb +131 -24
  37. data/test/rubygems/test_gem_source_index.rb +7 -192
  38. data/test/rubygems/test_gem_specification.rb +132 -103
  39. metadata +9 -9
  40. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
Binary file
data/.autotest CHANGED
@@ -4,7 +4,6 @@ require 'autotest/restart'
4
4
 
5
5
  Autotest.add_hook :initialize do |at|
6
6
  at.testlib = 'minitest/autorun'
7
- at.unit_diff = "cat -u"
8
7
 
9
8
  at.add_exception %r%/\.git/%
10
9
  at.add_exception %r%/\.svn/%
@@ -1,4 +1,66 @@
1
- === 1.6.2 / 2011-03-08
1
+ === 1.7.0 / 2011-03-31
2
+
3
+ * 16 Deprecations (woot!)
4
+ * Deprecated Gem.all_load_paths, latest_load_paths, promote_load_path, and
5
+ cache.
6
+ * Deprecated RemoteFetcher#open_uri_or_path.
7
+ * Deprecated SourceIndex#all_gems.
8
+ * Deprecated SourceIndex#initialize(hash_of_specs).
9
+ * Deprecated SourceIndex.from_installed_gems, from_gems_in, and
10
+ load_specification.
11
+ * Deprecated Specification#has_rdoc, default_executable, and
12
+ test_suite_file(=).
13
+ * Deprecated Specification#has_rdoc= and default_executable=
14
+
15
+ * 26 minor enhancements:
16
+ * Added stupid simple deprecation module.
17
+ * Added --spec option to `gem unpack` to output a gem's original metadata
18
+ * Added packaging option to Specification#validate
19
+ * Gem.bin_path requires the exec_name argument.
20
+ * Read from cached specs if fetch fails for some reason
21
+ * Refactored Specification#assign_defaults into #initialize.
22
+ * RemoteFetcher#fetch_path now dispatches dynamically to 'fetch_<uri.schema>'
23
+ * Removed Specification @@gather.
24
+ * Removed Specification.attribute.
25
+ * Removed Specification.attribute_alias_singular.
26
+ * Removed Specification.attribute_defaults.
27
+ * Removed Specification.attributes
28
+ * Removed Specification.overwrite_accessor.
29
+ * Removed Specification.read_only.
30
+ * Removed Specification.required_attribute.
31
+ * Removed Specification::SPECIFICATION_VERSION_HISTORY and turned into rdoc
32
+ * Removed blanket rescue in default_executable. Hope it doesn't blow up! :P
33
+ * Removed nearly all metaprogramming from Specification. Yay for
34
+ attr_accessor!
35
+ * SourceIndex#initialize changed to prefer an array of spec dirs, defaulting
36
+ to none.
37
+ * SourceIndex.new is now the preferred way to create SourceIndex instances.
38
+ *gasp*
39
+ * Specification#validate now checks that array attribs are indeed arrays.
40
+ * Specification.default_value is now an instance method.
41
+ * Switched Specification::TODAY to be proper midnight @ UTC
42
+ * Update Gem::RemoteFetcher\'s User-Agent to handle RUBY_ENGINE and
43
+ RUBY_REVISION when patchlevel is -1
44
+ * UpdateCommand#gems_to_update now returns (name, version) pairs.
45
+ * UpdateCommand#which_to_update now takes an optional system argument.
46
+
47
+ * 11 bug fixes:
48
+ * Added missing remote fetcher require to pristine command (aarnell)
49
+ * Building gems now checks to ensure all required fields are non-nil
50
+ * Fix option parser when summary is nil.
51
+ * Fixed `gem contents` to work with the lightweight specifications
52
+ * Fixed `gem update --system x.y.z` where x.y.z == latest version. (MGPalmer)
53
+ * Fixed gem contents sorting and tests. (MGPalmer)
54
+ * Fixed intermittant problem in `gem fetch` with --platform specified (quix)
55
+ * Fixed lightweight specifications so `gem rdoc` will generate proper
56
+ documentation
57
+ * MockGemUI#terminate_interaction should not raise Gem::SystemExitException.
58
+ (MGPalmer)
59
+ * RubyGems now raises a better error for broken .gem files. Bug #29067 by
60
+ Elias Baixas
61
+ * `gem update` now uniq's command line arguments.
62
+
63
+ === 1.6.2 / 2011-03-08
2
64
 
3
65
  Bug Fixes:
4
66
 
@@ -972,11 +1034,11 @@ There has been some minor usability enhancements and changes ...
972
1034
  names. This was useful for him while testing libs that he had in
973
1035
  development.
974
1036
 
975
- === 0.8.1 / 2009-09-14
1037
+ === 0.8.1 / 2004-09-17
976
1038
 
977
1039
  * Quick release to capture some bug fixes.
978
1040
 
979
- === 0.8.0 / 2009-09-12
1041
+ === 0.8.0 / 2004-09-15
980
1042
 
981
1043
  * Remove need for library stubs. Set the RUBYOPT environment variable to
982
1044
  include "rrubygems", and a normal require will find gem files. Continue to
@@ -1003,6 +1065,10 @@ There has been some minor usability enhancements and changes ...
1003
1065
 
1004
1066
  See ChangeLog
1005
1067
 
1068
+ === 0.6.1 / 2004-06-08
1069
+
1070
+ See ChangeLog
1071
+
1006
1072
  === 0.6.0 / 2004-06-08
1007
1073
 
1008
1074
  * Collapse output of --search and --list (and gem_server) operations so that
@@ -1039,7 +1105,7 @@ See ChangeLog
1039
1105
  automatically included.
1040
1106
  * Some small bug fixes
1041
1107
 
1042
- === 0.4.0 / 2004-05-31
1108
+ === 0.4.0 / 2004-05-30
1043
1109
 
1044
1110
  * Minor bug fixes including Windows compatability issues
1045
1111
 
@@ -47,3 +47,6 @@ You're sure you've found a bug! But where do you let us know? The best place
47
47
  for letting the RubyGems team know about bugs you've found is {on the rubygems
48
48
  tracker at rubyforge}[http://rubyforge.org/tracker/?group_id=126].
49
49
 
50
+ === Bundler Compatibility
51
+
52
+ See http://gembundler.com/compatibility for known issues.
data/Rakefile CHANGED
@@ -171,3 +171,79 @@ task "rcov:for", [:test] do |task, args|
171
171
  ruby "#{flags.join ' '} #{rcov} #{rflags.join ' '} #{args[:test]}"
172
172
  end
173
173
 
174
+ def changelog_section code
175
+ name = {
176
+ :major => "major enhancement",
177
+ :minor => "minor enhancement",
178
+ :bug => "bug fix",
179
+ :unknown => "unknown",
180
+ }[code]
181
+
182
+ changes = $changes[code]
183
+ count = changes.size
184
+ name += "s" if count > 1
185
+ name.sub!(/fixs/, 'fixes')
186
+
187
+ return if count < 1
188
+
189
+ puts "* #{count} #{name}:"
190
+ puts
191
+ changes.sort.each do |line|
192
+ puts " * #{line}"
193
+ end
194
+ puts
195
+ end
196
+
197
+ desc "Print the current changelog."
198
+ task "git:newchangelog" do
199
+ # This must be in here until rubygems depends on the version of hoe that has
200
+ # git_tags
201
+ # TODO: get this code back into hoe-git
202
+ module Hoe::Git
203
+ module_function :git_tags, :git_svn?, :git_release_tag_prefix
204
+ end
205
+
206
+ tags = Hoe::Git.git_tags
207
+ tag = ENV["FROM"] || tags.last
208
+ range = [tag, "HEAD"].compact.join ".."
209
+ cmd = "git log #{range} '--format=tformat:%B|||%aN|||%aE|||'"
210
+ now = Time.new.strftime "%Y-%m-%d"
211
+
212
+ changes = `#{cmd}`.split(/\|\|\|/).each_slice(3).map do |msg, author, email|
213
+ msg.split(/\n/).reject { |s| s.empty? }
214
+ end
215
+
216
+ changes = changes.flatten
217
+
218
+ next if changes.empty?
219
+
220
+ $changes = Hash.new { |h,k| h[k] = [] }
221
+
222
+ codes = {
223
+ "!" => :major,
224
+ "+" => :minor,
225
+ "*" => :minor,
226
+ "-" => :bug,
227
+ "?" => :unknown,
228
+ }
229
+
230
+ codes_re = Regexp.escape codes.keys.join
231
+
232
+ changes.each do |change|
233
+ if change =~ /^\s*([#{codes_re}])\s*(.*)/ then
234
+ code, line = codes[$1], $2
235
+ else
236
+ code, line = codes["?"], change.chomp
237
+ end
238
+
239
+ $changes[code] << line
240
+ end
241
+
242
+ puts "=== #{ENV['VERSION'] || 'NEXT'} / #{now}"
243
+ puts
244
+ changelog_section :major
245
+ changelog_section :minor
246
+ changelog_section :bug
247
+ changelog_section :unknown
248
+ puts
249
+ end
@@ -28,6 +28,7 @@ end
28
28
  require 'rubygems/defaults'
29
29
  require "rubygems/dependency_list"
30
30
  require 'rbconfig'
31
+ require "rubygems/deprecate"
31
32
 
32
33
  ##
33
34
  # RubyGems is the Ruby standard for publishing and managing third party
@@ -118,7 +119,7 @@ require 'rbconfig'
118
119
  # -The RubyGems Team
119
120
 
120
121
  module Gem
121
- VERSION = '1.6.2'
122
+ VERSION = '1.7.0'
122
123
 
123
124
  ##
124
125
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -182,7 +183,6 @@ module Gem
182
183
 
183
184
  @configuration = nil
184
185
  @loaded_specs = {}
185
- @loaded_stacks = {}
186
186
  @platforms = []
187
187
  @ruby = nil
188
188
  @sources = []
@@ -232,34 +232,27 @@ module Gem
232
232
  # Gem::Requirement and Gem::Version documentation.
233
233
 
234
234
  def self.activate(dep, *requirements)
235
- # TODO: remove options entirely
236
- if requirements.last.is_a?(Hash)
237
- options = requirements.pop
238
- else
239
- options = {}
240
- end
235
+ activate_dep dep, *requirements
236
+ end
241
237
 
238
+ def self.activate_dep dep, *requirements
242
239
  requirements = Gem::Requirement.default if requirements.empty?
243
240
  dep = Gem::Dependency.new(dep, requirements) unless Gem::Dependency === dep
244
241
 
245
- # TODO: remove sources entirely
246
- sources = options[:sources] || []
247
242
  matches = Gem.source_index.search dep, true
248
243
  report_activate_error(dep) if matches.empty?
249
244
 
250
- if @loaded_specs[dep.name] then
245
+ existing_spec = @loaded_specs[dep.name]
246
+
247
+ # TODO: move this to Dependency
248
+ if existing_spec then
251
249
  # This gem is already loaded. If the currently loaded gem is not in the
252
250
  # list of candidate gems, then we have a version conflict.
253
- existing_spec = @loaded_specs[dep.name]
254
251
 
255
252
  # TODO: unless dep.matches_spec? existing_spec then
256
253
  unless matches.any? { |spec| spec.version == existing_spec.version } then
257
- sources_message = sources.map { |spec| spec.full_name }
258
- stack_message = @loaded_stacks[dep.name].map { |spec| spec.full_name }
259
-
260
- msg = "can't activate #{dep} for #{sources_message.inspect}, "
261
- msg << "already activated #{existing_spec.full_name} for "
262
- msg << "#{stack_message.inspect}"
254
+ msg = "can't activate #{dep}, "
255
+ msg << "already activated #{existing_spec.full_name}"
263
256
 
264
257
  e = Gem::LoadError.new msg
265
258
  e.name = dep.name
@@ -271,9 +264,36 @@ module Gem
271
264
  return false
272
265
  end
273
266
 
267
+ # TODO: this + spec.conflicts hint that activation is still dumb
274
268
  spec = matches.last
275
269
 
270
+ activate_spec spec
271
+ end
272
+
273
+ def self.activate_spec spec
274
+ existing_spec = @loaded_specs[spec.name]
275
+
276
+ # TODO: move this to Specification
277
+ if existing_spec then
278
+ if spec.version != existing_spec.version then
279
+ # This gem is already loaded. If the currently loaded gem is not in the
280
+ # list of candidate gems, then we have a version conflict.
281
+
282
+ msg = "can't activate #{dep}, "
283
+ msg << "already activated #{existing_spec.full_name}"
284
+
285
+ e = Gem::LoadError.new msg
286
+ e.name = dep.name
287
+ e.requirement = dep.requirement
288
+
289
+ raise e
290
+ end
291
+
292
+ return false
293
+ end
294
+
276
295
  conf = spec.conflicts
296
+
277
297
  unless conf.empty? then
278
298
  why = conf.map { |act,con|
279
299
  "#{act.full_name} conflicts with #{con.join(", ")}"
@@ -284,11 +304,8 @@ module Gem
284
304
  raise LoadError, "Unable to activate #{spec.full_name}, because #{why}"
285
305
  end
286
306
 
287
- return false if spec.loaded?
288
-
289
307
  spec.loaded = true
290
308
  @loaded_specs[spec.name] = spec
291
- @loaded_stacks[spec.name] = sources.dup
292
309
 
293
310
  spec.runtime_dependencies.each do |spec_dep|
294
311
  next if Gem.loaded_specs.include? spec_dep.name
@@ -372,6 +389,8 @@ module Gem
372
389
  # you to specify specific gem versions.
373
390
 
374
391
  def self.bin_path(name, exec_name = nil, *requirements)
392
+ raise ArgumentError, "you must supply exec_name" unless exec_name
393
+
375
394
  requirements = Gem::Requirement.default if
376
395
  requirements.empty?
377
396
  specs = Gem.source_index.find_name(name, requirements)
@@ -587,6 +606,7 @@ module Gem
587
606
  # Zlib::GzipReader wrapper that unzips +data+.
588
607
 
589
608
  def self.gunzip(data)
609
+ # TODO: move to utils
590
610
  require 'stringio'
591
611
  require 'zlib'
592
612
  data = StringIO.new data
@@ -598,6 +618,7 @@ module Gem
598
618
  # Zlib::GzipWriter wrapper that zips +data+.
599
619
 
600
620
  def self.gzip(data)
621
+ # TODO: move to utils
601
622
  require 'stringio'
602
623
  require 'zlib'
603
624
  zipped = StringIO.new
@@ -611,6 +632,7 @@ module Gem
611
632
  # A Zlib::Inflate#inflate wrapper
612
633
 
613
634
  def self.inflate(data)
635
+ # TODO: move to utils
614
636
  require 'zlib'
615
637
  Zlib::Inflate.inflate data
616
638
  end
@@ -620,12 +642,14 @@ module Gem
620
642
  # <tt>https://rubygems.org</tt>.
621
643
 
622
644
  def self.host
645
+ # TODO: move to utils
623
646
  @host ||= "https://rubygems.org"
624
647
  end
625
648
 
626
649
  ## Set the default RubyGems API host.
627
650
 
628
651
  def self.host= host
652
+ # TODO: move to utils
629
653
  @host = host
630
654
  end
631
655
 
@@ -706,6 +730,7 @@ module Gem
706
730
  file = $1
707
731
  lineno = $2.to_i
708
732
 
733
+ # TODO: it is ALWAYS joined! STUPID!
709
734
  [file, lineno]
710
735
  end
711
736
 
@@ -1022,7 +1047,7 @@ module Gem
1022
1047
  # Returns the Gem::SourceIndex of specifications that are in the Gem.path
1023
1048
 
1024
1049
  def self.source_index
1025
- @@source_index ||= SourceIndex.from_installed_gems
1050
+ @@source_index ||= SourceIndex.new Gem::SourceIndex.installed_spec_directories
1026
1051
  end
1027
1052
 
1028
1053
  ##
@@ -1214,11 +1239,6 @@ module Gem
1214
1239
  end
1215
1240
 
1216
1241
  def self.cache # :nodoc:
1217
- warn "#{Gem.location_of_caller.join ':'}:Warning: " \
1218
- "Gem::cache is deprecated and will be removed on or after " \
1219
- "August 2011. " \
1220
- "Use Gem::source_index."
1221
-
1222
1242
  source_index
1223
1243
  end
1224
1244
 
@@ -1238,6 +1258,16 @@ module Gem
1238
1258
  autoload :Platform, 'rubygems/platform'
1239
1259
  autoload :Builder, 'rubygems/builder'
1240
1260
  autoload :ConfigFile, 'rubygems/config_file'
1261
+
1262
+ class << self
1263
+ extend Deprecate
1264
+ # Can't do this one until I add Specification#activate
1265
+ # deprecate :activate, "Specification#activate", 2011, 10
1266
+ deprecate :all_load_paths, :none, 2011, 10
1267
+ deprecate :latest_load_paths, :none, 2011, 10
1268
+ deprecate :promote_load_path, :none, 2011, 10
1269
+ deprecate :cache, "Gem::source_index", 2011, 8
1270
+ end
1241
1271
  end
1242
1272
 
1243
1273
  module Kernel
@@ -404,10 +404,12 @@ class Gem::Command
404
404
  end
405
405
  end
406
406
 
407
- @parser.separator nil
408
- @parser.separator " Summary:"
409
- wrap(@summary, 80 - 4).split("\n").each do |line|
410
- @parser.separator " #{line.strip}"
407
+ if @summary then
408
+ @parser.separator nil
409
+ @parser.separator " Summary:"
410
+ wrap(@summary, 80 - 4).split("\n").each do |line|
411
+ @parser.separator " #{line.strip}"
412
+ end
411
413
  end
412
414
 
413
415
  if description then
@@ -58,7 +58,7 @@ class Gem::Commands::ContentsCommand < Gem::Command
58
58
  "specified path"
59
59
  end
60
60
 
61
- si = Gem::SourceIndex.from_gems_in(*spec_dirs)
61
+ si = Gem::SourceIndex.new spec_dirs
62
62
 
63
63
  gem_names = if options[:all] then
64
64
  si.map { |_, spec| spec.name }
@@ -67,9 +67,9 @@ class Gem::Commands::ContentsCommand < Gem::Command
67
67
  end
68
68
 
69
69
  gem_names.each do |name|
70
- gem_spec = si.find_name(name, version).last
70
+ spec = si.find_name(name, version).last
71
71
 
72
- unless gem_spec then
72
+ unless spec then
73
73
  say "Unable to find gem '#{name}' in #{path_kind}"
74
74
 
75
75
  if Gem.configuration.verbose then
@@ -80,16 +80,19 @@ class Gem::Commands::ContentsCommand < Gem::Command
80
80
  terminate_interaction 1 if gem_names.length == 1
81
81
  end
82
82
 
83
- files = options[:lib_only] ? gem_spec.lib_files : gem_spec.files
83
+ gem_path = spec.full_gem_path
84
+ extra = "/{#{spec.require_paths.join ','}}" if options[:lib_only]
85
+ glob = "#{gem_path}#{extra}/**/*"
86
+ files = Dir[glob]
84
87
 
85
- files.each do |f|
86
- path = if options[:prefix] then
87
- File.join gem_spec.full_gem_path, f
88
- else
89
- f
90
- end
88
+ gem_path = File.join gem_path, '' # add trailing / if missing
91
89
 
92
- say path
90
+ files.sort.each do |file|
91
+ next if File.directory? file
92
+
93
+ file = file.sub gem_path, '' unless options[:prefix]
94
+
95
+ say file
93
96
  end
94
97
  end
95
98
  end