rubygems-update 1.3.2 → 1.3.3

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.

@@ -20,9 +20,15 @@ require 'rubygems'
20
20
  # parts are sorted alphabetically using the normal Ruby string sorting
21
21
  # rules.
22
22
  #
23
+ # Prereleases sort between real releases (newest to oldest):
24
+ #
25
+ # 1. 1.0
26
+ # 2. 1.0.b
27
+ # 3. 1.0.a
28
+ # 4. 0.9
23
29
 
24
30
  class Gem::Version
25
-
31
+
26
32
  class Part
27
33
  include Comparable
28
34
 
@@ -39,7 +45,7 @@ class Gem::Version
39
45
  def inspect
40
46
  @value
41
47
  end
42
-
48
+
43
49
  def alpha?
44
50
  String === value
45
51
  end
@@ -110,12 +116,16 @@ class Gem::Version
110
116
  "#<#{self.class} #{@version.inspect}>"
111
117
  end
112
118
 
119
+ ##
113
120
  # Dump only the raw version string, not the complete object
121
+
114
122
  def marshal_dump
115
123
  [@version]
116
124
  end
117
125
 
126
+ ##
118
127
  # Load custom marshal format
128
+
119
129
  def marshal_load(array)
120
130
  self.version = array[0]
121
131
  end
@@ -138,9 +148,7 @@ class Gem::Version
138
148
 
139
149
  ##
140
150
  # Returns the text representation of the version
141
- #
142
- # return:: [String] version as string
143
- #
151
+
144
152
  def to_s
145
153
  @version
146
154
  end
@@ -156,10 +164,20 @@ class Gem::Version
156
164
 
157
165
  ##
158
166
  # A version is considered a prerelease if any part contains a letter.
159
-
167
+
160
168
  def prerelease?
161
169
  parts.any? { |part| part.alpha? }
162
170
  end
171
+
172
+ ##
173
+ # The release for this version (e.g. 1.2.0.a -> 1.2.0)
174
+ # Non-prerelease versions return themselves
175
+ def release
176
+ return self unless prerelease?
177
+ rel_parts = parts.dup
178
+ rel_parts.pop while rel_parts.any? { |part| part.alpha? }
179
+ self.class.new(rel_parts.join('.'))
180
+ end
163
181
 
164
182
  def yaml_initialize(tag, values)
165
183
  self.version = values['version']
@@ -194,9 +212,12 @@ class Gem::Version
194
212
  @version.hash
195
213
  end
196
214
 
197
- # Return a new version object where the next to the last revision
198
- # number is one greater. (e.g. 5.3.1 => 5.4)
215
+ ##
216
+ # Return a new version object where the next to the last revision number is
217
+ # one greater. (e.g. 5.3.1 => 5.4)
218
+ #
199
219
  # Pre-release (alpha) parts are ignored. (e.g 5.3.1.b2 => 5.4)
220
+
200
221
  def bump
201
222
  parts = parse_parts_from_version_string
202
223
  parts.pop while parts.any? { |part| part.alpha? }
@@ -217,6 +238,7 @@ class Gem::Version
217
238
 
218
239
  require 'rubygems/requirement'
219
240
 
241
+ ##
220
242
  # Gem::Requirement's original definition is nested in Version.
221
243
  # Although an inappropriate place, current gems specs reference the nested
222
244
  # class name explicitly. To remain compatible with old software loading
@@ -77,6 +77,14 @@ class TestGem < RubyGemTestCase
77
77
  end
78
78
  end
79
79
 
80
+ def test_self_bin_path_with_spaces
81
+ quick_gem 'sp ace', '3' do |s|
82
+ s.executables = ['exec']
83
+ end
84
+ path = Gem.bin_path('sp ace', 'exec')
85
+ assert_equal %w(" "), [path[0,1], path[-1,1]], "Path should be escaped"
86
+ end
87
+
80
88
  def test_self_bin_path_not_found
