slimgems 1.3.9.4 → 1.3.9.5
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.
- data/lib/rubygems.rb +45 -15
- data/lib/rubygems/psych_additions.rb +9 -0
- data/lib/rubygems/psych_tree.rb +27 -0
- data/lib/rubygems/requirement.rb +18 -7
- data/lib/rubygems/specification.rb +5 -1
- data/lib/rubygems/syck_hack.rb +74 -0
- data/test/test_gem_specification.rb +24 -0
- metadata +7 -4
data/lib/rubygems.rb
CHANGED
@@ -106,7 +106,7 @@ require 'thread'
|
|
106
106
|
module Gem
|
107
107
|
NAME = 'SlimGems'
|
108
108
|
GEM_NAME = 'slimgems'
|
109
|
-
VERSION = '1.3.9.
|
109
|
+
VERSION = '1.3.9.5'
|
110
110
|
SlimGemsVersion = RubyGemsVersion = VERSION
|
111
111
|
|
112
112
|
##
|
@@ -633,24 +633,54 @@ module Gem
|
|
633
633
|
##
|
634
634
|
# Loads YAML, preferring Psych
|
635
635
|
|
636
|
+
@yaml_loaded = false
|
637
|
+
|
638
|
+
##
|
639
|
+
# Loads YAML, preferring Psych
|
640
|
+
|
636
641
|
def self.load_yaml
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
642
|
+
return if @yaml_loaded
|
643
|
+
|
644
|
+
test_syck = ENV['TEST_SYCK']
|
645
|
+
|
646
|
+
unless test_syck
|
647
|
+
begin
|
648
|
+
gem 'psych', '~> 1.2', '>= 1.2.1'
|
649
|
+
rescue Gem::LoadError
|
650
|
+
# It's OK if the user does not have the psych gem installed. We will
|
651
|
+
# attempt to require the stdlib version
|
652
|
+
end
|
643
653
|
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
654
|
+
begin
|
655
|
+
# Try requiring the gem version *or* stdlib version of psych.
|
656
|
+
require 'psych'
|
657
|
+
rescue ::LoadError
|
658
|
+
# If we can't load psych, thats fine, go on.
|
659
|
+
else
|
660
|
+
# If 'yaml' has already been required, then we have to
|
661
|
+
# be sure to switch it over to the newly loaded psych.
|
662
|
+
if defined?(YAML::ENGINE) && YAML::ENGINE.yamler != "psych"
|
663
|
+
YAML::ENGINE.yamler = "psych"
|
652
664
|
end
|
665
|
+
|
666
|
+
require 'rubygems/psych_additions'
|
667
|
+
require 'rubygems/psych_tree'
|
668
|
+
end
|
653
669
|
end
|
670
|
+
|
671
|
+
require 'yaml'
|
672
|
+
|
673
|
+
# If we're supposed to be using syck, then we may have to force
|
674
|
+
# activate it via the YAML::ENGINE API.
|
675
|
+
if test_syck and defined?(YAML::ENGINE)
|
676
|
+
YAML::ENGINE.yamler = "syck" unless YAML::ENGINE.syck?
|
677
|
+
end
|
678
|
+
|
679
|
+
# Now that we're sure some kind of yaml library is loaded, pull
|
680
|
+
# in our hack to deal with Syck's DefaultKey ugliness.
|
681
|
+
require 'rubygems/syck_hack'
|
682
|
+
|
683
|
+
@yaml_loaded = true
|
654
684
|
end
|
655
685
|
|
656
686
|
##
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Gem
|
2
|
+
if defined? ::Psych::Visitors
|
3
|
+
class NoAliasYAMLTree < Psych::Visitors::YAMLTree
|
4
|
+
def visit_String(str)
|
5
|
+
return super unless str == '=' # or whatever you want
|
6
|
+
|
7
|
+
quote = Psych::Nodes::Scalar::SINGLE_QUOTED
|
8
|
+
@emitter.scalar str, nil, nil, false, true, quote
|
9
|
+
end
|
10
|
+
|
11
|
+
# Noop this out so there are no anchors
|
12
|
+
def register(target, obj)
|
13
|
+
end
|
14
|
+
|
15
|
+
# This is ported over from the yaml_tree in 1.9.3
|
16
|
+
def format_time time
|
17
|
+
if time.utc?
|
18
|
+
time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
|
19
|
+
else
|
20
|
+
time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private :format_time
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/rubygems/requirement.rb
CHANGED
@@ -129,18 +129,15 @@ class Gem::Requirement
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def marshal_dump # :nodoc:
|
132
|
+
fix_syck_default_key_in_requirements
|
133
|
+
|
132
134
|
[@requirements]
|
133
135
|
end
|
134
136
|
|
135
137
|
def marshal_load array # :nodoc:
|
136
138
|
@requirements = array[0]
|
137
139
|
|
138
|
-
|
139
|
-
@requirements.each do |r|
|
140
|
-
if r[0].kind_of? YAML::Syck::DefaultKey
|
141
|
-
r[0] = "="
|
142
|
-
end
|
143
|
-
end
|
140
|
+
fix_syck_default_key_in_requirements
|
144
141
|
end
|
145
142
|
|
146
143
|
def prerelease?
|
@@ -157,7 +154,7 @@ class Gem::Requirement
|
|
157
154
|
# True if +version+ satisfies this Requirement.
|
158
155
|
|
159
156
|
def satisfied_by? version
|
160
|
-
requirements.all? { |op, rv| OPS[op].call version, rv }
|
157
|
+
requirements.all? { |op, rv| (OPS[op] || OPS["="]).call version, rv }
|
161
158
|
end
|
162
159
|
|
163
160
|
def to_s # :nodoc:
|
@@ -167,6 +164,20 @@ class Gem::Requirement
|
|
167
164
|
def <=> other # :nodoc:
|
168
165
|
to_s <=> other.to_s
|
169
166
|
end
|
167
|
+
|
168
|
+
private
|
169
|
+
|
170
|
+
def fix_syck_default_key_in_requirements
|
171
|
+
Gem.load_yaml
|
172
|
+
|
173
|
+
# Fixup the Syck DefaultKey bug
|
174
|
+
@requirements.each do |r|
|
175
|
+
if r[0].kind_of? Gem::SyckDefaultKey
|
176
|
+
r[0] = "="
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
170
181
|
end
|
171
182
|
|
172
183
|
# :stopdoc:
|
@@ -504,7 +504,11 @@ class Gem::Specification
|
|
504
504
|
gemspec = nil
|
505
505
|
raise "NESTED Specification.load calls not allowed!" if @@gather
|
506
506
|
@@gather = proc { |gs| gemspec = gs }
|
507
|
-
|
507
|
+
if defined? Encoding
|
508
|
+
data = File.read filename, :mode => 'r:UTF-8:-'
|
509
|
+
else
|
510
|
+
data = File.read filename
|
511
|
+
end
|
508
512
|
eval data, nil, filename
|
509
513
|
gemspec
|
510
514
|
ensure
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# :stopdoc:
|
2
|
+
|
3
|
+
# Hack to handle syck's DefaultKey bug
|
4
|
+
#
|
5
|
+
# This file is always loaded AFTER either syck or psych are already
|
6
|
+
# loaded. It then looks at what constants are available and creates
|
7
|
+
# a consistent view on all rubys.
|
8
|
+
#
|
9
|
+
# All this is so that there is always a YAML::Syck::DefaultKey
|
10
|
+
# class no matter if the full yaml library has loaded or not.
|
11
|
+
#
|
12
|
+
|
13
|
+
module YAML
|
14
|
+
# In newer 1.9.2, there is a Syck toplevel constant instead of it
|
15
|
+
# being underneith YAML. If so, reference it back under YAML as
|
16
|
+
# well.
|
17
|
+
if defined? ::Syck
|
18
|
+
# for tests that change YAML::ENGINE
|
19
|
+
# 1.8 does not support the second argument to const_defined?
|
20
|
+
remove_const :Syck rescue nil
|
21
|
+
|
22
|
+
Syck = ::Syck
|
23
|
+
|
24
|
+
# JRuby's "Syck" is called "Yecht"
|
25
|
+
elsif defined? YAML::Yecht
|
26
|
+
Syck = YAML::Yecht
|
27
|
+
|
28
|
+
# Otherwise, if there is no YAML::Syck, then we've got just psych
|
29
|
+
# loaded, so lets define a stub for DefaultKey.
|
30
|
+
elsif !defined? YAML::Syck
|
31
|
+
module Syck
|
32
|
+
class DefaultKey
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Now that we've got something that is always here, define #to_s
|
38
|
+
# so when code tries to use this, it at least just shows up like it
|
39
|
+
# should.
|
40
|
+
module Syck
|
41
|
+
class DefaultKey
|
42
|
+
remove_method :to_s rescue nil
|
43
|
+
|
44
|
+
def to_s
|
45
|
+
'='
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Sometime in the 1.9 dev cycle, the Syck constant was moved from under YAML
|
52
|
+
# to be a toplevel constant. So gemspecs created under these versions of Syck
|
53
|
+
# will have references to Syck::DefaultKey.
|
54
|
+
#
|
55
|
+
# So we need to be sure that we reference Syck at the toplevel too so that
|
56
|
+
# we can always load these kind of gemspecs.
|
57
|
+
#
|
58
|
+
if !defined?(Syck)
|
59
|
+
Syck = YAML::Syck
|
60
|
+
end
|
61
|
+
|
62
|
+
# Now that we've got Syck setup in all the right places, store
|
63
|
+
# a reference to the DefaultKey class inside Gem. We do this so that
|
64
|
+
# if later on YAML, etc are redefined, we've still got a consistent
|
65
|
+
# place to find the DefaultKey class for comparison.
|
66
|
+
|
67
|
+
module Gem
|
68
|
+
# for tests that change YAML::ENGINE
|
69
|
+
remove_const :SyckDefaultKey if const_defined? :SyckDefaultKey
|
70
|
+
|
71
|
+
SyckDefaultKey = YAML::Syck::DefaultKey
|
72
|
+
end
|
73
|
+
|
74
|
+
# :startdoc:
|
@@ -177,6 +177,30 @@ end
|
|
177
177
|
@a2.files.clear
|
178
178
|
end
|
179
179
|
|
180
|
+
def test_self_load_utf8_with_ascii_encoding
|
181
|
+
int_enc = Encoding.default_internal
|
182
|
+
Encoding.default_internal = 'US-ASCII'
|
183
|
+
|
184
|
+
spec2 = @a2.dup
|
185
|
+
bin = "\u5678"
|
186
|
+
full_path = nil
|
187
|
+
write_file spec2.spec_name do |io|
|
188
|
+
full_path = io.path
|
189
|
+
io.write spec2.to_ruby.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY'))
|
190
|
+
end
|
191
|
+
|
192
|
+
begin
|
193
|
+
spec = Gem::Specification.load full_path
|
194
|
+
assert true
|
195
|
+
rescue Encoding::UndefinedConversionError => e
|
196
|
+
assert false, "raised encoding conversion error: #{e}"
|
197
|
+
end
|
198
|
+
|
199
|
+
assert_equal spec2, spec
|
200
|
+
ensure
|
201
|
+
Encoding.default_internal = int_enc
|
202
|
+
end if defined?(Encoding)
|
203
|
+
|
180
204
|
def test_self_load_legacy_ruby
|
181
205
|
spec = eval LEGACY_RUBY_SPEC
|
182
206
|
assert_equal 'keyedlist', spec.name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slimgems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.9.
|
4
|
+
version: 1.3.9.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-
|
15
|
+
date: 2012-05-08 00:00:00.000000000 -04:00
|
16
16
|
default_executable:
|
17
17
|
dependencies: []
|
18
18
|
description: ! "SlimGems is a drop-in replacement for RubyGems, a package management
|
@@ -102,6 +102,8 @@ files:
|
|
102
102
|
- lib/rubygems/package.rb
|
103
103
|
- lib/rubygems/package_task.rb
|
104
104
|
- lib/rubygems/platform.rb
|
105
|
+
- lib/rubygems/psych_additions.rb
|
106
|
+
- lib/rubygems/psych_tree.rb
|
105
107
|
- lib/rubygems/remote_fetcher.rb
|
106
108
|
- lib/rubygems/require_paths_builder.rb
|
107
109
|
- lib/rubygems/requirement.rb
|
@@ -112,6 +114,7 @@ files:
|
|
112
114
|
- lib/rubygems/source_info_cache_entry.rb
|
113
115
|
- lib/rubygems/spec_fetcher.rb
|
114
116
|
- lib/rubygems/specification.rb
|
117
|
+
- lib/rubygems/syck_hack.rb
|
115
118
|
- lib/rubygems/test_utilities.rb
|
116
119
|
- lib/rubygems/text.rb
|
117
120
|
- lib/rubygems/uninstaller.rb
|
@@ -216,7 +219,7 @@ files:
|
|
216
219
|
has_rdoc: true
|
217
220
|
homepage: http://slimgems.github.com
|
218
221
|
licenses: []
|
219
|
-
post_install_message: ! "Upgraded from RubyGems to SlimGems 1.3.9.
|
222
|
+
post_install_message: ! "Upgraded from RubyGems to SlimGems 1.3.9.5\n\uFEFF=== 1.3.9.3
|
220
223
|
/ 2011-09-07\n\nSlimGems is a drop-in replacement for RubyGems. See README.md for
|
221
224
|
more.\n\n* Add support for Ruby 1.9.3 preview release (#9)\n* Fix rubygems-pwn gem
|
222
225
|
install remote execution vulnerability (#10)\n\n"
|
@@ -237,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
240
|
version: '0'
|
238
241
|
requirements: []
|
239
242
|
rubyforge_project:
|
240
|
-
rubygems_version: 1.3.9.
|
243
|
+
rubygems_version: 1.3.9.4
|
241
244
|
signing_key:
|
242
245
|
specification_version: 3
|
243
246
|
summary: SlimGems is a package management framework for Ruby
|