rubygems-update 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

@@ -11,6 +11,7 @@ class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
11
11
  def self.build(extension, directory, dest_path, results)
12
12
  unless File.exist?('Makefile') then
13
13
  cmd = "sh ./configure --prefix=#{dest_path}"
14
+ cmd << " #{Gem::Command.build_args.join ' '}" unless Gem::Command.build_args.empty?
14
15
 
15
16
  run cmd, results
16
17
  end
@@ -19,7 +19,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
19
19
  # Deal with possible spaces in the path, e.g. C:/Program Files
20
20
  dest_path = '"' + dest_path + '"' if dest_path.include?(' ')
21
21
 
22
- cmd = ENV['rake'] || Gem.bin_path('rake') rescue Gem.default_exec_format % 'rake'
22
+ cmd = ENV['rake'] || "#{Gem.ruby} -rubygems #{Gem.bin_path('rake')}" rescue Gem.default_exec_format % 'rake'
23
23
  cmd += " RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" # ENV is frozen
24
24
 
25
25
  run cmd, results
@@ -31,8 +31,8 @@ require 'rake/packagetask'
31
31
  # Create a package based upon a Gem::Specification. Gem packages, as well as
32
32
  # zip files and tar/gzipped packages can be produced by this task.
33
33
  #
34
- # In addition to the Rake targets generated by Gem::PackageTask, a
35
- # Gem::GemPackageTask will also generate the following tasks:
34
+ # In addition to the Rake targets generated by Rake::PackageTask, a
35
+ # Gem::PackageTask will also generate the following tasks:
36
36
  #
37
37
  # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.gem"</b>]
38
38
  # Create a RubyGems package with the given name and version.
@@ -40,7 +40,8 @@ require 'rake/packagetask'
40
40
  # Example using a Gem::Specification:
41
41
  #
42
42
  # require 'rubygems'
43
- #
43
+ # require 'rubygems/package_task'
44
+ #
44
45
  # spec = Gem::Specification.new do |s|
45
46
  # s.platform = Gem::Platform::RUBY
46
47
  # s.summary = "Ruby based make-like utility."
@@ -52,7 +53,7 @@ require 'rake/packagetask'
52
53
  # s.files = PKG_FILES
53
54
  # s.description = <<-EOF
54
55
  # Rake is a Make-like program implemented in Ruby. Tasks
55
- # and dependencies are specified in standard Ruby syntax.
56
+ # and dependencies are specified in standard Ruby syntax.
56
57
  # EOF
57
58
  # end
58
59
  #
@@ -76,7 +77,7 @@ class Gem::PackageTask < Rake::PackageTask
76
77
  # to define the task.
77
78
 
78
79
  def initialize(gem_spec)
79
- init(gem_spec)
80
+ init gem_spec
80
81
  yield self if block_given?
81
82
  define if block_given?
82
83
  end
@@ -85,7 +86,7 @@ class Gem::PackageTask < Rake::PackageTask
85
86
  # Initialization tasks without the "yield self" or define operations.
86
87
 
87
88
  def init(gem)
88
- super(gem.name, gem.version)
89
+ super gem.name, gem.version
89
90
  @gem_spec = gem
90
91
  @package_files += gem_spec.files if gem_spec.files
91
92
  end
@@ -108,10 +109,10 @@ class Gem::PackageTask < Rake::PackageTask
108
109
  }
109
110
  end
110
111
  end
111
-
112
+
112
113
  def gem_file
113
114
  "#{@gem_spec.full_name}.gem"
114
115
  end
115
-
116
+
116
117
  end
117
118
 
@@ -26,7 +26,7 @@ class Gem::Requirement
26
26
  "<" => lambda { |v, r| v < r },
27
27
  ">=" => lambda { |v, r| v >= r },
28
28
  "<=" => lambda { |v, r| v <= r },
29
- "~>" => lambda { |v, r| v >= r && v < r.bump }
29
+ "~>" => lambda { |v, r| v = v.release; v >= r && v < r.bump }
30
30
  }
31
31
 
32
32
  OP_RE = OPS.keys.map{ |k| Regexp.quote k }.join '|'