81
89
  assert_raises(Gem::GemNotFoundException) do
82
90
  Gem.bin_path('non-existent')
@@ -22,5 +22,31 @@ class TestGemCommandsServerCommand < RubyGemTestCase
22
22
  assert_equal File.expand_path('/nonexistent'), @cmd.options[:gemdir]
23
23
  assert_equal 9999, @cmd.options[:port]
24
24
  end
25
+
26
+ def test_handle_options_port
27
+ @cmd.send :handle_options, %w[-p 0]
28
+ assert_equal 0, @cmd.options[:port]
29
+
30
+ @cmd.send :handle_options, %w[-p 65535]
31
+ assert_equal 65535, @cmd.options[:port]
32
+
33
+ @cmd.send :handle_options, %w[-p http]
34
+ assert_equal 80, @cmd.options[:port]
35
+
36
+ e = assert_raises OptionParser::InvalidArgument do
37
+ @cmd.send :handle_options, %w[-p nonexistent]
38
+ end
39
+
40
+ assert_equal 'invalid argument: -p nonexistent: no such named service',
41
+ e.message
42
+
43
+ e = assert_raises OptionParser::InvalidArgument do
44
+ @cmd.send :handle_options, %w[-p 65536]
45
+ end
46
+
47
+ assert_equal 'invalid argument: -p 65536: not a port number',
48
+ e.message
49
+ end
50
+
25
51
  end
26
52
 
@@ -70,6 +70,19 @@ class TestGemCommandsSpecificationCommand < RubyGemTestCase
70
70
  assert_equal '', @ui.error
71
71
  end
72
72
 
73
+ def test_execute_field
74
+ foo = quick_gem 'foo'
75
+ Gem.source_index.add_spec foo
76
+
77
+ @cmd.options[:args] = %w[foo name]
78
+
79
+ use_ui @ui do
80
+ @cmd.execute
81
+ end
82
+
83
+ assert_equal "--- foo\n\n", @ui.output
84
+ end
85
+
73
86
  def test_execute_marshal
74
87
  foo = quick_gem 'foo'
75
88
  Gem.source_index.add_spec foo
@@ -222,6 +222,16 @@ class TestGemServer < RubyGemTestCase
222
222
  assert_equal Gem::Platform.local, spec.platform
223
223
  end
224
224
 
225
+ def test_rdoc
226
+ data = StringIO.new "GET /rdoc?q=a HTTP/1.0\r\n\r\n"
227
+ @req.parse data
228
+
229
+ @server.rdoc @req, @res
230
+
231
+ assert_equal 200, @res.status, @res.body
232
+ assert_match %r|No documentation found|, @res.body
233
+ assert_equal 'text/html', @res['content-type']
234
+ end
225
235
 
226
236
  def test_root
227
237
  data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
@@ -197,8 +197,8 @@ end
197
197
  assert_equal [], spec.requirements
198
198
  assert_equal [], spec.dependencies
199
199
  assert_equal 'bin', spec.bindir
200
- assert_equal false, spec.has_rdoc
201
- assert_equal false, spec.has_rdoc?
200
+ assert_equal true, spec.has_rdoc
201
+ assert_equal true, spec.has_rdoc?
202
202
  assert_equal '>= 0', spec.required_ruby_version.to_s
203
203
  assert_equal '>= 0', spec.required_rubygems_version.to_s
204
204
  end
@@ -281,7 +281,7 @@ end
281
281
  assert_equal 'bin', spec.bindir
282
282
  assert_same spec.bindir, new_spec.bindir
283
283
 
284
- assert_equal false, spec.has_rdoc
284
+ assert_equal true, spec.has_rdoc
285
285
  assert_same spec.has_rdoc, new_spec.has_rdoc
286
286
 
287
287
  assert_equal '>= 0', spec.required_ruby_version.to_s
