rubygems-update 0.9.0 → 0.9.1

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 (105) hide show
  1. data/.document +4 -0
  2. data/ChangeLog +458 -0
  3. data/GPL.txt +340 -0
  4. data/LICENSE.txt +53 -0
  5. data/Rakefile +26 -10
  6. data/TODO +0 -1
  7. data/bin/gem_server +2 -434
  8. data/bin/gemlock +1 -1
  9. data/bin/index_gem_repository.rb +34 -12
  10. data/examples/application/an-app.gemspec +4 -2
  11. data/examples/application/ext/Makefile +139 -0
  12. data/examples/application/ext/extconf.rb +3 -0
  13. data/examples/application/ext/foo.c +1 -0
  14. data/lib/gemconfigure.rb +2 -2
  15. data/lib/rubygems.rb +85 -46
  16. data/lib/rubygems/cmd_manager.rb +14 -11
  17. data/lib/rubygems/command.rb +18 -9
  18. data/lib/rubygems/config_file.rb +17 -16
  19. data/lib/rubygems/custom_require.rb +7 -12
  20. data/lib/rubygems/dependency_list.rb +38 -38
  21. data/lib/rubygems/gem_commands.rb +471 -242
  22. data/lib/rubygems/gem_openssl.rb +1 -1
  23. data/lib/rubygems/gem_runner.rb +2 -1
  24. data/lib/rubygems/installer.rb +189 -143
  25. data/lib/rubygems/package.rb +625 -621
  26. data/lib/rubygems/remote_fetcher.rb +142 -0
  27. data/lib/rubygems/remote_installer.rb +85 -465
  28. data/lib/rubygems/rubygems_version.rb +1 -1
  29. data/lib/rubygems/security.rb +54 -11
  30. data/lib/rubygems/server.rb +486 -0
  31. data/lib/rubygems/source_index.rb +187 -21
  32. data/lib/rubygems/source_info_cache.rb +153 -0
  33. data/lib/rubygems/source_info_cache_entry.rb +31 -0
  34. data/lib/rubygems/specification.rb +71 -30
  35. data/lib/rubygems/user_interaction.rb +22 -20
  36. data/lib/rubygems/validator.rb +8 -7
  37. data/lib/rubygems/version.rb +32 -17
  38. data/pkgs/sources/sources-0.0.1.gem +0 -0
  39. data/post-install.rb +42 -3
  40. data/scripts/gemdoc.rb +3 -3
  41. data/scripts/runtest.rb +1 -1
  42. data/scripts/upload_gemdoc.rb +11 -11
  43. data/setup.rb +14 -7
  44. data/test/brokenbuildgem.rb +35 -0
  45. data/test/data/a-0.0.1.gem +0 -0
  46. data/test/data/a-0.0.2.gem +0 -0
  47. data/test/data/b-0.0.2.gem +0 -0
  48. data/test/data/broken-1.0.0.gem +0 -0
  49. data/test/data/broken_build/broken-build.gemspec +20 -0
  50. data/test/data/broken_build/ext/extconf.rb +3 -0
  51. data/test/data/broken_build/ext/foo.c +1 -0
  52. data/test/data/c-1.2.gem +0 -0
  53. data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
  54. data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
  55. data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
  56. data/test/data/gemhome/cache/c-1.2.gem +0 -0
  57. data/test/data/gemhome/gems/a-0.0.1/lib/code.rb +0 -6
  58. data/test/data/gemhome/gems/a-0.0.2/lib/code.rb +0 -6
  59. data/test/data/gemhome/gems/b-0.0.2/lib/code.rb +0 -6
  60. data/test/data/gemhome/gems/c-1.2/lib/code.rb +0 -6
  61. data/test/data/gemhome/specifications/a-0.0.1.gemspec +1 -1
  62. data/test/data/gemhome/specifications/a-0.0.2.gemspec +1 -1
  63. data/test/data/gemhome/specifications/b-0.0.2.gemspec +1 -1
  64. data/test/data/gemhome/specifications/c-1.2.gemspec +1 -1
  65. data/test/data/lib/code.rb +0 -6
  66. data/test/data/one/one-0.0.1.gem +0 -0
  67. data/test/functional.rb +24 -21
  68. data/test/functional_extension_gems.rb +48 -0
  69. data/test/functional_generate_yaml_index.rb +6 -3
  70. data/test/gemenvironment.rb +27 -22
  71. data/test/gemutilities.rb +95 -5
  72. data/test/insure_session.rb +2 -2
  73. data/test/io_capture.rb +33 -0
  74. data/test/test_check_command.rb +2 -2
  75. data/test/test_command.rb +16 -13
  76. data/test/test_dependency_list.rb +20 -20
  77. data/test/test_file_list.rb +10 -11
  78. data/test/test_format.rb +19 -46
  79. data/test/test_gem.rb +25 -0
  80. data/test/test_gem_ext_configure_builder.rb +88 -0
  81. data/test/test_gem_ext_ext_conf_builder.rb +122 -0
  82. data/test/test_gem_ext_rake_builder.rb +61 -0
  83. data/test/test_gem_outdated_command.rb +37 -0
  84. data/test/test_gem_source_info_cache.rb +196 -0
  85. data/test/test_gem_source_info_cache_entry.rb +44 -0
  86. data/test/test_gem_sources_command.rb +130 -0
  87. data/test/test_installer.rb +137 -9
  88. data/test/test_package.rb +521 -531
  89. data/test/test_parse_commands.rb +7 -7
  90. data/test/test_process_commands.rb +1 -1
  91. data/test/test_remote_fetcher.rb +187 -45
  92. data/test/test_remote_installer.rb +35 -52
  93. data/test/test_require_gem.rb +12 -12
  94. data/test/test_source_index.rb +194 -48
  95. data/test/test_specification.rb +154 -0
  96. data/test/test_user_interaction.rb +48 -0
  97. data/test/test_validator.rb +1 -1
  98. data/test/test_version_comparison.rb +116 -5
  99. metadata +33 -10
  100. data/lib/rubygems/incremental_fetcher.rb +0 -136
  101. data/lib/rubygems/loadpath_manager.rb +0 -114
  102. data/lib/rubygems/open-uri.rb +0 -756
  103. data/test/test_cached_fetcher.rb +0 -64
  104. data/test/test_incremental_fetcher.rb +0 -175
  105. data/test/test_local_cache.rb +0 -106
