psych 2.0.13 → 2.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/Manifest.txt +2 -0
- data/Rakefile +55 -6
- data/ext/psych/psych_emitter.c +2 -3
- data/ext/psych/psych_parser.c +2 -2
- data/lib/psych.rb +8 -2
- data/lib/psych/versions.rb +3 -0
- data/lib/psych/visitors/to_ruby.rb +2 -2
- data/lib/psych_jars.rb +5 -0
- data/test/psych/helper.rb +1 -0
- data/test/psych/visitors/test_to_ruby.rb +7 -0
- metadata +8 -52
- data/test/psych/test_marshalable.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ed482aa38a7a9622af286172a58c843a19fee10
|
4
|
+
data.tar.gz: bf517307f66846bfa7d36c048ad7b20d8304c094
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c6f8dc7c2c2f6583c5821f6de3c325cf7ec5ddaecdd934dbb7137cd2521e32818cfccae6b46256d8659f27a17ca06caebab2150e8fd63df232bd4b1fbe487bf
|
7
|
+
data.tar.gz: f17fb70ae8e676ad441b68adfa0f79c97a1b55c8e6a844ab041bbab1efc2bc93e4b92a37f72f38a63120323bcb8e6ca06cc728c4b59577791ab9bde8ea56d9ef
|
data/.travis.yml
CHANGED
@@ -3,9 +3,14 @@ rvm:
|
|
3
3
|
- 1.9.3
|
4
4
|
- 2.0.0
|
5
5
|
- 2.1.0
|
6
|
+
- 2.2.0
|
6
7
|
- ruby-head
|
8
|
+
- rbx-2
|
7
9
|
before_script:
|
8
10
|
- gem install hoe
|
9
11
|
- gem install rake-compiler
|
10
|
-
- gem install minitest -v '~>
|
12
|
+
- gem install minitest -v '~> 5.0'
|
11
13
|
script: rake test
|
14
|
+
matrix:
|
15
|
+
allow_failures:
|
16
|
+
- rvm: rbx-2
|
data/Manifest.txt
CHANGED
@@ -57,6 +57,7 @@ lib/psych/stream.rb
|
|
57
57
|
lib/psych/streaming.rb
|
58
58
|
lib/psych/syntax_error.rb
|
59
59
|
lib/psych/tree_builder.rb
|
60
|
+
lib/psych/versions.rb
|
60
61
|
lib/psych/visitors.rb
|
61
62
|
lib/psych/visitors/depth_first.rb
|
62
63
|
lib/psych/visitors/emitter.rb
|
@@ -65,6 +66,7 @@ lib/psych/visitors/to_ruby.rb
|
|
65
66
|
lib/psych/visitors/visitor.rb
|
66
67
|
lib/psych/visitors/yaml_tree.rb
|
67
68
|
lib/psych/y.rb
|
69
|
+
lib/psych_jars.rb
|
68
70
|
test/psych/handlers/test_recorder.rb
|
69
71
|
test/psych/helper.rb
|
70
72
|
test/psych/json/test_stream.rb
|
data/Rakefile
CHANGED
@@ -1,15 +1,22 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
+
require 'psych'
|
3
4
|
require 'rubygems'
|
4
5
|
require 'hoe'
|
5
6
|
|
7
|
+
def java?
|
8
|
+
RUBY_PLATFORM =~ /java/
|
9
|
+
end
|
10
|
+
|
6
11
|
class Hoe
|
7
12
|
remove_const :RUBY_FLAGS
|
8
|
-
|
13
|
+
flags = "-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
|
14
|
+
flags = "--1.9 " + flags if java?
|
15
|
+
RUBY_FLAGS = flags
|
9
16
|
end
|
10
17
|
|
11
18
|
gem 'rake-compiler', '>= 0.4.1'
|
12
|
-
gem 'minitest', '~>
|
19
|
+
gem 'minitest', '~> 5.0'
|
13
20
|
require "rake/extensiontask"
|
14
21
|
|
15
22
|
Hoe.plugin :doofus, :git, :gemspec
|
@@ -24,15 +31,57 @@ $hoe = Hoe.spec 'psych' do
|
|
24
31
|
self.testlib = :minitest
|
25
32
|
|
26
33
|
extra_dev_deps << ['rake-compiler', '>= 0.4.1']
|
27
|
-
extra_dev_deps << ['minitest', '~>
|
34
|
+
extra_dev_deps << ['minitest', '~> 5.0']
|
28
35
|
|
29
36
|
self.spec_extras = {
|
30
|
-
:extensions => ["ext/psych/extconf.rb"],
|
31
37
|
:required_ruby_version => '>= 1.9.2'
|
32
38
|
}
|
33
39
|
|
34
|
-
|
35
|
-
|
40
|
+
if java?
|
41
|
+
require './lib/psych/versions.rb'
|
42
|
+
extra_deps << ['jar-dependencies', '>= 0.1.7']
|
43
|
+
|
44
|
+
# the jar declaration for jar-dependencies
|
45
|
+
self.spec_extras[ 'requirements' ] = "jar org.yaml:snakeyaml, #{Psych::DEFAULT_SNAKEYAML_VERSION}"
|
46
|
+
self.spec_extras[ 'platform' ] = 'java'
|
47
|
+
# TODO: clean this section up.
|
48
|
+
require "rake/javaextensiontask"
|
49
|
+
Rake::JavaExtensionTask.new("psych", spec) do |ext|
|
50
|
+
require 'maven/ruby/maven'
|
51
|
+
# uses Mavenfile to write classpath into pkg/classpath
|
52
|
+
# and tell maven via system properties the snakeyaml version
|
53
|
+
# this is basically the same as running from the commandline:
|
54
|
+
# rmvn dependency:build-classpath -Dsnakeyaml.version='use version from Psych::DEFAULT_SNAKEYAML_VERSION here'
|
55
|
+
Maven::Ruby::Maven.new.exec( 'dependency:build-classpath', "-Dsnakeyaml.version=#{Psych::DEFAULT_SNAKEYAML_VERSION}", '-Dverbose=true')#, '--quiet' )
|
56
|
+
ext.source_version = '1.7'
|
57
|
+
ext.target_version = '1.7'
|
58
|
+
ext.classpath = File.read('pkg/classpath')
|
59
|
+
ext.ext_dir = 'ext/java'
|
60
|
+
end
|
61
|
+
else
|
62
|
+
self.spec_extras[:extensions] = ["ext/psych/extconf.rb"]
|
63
|
+
Rake::ExtensionTask.new "psych", spec do |ext|
|
64
|
+
ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def gem_build_path
|
70
|
+
File.join 'pkg', $hoe.spec.full_name
|
71
|
+
end
|
72
|
+
|
73
|
+
def add_file_to_gem relative_path
|
74
|
+
target_path = File.join gem_build_path, relative_path
|
75
|
+
target_dir = File.dirname(target_path)
|
76
|
+
mkdir_p target_dir unless File.directory?(target_dir)
|
77
|
+
rm_f target_path
|
78
|
+
safe_ln relative_path, target_path
|
79
|
+
$hoe.spec.files.concat [relative_path]
|
80
|
+
end
|
81
|
+
|
82
|
+
if java?
|
83
|
+
task gem_build_path => [:compile] do
|
84
|
+
add_file_to_gem 'lib/psych.jar'
|
36
85
|
end
|
37
86
|
end
|
38
87
|
|
data/ext/psych/psych_emitter.c
CHANGED
@@ -50,14 +50,13 @@ static const rb_data_type_t psych_emitter_type = {
|
|
50
50
|
static VALUE allocate(VALUE klass)
|
51
51
|
{
|
52
52
|
yaml_emitter_t * emitter;
|
53
|
-
|
54
|
-
emitter = xmalloc(sizeof(yaml_emitter_t));
|
53
|
+
VALUE obj = TypedData_Make_Struct(klass, yaml_emitter_t, &psych_emitter_type, emitter);
|
55
54
|
|
56
55
|
yaml_emitter_initialize(emitter);
|
57
56
|
yaml_emitter_set_unicode(emitter, 1);
|
58
57
|
yaml_emitter_set_indent(emitter, 2);
|
59
58
|
|
60
|
-
return
|
59
|
+
return obj;
|
61
60
|
}
|
62
61
|
|
63
62
|
/* call-seq: Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS)
|
data/ext/psych/psych_parser.c
CHANGED
@@ -70,11 +70,11 @@ static const rb_data_type_t psych_parser_type = {
|
|
70
70
|
static VALUE allocate(VALUE klass)
|
71
71
|
{
|
72
72
|
yaml_parser_t * parser;
|
73
|
+
VALUE obj = TypedData_Make_Struct(klass, yaml_parser_t, &psych_parser_type, parser);
|
73
74
|
|
74
|
-
parser = xmalloc(sizeof(yaml_parser_t));
|
75
75
|
yaml_parser_initialize(parser);
|
76
76
|
|
77
|
-
return
|
77
|
+
return obj;
|
78
78
|
}
|
79
79
|
|
80
80
|
static VALUE make_exception(yaml_parser_t * parser, VALUE path)
|
data/lib/psych.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
case RUBY_ENGINE
|
2
|
+
when 'jruby'
|
3
|
+
require 'psych_jars'
|
4
|
+
org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
|
5
|
+
else
|
6
|
+
require 'psych.so'
|
7
|
+
end
|
2
8
|
require 'psych/nodes'
|
3
9
|
require 'psych/streaming'
|
4
10
|
require 'psych/visitors'
|
@@ -217,7 +223,7 @@ require 'psych/class_loader'
|
|
217
223
|
|
218
224
|
module Psych
|
219
225
|
# The version is Psych you're using
|
220
|
-
VERSION = '2.0.
|
226
|
+
VERSION = '2.0.14'
|
221
227
|
|
222
228
|
# The version of libyaml Psych is using
|
223
229
|
LIBYAML_VERSION = Psych.libyaml_version.join '.'
|
@@ -61,7 +61,7 @@ module Psych
|
|
61
61
|
case o.tag
|
62
62
|
when '!binary', 'tag:yaml.org,2002:binary'
|
63
63
|
o.value.unpack('m').first
|
64
|
-
when /^!(?:str|ruby\/string)(?::(.*))
|
64
|
+
when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
|
65
65
|
klass = resolve_class($1)
|
66
66
|
if klass
|
67
67
|
klass.allocate.replace o.value
|
@@ -208,7 +208,7 @@ module Psych
|
|
208
208
|
obj
|
209
209
|
end
|
210
210
|
|
211
|
-
when /^!(?:str|ruby\/string)(?::(.*))
|
211
|
+
when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
|
212
212
|
klass = resolve_class($1)
|
213
213
|
members = {}
|
214
214
|
string = nil
|
data/lib/psych_jars.rb
ADDED
data/test/psych/helper.rb
CHANGED
@@ -321,6 +321,13 @@ description:
|
|
321
321
|
assert_equal %w{ foo foo }, list
|
322
322
|
assert_equal list[0].object_id, list[1].object_id
|
323
323
|
end
|
324
|
+
|
325
|
+
def test_mapping_with_str_tag
|
326
|
+
mapping = Nodes::Mapping.new(nil, '!strawberry')
|
327
|
+
mapping.children << Nodes::Scalar.new('foo')
|
328
|
+
mapping.children << Nodes::Scalar.new('bar')
|
329
|
+
assert_equal({'foo' => 'bar'}, mapping.to_ruby)
|
330
|
+
end
|
324
331
|
end
|
325
332
|
end
|
326
333
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: psych
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: hoe
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/psych/streaming.rb
|
142
142
|
- lib/psych/syntax_error.rb
|
143
143
|
- lib/psych/tree_builder.rb
|
144
|
+
- lib/psych/versions.rb
|
144
145
|
- lib/psych/visitors.rb
|
145
146
|
- lib/psych/visitors/depth_first.rb
|
146
147
|
- lib/psych/visitors/emitter.rb
|
@@ -149,6 +150,7 @@ files:
|
|
149
150
|
- lib/psych/visitors/visitor.rb
|
150
151
|
- lib/psych/visitors/yaml_tree.rb
|
151
152
|
- lib/psych/y.rb
|
153
|
+
- lib/psych_jars.rb
|
152
154
|
- test/psych/handlers/test_recorder.rb
|
153
155
|
- test/psych/helper.rb
|
154
156
|
- test/psych/json/test_stream.rb
|
@@ -166,7 +168,6 @@ files:
|
|
166
168
|
- test/psych/test_exception.rb
|
167
169
|
- test/psych/test_hash.rb
|
168
170
|
- test/psych/test_json_tree.rb
|
169
|
-
- test/psych/test_marshalable.rb
|
170
171
|
- test/psych/test_merge_keys.rb
|
171
172
|
- test/psych/test_nil.rb
|
172
173
|
- test/psych/test_null.rb
|
@@ -217,53 +218,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
218
|
version: '0'
|
218
219
|
requirements: []
|
219
220
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.
|
221
|
+
rubygems_version: 2.5.0
|
221
222
|
signing_key:
|
222
223
|
specification_version: 4
|
223
224
|
summary: Psych is a YAML parser and emitter
|
224
|
-
test_files:
|
225
|
-
- test/psych/handlers/test_recorder.rb
|
226
|
-
- test/psych/json/test_stream.rb
|
227
|
-
- test/psych/nodes/test_enumerable.rb
|
228
|
-
- test/psych/test_alias_and_anchor.rb
|
229
|
-
- test/psych/test_array.rb
|
230
|
-
- test/psych/test_boolean.rb
|
231
|
-
- test/psych/test_class.rb
|
232
|
-
- test/psych/test_coder.rb
|
233
|
-
- test/psych/test_date_time.rb
|
234
|
-
- test/psych/test_deprecated.rb
|
235
|
-
- test/psych/test_document.rb
|
236
|
-
- test/psych/test_emitter.rb
|
237
|
-
- test/psych/test_encoding.rb
|
238
|
-
- test/psych/test_exception.rb
|
239
|
-
- test/psych/test_hash.rb
|
240
|
-
- test/psych/test_json_tree.rb
|
241
|
-
- test/psych/test_marshalable.rb
|
242
|
-
- test/psych/test_merge_keys.rb
|
243
|
-
- test/psych/test_nil.rb
|
244
|
-
- test/psych/test_null.rb
|
245
|
-
- test/psych/test_numeric.rb
|
246
|
-
- test/psych/test_object.rb
|
247
|
-
- test/psych/test_object_references.rb
|
248
|
-
- test/psych/test_omap.rb
|
249
|
-
- test/psych/test_parser.rb
|
250
|
-
- test/psych/test_psych.rb
|
251
|
-
- test/psych/test_safe_load.rb
|
252
|
-
- test/psych/test_scalar.rb
|
253
|
-
- test/psych/test_scalar_scanner.rb
|
254
|
-
- test/psych/test_serialize_subclasses.rb
|
255
|
-
- test/psych/test_set.rb
|
256
|
-
- test/psych/test_stream.rb
|
257
|
-
- test/psych/test_string.rb
|
258
|
-
- test/psych/test_struct.rb
|
259
|
-
- test/psych/test_symbol.rb
|
260
|
-
- test/psych/test_tainted.rb
|
261
|
-
- test/psych/test_to_yaml_properties.rb
|
262
|
-
- test/psych/test_tree_builder.rb
|
263
|
-
- test/psych/test_yaml.rb
|
264
|
-
- test/psych/test_yamldbm.rb
|
265
|
-
- test/psych/test_yamlstore.rb
|
266
|
-
- test/psych/visitors/test_depth_first.rb
|
267
|
-
- test/psych/visitors/test_emitter.rb
|
268
|
-
- test/psych/visitors/test_to_ruby.rb
|
269
|
-
- test/psych/visitors/test_yaml_tree.rb
|
225
|
+
test_files: []
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require_relative 'helper'
|
2
|
-
require 'delegate'
|
3
|
-
|
4
|
-
module Psych
|
5
|
-
class TestMarshalable < TestCase
|
6
|
-
def test_objects_defining_marshal_dump_and_marshal_load_can_be_dumped
|
7
|
-
sd = SimpleDelegator.new(1)
|
8
|
-
loaded = Psych.load(Psych.dump(sd))
|
9
|
-
|
10
|
-
assert_instance_of(SimpleDelegator, loaded)
|
11
|
-
assert_equal(sd, loaded)
|
12
|
-
end
|
13
|
-
|
14
|
-
class PsychCustomMarshalable < BasicObject
|
15
|
-
attr_reader :foo
|
16
|
-
|
17
|
-
def initialize(foo)
|
18
|
-
@foo = foo
|
19
|
-
end
|
20
|
-
|
21
|
-
def marshal_dump
|
22
|
-
[foo]
|
23
|
-
end
|
24
|
-
|
25
|
-
def mashal_load(data)
|
26
|
-
@foo = data[0]
|
27
|
-
end
|
28
|
-
|
29
|
-
def init_with(coder)
|
30
|
-
@foo = coder['foo']
|
31
|
-
end
|
32
|
-
|
33
|
-
def encode_with(coder)
|
34
|
-
coder['foo'] = 2
|
35
|
-
end
|
36
|
-
|
37
|
-
def respond_to?(method)
|
38
|
-
[:marshal_dump, :marshal_load, :init_with, :encode_with].include?(method)
|
39
|
-
end
|
40
|
-
|
41
|
-
def class
|
42
|
-
PsychCustomMarshalable
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_init_with_takes_priority_over_marshal_methods
|
47
|
-
obj = PsychCustomMarshalable.new(1)
|
48
|
-
loaded = Psych.load(Psych.dump(obj))
|
49
|
-
|
50
|
-
assert(PsychCustomMarshalable === loaded)
|
51
|
-
assert_equal(2, loaded.foo)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|