rubygems-update 0.8.4 → 0.8.5

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.

data/ChangeLog CHANGED
@@ -1,3 +1,45 @@
1
+ 2005-02-26 Jim Weirich <jim@weirichhouse.org>
2
+
3
+ * lib/rubygems/doc_manager.rb (Gem::DocManager::generate_rdoc):
4
+ Removed warning about generating rdocs on gems w/o an rdoc flag.
5
+
6
+ * lib/rubygems/gem_commands.rb
7
+ (Gem::UpdateCommand::do_rubygems_update): Added --system option to
8
+ update to specifically update the version of rubygems.
9
+ (Gem::UpdateCommand::which_to_update): Fixed some refactoring bugs
10
+ in the which_to_update method.
11
+
12
+ * lib/rubygems/remote_installer.rb
13
+ (Gem::LocalSourceInfoCache::read_cache): switched to Marshal
14
+ rather than Yaml for local cache.
15
+
16
+ * bin/gem: Added requirement for Ruby >= 1.8.0.
17
+
18
+ 2005-02-10 Chad Fowler <chad@chadfowler.com>
19
+ * bin/gem_server: Added Martin Ankerl's wonderful new gem_server
20
+ template
21
+
22
+ 2005-01-27 Chad Fowler <chad@chadfowler.com>
23
+ * lib/rubygems/gem_commands.rb: Fixed
24
+ `gem update` so it accepts a list of gems to update and _only_
25
+ updates those.
26
+ * lib/rubygems/installer.rb: Fixed a bug in the new shebang code.
27
+ * lib/rubygems/remote_installer.rb: Attempt to fix Curt Hibbs'
28
+ reported Proxy bug without actually having a proxy to test with.
29
+
30
+ 2005-01-22 Chad Fowler <chad@chadfowler.com>
31
+ * lib/rubygems/custom_require.rb: Lyle Johnson's fix for Bug #1379
32
+
33
+ 2005-01-20 Chad Fowler <chad@chadfowler.com>
34
+ * lib/rubygems/validator.rb: Applied Austin Ziegler/Kasper Schiess's
35
+ patch to fix unit test running bug.
36
+
37
+ 2005-01-14 Chad Fowler <chad@chadfowler.com>
38
+ * lib/rubygems/installer.rb: attempt at fixing Ryan Davis's reported Shebang bug.
39
+ STILL NOT WORKING, because it doesn't work with ^M characters.
40
+ * lib/rubygems/config_file.rb: small but ugly error fixed if no config file exists.
41
+ * lib/rubygems/remote_installer.rb: Fixed bug http://rubyforge.org/tracker/index.php?func=detail&aid=1331&group_id=126&atid=575.
42
+
1
43
  2005-01-01 Chad Fowler <chad@chadfowler.com>
2
44
  * Released 0.8.4
3
45
 
data/bin/gem CHANGED
@@ -3,6 +3,12 @@
3
3
  require 'rubygems'
4
4
  Gem.manage_gems
5
5
 
6
+ required_version = Gem::Version::Requirement.new(">= 1.8.0")
7
+ unless required_version.satisfied_by?(Gem::Version.new(RUBY_VERSION))
8
+ puts "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}"
9
+ exit(1)
10
+ end
11
+
6
12
  # We need to preserve the original ARGV to use for passing gem options
7
13
  # to source gems. If there is a -- in the line, strip all options after
8
14
  # it...its for the source building process.
@@ -1,40 +1,320 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  DOC_TEMPLATE = <<-WEBPAGE
4
- <?xml version="1.0" encoding="utf-8"?>
5
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
6
- <html xmlns="http://www.w3.org/1999/xhtml">
7
- <head>
8
- <title>RubyGems Documentation Index</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
- </head>
11
- <body>
12
- <center>
13
- <h1>RubyGems Documentation Index</h1>
14
- <table border="2">
15
- <tr>
16
- <td align='center'><h3>Gem Name</h3></td>
17
- <td align='center'><h3>Description</h3></td>
18
- <td align='center'><h3>Documentation</h3></td>
19
- </tr>
4
+ <?xml version="1.0" encoding="iso-8859-1"?>
5
+ <!DOCTYPE html
6
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
7
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
8
+
9
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
10
+ <head>
11
+ <title>RubyGems Documentation Index</title>
12
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
13
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" media="screen" />
14
+ </head>
15
+ <body>
16
+ <div id="fileHeader">
17
+ <h1>RubyGems Documentation Index</h1>
18
+ </div>
19
+ <!-- banner header -->
20
+
21
+ <div id="bodyContent">
22
+ <div id="contextContent">
23
+ <div id="description">
24
+ <h1>Summary</h1>
25
+ <p>There are %gem_count% gems installed:</p>
26
+ <p>
27
+ START:specs
28
+ IFNOT:is_last
29
+ <a href="#%name%">%name%</a>,
30
+ ENDIF:is_last
31
+ IF:is_last
32
+ <a href="#%name%">%name%</a>.
33
+ ENDIF:is_last
34
+ END:specs
35
+ <h1>Gems</h1>
36
+
37
+ <dl>
20
38
  START:specs