@@ -4,8 +4,20 @@
4
4
  # See LICENSE.txt for permissions.
5
5
  #++
6
6
 
7
+ require 'rbconfig'
8
+
9
+ def run_rdoc(*args)
10
+ args << '--quiet'
11
+ args << '--main' << 'README'
12
+ args << '.' << 'README' << 'LICENSE.txt' << 'GPL.txt'
13
+
14
+ r = RDoc::RDoc.new
15
+ r.document args
16
+ end
17
+
7
18
  def remove_stubs
8
19
  is_apparent_stub = lambda { |path|
20
+ break unless File.readable? path
9
21
  File.read(path, 40) =~ /^# This file was generated by RubyGems/ and
10
22
  File.readlines(path).size < 20
11
23
  }
@@ -57,7 +69,7 @@ def install_windows_batch_files
57
69
  target = File.join(bindir, File.basename(f))
58
70
  if is_windows_platform
59
71
  File.open(target+".cmd", "w") do |file|
60
- ruby_cmd = Gem.ruby rescue 'ruby'
72
+ ruby_cmd = Gem.ruby rescue 'ruby'
61
73
  file.puts %{@"#{ruby_cmd}" "#{target}" %1 %2 %3 %4 %5 %6 %7 %8 %9}
62
74
  end
63
75
  end
@@ -67,7 +79,8 @@ end
67
79
  def install_sources
68
80
  $: << "lib"
69
81
  require 'rubygems'
70
- Gem::manage_gems
82
+ require 'rubygems/builder'
83
+ require 'rubygems/installer'
71
84
  Dir.chdir("pkgs/sources") do
72
85
  load "sources.gemspec"
73
86
  spec = Gem.sources_spec
@@ -76,7 +89,33 @@ def install_sources
76
89
  end
77
90
  end
78
91
 
92
+ def remove_old_rdoc
93
+ require 'rubygems'
94
+ require 'fileutils'
95
+
96
+ puts "Removing old RubyGems RDoc and ri..."
97
+ Dir[File.join(Gem.dir, 'doc', 'rubygems-*')].each do |dir|
98
+ FileUtils.rm_rf dir
99
+ end
100
+ end
101
+
102
+ def install_rdoc
103
+ require 'rdoc/rdoc'
104
+ require 'rubygems'
105
+
106
+ rubygems_name = "rubygems-#{Gem::RubyGemsVersion}"
107
+
108
+ doc_dir = File.join Gem.dir, 'doc', rubygems_name
109
+
110
+ puts "Installing #{rubygems_name} ri..."
111
+ run_rdoc '--ri', '--op', File.join(doc_dir, 'ri')
112
+ puts "Installing #{rubygems_name} rdoc..."
113
+ run_rdoc '--op', File.join(doc_dir, 'rdoc')
114
+ end
115
+
116
+ install_sources
117
+ remove_old_rdoc
118
+ install_rdoc
79
119
  install_windows_batch_files