@@ -431,7 +431,7 @@ end
431
431
  s.homepage = %q{http://www.spice-of-life.net/download/cgikit/}
432
432
  s.autorequire = %q{cgikit}
433
433
  s.bindir = nil
434
- s.has_rdoc = nil
434
+ s.has_rdoc = true
435
435
  s.required_ruby_version = nil
436
436
  s.platform = nil
437
437
  s.files = ["lib/cgikit", "lib/cgikit.rb", "lib/cgikit/components", "..."]
@@ -578,12 +578,35 @@ end
578
578
  assert @a1.has_rdoc?
579
579
  end
580
580
 
581
+ def test_has_rdoc_equals
582
+
583
+ use_ui @ui do
584
+ @a1.has_rdoc = false
585
+ end
586
+
587
+ assert_equal '', @ui.output
588
+
589
+ assert_equal true, @a1.has_rdoc
590
+ end
591
+
581
592
  def test_hash
582
593
  assert_equal @a1.hash, @a1.hash
583
594
  assert_equal @a1.hash, @a1.dup.hash
584
595
  refute_equal @a1.hash, @a2.hash
585
596
  end
586
597
 
598
+ def test_installation_path
599
+ assert_equal @gemhome, @a1.installation_path
600
+
601
+ @a1.send :remove_instance_variable, :@loaded_from
602
+
603
+ e = assert_raises Gem::Exception do
604
+ @a1.installation_path
605
+ end
606
+
607
+ assert_equal 'spec a-1 is not from an installed gem', e.message
608
+ end
609
+
587
610
  def test_lib_files
588
611
  @a1.files = %w[lib/foo.rb Rakefile]
589
612
 
@@ -736,7 +759,6 @@ Gem::Specification.new do |s|
736
759
  s.description = %q{This is a test description}
737
760
  s.email = %q{example@example.com}
738
761
  s.files = [\"lib/code.rb\"]
739
- s.has_rdoc = true
740
762
  s.homepage = %q{http://example.com}
741
763
  s.require_paths = [\"lib\"]
742
764
  s.rubygems_version = %q{#{Gem::RubyGemsVersion}}
@@ -788,7 +810,6 @@ Gem::Specification.new do |s|
788
810
  s.executables = [\"exec\"]
789
811
  s.extensions = [\"ext/a/extconf.rb\"]
790
812
  s.files = [\"lib/code.rb\", \"test/suite.rb\", \"bin/exec\", \"ext/a/extconf.rb\"]
791
- s.has_rdoc = %q{true}
792
813
  s.homepage = %q{http://example.com}
793
814
  s.licenses = [\"MIT\"]
794
815
  s.require_paths = [\"lib\"]
@@ -1034,6 +1055,7 @@ end
1034
1055
 
1035
1056
  FileUtils.mkdir_p File.join(@tempdir, 'bin')
1036
1057
  File.open File.join(@tempdir, 'bin', 'exec'), 'w' do end
1058
+ FileUtils.mkdir_p File.join(@tempdir, 'exec')
1037
1059
 
1038
1060
  use_ui @ui do
1039
1061
  Dir.chdir @tempdir do
@@ -1041,19 +1063,26 @@ end
1041
1063
  end
1042
1064
  end
1043
1065
 
1066
+ assert_equal %w[exec], @a1.executables
1067
+
1044
1068
  assert_equal '', @ui.output, 'output'
1045
1069
  assert_equal "WARNING: bin/exec is missing #! line\n", @ui.error, 'error'
1046
1070
  end
1047
1071
 
1048
1072
  def test_validate_empty_require_paths
1049
- util_setup_validate
1073
+ if win_platform? then
1074
+ skip 'test_validate_empty_require_paths skipped on MS Windows (symlink)'
1075
+ else
1076
+ util_setup_validate
1050
1077
 
1051
- @a1.require_paths = []
1052
- e = assert_raises Gem::InvalidSpecificationException do
1053
- @a1.validate
1054
- end
1078
+ @a1.require_paths = []
1079
+ e = assert_raises Gem::InvalidSpecificationException do
1080
+ @a1.validate
1081
+ end
1055
1082
 
1056
- assert_equal 'specification must have at least one require_path', e.message
1083
+ assert_equal 'specification must have at least one require_path',
1084
+ e.message
1085
+ end
1057
1086
  end
1058
1087
 
1059
1088
  def test_validate_files
@@ -1079,7 +1108,7 @@ end
1079
1108
  util_setup_validate
1080
1109
 
1081
1110
  Dir.chdir @tempdir do
1082
- @a1.homepage = ''
1111
+ @a1.homepage = nil
1083
1112
 
1084
1113
  use_ui @ui do
1085
1114
  @a1.validate
@@ -1087,28 +1116,23 @@ end
1087
1116
 
1088
1117
  assert_equal "WARNING: no homepage specified\n", @ui.error, 'error'
1089
1118
 
1090
- @a1.homepage = 'over at my cool site'
1119
+ @ui = MockGemUi.new
1091
1120
 
1092
- e = assert_raises Gem::InvalidSpecificationException do
1121
+ @a1.homepage = ''
1122
+
1123
+ use_ui @ui do
1093
1124
  @a1.validate
1094
1125
  end
1095
1126
 
1096
- assert_equal '"over at my cool site" is not a URI', e.message
1097
- end
1098
- end
1099
-
1100
- def test_validate_has_rdoc
1101
- util_setup_validate
1127
+ assert_equal "WARNING: no homepage specified\n", @ui.error, 'error'
1102
1128
 
1103
- Dir.chdir @tempdir do
1104
- @a1.has_rdoc = false
1129
+ @a1.homepage = 'over at my cool site'
1105
1130
 
1106
- use_ui @ui do
1131
+ e = assert_raises Gem::InvalidSpecificationException do
1107
1132
  @a1.validate
1108
1133
  end
1109
1134
 
1110
- assert_equal "WARNING: RDoc will not be generated (has_rdoc == false)\n",
1111
- @ui.error, 'error'
1135
+ assert_equal '"over at my cool site" is not a URI', e.message
1112
1136
  end
1113
1137
  end
1114
1138
 
@@ -10,6 +10,23 @@ class TestGemUninstaller < GemInstallerTestCase
10
10
  ui = MockGemUi.new
11
11
  util_setup_gem ui
12
12
 
13
+ @user_spec.executables = ["my_exec"]
14
+
15
+ # HACK util_make_exec
16
+ user_bin_dir = File.join Gem.user_dir, 'gems', @user_spec.full_name, 'bin'
17
+ FileUtils.mkdir_p user_bin_dir
18
+ exec_path = File.join user_bin_dir, "my_exec"
19
+ File.open exec_path, 'w' do |f|
20
+ f.puts "#!/usr/bin/ruby"
21
+ end
22
+
23
+ user_bin_dir = File.join Gem.user_dir, 'bin'
24
+ FileUtils.mkdir_p user_bin_dir
25
+ exec_path = File.join user_bin_dir, "my_exec"
26
+ File.open exec_path, 'w' do |f|
27
+ f.puts "#!/usr/bin/ruby"
28
+ end
29
+
13
30
  build_rake_in do
14
31
  use_ui ui do
15
32
  @installer.install
@@ -49,6 +66,19 @@ class TestGemUninstaller < GemInstallerTestCase
49
66
  assert_equal false, File.exist?(File.join(@gemhome, 'bin', 'executable'))
50
67
  end
51
68
 
69
+ def test_remove_executables_user
70
+ uninstaller = Gem::Uninstaller.new nil, :executables => true
71
+
72
+ use_ui @ui do
73
+ uninstaller.remove_executables @user_spec
74
+ end
75
+
76
+ exec_path = File.join Gem.user_dir, 'bin', 'my_exec'
77
+ assert_equal false, File.exist?(exec_path), 'removed exec from bin dir'
78
+
79
+ assert_equal "Removing my_exec\n", @ui.output
80
+ end
81
+
52
82
  def test_path_ok_eh
53
83
  uninstaller = Gem::Uninstaller.new nil
54
84
 
@@ -199,6 +199,13 @@ class TestGemVersion < RubyGemTestCase
199
199
  refute Gem::Version.new('2.9').prerelease?
200
200
  refute Gem::Version.new('22.1.50.0').prerelease?
201
201
  end
202
+
203
+ def test_release
204
+ assert_equal Gem::Version.new('1.2.0'), Gem::Version.new('1.2.0.a').release
205
+ assert_equal Gem::Version.new('1.1'), Gem::Version.new('1.1.rc10').release
206
+ assert_equal Gem::Version.new('1.9.3'), Gem::Version.new('1.9.3.alpha.5').release
207
+ assert_equal Gem::Version.new('1.9.3'), Gem::Version.new('1.9.3').release
208
+ end
202
209
 
203
210
  def test_satisfied_by_eh_boxed
204
211
  assert_inadequate("1.3", "~> 1.4")
@@ -212,6 +219,11 @@ class TestGemVersion < RubyGemTestCase
212
219
  assert_adequate( "1.4.5", "~> 1.4.4")
213
220
  assert_inadequate("1.5", "~> 1.4.4")
214
221
  assert_inadequate("2.0", "~> 1.4.4")
222
+
223
+ assert_inadequate("1.1.pre", "~> 1.0.0")
224
+ assert_adequate( "1.1.pre", "~> 1.1")
225
+ assert_inadequate("2.0.a", "~> 1.0")
226
+ assert_adequate( "2.0.a", "~> 2.0")
215
227
  end
216
228
 
217
229
  def test_satisfied_by_eh_multiple
@@ -46,12 +46,14 @@ class TestKernel < RubyGemTestCase
46
46
  def test_gem_conflicting
47
47
  assert gem('a', '= 1'), "Should load"
48
48
 
49
- ex = assert_raises Gem::Exception do
49
+ ex = assert_raises Gem::LoadError do
50
50
  gem 'a', '= 2'
51
51
  end
52
52
 
53
53
  assert_match(/activate a \(= 2, runtime\)/, ex.message)
54
54
  assert_match(/activated a-1/, ex.message)
55
+ assert_equal 'a', ex.name
56
+ assert_equal Gem::Requirement.new('= 2'), ex.version_requirement
55
57
 
56
58
  assert $:.any? { |p| %r{a-1/lib} =~ p }
57
59
  assert $:.any? { |p| %r{a-1/bin} =~ p }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -32,7 +32,7 @@ cert_chain:
32
32
  x52qPcexcYZR7w==
33
33
  -----END CERTIFICATE-----
34
34
 
35
- date: 2009-04-15 00:00:00 -07:00
35
+ date: 2009-05-04 00:00:00 -07:00
36
36
  default_executable:
37
37
  dependencies: []
38
38
 
@@ -89,6 +89,7 @@ files:
89
89
  - doc/release_notes/rel_1_3_0.rdoc
90
90
  - doc/release_notes/rel_1_3_1.rdoc
91
91
  - doc/release_notes/rel_1_3_2.rdoc
92
+ - doc/release_notes/rel_1_3_3.rdoc
92
93
  - lib/gauntlet_rubygems.rb
93
94
  - lib/rbconfig/datadir.rb
94
95
  - lib/rubygems.rb
@@ -288,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
289
  requirements: []
289
290
 
290
291
  rubyforge_project: rubygems
291
- rubygems_version: 1.3.1.2162
292
+ rubygems_version: 1.3.2.2179
292
293
  signing_key:
293
294
  specification_version: 3
294
295
  summary: RubyGems update gem