21
- <tr><td>%full_name%</td>
22
- <td>%summary%</td>
23
- <td>
39
+ <dt>
40
+ IF:first_name_entry
41
+ <a name="%name%"></a>
42
+ ENDIF:first_name_entry
43
+ <b>%name% %version%</b>
24
44
  IF:rdoc_installed
25
- <a href="%doc_path%">RDoc Index</a>
45
+ <a href="%doc_path%" target="_blank">[rdoc]</a>
26
46
  ENDIF:rdoc_installed
27
47
  IFNOT:rdoc_installed
28
- None installed
48
+ <span title="rdoc not installed">[rdoc]</span>
29
49
  ENDIF:rdoc_installed
30
- </td>
31
- </tr>
50
+ IF:homepage
51
+ <a href="%homepage%" target="_blank" title="%homepage%">[www]</a>
52
+ ENDIF:homepage
53
+ IFNOT:homepage
54
+ <span title="no homepage available">[www]</span>
55
+ ENDIF:homepage
56
+ IF:has_deps
57
+ - depends on
58
+ START:dependencies
59
+ IFNOT:is_last
60
+ <a href="#%name%" title="%version%">%name%</a>,
61
+ ENDIF:is_last
62
+ IF:is_last
63
+ <a href="#%name%" title="%version%">%name%</a>.
64
+ ENDIF:is_last
65
+ END:dependencies
66
+ ENDIF:has_deps
67
+ </dt>
68
+ <dd>
69
+ %summary%
70
+ IF:executables
71
+ <br/>
72
+
73
+ IF:only_one_executable
74
+ Executable is
75
+ ENDIF:only_one_executable
76
+
77
+ IFNOT:only_one_executable
78
+ Executables are
79
+ ENDIF:only_one_executable
80
+
81
+ START:executables
82
+ IFNOT:is_last
83
+ <span class="context-item-name">%executable%</span>,
84
+ ENDIF:is_last
85
+ IF:is_last
86
+ <span class="context-item-name">%executable%</span>.
87
+ ENDIF:is_last
88
+ END:executables
89
+ ENDIF:executables
90
+ <br/>
91
+ <br/>
92
+ </dd>
32
93
  END:specs