80
120
  remove_stubs
81
- install_sources
82
121
 
@@ -50,10 +50,10 @@ while line = gets
50
50
  case cmd
51
51
  when "!usage"
52
52
  begin
53
- cmdobj = $gm[arg]
54
- pre(cmdobj, "--help")
53
+ cmdobj = $gm[arg]
54
+ pre(cmdobj, "--help")
55
55
  rescue NoMethodError
56
- puts "Usage of command #{arg} failed"
56
+ puts "Usage of command #{arg} failed"
57
57
  end
58
58
  when "!toc"
59
59
  puts table_of_contents()
@@ -17,7 +17,7 @@ def run_tests(pattern='test/test*.rb', log_enabled=false)
17
17
  rescue Exception => ex
18
18
  puts "Error in #{fn}: #{ex.message}"
19
19
  puts ex.backtrace
20
- assert false
20
+ assert false
21
21
  end
22
22
  }
23
23
  end
@@ -26,12 +26,12 @@ def read_document
26
26
  name = nil
27
27
  f.each do |line|
28
28
  if line =~ /^==/
29
- line =~ /gem\s+(\S+)/ or fail "Illformatted Document Line [#{line.chomp}]"
30
- name = $1
31
- DOC[name] = ''
29
+ line =~ /gem\s+(\S+)/ or fail "Illformatted Document Line [#{line.chomp}]"
30
+ name = $1
31
+ DOC[name] = ''
32
32
  else
33
- next if name.nil?
34
- DOC[name] << line
33
+ next if name.nil?
34
+ DOC[name] << line
35
35
  end
36
36
  end
37
37
  end
@@ -103,13 +103,13 @@ def update_command_docs(cmdref_page)
103
103
  if title =~ /gem\s([a-z]+)/
104
104
  name = $1
105
105
  if DOC[name]
106
- body_field = edit_form.fields.find { |f| f.name == 'page[body]'}
107
- body_field.value = DOC[name]
108
- puts "*** Updating gem #{name} page"
109
- $agent.submit(edit_form)
110
- UPDATED[name] = true
106
+ body_field = edit_form.fields.find { |f| f.name == 'page[body]'}
107
+ body_field.value = DOC[name]
108
+ puts "*** Updating gem #{name} page"
109
+ $agent.submit(edit_form)
110
+ UPDATED[name] = true
111
111
  else
112
- MISSING << name
112
+ MISSING << name
113
113
  end
114
114
  end
115
115
  end
data/setup.rb CHANGED
@@ -244,6 +244,8 @@ class ConfigTable_class
244
244
  f.printf "%s=%s\n", i.name, i.value if i.value
245
245
  end
246
246
  }
247
+ rescue Exception => e
248
+ $stderr.puts "Exception thrown while trying to open #{savefile} in #{Dir.pwd}: #{e}... continuing"
247
249
  end
248
250
 
249
251
  def [](key)
@@ -515,13 +517,18 @@ module FileOperations
515
517
  }
516
518
  File.chmod mode, realdest
517
519
 
518
- File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
519
- if prefix
520
- f.puts realdest.sub(prefix, '')
521
- else
522
- f.puts realdest
523
- end
524
- }
520
+ path = "#{objdir_root()}/InstalledFiles"
521
+ begin
522
+ File.open(path, 'a') {|f|
523
+ if prefix
524
+ f.puts realdest.sub(prefix, '')
525
+ else
526
+ f.puts realdest
527
+ end
528
+ }
529
+ rescue Exception => e
530
+ $stderr.puts "Exception thrown while trying to open #{path} in #{Dir.pwd}: #{e}... continuing"
531
+ end
525
532
  end
526
533
  end
527
534
 
