rubygems-update 2.0.3 → 2.0.4
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.txt +42 -1
- data/Manifest.txt +0 -2
- data/Rakefile +0 -1
- data/lib/rubygems.rb +7 -2
- data/lib/rubygems/commands/help_command.rb +9 -1
- data/lib/rubygems/commands/list_command.rb +4 -6
- data/lib/rubygems/commands/owner_command.rb +1 -1
- data/lib/rubygems/commands/pristine_command.rb +5 -4
- data/lib/rubygems/commands/push_command.rb +2 -1
- data/lib/rubygems/commands/search_command.rb +17 -3
- data/lib/rubygems/commands/setup_command.rb +35 -23
- data/lib/rubygems/commands/specification_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +8 -0
- data/lib/rubygems/defaults.rb +3 -1
- data/lib/rubygems/dependency_installer.rb +0 -1
- data/lib/rubygems/dependency_resolver.rb +1 -1
- data/lib/rubygems/errors.rb +2 -2
- data/lib/rubygems/ext/builder.rb +8 -3
- data/lib/rubygems/ext/ext_conf_builder.rb +1 -0
- data/lib/rubygems/gemcutter_utilities.rb +14 -4
- data/lib/rubygems/installer.rb +9 -2
- data/lib/rubygems/package.rb +0 -1
- data/lib/rubygems/platform.rb +2 -0
- data/lib/rubygems/psych_tree.rb +4 -0
- data/lib/rubygems/specification.rb +24 -26
- data/lib/rubygems/test_case.rb +58 -0
- data/test/rubygems/test_gem.rb +4 -2
- data/test/rubygems/test_gem_commands_help_command.rb +5 -0
- data/test/rubygems/test_gem_commands_owner_command.rb +12 -0
- data/test/rubygems/test_gem_commands_push_command.rb +16 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +52 -0
- data/test/rubygems/test_gem_ext_cmake_builder.rb +4 -4
- data/test/rubygems/test_gem_ext_configure_builder.rb +4 -4
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +8 -13
- data/test/rubygems/test_gem_gemcutter_utilities.rb +23 -0
- data/test/rubygems/test_gem_installer.rb +15 -0
- data/test/rubygems/test_gem_package.rb +3 -1
- data/test/rubygems/test_gem_spec_fetcher.rb +3 -1
- data/test/rubygems/test_gem_specification.rb +25 -1
- metadata +6 -23
- metadata.gz.sig +0 -0
- data/test/rubygems/insure_session.rb +0 -43
- data/test/rubygems/test_gem_commands_search_command.rb +0 -25
data/lib/rubygems/installer.rb
CHANGED
@@ -331,8 +331,9 @@ class Gem::Installer
|
|
331
331
|
# specifications directory.
|
332
332
|
|
333
333
|
def write_spec
|
334
|
-
|
334
|
+
open spec_file, 'w' do |file|
|
335
335
|
file.puts spec.to_ruby_for_cache
|
336
|
+
file.fsync rescue nil # for filesystems without fsync(2)
|
336
337
|
end
|
337
338
|
end
|
338
339
|
|
@@ -773,7 +774,13 @@ EOF
|
|
773
774
|
def write_build_info_file
|
774
775
|
return if @build_args.empty?
|
775
776
|
|
776
|
-
|
777
|
+
build_info_dir = File.join gem_home, 'build_info'
|
778
|
+
|
779
|
+
FileUtils.mkdir_p build_info_dir
|
780
|
+
|
781
|
+
build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
|
782
|
+
|
783
|
+
open build_info_file, 'w' do |io|
|
777
784
|
@build_args.each do |arg|
|
778
785
|
io.puts arg
|
779
786
|
end
|
data/lib/rubygems/package.rb
CHANGED
data/lib/rubygems/platform.rb
CHANGED
@@ -74,6 +74,7 @@ class Gem::Platform
|
|
74
74
|
when /hpux(\d+)?/ then [ 'hpux', $1 ]
|
75
75
|
when /^java$/, /^jruby$/ then [ 'java', nil ]
|
76
76
|
when /^java([\d.]*)/ then [ 'java', $1 ]
|
77
|
+
when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ]
|
77
78
|
when /^dotnet$/ then [ 'dotnet', nil ]
|
78
79
|
when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
|
79
80
|
when /linux/ then [ 'linux', $1 ]
|
@@ -155,6 +156,7 @@ class Gem::Platform
|
|
155
156
|
when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
|
156
157
|
when /^i\d86-linux/ then ['x86', 'linux', nil ]
|
157
158
|
when 'java', 'jruby' then [nil, 'java', nil ]
|
159
|
+
when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
|
158
160
|
when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
|
159
161
|
when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
|
160
162
|
when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
|
data/lib/rubygems/psych_tree.rb
CHANGED
@@ -5,6 +5,17 @@
|
|
5
5
|
# See LICENSE.txt for permissions.
|
6
6
|
#++
|
7
7
|
|
8
|
+
require 'rubygems/version'
|
9
|
+
require 'rubygems/requirement'
|
10
|
+
require 'rubygems/platform'
|
11
|
+
require 'rubygems/deprecate'
|
12
|
+
|
13
|
+
# :stopdoc:
|
14
|
+
# date.rb can't be loaded for `make install` due to miniruby
|
15
|
+
# Date is needed for old gems that stored #date as Date instead of Time.
|
16
|
+
class Date; end
|
17
|
+
# :startdoc:
|
18
|
+
|
8
19
|
##
|
9
20
|
# The Specification class contains the information for a Gem. Typically
|
10
21
|
# defined in a .gemspec file or a Rakefile, and looks like this:
|
@@ -20,32 +31,19 @@
|
|
20
31
|
# s.homepage = 'https://rubygems.org/gems/example'
|
21
32
|
# end
|
22
33
|
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
34
|
+
# Starting in RubyGems 1.9.0, a Specification can hold arbitrary
|
35
|
+
# metadata. This metadata is accessed via Specification#metadata
|
36
|
+
# and has the following restrictions:
|
26
37
|
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
38
|
+
# * Must be a Hash object
|
39
|
+
# * All keys and values must be Strings
|
40
|
+
# * Keys can be a maximum of 128 bytes and values can be a
|
41
|
+
# maximum of 1024 bytes
|
42
|
+
# * All strings must be UTF8, no binary data is allowed
|
32
43
|
#
|
33
|
-
#
|
44
|
+
# For example, to add metadata for the location of a bugtracker:
|
34
45
|
#
|
35
46
|
# s.metadata = { "bugtracker" => "http://somewhere.com/blah" }
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
require 'rubygems/version'
|
40
|
-
require 'rubygems/requirement'
|
41
|
-
require 'rubygems/platform'
|
42
|
-
require 'rubygems/deprecate'
|
43
|
-
|
44
|
-
# :stopdoc:
|
45
|
-
# date.rb can't be loaded for `make install` due to miniruby
|
46
|
-
# Date is needed for old gems that stored #date as Date instead of Time.
|
47
|
-
class Date; end
|
48
|
-
# :startdoc:
|
49
47
|
|
50
48
|
class Gem::Specification
|
51
49
|
|
@@ -918,7 +916,7 @@ class Gem::Specification
|
|
918
916
|
result = Hash.new { |h,k| h[k] = {} }
|
919
917
|
native = {}
|
920
918
|
|
921
|
-
Gem::Specification.
|
919
|
+
Gem::Specification.reverse_each do |spec|
|
922
920
|
next if spec.version.prerelease? unless prerelease
|
923
921
|
|
924
922
|
native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY
|
@@ -995,7 +993,7 @@ class Gem::Specification
|
|
995
993
|
# TODO: maybe we should switch to rubygems' version service?
|
996
994
|
fetcher = Gem::SpecFetcher.fetcher
|
997
995
|
|
998
|
-
latest_specs.each do |local|
|
996
|
+
latest_specs(true).each do |local|
|
999
997
|
dependency = Gem::Dependency.new local.name, ">= #{local.version}"
|
1000
998
|
remotes, _ = fetcher.search_for_dependency dependency
|
1001
999
|
remotes = remotes.map { |n, _| n.version }
|
@@ -1236,7 +1234,7 @@ class Gem::Specification
|
|
1236
1234
|
|
1237
1235
|
unless dependency.respond_to?(:name) &&
|
1238
1236
|
dependency.respond_to?(:version_requirements)
|
1239
|
-
dependency = Gem::Dependency.new(dependency, requirements, type)
|
1237
|
+
dependency = Gem::Dependency.new(dependency.to_s, requirements, type)
|
1240
1238
|
end
|
1241
1239
|
|
1242
1240
|
dependencies << dependency
|
@@ -2270,7 +2268,7 @@ class Gem::Specification
|
|
2270
2268
|
require 'rubygems/psych_tree'
|
2271
2269
|
end
|
2272
2270
|
|
2273
|
-
builder = Gem::NoAliasYAMLTree.
|
2271
|
+
builder = Gem::NoAliasYAMLTree.create
|
2274
2272
|
builder << self
|
2275
2273
|
ast = builder.tree
|
2276
2274
|
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -28,6 +28,7 @@ require 'rubygems/test_utilities'
|
|
28
28
|
require 'pp'
|
29
29
|
require 'zlib'
|
30
30
|
require 'pathname'
|
31
|
+
require 'shellwords'
|
31
32
|
Gem.load_yaml
|
32
33
|
|
33
34
|
require 'rubygems/mock_gem_ui'
|
@@ -89,6 +90,63 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
89
90
|
refute File.exist?(path), msg
|
90
91
|
end
|
91
92
|
|
93
|
+
def scan_make_command_lines(output)
|
94
|
+
output.scan(/^#{Regexp.escape make_command}(?:[[:blank:]].*)?$/)
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse_make_command_line(line)
|
98
|
+
command, *args = line.shellsplit
|
99
|
+
|
100
|
+
targets = []
|
101
|
+
macros = {}
|
102
|
+
|
103
|
+
args.each do |arg|
|
104
|
+
case arg
|
105
|
+
when /\A(\w+)=/
|
106
|
+
macros[$1] = $'
|
107
|
+
else
|
108
|
+
targets << arg
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
targets << '' if targets.empty?
|
113
|
+
|
114
|
+
{
|
115
|
+
:command => command,
|
116
|
+
:targets => targets,
|
117
|
+
:macros => macros,
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
def assert_contains_make_command(target, output, msg = nil)
|
122
|
+
if output.match(/\n/)
|
123
|
+
msg = message(msg) {
|
124
|
+
'Expected output containing make command "%s": %s' % [
|
125
|
+
('%s %s' % [make_command, target]).rstrip,
|
126
|
+
output.inspect
|
127
|
+
]
|
128
|
+
}
|
129
|
+
else
|
130
|
+
msg = message(msg) {
|
131
|
+
'Expected make command "%s": %s' % [
|
132
|
+
('%s %s' % [make_command, target]).rstrip,
|
133
|
+
output.inspect
|
134
|
+
]
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
assert scan_make_command_lines(output).any? { |line|
|
139
|
+
make = parse_make_command_line(line)
|
140
|
+
|
141
|
+
if make[:targets].include?(target)
|
142
|
+
yield make, line if block_given?
|
143
|
+
true
|
144
|
+
else
|
145
|
+
false
|
146
|
+
end
|
147
|
+
}, msg
|
148
|
+
end
|
149
|
+
|
92
150
|
include Gem::DefaultUserInteraction
|
93
151
|
|
94
152
|
undef_method :default_test if instance_methods.include? 'default_test' or
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -1198,8 +1198,10 @@ class TestGem < Gem::TestCase
|
|
1198
1198
|
end
|
1199
1199
|
|
1200
1200
|
def test_self_user_dir
|
1201
|
-
|
1202
|
-
|
1201
|
+
parts = [@userhome, '.gem', Gem.ruby_engine]
|
1202
|
+
parts << Gem::ConfigMap[:ruby_version] unless Gem::ConfigMap[:ruby_version].empty?
|
1203
|
+
|
1204
|
+
assert_equal File.join(parts), Gem.user_dir
|
1203
1205
|
end
|
1204
1206
|
|
1205
1207
|
def test_self_user_home
|
@@ -10,6 +10,9 @@ class TestGemCommandsHelpCommand < Gem::TestCase
|
|
10
10
|
super
|
11
11
|
|
12
12
|
@cmd = Gem::Commands::HelpCommand.new
|
13
|
+
|
14
|
+
load File.expand_path('../rubygems_plugin.rb', __FILE__) unless
|
15
|
+
Gem::Commands.const_defined? :InterruptCommand
|
13
16
|
end
|
14
17
|
|
15
18
|
def test_gem_help_bad
|
@@ -34,6 +37,8 @@ class TestGemCommandsHelpCommand < Gem::TestCase
|
|
34
37
|
assert_match(/\s+#{cmd}\s+\S+/, out)
|
35
38
|
end
|
36
39
|
assert_equal '', err
|
40
|
+
|
41
|
+
refute_match 'No command found for ', out
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
@@ -140,4 +140,16 @@ EOF
|
|
140
140
|
|
141
141
|
assert_equal '701229f217cdf23b1344c7b4b54ca97', @fetcher.last_request['Authorization']
|
142
142
|
end
|
143
|
+
|
144
|
+
def test_remove_owners_missing
|
145
|
+
response = 'Owner could not be found.'
|
146
|
+
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 404, 'Not Found']
|
147
|
+
|
148
|
+
use_ui @ui do
|
149
|
+
@cmd.remove_owners("freewill", ["missing@example"])
|
150
|
+
end
|
151
|
+
|
152
|
+
assert_equal "Removing missing@example: #{response}\n", @ui.output
|
153
|
+
end
|
154
|
+
|
143
155
|
end
|
@@ -61,6 +61,22 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
61
61
|
assert_match @response, @ui.output
|
62
62
|
end
|
63
63
|
|
64
|
+
def test_execute
|
65
|
+
open 'example', 'w' do |io| io.write 'hello' end
|
66
|
+
|
67
|
+
@response = "Successfully registered gem: freewill (1.0.0)"
|
68
|
+
@fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, 'OK']
|
69
|
+
|
70
|
+
@cmd.options[:args] = %w[example]
|
71
|
+
|
72
|
+
@cmd.execute
|
73
|
+
|
74
|
+
assert_equal Net::HTTP::Post, @fetcher.last_request.class
|
75
|
+
assert_equal 'hello', @fetcher.last_request.body
|
76
|
+
assert_equal "application/octet-stream",
|
77
|
+
@fetcher.last_request["Content-Type"]
|
78
|
+
end
|
79
|
+
|
64
80
|
def test_execute_host
|
65
81
|
host = 'https://other.example'
|
66
82
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
|
1
3
|
require 'rubygems/test_case'
|
2
4
|
require 'rubygems/commands/setup_command'
|
3
5
|
|
@@ -73,5 +75,55 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
73
75
|
assert_path_exists os_defaults_rb
|
74
76
|
end
|
75
77
|
|
78
|
+
def test_show_release_notes
|
79
|
+
@default_external = nil
|
80
|
+
capture_io do
|
81
|
+
@default_external, Encoding.default_external =
|
82
|
+
Encoding.default_external, Encoding::US_ASCII
|
83
|
+
end if Object.const_defined? :Encoding
|
84
|
+
|
85
|
+
@cmd.options[:previous_version] = Gem::Version.new '2.0.2'
|
86
|
+
|
87
|
+
open 'History.txt', 'w' do |io|
|
88
|
+
io.puts <<-History_txt
|
89
|
+
# coding: UTF-8
|
90
|
+
|
91
|
+
=== #{Gem::VERSION} / 2013-03-26
|
92
|
+
|
93
|
+
* Bug fixes:
|
94
|
+
* Fixed release note display for LANG=C when installing rubygems
|
95
|
+
* π is tasty
|
96
|
+
|
97
|
+
=== 2.0.2 / 2013-03-06
|
98
|
+
|
99
|
+
* Bug fixes:
|
100
|
+
* Other bugs fixed
|
101
|
+
|
102
|
+
=== 2.0.1 / 2013-03-05
|
103
|
+
|
104
|
+
* Bug fixes:
|
105
|
+
* Yet more bugs fixed
|
106
|
+
History_txt
|
107
|
+
end
|
108
|
+
|
109
|
+
use_ui @ui do
|
110
|
+
@cmd.show_release_notes
|
111
|
+
end
|
112
|
+
|
113
|
+
expected = <<-EXPECTED
|
114
|
+
=== 2.0.2 / 2013-03-06
|
115
|
+
|
116
|
+
* Bug fixes:
|
117
|
+
* Other bugs fixed
|
118
|
+
|
119
|
+
EXPECTED
|
120
|
+
|
121
|
+
assert_equal expected, @ui.output
|
122
|
+
ensure
|
123
|
+
capture_io do
|
124
|
+
Encoding.default_external = @default_external
|
125
|
+
end if @default_external
|
126
|
+
end
|
127
|
+
|
76
128
|
end
|
77
129
|
|
@@ -38,8 +38,8 @@ install (FILES test.txt DESTINATION bin)
|
|
38
38
|
assert_match \
|
39
39
|
%r%^cmake \. -DCMAKE_INSTALL_PREFIX=#{Regexp.escape @dest_path}%, output
|
40
40
|
assert_match %r%#{Regexp.escape @ext}%, output
|
41
|
-
|
42
|
-
|
41
|
+
assert_contains_make_command '', output
|
42
|
+
assert_contains_make_command 'install', output
|
43
43
|
assert_match %r%test\.txt%, output
|
44
44
|
end
|
45
45
|
|
@@ -82,8 +82,8 @@ install (FILES test.txt DESTINATION bin)
|
|
82
82
|
|
83
83
|
output = output.join "\n"
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
assert_contains_make_command '', output
|
86
|
+
assert_contains_make_command 'install', output
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|
@@ -30,9 +30,9 @@ class TestGemExtConfigureBuilder < Gem::TestCase
|
|
30
30
|
|
31
31
|
assert_equal "sh ./configure --prefix=#{@dest_path}", output.shift
|
32
32
|
assert_equal "", output.shift
|
33
|
-
|
33
|
+
assert_contains_make_command '', output.shift
|
34
34
|
assert_match(/^ok$/m, output.shift)
|
35
|
-
|
35
|
+
assert_contains_make_command 'install', output.shift
|
36
36
|
assert_match(/^ok$/m, output.shift)
|
37
37
|
end
|
38
38
|
|
@@ -76,8 +76,8 @@ class TestGemExtConfigureBuilder < Gem::TestCase
|
|
76
76
|
Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
|
-
|
79
|
+
assert_contains_make_command '', output[0]
|
80
|
+
assert_contains_make_command 'install', output[2]
|
81
81
|
end
|
82
82
|
|
83
83
|
end
|
@@ -32,14 +32,9 @@ class TestGemExtExtConfBuilder < Gem::TestCase
|
|
32
32
|
|
33
33
|
assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
|
34
34
|
assert_equal "creating Makefile\n", output[1]
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
assert_equal "nmake install", output[4]
|
39
|
-
else
|
40
|
-
assert_equal "make", output[2]
|
41
|
-
assert_equal "make install", output[4]
|
42
|
-
end
|
35
|
+
assert_contains_make_command '', output[2]
|
36
|
+
assert_contains_make_command 'install', output[4]
|
37
|
+
assert_empty Dir.glob(File.join(@ext, 'siteconf*.rb'))
|
43
38
|
end
|
44
39
|
|
45
40
|
def test_class_build_rbconfig_make_prog
|
@@ -56,8 +51,8 @@ class TestGemExtExtConfBuilder < Gem::TestCase
|
|
56
51
|
end
|
57
52
|
|
58
53
|
assert_equal "creating Makefile\n", output[1]
|
59
|
-
|
60
|
-
|
54
|
+
assert_contains_make_command '', output[2]
|
55
|
+
assert_contains_make_command 'install', output[4]
|
61
56
|
ensure
|
62
57
|
RbConfig::CONFIG['configure_args'] = configure_args
|
63
58
|
end
|
@@ -80,7 +75,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
|
|
80
75
|
end
|
81
76
|
|
82
77
|
assert_equal "creating Makefile\n", output[1]
|
83
|
-
|
78
|
+
assert_contains_make_command '', output[2]
|
84
79
|
ensure
|
85
80
|
RbConfig::CONFIG['configure_args'] = configure_args
|
86
81
|
ENV['make'] = env_make
|
@@ -132,8 +127,8 @@ checking for main\(\) in .*?nonexistent/m, error.message)
|
|
132
127
|
Gem::Ext::ExtConfBuilder.make @ext, output
|
133
128
|
end
|
134
129
|
|
135
|
-
|
136
|
-
|
130
|
+
assert_contains_make_command '', output[0]
|
131
|
+
assert_contains_make_command 'install', output[2]
|
137
132
|
end
|
138
133
|
|
139
134
|
def test_class_make_no_Makefile
|