33
- </table>
34
- </center>
35
- </body>
36
- </html>
37
- WEBPAGE
94
+ </dl>
95
+
96
+ </div>
97
+ </div>
98
+ </div>
99
+ <div id="validator-badges">
100
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
101
+ </div>
102
+ </body>
103
+ </html>
104
+ WEBPAGE
105
+
106
+
107
+ # CSS is copy & paste from rdoc-style.css, RDoc V1.0.1 - 20041108
108
+ RDOC_CSS = <<-RDOCCSS
109
+ body {
110
+ font-family: Verdana,Arial,Helvetica,sans-serif;
111
+ font-size: 90%;
112
+ margin: 0;
113
+ margin-left: 40px;
114
+ padding: 0;
115
+ background: white;
116
+ }
117
+
118
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
119
+ h1 { font-size: 150%; }
120
+ h2,h3,h4 { margin-top: 1em; }
121
+
122
+ a { background: #eef; color: #039; text-decoration: none; }
123
+ a:hover { background: #039; color: #eef; }
124
+
125
+ /* Override the base stylesheet's Anchor inside a table cell */
126
+ td > a {
127
+ background: transparent;
128
+ color: #039;
129
+ text-decoration: none;
130
+ }
131
+
132
+ /* and inside a section title */
133
+ .section-title > a {
134
+ background: transparent;
135
+ color: #eee;
136
+ text-decoration: none;
137
+ }
138
+
139
+ /* === Structural elements =================================== */
140
+
141
+ div#index {
142
+ margin: 0;
143
+ margin-left: -40px;
144
+ padding: 0;
145
+ font-size: 90%;
146
+ }
147
+
148
+
149
+ div#index a {
150
+ margin-left: 0.7em;
151
+ }
152
+
153
+ div#index .section-bar {
154
+ margin-left: 0px;
155
+ padding-left: 0.7em;
156
+ background: #ccc;
157
+ font-size: small;
158
+ }
159
+
160
+
161
+ div#classHeader, div#fileHeader {
162
+ width: auto;
163
+ color: white;
164
+ padding: 0.5em 1.5em 0.5em 1.5em;
165
+ margin: 0;
166
+ margin-left: -40px;
167
+ border-bottom: 3px solid #006;
168
+ }
169
+
170
+ div#classHeader a, div#fileHeader a {
171
+ background: inherit;
172
+ color: white;
173
+ }
174
+
175
+ div#classHeader td, div#fileHeader td {
176
+ background: inherit;
177
+ color: white;
178
+ }
179
+
180
+
181
+ div#fileHeader {
182
+ background: #057;
183
+ }
184
+
185
+ div#classHeader {
186
+ background: #048;
187
+ }
188
+
189
+
190
+ .class-name-in-header {
191
+ font-size: 180%;
192
+ font-weight: bold;
193
+ }
194
+
195
+
196
+ div#bodyContent {
197
+ padding: 0 1.5em 0 1.5em;
198
+ }
199
+
200
+ div#description {
201
+ padding: 0.5em 1.5em;
202
+ background: #efefef;
203
+ border: 1px dotted #999;
204
+ }
205
+
206
+ div#description h1,h2,h3,h4,h5,h6 {
207
+ color: #125;;
208
+ background: transparent;
209
+ }
210
+
211
+ div#validator-badges {
212
+ text-align: center;
213
+ }
214
+ div#validator-badges img { border: 0; }
215
+
216
+ div#copyright {
217
+ color: #333;
218
+ background: #efefef;
219
+ font: 0.75em sans-serif;
220
+ margin-top: 5em;
221
+ margin-bottom: 0;
222
+ padding: 0.5em 2em;
223
+ }
224
+
225
+
226
+ /* === Classes =================================== */
227
+
228
+ table.header-table {
229
+ color: white;
230
+ font-size: small;
231
+ }
232
+
233
+ .type-note {
234
+ font-size: small;
235
+ color: #DEDEDE;
236
+ }
237
+
238
+ .xxsection-bar {
239
+ background: #eee;
240
+ color: #333;
241
+ padding: 3px;
242
+ }
243
+
244
+ .section-bar {
245
+ color: #333;
246
+ border-bottom: 1px solid #999;
247
+ margin-left: -20px;
248
+ }
249
+
250
+
251
+ .section-title {
252
+ background: #79a;
253
+ color: #eee;
254
+ padding: 3px;
255
+ margin-top: 2em;
256
+ margin-left: -30px;
257
+ border: 1px solid #999;
258
+ }
259
+
260
+ .top-aligned-row { vertical-align: top }
261
+ .bottom-aligned-row { vertical-align: bottom }
262
+
263
+ /* --- Context section classes ----------------------- */
264
+
265
+ .context-row { }
266
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
267
+ .context-item-value { font-size: small; color: #448; }
268
+ .context-item-desc { color: #333; padding-left: 2em; }
269
+
270
+ /* --- Method classes -------------------------- */
271
+ .method-detail {
272
+ background: #efefef;
273
+ padding: 0;
274
+ margin-top: 0.5em;
275
+ margin-bottom: 1em;
276
+ border: 1px dotted #ccc;
277
+ }
278
+ .method-heading {
279
+ color: black;
280
+ background: #ccc;
281
+ border-bottom: 1px solid #666;
282
+ padding: 0.2em 0.5em 0 0.5em;
283
+ }
284
+ .method-signature { color: black; background: inherit; }
285
+ .method-name { font-weight: bold; }
286
+ .method-args { font-style: italic; }
287
+ .method-description { padding: 0 0.5em 0 0.5em; }
288
+
289
+ /* --- Source code sections -------------------- */
290
+
291
+ a.source-toggle { font-size: 90%; }
292
+ div.method-source-code {
293
+ background: #262626;
294
+ color: #ffdead;
295
+ margin: 1em;
296
+ padding: 0.5em;
297
+ border: 1px dashed #999;
298
+ overflow: hidden;
299
+ }
300
+
301
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
302
+
303
+ /* --- Ruby keyword styles --------------------- */
304
+
305
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
306
+
307
+ .ruby-constant { color: #7fffd4; background: transparent; }
308
+ .ruby-keyword { color: #00ffff; background: transparent; }
309
+ .ruby-ivar { color: #eedd82; background: transparent; }
310
+ .ruby-operator { color: #00ffee; background: transparent; }
311
+ .ruby-identifier { color: #ffdead; background: transparent; }
312
+ .ruby-node { color: #ffa07a; background: transparent; }
313
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
314
+ .ruby-regexp { color: #ffa07a; background: transparent; }
315
+ .ruby-value { color: #7fffd4; background: transparent; }
316
+ RDOCCSS
317
+
38
318
 
39
319
 
40
320
  ##
@@ -78,27 +358,76 @@ if __FILE__ == $0
78
358
  res.body << Gem::SourceIndex.from_installed_gems(fn).to_yaml
79
359
  }
80
360
 
361
+ s.mount_proc("/rdoc-style.css") { |req, res|
362
+ fn = File.join(options[:gemdir] || Gem.dir, "specifications")
363
+ res['content-type'] = 'text/css'
364
+ res['date'] = File.stat(fn).mtime
365
+ res.body << RDOC_CSS
366
+ }
367
+
81
368
  s.mount_proc("/") { |req, res|
82
369
  specs = []
83
370
  specifications_dir = File.join(options[:gemdir] || Gem.dir, "specifications")
371
+ total_file_count = 0
84
372
  Gem::SourceIndex.from_installed_gems(specifications_dir).each do |path, spec|
373
+ total_file_count += spec.files.size
374
+ deps = spec.dependencies.collect { |dep|
375
+ {
376
+ "name" => dep.name,
377
+ "version" => dep.version_requirements.to_s,
378
+ }
379
+ }
380
+ deps = deps.sort_by { |dep| [dep["name"].downcase, dep["version"]] }
381
+ deps.last["is_last"] = true unless deps.empty?
382
+
383
+ # executables
384
+ executables = spec.executables.sort.collect { |exec| {"executable" => exec} }
385
+ executables = nil if executables.empty?
386
+ executables.last["is_last"] = true if executables
387
+
85
388
  specs << {
86
- "name" => spec.name,
87
- "version" => spec.version,
389
+ "authors" => spec.authors.sort.join(", "),
390
+ "date" => spec.date.to_s,
391
+ "dependencies" => deps,
392
+ "doc_path" => ('/doc_root/' + spec.full_name + '/rdoc/index.html'),
393
+ "executables" => executables,
394
+ "only_one_executable" => (executables && executables.size==1),
88
395
  "full_name" => spec.full_name,
89
- "summary" => spec.summary,
396
+ "has_deps" => !deps.empty?,
397
+ "homepage" => spec.homepage,
398
+ "name" => spec.name,
90
399
  "rdoc_installed" => Gem::DocManager.new(spec).rdoc_installed?,
91
- "doc_path" => ('/doc_root/' + spec.full_name + '/rdoc/index.html')
400
+ "summary" => spec.summary,
401
+ "version" => spec.version.to_s,
92
402
  }
93
403
  end
94
404
  specs = specs.sort_by { |spec| [spec["name"].downcase, spec["version"]] }
405
+ specs.last["is_last"] = true
406
+
407
+ # tag all specs with first_name_entry
408
+ last_spec = nil
409
+ specs.each do |spec|
410
+ is_first = last_spec.nil? || (last_spec["name"].downcase != spec["name"].downcase)
411
+ spec["first_name_entry"] = is_first
412
+ last_spec = spec
413
+ end
414
+
415
+ # create page from template
95
416
  template = TemplatePage.new(DOC_TEMPLATE)
96
417
  res['content-type'] = 'text/html'
97
- template.write_html_on(res.body, {"specs" => specs})
418
+ template.write_html_on(
419
+ res.body,
420
+ {
421
+ "gem_count" => specs.size.to_s,
422
+ "specs" => specs,
423
+ "total_file_count" => total_file_count.to_s,
424
+ }
425
+ )
426
+
98
427
  }
99
428
  {
100
429
  "/gems" => "/cache/",
101
- "/doc_root" => "/doc/"
430
+ "/doc_root" => "/doc/",
102
431
  }.each do |mount_point, mount_dir|
103
432
  s.mount(
104
433
  mount_point,
@@ -8,7 +8,6 @@ spec = Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.summary = "This gem demonstrates executable scripts"
10
10
  s.requirements << 'a computer processor'
11
- s.add_dependency("session", "> 0.0.0")
12
11
  s.files = Dir.glob("lib/**/*").delete_if {|item| item.include?("CVS")}
13
12
  s.files.concat Dir.glob("bin/**/*").delete_if {|item| item.include?("CVS")}
14
13
  s.require_path = 'lib'
@@ -1,3 +1,3 @@
1
- #!/usr/local/bin/ruby
1
+ #!/usr/bin/ruby -w
2
2
  require 'somefunctionality'
3
3
  go
@@ -8,11 +8,14 @@ module Gem
8
8
 
9
9
  def initialize(arg_list)
10
10
  handle_arguments(arg_list)
11
- if File.exist?(config_file_name)
12
- @hash = open(config_file_name) { |f| YAML.load(f) }
13
- else
14
- @hash = {}
11
+ begin
12
+ @hash = open(config_file_name) {|f| YAML.load(f) }
13
+ rescue ArgumentError
14
+ warn "Failed to load #{config_file_name}"
15
+ rescue Errno::ENOENT
16
+ warn "Config file #{config_file_name} does not exist"
15
17
  end
18
+ @hash ||= {}
16
19
  end
17
20
 
18
21
  def config_file_name
@@ -16,14 +16,14 @@ module Kernel
16
16
  #
17
17
  def require(path)
18
18
  require__ path
19
- rescue LoadError
19
+ rescue LoadError => load_error
20
20
  begin
21
21
  @gempath_searcher ||= Gem::GemPathSearcher.new
22
22
  if spec = @gempath_searcher.find(path)
23
23
  Gem.activate(spec.name, true, "= #{spec.version}")
24
24
  require__ path
25
25
  else
26
- raise LoadError, "No such file to load -- #{path}"
26
+ raise load_error
27
27
  end
28
28
  end
29
29
  end
@@ -101,7 +101,7 @@ module Gem
101
101
  # Returns library directories glob for a gemspec. For example,
102
102
  # '/usr/local/lib/ruby/gems/1.8/gems/foobar-1.0/{lib,ext}'
103
103
  def lib_dirs(spec)
104
- "#{spec.full_gem_path}/#{spec.require_paths.join(',')}"
104
+ "#{spec.full_gem_path}/{#{spec.require_paths.join(',')}}"
105
105
  end
106
106
 
107
107
  end # class Gem::GemPathLoader
@@ -44,7 +44,6 @@ module Gem
44
44
  raise DocumentError, "ERROR: RDoc documentation generator not installed!"
45
45
  end
46
46
  say "Installing RDoc documentation for #{@spec.full_name}..."
47
- say "WARNING: Generating RDoc on .gem that may not have RDoc." unless @spec.has_rdoc?
48
47
  rdoc_dir = File.join(@doc_dir, "rdoc")
49
48
  begin
50
49
  source_dirs = @spec.require_paths.clone.concat(@spec.extra_rdoc_files)
@@ -153,6 +153,10 @@ module Gem
153
153
  rescue Gem::LoadError => e
154
154
  say " -> Local installation can't proceed due to LoadError: #{e.message}"
155
155
  rescue => e
156
+ # TODO: Fix this handle to allow the error to propagate to
157
+ # the top level handler. Example the other errors as
158
+ # well. This implementation here looks suspicious to me --
159
+ # JimWeirich (4/Jan/05)
156
160
  alert_error "Error installing gem #{gem_name}[.gem]: #{e.message}"
157
161
  return
158
162
  end
@@ -498,7 +502,7 @@ module Gem
498
502
  def initialize
499
503
  super(
500
504
  'update',
501
- 'Upgrade all currently installed gems in the local repository',
505
+ 'Upgrade currently installed gems in the local repository',
502
506
  {
503
507
  :generate_rdoc => true,
504
508
  :force => false,
@@ -506,6 +510,10 @@ module Gem
506
510
  :install_dir => Gem.dir
507
511
  })
508
512
  add_install_update_options
513
+ add_option('--system',
514
+ 'Update the RubyGems system software') do |value, options|
515
+ options[:system] = value
516
+ end
509
517
  end
510
518
 
511
519
  def defaults_str
@@ -513,8 +521,21 @@ module Gem
513
521
  "--install-dir #{Gem.dir}"
514
522
  end
515
523
 
524
+ def arguments
525
+ "GEMNAME(s) name of gem(s) to update"
526
+ end
527
+
528
+
516
529
  def execute
517
- say "Upgrading installed gems..."
530
+ if options[:system]
531
+ say "Upgrading RubyGems..."
532
+ if ! options[:args].empty?
533
+ fail "No gem names are allowed with the --system option"
534
+ end
535
+ options[:args] = ["rubygems-update"]
536
+ else
537
+ say "Upgrading installed gems..."
538
+ end
518
539
  hig = highest_installed_gems = {}
519
540
  Gem::SourceIndex.from_installed_gems.each do |name, spec|
520
541
  if hig[spec.name].nil? or hig[spec.name].version < spec.version
@@ -522,20 +543,15 @@ module Gem
522
543
  end
523
544
  end
524
545
  remote_gemspecs = Gem::RemoteInstaller.new(options).search(//)
525
- # For some reason, this is an array of arrays. The actual list of specifications is
526
- # the first and only element. If there were more remote sources, perhaps there would be
527
- # more.
546
+ # For some reason, this is an array of arrays. The actual list
547
+ # of specifications is the first and only element. If there
548
+ # were more remote sources, perhaps there would be more.
528
549
  remote_gemspecs = remote_gemspecs.flatten
529
- gems_to_update = []
530
- highest_installed_gems.each do |l_name, l_spec|
531
- hrg = highest_remote_gem =
532
- remote_gemspecs.select { |spec| spec.name == l_name }.
533
- sort_by { |spec| spec.version }.
534
- last
535
- if hrg and l_spec.version < hrg.version
536
- gems_to_update << l_name
537
- end
538
- end
550
+ gems_to_update = if(options[:args].empty?) then
551
+ which_to_update(highest_installed_gems, remote_gemspecs)
552
+ else
553
+ options[:args]
554
+ end
539
555
  options[:domain] = :remote # install from remote source
540
556
  install_command = command_manager['install']
541
557
  gems_to_update.uniq.sort.each do |name|
@@ -544,9 +560,36 @@ module Gem
544
560
  install_command.merge_options(options)
545
561
  install_command.execute
546
562
  end
563
+ if gems_to_update.include?("rubygems-update")
564
+ say "Updating version of RubyGems"
565
+ do_rubygems_update
566
+ end
547
567
  say "All gems up to date"
548
568
  end
549
569
 
570
+ def do_rubygems_update
571
+ # Need to clear out the argument list because the
572
+ # update_rubygems script expects to handle command line
573
+ # argument.
574
+ ARGV.clear
575
+ require_gem 'rubygems-update'
576
+ load 'update_rubygems'
577
+ end
578
+
579
+ def which_to_update(highest_installed_gems, remote_gemspecs)
580
+ result = []
581
+ highest_installed_gems.each do |l_name, l_spec|
582
+ highest_remote_gem =
583
+ remote_gemspecs.select { |spec| spec.name == l_name }.
584
+ sort_by { |spec| spec.version }.
585
+ last
586
+ if highest_remote_gem and l_spec.version < highest_remote_gem.version
587
+ result << l_name
588
+ end
589
+ end
590
+ result
591
+ end
592
+
550
593
  def command_manager
551
594
  Gem::CommandManager.instance
552
595
  end
@@ -144,24 +144,35 @@ module Gem
144
144
  raise Gem::FilePermissionError.new(bindir) unless File.writable?(bindir)
145
145
  spec.executables.each do |filename|
146
146
  File.open(File.join(bindir, File.basename(filename)), "w", 0755) do |file|
147
- file.print(app_script_text(spec.name, spec.version.version, filename))
147
+ file.print(app_script_text(spec, install_dir, filename))
148
148
  end
149
149
  generate_windows_script(bindir, filename)
150
150
  end
151
151
  end
152
152
  end
153
153
 
154
+ def shebang(spec, install_dir, file_name)
155
+ first_line = ""
156
+ File.open(File.join(install_dir, "gems", spec.full_name, spec.bindir,file_name), "rb") do |file|
157
+ first_line = file.readlines("\n").first
158
+ end
159
+ if first_line =~ /^#!/ then
160
+ first_line.sub(/\A\#!\s*\S*ruby\S*/, "#!" + File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])) #Thanks RPA
161
+ else
162
+ File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
163
+ end
164
+ end
165
+
154
166
  ##
155
167
  # Returns the text for an application file.
156
168
  #
157
- def app_script_text(name, version, filename)
169
+ def app_script_text(spec, install_dir, filename)
158
170
  text = <<-TEXT
159
- #!#{File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])}
160
-
171
+ #{shebang(spec, install_dir, filename)}
161
172
  #
162
173
  # This file was generated by RubyGems.
163
174
  #
164
- # The application '#{name}' is installed as part of a gem, and
175
+ # The application '#{spec.name}' is installed as part of a gem, and
165
176
  # this file is here to facilitate running it.
166
177
  #
167
178
 
@@ -173,7 +184,7 @@ if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95
173
184
  ARGV.shift
174
185
  end
175
186
  end
176
- require_gem '#{name}', version
187
+ require_gem '#{spec.name}', version
177
188
  load '#{filename}'
178
189
  TEXT
179
190
  text
@@ -170,7 +170,7 @@ module Gem
170
170
  def write_cache
171
171
  data = cache_data
172
172
  open(writable_file, "w") do |f|
173
- f.puts data.to_yaml
173
+ f.puts Marshal.dump(data)
174
174
  end
175
175
  end
176
176
 
@@ -206,7 +206,17 @@ module Gem
206
206
  # Read the most current cache data.
207
207
  def read_cache
208
208
  @cache_file = select_cache_file
209
- open(@cache_file) { |f| YAML.load(f) } || {}
209
+ begin
210
+ open(@cache_file) { |f| load_local_cache(f) } || {}
211
+ rescue StandardError => ex
212
+ {}
213
+ end
214
+ end
215
+
216
+ def load_local_cache(f)
217
+ Marshal.load(f)
218
+ rescue StandardError => ex
219
+ {}
210
220
  end
211
221
 
212
222
  # Select a writable cache file
@@ -334,7 +344,7 @@ module Gem
334
344
  when nil
335
345
  true
336
346
  else
337
- http_proxy.to_str
347
+ @options[:http_proxy].to_str
338
348
  end
339
349
  @fetcher_class = CachedFetcher
340
350
  end
@@ -414,7 +424,7 @@ module Gem
414
424
  specs_n_sources = []
415
425
  caches.each do |source, cache|
416
426
  cache.each do |name, spec|
417
- if (/#{gem_name}/i === name &&
427
+ if (/^#{gem_name}-/i === name &&
418
428
  version_requirement.satisfied_by?(spec.version))
419
429
  specs_n_sources << [spec, source]
420
430
  end
@@ -2,5 +2,5 @@
2
2
  # This file is auto-generated by build scripts.
3
3
  # See: rake update_version
4
4
  module Gem
5
- RubyGemsVersion = '0.8.4'
5
+ RubyGemsVersion = '0.8.5'
6
6
  end
@@ -139,6 +139,7 @@ module Gem
139
139
  #end
140
140
  end
141
141
  Dir.chdir(start_dir)
142
+ result
142
143
  end
143
144
 
144
145
  def remove_leading_dot_dir(path)
@@ -11,7 +11,7 @@ module Utilities
11
11
  def make_cache_area(path, *uris)
12
12
  make_gemhome(path)
13
13
  fn = File.join(path, 'source_cache')
14
- open(fn, 'w') do |f| f.write cache_hash(*uris).to_yaml end
14
+ open(fn, 'w') do |f| f.write Marshal.dump(cache_hash(*uris)) end
15
15
  end
16
16
 
17
17
  extend self
@@ -138,7 +138,7 @@ class TestLocalCache < Test::Unit::TestCase
138
138
  [lc.user_cache_file, 'usr'],
139
139
  ].each do |fn, data|
140
140
  FileUtils.mkdir_p File.dirname(fn)
141
- open(fn, "w") { |f| f.puts({'key' => data}.to_yaml) }
141
+ open(fn, "w") { |f| f.puts(Marshal.dump({'key' => data})) }
142
142
  end
143
143
  end
144
144
 
@@ -150,7 +150,7 @@ class TestLocalCache < Test::Unit::TestCase
150
150
  end
151
151
 
152
152
  def read_cache(fn)
153
- open(fn) { |f| YAML.load(f) }
153
+ open(fn) { |f| Marshal.load(f) }
154
154
  end
155
155
 
156
156
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.3
2
+ rubygems_version: 0.8.4.1
3
3
  specification_version: 1
4
4
  name: rubygems-update
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.4
7
- date: 2005-01-01
6
+ version: 0.8.5
7
+ date: 2005-02-26
8
8
  summary: RubyGems Update GEM
9
9
  require_paths:
10
10
  - lib
@@ -41,17 +41,17 @@ files:
41
41
  - doc/doc.css
42
42
  - doc/makedoc.rb
43
43
  - examples/application
44
- - examples/application/an-app.gemspec
45
44
  - examples/application/bin
46
45
  - examples/application/lib
46
+ - examples/application/an-app.gemspec
47
47
  - examples/application/bin/myapp
48
48
  - examples/application/lib/somefunctionality.rb
49
+ - gemspecs/ook.gemspec
50
+ - gemspecs/README
49
51
  - gemspecs/cgikit-1.1.0.gemspec
50
52
  - gemspecs/jabber4r.gemspec
51
53
  - gemspecs/linguistics.gemspec
52
- - gemspecs/ook.gemspec
53
54
  - gemspecs/progressbar.gemspec
54
- - gemspecs/README
55
55
  - gemspecs/redcloth.gemspec
56
56
  - gemspecs/rublog.gemspec
57
57
  - gemspecs/ruby-doom.gemspec
@@ -60,13 +60,12 @@ files:
60
60
  - lib/rubygems.rb
61
61
  - lib/ubygems.rb
62
62
  - lib/rubygems/builder.rb
63
- - lib/rubygems/cmd_manager.rb
64
63
  - lib/rubygems/command.rb
65
64
  - lib/rubygems/config_file.rb
66
65
  - lib/rubygems/custom_require.rb
67
66
  - lib/rubygems/doc_manager.rb
68
67
  - lib/rubygems/format.rb
69
- - lib/rubygems/gem_commands.rb
68
+ - lib/rubygems/cmd_manager.rb
70
69
  - lib/rubygems/gem_runner.rb
71
70
  - lib/rubygems/installer.rb
72
71
  - lib/rubygems/loadpath_manager.rb
@@ -81,6 +80,7 @@ files:
81
80
  - lib/rubygems/user_interaction.rb
82
81
  - lib/rubygems/validator.rb
83
82
  - lib/rubygems/version.rb
83
+ - lib/rubygems/gem_commands.rb
84
84
  - pkgs/sources
85
85
  - pkgs/sources/lib
86
86
  - pkgs/sources/sources.gemspec
@@ -90,13 +90,13 @@ files:
90
90
  - scripts/gemdoc.rb
91
91
  - scripts/runtest.rb
92
92
  - scripts/specdoc.rb
93
- - test/bogussources.rb
94
93
  - test/data
94
+ - test/mock
95
+ - test/bogussources.rb
95
96
  - test/functional.rb
96
97
  - test/gemenvironment.rb
97
98
  - test/gemutilities.rb
98
99
  - test/insure_session.rb
99
- - test/mock
100
100
  - test/mockgemui.rb
101
101
  - test/onegem.rb
102
102
  - test/simple_gem.rb
@@ -122,48 +122,18 @@ files:
122
122
  - test/testgem.rc
123
123
  - test/user_capture.rb
124
124
  - test/yaml_data.rb
125
- - test/data/a-0.0.1.gem
126
- - test/data/a-0.0.2.gem
127
- - test/data/b-0.0.2.gem
128
- - test/data/c-1.2.gem
129
- - test/data/gemhome
130
125
  - test/data/gems
126
+ - test/data/one
131
127
  - test/data/legacy
132
128
  - test/data/lib
133
- - test/data/one
134
- - test/data/gemhome/cache
135
- - test/data/gemhome/doc
136
- - test/data/gemhome/gems
137
- - test/data/gemhome/specifications
138
- - test/data/gemhome/cache/a-0.0.1.gem
139
- - test/data/gemhome/cache/a-0.0.2.gem
140
- - test/data/gemhome/cache/b-0.0.2.gem
141
- - test/data/gemhome/cache/c-1.2.gem
142
- - test/data/gemhome/gems/a-0.0.1
143
- - test/data/gemhome/gems/a-0.0.2
144
- - test/data/gemhome/gems/b-0.0.2
145
- - test/data/gemhome/gems/c-1.2
146
- - test/data/gemhome/gems/a-0.0.1/lib
147
- - test/data/gemhome/gems/a-0.0.1/lib/code.rb
148
- - test/data/gemhome/gems/a-0.0.2/lib
149
- - test/data/gemhome/gems/a-0.0.2/lib/code.rb
150
- - test/data/gemhome/gems/b-0.0.2/lib
151
- - test/data/gemhome/gems/b-0.0.2/lib/code.rb
152
- - test/data/gemhome/gems/c-1.2/lib
153
- - test/data/gemhome/gems/c-1.2/lib/code.rb
154
- - test/data/gemhome/specifications/a-0.0.1.gemspec
155
- - test/data/gemhome/specifications/a-0.0.2.gemspec
156
- - test/data/gemhome/specifications/b-0.0.2.gemspec
157
- - test/data/gemhome/specifications/c-1.2.gemspec
158
- - test/data/legacy/keyedlist-0.4.0.ruby
159
- - test/data/legacy/keyedlist-0.4.0.yaml
160
- - test/data/lib/code.rb
161
129
  - test/data/one/lib
162
- - test/data/one/one-0.0.1.gem
130
+ - test/data/one/README.one
163
131
  - test/data/one/one.gemspec
164
132
  - test/data/one/one.yaml
165
- - test/data/one/README.one
166
133
  - test/data/one/lib/one.rb
134
+ - test/data/legacy/keyedlist-0.4.0.ruby
135
+ - test/data/legacy/keyedlist-0.4.0.yaml
136
+ - test/data/lib/code.rb
167
137
  - test/mock/gems
168
138
  - test/mock/gems/cache
169
139
  - test/mock/gems/doc
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- CODE = 1
@@ -1 +0,0 @@
1
- CODE = 1
@@ -1 +0,0 @@
1
- CODE = 1
@@ -1 +0,0 @@
1
- CODE = 1
@@ -1,8 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{a}
3
- s.version = "0.0.1"
4
- s.date = %q{2005-01-01}
5
- s.summary = %q{summary}
6
- s.description = %q{desc}
7
- s.files = ["lib/code.rb"]
8
- end
@@ -1,8 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{a}
3
- s.version = "0.0.2"
4
- s.date = %q{2005-01-01}
5
- s.summary = %q{summary}
6
- s.description = %q{desc}
7
- s.files = ["lib/code.rb"]
8
- end
@@ -1,8 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{b}
3
- s.version = "0.0.2"
4
- s.date = %q{2005-01-01}
5
- s.summary = %q{summary}
6
- s.description = %q{desc}
7
- s.files = ["lib/code.rb"]
8
- end
@@ -1,8 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{c}
3
- s.version = "1.2"
4
- s.date = %q{2005-01-01}
5
- s.summary = %q{summary}
6
- s.description = %q{desc}
7
- s.files = ["lib/code.rb"]
8
- end
Binary file