@@ -9,7 +9,7 @@ module Gem
9
9
  ##
10
10
  # The version of RubyGems you are using
11
11
 
12
- RubyGemsVersion = '1.3.2'
12
+ RubyGemsVersion = '1.3.3'
13
13
 
14
14
  ##
15
15
  # The version of RubyGems you are using (duplicated for familiarity)
@@ -17,6 +17,7 @@ require 'rubygems/doc_manager'
17
17
  # name/version/platform index
18
18
  # * "/quick/" - Individual gemspecs
19
19
  # * "/gems" - Direct access to download the installable gems
20
+ # * "/rdoc?q=" - Search for installed rdoc documentation
20
21
  # * legacy indexes:
21
22
  # * "/Marshal.#{Gem.marshal_version}" - Full SourceIndex dump of metadata
22
23
  # for installed gems
@@ -32,9 +33,20 @@ require 'rubygems/doc_manager'
32
33
 
33
34
  class Gem::Server
34
35
 
36
+ include ERB::Util
35
37
  include Gem::UserInteraction
36
38
 
37
- DOC_TEMPLATE = <<-'WEBPAGE'
39
+ SEARCH = <<-SEARCH
40
+ <form class="headerSearch" name="headerSearchForm" method="get" action="/rdoc">
41
+ <div id="search" style="float:right">
42
+ <span>Filter/Search</span>
43
+ <input id="q" type="text" style="width:10em" name="q"/>
44
+ <button type="submit" style="display:none" />
45
+ </div>
46
+ </form>
47
+ SEARCH
48
+
49
+ DOC_TEMPLATE = <<-'DOC_TEMPLATE'
38
50
  <?xml version="1.0" encoding="iso-8859-1"?>
39
51
  <!DOCTYPE html
40
52
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -47,6 +59,7 @@ class Gem::Server
47
59
  </head>
48
60
  <body>
49
61
  <div id="fileHeader">
62
+ <%= SEARCH %>
50
63
  <h1>RubyGems Documentation Index</h1>
51
64
  </div>
52
65
  <!-- banner header -->
@@ -114,10 +127,10 @@ class Gem::Server
114
127
  </div>
115
128
  </body>
116
129
  </html>
117
- WEBPAGE
130
+ DOC_TEMPLATE
118
131
 
119
132
  # CSS is copy & paste from rdoc-style.css, RDoc V1.0.1 - 20041108