@@ -0,0 +1,35 @@
1
+ #--
2
+ # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
+ # All rights reserved.
4
+ # See LICENSE.txt for permissions.
5
+ #++
6
+
7
+ module BrokenBuildGem
8
+
9
+ DIR = "test/data/broken_build"
10
+ NAME = "broken-build-0.0.1.gem"
11
+ GEM = "#{DIR}/#{NAME}"
12
+
13
+ def clear
14
+ FileUtils.rm_f GEM
15
+ end
16
+
17
+ def make(controller)
18
+ unless File.exist?(GEM)
19
+ build(controller)
20
+ end
21
+ end
22
+
23
+ def build(controller)
24
+ Dir.chdir(DIR) do
25
+ controller.gem "build broken-build.gemspec"
26
+ end
27
+ end
28
+
29
+ def install(controller)
30
+ make(controller)
31
+ controller.gem "install #{GEM}"
32
+ end
33
+
34
+ extend self
35
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1,20 @@
1
+ $:.unshift '../lib'
2
+ require 'rubygems'
3
+
4
+ spec = Gem::Specification.new do |s|
5
+ s.name = 'broken-build'
6
+ s.version = "0.0.1"
7
+ s.required_ruby_version = ">= 1.8.1"
8
+ s.platform = Gem::Platform::RUBY
9
+ s.summary = "This gem demonstrates extensions that don't compile"
10
+ s.files = Dir.glob("ext/**/*").delete_if {|item| item.include?("CVS")}
11
+ s.require_path = 'lib'
12
+ s.extensions << "ext/extconf.rb"
13
+ s.bindir = "bin"
14
+ end
15
+
16
+ if $0==__FILE__
17
+ Gem::manage_gems
18
+ Gem::Builder.new(spec).build
19
+ end
20
+
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+ create_makefile("foo")
3
+
@@ -0,0 +1 @@
1
+ will not compile
Binary file
@@ -1,7 +1 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
1
  CODE = 1
@@ -1,7 +1 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
1
  CODE = 1
@@ -1,7 +1 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
1
  CODE = 1
@@ -1,7 +1 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
1
  CODE = 1
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{a}
3
3
  s.version = "0.0.1"
4
- s.date = %q{2006-06-28}
4
+ s.date = %q{2007-01-16}
5
5
  s.summary = %q{summary}
6
6
  s.description = %q{desc}
7
7
  s.files = ["lib/code.rb"]
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{a}
3
3
  s.version = "0.0.2"
4
- s.date = %q{2006-06-28}
4
+ s.date = %q{2007-01-16}
5
5
  s.summary = %q{summary}
6
6
  s.description = %q{desc}
7
7
  s.files = ["lib/code.rb"]
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{b}
3
3
  s.version = "0.0.2"
4
- s.date = %q{2006-06-28}
4
+ s.date = %q{2007-01-16}
5
5
  s.summary = %q{summary}
6
6
  s.description = %q{desc}
7
7
  s.files = ["lib/code.rb"]
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{c}
3
3
  s.version = "1.2"
4
- s.date = %q{2006-06-28}
4
+ s.date = %q{2007-01-16}
5
5
  s.summary = %q{summary}
6
6
  s.description = %q{desc}
7
7
  s.files = ["lib/code.rb"]
@@ -1,7 +1 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
1
  CODE = 1
Binary file
@@ -43,16 +43,16 @@ class FunctionalTest < Test::Unit::TestCase
43
43
  def test_environment
44
44
  gem_nossl 'environment'
45
45
 
46
- assert_match /VERSION:\s+(\d+\.)*\d+/, @out
47
- assert_match /INSTALLATION DIRECTORY:/, @out
48
- assert_match /GEM PATH:/, @out
49
- assert_match /REMOTE SOURCES:/, @out
46
+ assert_match(/VERSION:\s+(\d+\.)*\d+/, @out)
47
+ assert_match(/INSTALLATION DIRECTORY:/, @out)
48
+ assert_match(/GEM PATH:/, @out)
49
+ assert_match(/REMOTE SOURCES:/, @out)
50
50
  assert_status
51
51
  end
52
52
 
53
53
  def test_env_version
54
54
  gem_nossl 'environment version'
55
- assert_match /\d+\.\d+$/, @out
55
+ assert_match(/\d+\.\d+$/, @out)
56
56
  end
57
57
 
58
58
  def test_env_gemdir
@@ -67,16 +67,16 @@ class FunctionalTest < Test::Unit::TestCase
67
67
 
68
68
  def test_env_remotesources
69
69
  gem_nossl 'environment remotesources'
