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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98ff80d57bc20b6d84ee24df83966f0feebfbe3f
4
- data.tar.gz: afa7e8005ce6e5ce2867e4c3d06793d94c2af627
3
+ metadata.gz: 5ed482aa38a7a9622af286172a58c843a19fee10
4
+ data.tar.gz: bf517307f66846bfa7d36c048ad7b20d8304c094
5
5
  SHA512:
6
- metadata.gz: d219a2267fdb9c6471a9e27e18242e572bcbf259207d78b4a8948dd812fc1da23bde5b24850e099961c4d0384a71d2bb2177c02b8131d771d8c726924ec693f0
7
- data.tar.gz: 0ae5569645a513442d8f7859b2ab3154a42c8fc728ec9a82f6a40971554eab5907338032352522755cc59666d13f58d42304f71aaacd6f86b5fc9c7c3f4f9dc9
6
+ metadata.gz: 3c6f8dc7c2c2f6583c5821f6de3c325cf7ec5ddaecdd934dbb7137cd2521e32818cfccae6b46256d8659f27a17ca06caebab2150e8fd63df232bd4b1fbe487bf
7
+ data.tar.gz: f17fb70ae8e676ad441b68adfa0f79c97a1b55c8e6a844ab041bbab1efc2bc93e4b92a37f72f38a63120323bcb8e6ca06cc728c4b59577791ab9bde8ea56d9ef
@@ -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 '~> 4.0'
12
+ - gem install minitest -v '~> 5.0'
11
13
  script: rake test
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: rbx-2
@@ -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
- RUBY_FLAGS = "-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
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', '~> 4.0'
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', '~> 4.0']
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
- Rake::ExtensionTask.new "psych", spec do |ext|
35
- ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
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
 
@@ -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 TypedData_Wrap_Struct(klass, &psych_emitter_type, emitter);
59
+ return obj;
61
60
  }
62
61
 
63
62
  /* call-seq: Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS)
@@ -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 TypedData_Wrap_Struct(klass, &psych_parser_type, parser);
77
+ return obj;
78
78
  }
79
79
 
80
80
  static VALUE make_exception(yaml_parser_t * parser, VALUE path)
@@ -1,4 +1,10 @@
1
- require 'psych.so'
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.13'
226
+ VERSION = '2.0.14'
221
227
 
222
228
  # The version of libyaml Psych is using
223
229
  LIBYAML_VERSION = Psych.libyaml_version.join '.'
@@ -0,0 +1,3 @@
1
+ module Psych
2
+ DEFAULT_SNAKEYAML_VERSION = '1.14'.freeze
3
+ end
@@ -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)(?::(.*))?/, 'tag:yaml.org,2002:str'
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)(?::(.*))?/, 'tag:yaml.org,2002:str'
211
+ when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
212
212
  klass = resolve_class($1)
213
213
  members = {}
214
214
  string = nil
@@ -0,0 +1,5 @@
1
+ require 'psych/versions'
2
+ require 'psych.jar'
3
+
4
+ require 'jar-dependencies'
5
+ require_jar('org.yaml', 'snakeyaml', Psych::DEFAULT_SNAKEYAML_VERSION)
@@ -2,6 +2,7 @@ require 'minitest/autorun'
2
2
  require 'stringio'
3
3
  require 'tempfile'
4
4
  require 'date'
5
+
5
6
  require 'psych'
6
7
 
7
8
  module Psych
@@ -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.13
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-02-17 00:00:00.000000000 Z
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: '4.0'
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: '4.0'
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.4.5
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