120
- RDOC_CSS = <<-RDOCCSS
133
+ RDOC_CSS = <<-RDOC_CSS
121
134
  body {
122
135
  font-family: Verdana,Arial,Helvetica,sans-serif;
123
136
  font-size: 90%;
@@ -325,7 +338,92 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
325
338
  .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
326
339
  .ruby-regexp { color: #ffa07a; background: transparent; }
327
340
  .ruby-value { color: #7fffd4; background: transparent; }
328
- RDOCCSS
341
+ RDOC_CSS
342
+
343
+ RDOC_NO_DOCUMENTATION = <<-'NO_DOC'
344
+ <?xml version="1.0" encoding="iso-8859-1"?>
345
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
346
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
347
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
348
+ <head>
349
+ <title>Found documentation</title>
350
+ <link rel="stylesheet" href="gem-server-rdoc-style.css" type="text/css" media="screen" />
351
+ </head>
352
+ <body>
353
+ <div id="fileHeader">
354
+ <%= SEARCH %>
355
+ <h1>No documentation found</h1>
356
+ </div>
357
+
358
+ <div id="bodyContent">
359
+ <div id="contextContent">
360
+ <div id="description">
361
+ <p>No gems matched <%= h query.inspect %></p>
362
+
363
+ <p>
364
+ Back to <a href="/">complete gem index</a>
365
+ </p>
366
+
367
+ </div>
368
+ </div>
369
+ </div>
370
+ <div id="validator-badges">
371
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
372
+ </div>
373
+ </body>
374
+ </html>
375
+ NO_DOC
376
+
377
+ RDOC_SEARCH_TEMPLATE = <<-'RDOC_SEARCH'
378
+ <?xml version="1.0" encoding="iso-8859-1"?>
379
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
380
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
381
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
382
+ <head>
383
+ <title>Found documentation</title>
384
+ <link rel="stylesheet" href="gem-server-rdoc-style.css" type="text/css" media="screen" />
385
+ </head>
386
+ <body>
387
+ <div id="fileHeader">
388
+ <%= SEARCH %>
389
+ <h1>Found documentation</h1>
390
+ </div>
391
+ <!-- banner header -->
392
+
393
+ <div id="bodyContent">
394
+ <div id="contextContent">
395
+ <div id="description">
396
+ <h1>Summary</h1>
397
+ <p><%=doc_items.length%> documentation topics found.</p>
398
+ <h1>Topics</h1>
399
+
400
+ <dl>
401
+ <% doc_items.each do |doc_item| %>
402
+ <dt>
403
+ <b><%=doc_item[:name]%></b>
404
+ <a href="<%=doc_item[:url]%>">[rdoc]</a>
405
+ </dt>
406
+ <dd>
407
+ <%=doc_item[:summary]%>
408
+ <br/>
409
+ <br/>
410
+ </dd>
411
+ <% end %>
412
+ </dl>
413
+
414
+ <p>
415
+ Back to <a href="/">complete gem index</a>
416
+ </p>
417
+
418
+ </div>
419
+ </div>
420
+ </div>
421
+ <div id="validator-badges">
422
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
423
+ </div>
424
+ </body>
425
+ </html>
426
+ RDOC_SEARCH
329
427
 
330
428
  def self.run(options)
331
429
  new(options[:gemdir], options[:port], options[:daemon]).run
@@ -533,6 +631,90 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
533
631
  res.body = result
534
632
  end
535
633
 
634
+ ##
635
+ # Can be used for quick navigation to the rdoc documentation. You can then
636
+ # define a search shortcut for your browser. E.g. in Firefox connect
637
+ # 'shortcut:rdoc' to http://localhost:8808/rdoc?q=%s template. Then you can
638
+ # directly open the ActionPack documentation by typing 'rdoc actionp'. If
639
+ # there are multiple hits for the search term, they are presented as a list
640
+ # with links.
641
+ #
642
+ # Search algorithm aims for an intuitive search:
643
+ # 1. first try to find the gems and documentation folders which name
644
+ # starts with the search term
645
+ # 2. search for entries, that *contain* the search term
646
+ # 3. show all the gems
647
+ #
648
+ # If there is only one search hit, user is immediately redirected to the
649
+ # documentation for the particular gem, otherwise a list with results is
650
+ # shown.
651
+ #
652
+ # === Additional trick - install documentation for ruby core
653
+ #
654
+ # Note: please adjust paths accordingly use for example 'locate yaml.rb' and
655
+ # 'gem environment' to identify directories, that are specific for your
656
+ # local installation
657
+ #
658
+ # 1. install ruby sources
659
+ # cd /usr/src
660
+ # sudo apt-get source ruby
661
+ #
662
+ # 2. generate documentation
663
+ # rdoc -o /usr/lib/ruby/gems/1.8/doc/core/rdoc \
664
+ # /usr/lib/ruby/1.8 ruby1.8-1.8.7.72
665
+ #
666
+ # By typing 'rdoc core' you can now access the core documentation
667
+
668
+ def rdoc(req, res)
669
+ query = req.query['q']
670
+ show_rdoc_for_pattern("#{query}*", res) && return
671
+ show_rdoc_for_pattern("*#{query}*", res) && return
672
+
673
+ template = ERB.new RDOC_NO_DOCUMENTATION
674
+
675
+ res['content-type'] = 'text/html'
676
+ res.body = template.result binding
677
+ end
678
+
679
+ ##
680
+ # Returns true and prepares http response, if rdoc for the requested gem
681
+ # name pattern was found.
682
+ #
683
+ # The search is based on the file system content, not on the gems metadata.
684
+ # This allows additional documentation folders like 'core' for the ruby core
685
+ # documentation - just put it underneath the main doc folder.
686
+
687
+ def show_rdoc_for_pattern(pattern, res)
688
+ found_gems = Dir.glob("#{@gem_dir}/doc/#{pattern}").select {|path|
689
+ File.exist? File.join(path, 'rdoc/index.html')
690
+ }
691
+ case found_gems.length
692
+ when 0
693
+ return false
694
+ when 1
695
+ new_path = File.basename(found_gems[0])
696
+ res.status = 302
697
+ res['Location'] = "/doc_root/#{new_path}/rdoc/index.html"
698
+ return true
699
+ else
700
+ doc_items = []
701
+ found_gems.each do |file_name|
702
+ base_name = File.basename(file_name)
703
+ doc_items << {
704
+ :name => base_name,
705
+ :url => "/doc_root/#{base_name}/rdoc/index.html",
706
+ :summary => ''
707
+ }
708
+ end
709
+
710
+ template = ERB.new(RDOC_SEARCH_TEMPLATE)
711
+ res['content-type'] = 'text/html'
712
+ result = template.result binding
713
+ res.body = result
714
+ return true
715
+ end
716
+ end
717
+
536
718
  def run
537
719
  @server.listen nil, @port
538
720
 
@@ -564,6 +746,8 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
564
746
 
565
747
  @server.mount_proc "/", method(:root)
566
748
 
749
+ @server.mount_proc "/rdoc", method(:rdoc)
750
+
567
751
  paths = { "/gems" => "/cache/", "/doc_root" => "/doc/" }
568
752
  paths.each do |mount_point, mount_dir|
569
753
  @server.mount(mount_point, WEBrick::HTTPServlet::FileHandler,
@@ -10,19 +10,7 @@ require 'rubygems/requirement'
10
10
  require 'rubygems/platform'
11
11
 
12
12
  # :stopdoc:
13
- # Time::today has been deprecated in 0.9.5 and will be removed.
14
- if RUBY_VERSION < '1.9' then
15
- def Time.today
16
- file, lineno = location_of_caller
17
- warn "#{file}:#{lineno}:Warning: Time::today is deprecated and will be removed in RubyGems 1.4."
18
-
19
- t = Time.now
20
- t - ((t.to_f + t.gmt_offset) % 86400)
21
- end unless defined? Time.today
22
- end
23
-
24
13
  class Date; end # for ruby_code if date.rb wasn't required
25
-
26
14
  # :startdoc:
27
15
 
28
16
  ##
@@ -621,7 +609,11 @@ class Gem::Specification
621
609
  # The directory that this gem was installed into.
622
610
 
623
611
  def installation_path
624
- File.expand_path(File.dirname(File.dirname(@loaded_from)))
612
+ unless @loaded_from then
613
+ raise Gem::Exception, "spec #{full_name} is not from an installed gem"
614
+ end
615
+
616
+ File.expand_path File.dirname(File.dirname(@loaded_from))
625
617
  end
626
618
 
627
619
  ##
@@ -822,7 +814,9 @@ class Gem::Specification
822
814
 
823
815
  @files.delete_if do |file| File.directory? file end
824
816
  @test_files.delete_if do |file| File.directory? file end
825
- @executables.delete_if do |file| File.directory? file end
817
+ @executables.delete_if do |file|
818
+ File.directory? File.join(bindir, file)
819
+ end
826
820
  @extra_rdoc_files.delete_if do |file| File.directory? file end
827
821
  @extensions.delete_if do |file| File.directory? file end
828
822
 
@@ -883,7 +877,8 @@ class Gem::Specification
883
877
  '"FIXME" or "TODO" is not a summary'
884
878
  end
885
879
 
886
- unless homepage.empty? or homepage =~ /\A[a-z][a-z\d+.-]*:/i then
880
+ if homepage and not homepage.empty? and
881
+ homepage !~ /\A[a-z][a-z\d+.-]*:/i then
887
882
  raise Gem::InvalidSpecificationException,
888
883
  "\"#{homepage}\" is not a URI"
889
884
  end
@@ -899,9 +894,6 @@ class Gem::Specification
899
894
  alert_warning 'description and summary are identical'
900
895
  end
901
896
 
902
- alert_warning "RDoc will not be generated (has_rdoc == false)" unless
903
- has_rdoc
904
-
905
897
  alert_warning "deprecated autorequire specified" if autorequire
906
898
 
907
899
  executables.each do |executable|
@@ -1144,9 +1136,11 @@ class Gem::Specification
1144
1136
  ##
1145
1137
  # :attr_accessor: has_rdoc
1146
1138
  #
1147
- # True if this gem is RDoc-compliant
1139
+ # Deprecated and ignored, defaults to true.
1140
+ #
1141
+ # Formerly used to indicate this gem was RDoc-capable.
1148
1142
 
1149
- attribute :has_rdoc, false
1143
+ attribute :has_rdoc, true
1150
1144
 
1151
1145
  ##
1152
1146
  # True if this gem supports RDoc
@@ -1305,6 +1299,20 @@ class Gem::Specification
1305
1299
 
1306
1300
  attribute_alias_singular :test_file, :test_files
1307
1301
 
1302
+ ##
1303
+ # has_rdoc is now ignored
1304
+
1305
+ overwrite_accessor :has_rdoc do
1306
+ true
1307
+ end
1308
+
1309
+ ##
1310
+ # has_rdoc is now ignored
1311
+
1312
+ overwrite_accessor :has_rdoc= do |value|
1313
+ @has_rdoc = true
1314
+ end
1315
+
1308
1316
  overwrite_accessor :version= do |version|
1309
1317
  @version = Gem::Version.create(version)
1310
1318
  self.required_rubygems_version = '> 1.3.1' if @version.prerelease?
@@ -106,8 +106,8 @@ class Gem::Uninstaller
106
106
  hook.call self
107
107
  end
108
108
 
109
- specs.each { |s| remove_executables s }
110
- remove spec, specs
109
+ remove_executables @spec
110
+ remove @spec, specs
111
111
 
112
112
  Gem.post_uninstall_hooks.each do |hook|
113
113
  hook.call self
@@ -120,29 +120,29 @@ class Gem::Uninstaller
120
120
  # Removes installed executables and batch files (windows only) for
121
121
  # +gemspec+.
122
122
 
123
- def remove_executables(gemspec)
124
- return if gemspec.nil?
123
+ def remove_executables(spec)
124
+ return if spec.nil?
125
125
 
126
- if gemspec.executables.size > 0 then
127
- bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home)
126
+ unless spec.executables.empty? then
127
+ bindir = @bin_dir ? @bin_dir : Gem.bindir(spec.installation_path)
128
128
 
129
- list = @source_index.find_name(gemspec.name).delete_if { |spec|
130
- spec.version == gemspec.version
129
+ list = @source_index.find_name(spec.name).delete_if { |spec|
130
+ spec.version == spec.version
131
131
  }
132
132
 
133
- executables = gemspec.executables.clone
133
+ executables = spec.executables.clone
134
134
 
135
135
  list.each do |spec|
136
136
  spec.executables.each do |exe_name|
137
- executables.delete(exe_name)
137
+ executables.delete exe_name
138
138
  end
139
139
  end
140
140
 
141
- return if executables.size == 0
141
+ return if executables.empty?
142
142
 
143
143
  answer = if @force_executables.nil? then
144
144
  ask_yes_no("Remove executables:\n" \
145
- "\t#{gemspec.executables.join(", ")}\n\nin addition to the gem?",
145
+ "\t#{spec.executables.join(", ")}\n\nin addition to the gem?",
146
146
  true) # " # appease ruby-mode - don't ask
147
147
  else
148
148
  @force_executables
@@ -153,7 +153,7 @@ class Gem::Uninstaller
153
153
  else
154
154
  raise Gem::FilePermissionError, bindir unless File.writable? bindir
155
155
 
156
- gemspec.executables.each do |exe_name|
156
+ spec.executables.each do |exe_name|
157
157
  say "Removing #{exe_name}"
158
158
  FileUtils.rm_f File.join(bindir, exe_name)
159
159
  FileUtils.rm_f File.join(bindir, "#{exe_name}.bat")