70
- assert_equal Gem::RemoteInstaller.new.sources, @out.chomp.split("\n")
70
+ assert_equal Gem.sources, @out.chomp.split("\n")
71
71
  end
72
72
 
73
73
  def test_build
74
74
  OneGem.rebuild(self)
75
75
  assert File.exist?(OneGem::ONEGEM), "Gem file (#{OneGem::ONEGEM}) should exist"
76
- assert_match /Successfully built RubyGem/, @out
77
- assert_match /Name: one$/, @out
78
- assert_match /Version: 0.0.1$/, @out
79
- assert_match /File: #{OneGem::ONENAME}/, @out
76
+ assert_match(/Successfully built RubyGem/, @out)
77
+ assert_match(/Name: one$/, @out)
78
+ assert_match(/Version: 0.0.1$/, @out)
79
+ assert_match(/File: #{OneGem::ONENAME}/, @out)
80
80
  spec = read_gem_file(OneGem::ONEGEM)
81
81
  assert_equal "one", spec.name
82
82
  assert_equal "Test GEM One", spec.summary
@@ -85,16 +85,18 @@ class FunctionalTest < Test::Unit::TestCase
85
85
  def test_build_from_yaml
86
86
  OneGem.rebuild(self)
87
87
  assert File.exist?(OneGem::ONEGEM), "Gem file (#{OneGem::ONEGEM}) should exist"
88
- assert_match /Successfully built RubyGem/, @out
89
- assert_match /Name: one$/, @out
90
- assert_match /Version: 0.0.1$/, @out
91
- assert_match /File: #{OneGem::ONENAME}/, @out
88
+ assert_match(/Successfully built RubyGem/, @out)
89
+ assert_match(/Name: one$/, @out)
90
+ assert_match(/Version: 0.0.1$/, @out)
91
+ assert_match(/File: #{OneGem::ONENAME}/, @out)
92
92
  spec = read_gem_file(OneGem::ONEGEM)
93
93
  assert_equal "one", spec.name
94
94
  assert_equal "Test GEM One", spec.summary
95
95
  end
96
96
 
97
- def test_bogus_source_hoses_up_remote_install_but_gem_command_gives_decent_error_message
97
+ # This test is disabled because of the insanely long time it takes
98
+ # to time out.
99
+ def xtest_bogus_source_hoses_up_remote_install_but_gem_command_gives_decent_error_message
98
100
  @ruby_options << " -rtest/bogussources"
99
101
  gem_nossl "install asdf --remote"
100
102
  assert_match(/error/im, @err)
@@ -105,7 +107,8 @@ class FunctionalTest < Test::Unit::TestCase
105
107
  mgr = Gem::CommandManager.new
106
108
  mgr.command_names.each do |cmdname|
107
109
  gem_nossl "help #{cmdname}"
108
- assert_match /Usage: gem #{cmdname}/, @out, "should see help for #{cmdname}"
110
+ assert_match(/Usage: gem #{cmdname}/, @out,
111
+ "should see help for #{cmdname}")
109
112
  end
110
113
  end
111
114
 
@@ -129,7 +132,7 @@ class FunctionalTest < Test::Unit::TestCase
129
132
  require 'openssl'
130
133
  rescue LoadError => ex
131
134
  puts "WARNING: openssl is not availble, " +
132
- "unable to test the cert functions"
135
+ "unable to test the cert functions"
133
136
  return
134
137
  end
135
138
 
@@ -137,7 +140,7 @@ class FunctionalTest < Test::Unit::TestCase
137
140
  gem_withssl "cert --build x@y.z"
138
141
  SIGN_FILES.each do |fn|
139
142
  assert File.exist?(fn),
140
- "Signing key/cert file '#{fn}' should exist"
143
+ "Signing key/cert file '#{fn}' should exist"
141
144
  end
142
145
  ensure
143
146
  SIGN_FILES.each do |fn| FileUtils.rm_f fn end
@@ -145,9 +148,9 @@ class FunctionalTest < Test::Unit::TestCase
145
148
 
146
149
  def test_nossl_cert
147
150
  gem_nossl "cert --build x@y.z"
148
- assert @status != 0
149
- assert_match /not installed/, @err,
150
- "Should have a not installed error for openssl"
151
+ assert_not_equal 0, @status
152
+ assert_match(/not installed/, @err,
153
+ "Should have a not installed error for openssl")
151
154
  end
152
155
 
153
156
  # :section: Help Methods