psych 2.1.0-java → 2.1.1-java

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +14 -0
  3. data/Gemfile +3 -0
  4. data/Mavenfile +7 -0
  5. data/bin/console +7 -0
  6. data/bin/setup +6 -0
  7. data/ext/java/PsychEmitter.java +345 -0
  8. data/ext/java/PsychLibrary.java +93 -0
  9. data/ext/java/PsychParser.java +399 -0
  10. data/ext/java/PsychToRuby.java +79 -0
  11. data/ext/java/PsychYamlTree.java +55 -0
  12. data/ext/psych/.gitignore +11 -0
  13. data/lib/psych.rb +2 -2
  14. data/lib/psych/visitors/to_ruby.rb +2 -2
  15. data/psych.gemspec +39 -0
  16. metadata +19 -53
  17. data/test/psych/handlers/test_recorder.rb +0 -26
  18. data/test/psych/helper.rb +0 -122
  19. data/test/psych/json/test_stream.rb +0 -110
  20. data/test/psych/nodes/test_enumerable.rb +0 -44
  21. data/test/psych/test_alias_and_anchor.rb +0 -97
  22. data/test/psych/test_array.rb +0 -58
  23. data/test/psych/test_boolean.rb +0 -37
  24. data/test/psych/test_class.rb +0 -37
  25. data/test/psych/test_coder.rb +0 -207
  26. data/test/psych/test_date_time.rb +0 -39
  27. data/test/psych/test_deprecated.rb +0 -215
  28. data/test/psych/test_document.rb +0 -47
  29. data/test/psych/test_emitter.rb +0 -112
  30. data/test/psych/test_encoding.rb +0 -269
  31. data/test/psych/test_exception.rb +0 -158
  32. data/test/psych/test_hash.rb +0 -95
  33. data/test/psych/test_json_tree.rb +0 -66
  34. data/test/psych/test_merge_keys.rb +0 -181
  35. data/test/psych/test_nil.rb +0 -19
  36. data/test/psych/test_null.rb +0 -20
  37. data/test/psych/test_numeric.rb +0 -46
  38. data/test/psych/test_object.rb +0 -45
  39. data/test/psych/test_object_references.rb +0 -72
  40. data/test/psych/test_omap.rb +0 -76
  41. data/test/psych/test_parser.rb +0 -340
  42. data/test/psych/test_psych.rb +0 -184
  43. data/test/psych/test_safe_load.rb +0 -98
  44. data/test/psych/test_scalar.rb +0 -12
  45. data/test/psych/test_scalar_scanner.rb +0 -111
  46. data/test/psych/test_serialize_subclasses.rb +0 -39
  47. data/test/psych/test_set.rb +0 -50
  48. data/test/psych/test_stream.rb +0 -94
  49. data/test/psych/test_string.rb +0 -231
  50. data/test/psych/test_struct.rb +0 -50
  51. data/test/psych/test_symbol.rb +0 -26
  52. data/test/psych/test_tainted.rb +0 -131
  53. data/test/psych/test_to_yaml_properties.rb +0 -64
  54. data/test/psych/test_tree_builder.rb +0 -80
  55. data/test/psych/test_yaml.rb +0 -1293
  56. data/test/psych/test_yamldbm.rb +0 -193
  57. data/test/psych/test_yamlstore.rb +0 -86
  58. data/test/psych/visitors/test_depth_first.rb +0 -50
  59. data/test/psych/visitors/test_emitter.rb +0 -145
  60. data/test/psych/visitors/test_to_ruby.rb +0 -332
  61. data/test/psych/visitors/test_yaml_tree.rb +0 -180
@@ -0,0 +1,55 @@
1
+ /***** BEGIN LICENSE BLOCK *****
2
+ * Version: EPL 1.0/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Eclipse Public
5
+ * License Version 1.0 (the "License"); you may not use this file
6
+ * except in compliance with the License. You may obtain a copy of
7
+ * the License at http://www.eclipse.org/legal/epl-v10.html
8
+ *
9
+ * Software distributed under the License is distributed on an "AS
10
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
+ * implied. See the License for the specific language governing
12
+ * rights and limitations under the License.
13
+ *
14
+ * Copyright (C) 2010 Charles O Nutter <headius@headius.com>
15
+ *
16
+ * Alternatively, the contents of this file may be used under the terms of
17
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
18
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19
+ * in which case the provisions of the GPL or the LGPL are applicable instead
20
+ * of those above. If you wish to allow use of your version of this file only
21
+ * under the terms of either the GPL or the LGPL, and not to allow others to
22
+ * use your version of this file under the terms of the EPL, indicate your
23
+ * decision by deleting the provisions above and replace them with the notice
24
+ * and other provisions required by the GPL or the LGPL. If you do not delete
25
+ * the provisions above, a recipient may use your version of this file under
26
+ * the terms of any one of the EPL, the GPL or the LGPL.
27
+ ***** END LICENSE BLOCK *****/
28
+ package org.jruby.ext.psych;
29
+
30
+ import org.jruby.Ruby;
31
+ import org.jruby.RubyClass;
32
+ import org.jruby.RubyModule;
33
+ import org.jruby.RubyObject;
34
+ import org.jruby.anno.JRubyMethod;
35
+ import org.jruby.runtime.ThreadContext;
36
+ import org.jruby.runtime.builtin.IRubyObject;
37
+ import static org.jruby.runtime.Visibility.*;
38
+
39
+ public class PsychYamlTree {
40
+ public static void initPsychYamlTree(Ruby runtime, RubyModule psych) {
41
+ RubyModule visitors = (RubyModule)psych.getConstant("Visitors");
42
+ RubyClass visitor = (RubyClass)visitors.getConstant("Visitor");
43
+ RubyClass psychYamlTree = runtime.defineClassUnder("YAMLTree", visitor, RubyObject.OBJECT_ALLOCATOR, visitors);
44
+
45
+ psychYamlTree.defineAnnotatedMethods(PsychYamlTree.class);
46
+ }
47
+
48
+ @JRubyMethod(visibility = PRIVATE)
49
+ public static IRubyObject private_iv_get(ThreadContext context, IRubyObject self, IRubyObject target, IRubyObject prop) {
50
+ IRubyObject obj = (IRubyObject)target.getInternalVariables().getInternalVariable(prop.asJavaString());
51
+ if (obj == null) obj = context.nil;
52
+
53
+ return obj;
54
+ }
55
+ }
@@ -0,0 +1,11 @@
1
+ /api.c
2
+ /config.h
3
+ /dumper.c
4
+ /emitter.c
5
+ /loader.c
6
+ /parser.c
7
+ /reader.c
8
+ /scanner.c
9
+ /writer.c
10
+ /yaml.h
11
+ /yaml_private.h
@@ -224,7 +224,7 @@ require 'psych/class_loader'
224
224
 
225
225
  module Psych
226
226
  # The version is Psych you're using
227
- VERSION = '2.1.0'
227
+ VERSION = '2.1.1'
228
228
 
229
229
  # The version of libyaml Psych is using
230
230
  LIBYAML_VERSION = Psych.libyaml_version.join '.'
@@ -469,7 +469,7 @@ module Psych
469
469
  ###
470
470
  # Load the document contained in +filename+. Returns the yaml contained in
471
471
  # +filename+ as a Ruby object, or if the file is empty, it returns
472
- # the specified default return value, which defaults to an empty Hash
472
+ # the specified default return value, which defaults to an empty Hash
473
473
  def self.load_file filename, fallback = false
474
474
  File.open(filename, 'r:bom|utf-8') { |f|
475
475
  self.load f, filename, FALLBACK.new(fallback)
@@ -70,11 +70,11 @@ module Psych
70
70
  o.value
71
71
  end
72
72
  when '!ruby/object:BigDecimal'
73
- require 'bigdecimal'
73
+ require 'bigdecimal' unless defined? BigDecimal
74
74
  class_loader.big_decimal._load o.value
75
75
  when "!ruby/object:DateTime"
76
76
  class_loader.date_time
77
- require 'date'
77
+ require 'date' unless defined? DateTime
78
78
  @ss.parse_time(o.value).to_datetime
79
79
  when '!ruby/encoding'
80
80
  ::Encoding.find o.value
@@ -0,0 +1,39 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "psych"
5
+ s.version = "2.1.1"
6
+ s.authors = ["Aaron Patterson", "SHIBATA Hiroshi"]
7
+ s.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org"]
8
+ s.date = "2016-09-07"
9
+ s.summary = "Psych is a YAML parser and emitter"
10
+ s.description = <<-DESCRIPTION
11
+ Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
12
+ for its YAML parsing and emitting capabilities. In addition to wrapping libyaml,
13
+ Psych also knows how to serialize and de-serialize most Ruby objects to and from the YAML format.
14
+ DESCRIPTION
15
+ s.homepage = "http://github.com/tenderlove/psych"
16
+ s.licenses = ["MIT"]
17
+ s.require_paths = ["lib"]
18
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+
20
+ s.rdoc_options = ["--main", "README.rdoc"]
21
+ s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc", "CHANGELOG.rdoc", "README.rdoc"]
22
+
23
+ s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
24
+ s.rubygems_version = "2.5.1"
25
+ s.required_rubygems_version = Gem::Requirement.new(">= 0")
26
+
27
+ s.add_development_dependency(%q<rake-compiler>, [">= 0.4.1"])
28
+ s.add_development_dependency(%q<minitest>, ["~> 5.0"])
29
+
30
+ if RUBY_PLATFORM =~ /java/
31
+ require 'psych/versions'
32
+ s.platform = 'java'
33
+ s.requirements = "jar org.yaml:snakeyaml, #{Psych::DEFAULT_SNAKEYAML_VERSION}"
34
+ s.add_dependency 'jar-dependencies', '>= 0.1.7'
35
+ s.add_development_dependency 'ruby-maven'
36
+ else
37
+ s.extensions = ["ext/psych/extconf.rb"]
38
+ end
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: java
6
6
  authors:
7
7
  - Aaron Patterson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-24 00:00:00.000000000 Z
12
+ date: 2016-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -67,11 +67,10 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
- description: |-
71
- Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
72
- for its YAML parsing and emitting capabilities. In addition to wrapping
73
- libyaml, Psych also knows how to serialize and de-serialize most Ruby objects
74
- to and from the YAML format.
70
+ description: |
71
+ Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
72
+ for its YAML parsing and emitting capabilities. In addition to wrapping libyaml,
73
+ Psych also knows how to serialize and de-serialize most Ruby objects to and from the YAML format.
75
74
  email:
76
75
  - aaron@tenderlovemaking.com
77
76
  - hsbt@ruby-lang.org
@@ -81,10 +80,21 @@ extra_rdoc_files:
81
80
  - CHANGELOG.rdoc
82
81
  - README.rdoc
83
82
  files:
83
+ - ".gitignore"
84
84
  - ".travis.yml"
85
85
  - CHANGELOG.rdoc
86
+ - Gemfile
87
+ - Mavenfile
86
88
  - README.rdoc
87
89
  - Rakefile
90
+ - bin/console
91
+ - bin/setup
92
+ - ext/java/PsychEmitter.java
93
+ - ext/java/PsychLibrary.java
94
+ - ext/java/PsychParser.java
95
+ - ext/java/PsychToRuby.java
96
+ - ext/java/PsychYamlTree.java
97
+ - ext/psych/.gitignore
88
98
  - ext/psych/depend
89
99
  - ext/psych/extconf.rb
90
100
  - ext/psych/psych.c
@@ -148,51 +158,7 @@ files:
148
158
  - lib/psych/visitors/yaml_tree.rb
149
159
  - lib/psych/y.rb
150
160
  - lib/psych_jars.rb
151
- - test/psych/handlers/test_recorder.rb
152
- - test/psych/helper.rb
153
- - test/psych/json/test_stream.rb
154
- - test/psych/nodes/test_enumerable.rb
155
- - test/psych/test_alias_and_anchor.rb
156
- - test/psych/test_array.rb
157
- - test/psych/test_boolean.rb
158
- - test/psych/test_class.rb
159
- - test/psych/test_coder.rb
160
- - test/psych/test_date_time.rb
161
- - test/psych/test_deprecated.rb
162
- - test/psych/test_document.rb
163
- - test/psych/test_emitter.rb
164
- - test/psych/test_encoding.rb
165
- - test/psych/test_exception.rb
166
- - test/psych/test_hash.rb
167
- - test/psych/test_json_tree.rb
168
- - test/psych/test_merge_keys.rb
169
- - test/psych/test_nil.rb
170
- - test/psych/test_null.rb
171
- - test/psych/test_numeric.rb
172
- - test/psych/test_object.rb
173
- - test/psych/test_object_references.rb
174
- - test/psych/test_omap.rb
175
- - test/psych/test_parser.rb
176
- - test/psych/test_psych.rb
177
- - test/psych/test_safe_load.rb
178
- - test/psych/test_scalar.rb
179
- - test/psych/test_scalar_scanner.rb
180
- - test/psych/test_serialize_subclasses.rb
181
- - test/psych/test_set.rb
182
- - test/psych/test_stream.rb
183
- - test/psych/test_string.rb
184
- - test/psych/test_struct.rb
185
- - test/psych/test_symbol.rb
186
- - test/psych/test_tainted.rb
187
- - test/psych/test_to_yaml_properties.rb
188
- - test/psych/test_tree_builder.rb
189
- - test/psych/test_yaml.rb
190
- - test/psych/test_yamldbm.rb
191
- - test/psych/test_yamlstore.rb
192
- - test/psych/visitors/test_depth_first.rb
193
- - test/psych/visitors/test_emitter.rb
194
- - test/psych/visitors/test_to_ruby.rb
195
- - test/psych/visitors/test_yaml_tree.rb
161
+ - psych.gemspec
196
162
  homepage: http://github.com/tenderlove/psych
197
163
  licenses:
198
164
  - MIT
@@ -216,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
182
  requirements:
217
183
  - jar org.yaml:snakeyaml, 1.14
218
184
  rubyforge_project:
219
- rubygems_version: 2.6.4
185
+ rubygems_version: 2.6.6
220
186
  signing_key:
221
187
  specification_version: 4
222
188
  summary: Psych is a YAML parser and emitter
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: false
2
- require 'psych/helper'
3
- require 'psych/handlers/recorder'
4
-
5
- module Psych
6
- module Handlers
7
- class TestRecorder < TestCase
8
- def test_replay
9
- yaml = "--- foo\n...\n"
10
- output = StringIO.new
11
-
12
- recorder = Psych::Handlers::Recorder.new
13
- parser = Psych::Parser.new recorder
14
- parser.parse yaml
15
-
16
- assert_equal 5, recorder.events.length
17
-
18
- emitter = Psych::Emitter.new output
19
- recorder.events.each do |m, args|
20
- emitter.send m, *args
21
- end
22
- assert_equal yaml, output.string
23
- end
24
- end
25
- end
26
- end
@@ -1,122 +0,0 @@
1
- # frozen_string_literal: false
2
- require 'minitest/autorun'
3
- require 'stringio'
4
- require 'tempfile'
5
- require 'date'
6
-
7
- require 'psych'
8
-
9
- module Psych
10
- superclass = if defined?(Minitest::Test)
11
- Minitest::Test
12
- else
13
- MiniTest::Unit::TestCase
14
- end
15
-
16
- class TestCase < superclass
17
- def self.suppress_warning
18
- verbose, $VERBOSE = $VERBOSE, nil
19
- yield
20
- ensure
21
- $VERBOSE = verbose
22
- end
23
-
24
- def with_default_external(enc)
25
- verbose, $VERBOSE = $VERBOSE, nil
26
- origenc, Encoding.default_external = Encoding.default_external, enc
27
- $VERBOSE = verbose
28
- yield
29
- ensure
30
- verbose, $VERBOSE = $VERBOSE, nil
31
- Encoding.default_external = origenc
32
- $VERBOSE = verbose
33
- end
34
-
35
- def with_default_internal(enc)
36
- verbose, $VERBOSE = $VERBOSE, nil
37
- origenc, Encoding.default_internal = Encoding.default_internal, enc
38
- $VERBOSE = verbose
39
- yield
40
- ensure
41
- verbose, $VERBOSE = $VERBOSE, nil
42
- Encoding.default_internal = origenc
43
- $VERBOSE = verbose
44
- end
45
-
46
- #
47
- # Convert between Psych and the object to verify correct parsing and
48
- # emitting
49
- #
50
- def assert_to_yaml( obj, yaml )
51
- assert_equal( obj, Psych::load( yaml ) )
52
- assert_equal( obj, Psych::parse( yaml ).transform )
53
- assert_equal( obj, Psych::load( obj.psych_to_yaml ) )
54
- assert_equal( obj, Psych::parse( obj.psych_to_yaml ).transform )
55
- assert_equal( obj, Psych::load(
56
- obj.psych_to_yaml(
57
- :UseVersion => true, :UseHeader => true, :SortKeys => true
58
- )
59
- ))
60
- end
61
-
62
- #
63
- # Test parser only
64
- #
65
- def assert_parse_only( obj, yaml )
66
- assert_equal( obj, Psych::load( yaml ) )
67
- assert_equal( obj, Psych::parse( yaml ).transform )
68
- end
69
-
70
- def assert_cycle( obj )
71
- v = Visitors::YAMLTree.create
72
- v << obj
73
- assert_equal(obj, Psych.load(v.tree.yaml))
74
- assert_equal( obj, Psych::load(Psych.dump(obj)))
75
- assert_equal( obj, Psych::load( obj.psych_to_yaml ) )
76
- end
77
-
78
- #
79
- # Make a time with the time zone
80
- #
81
- def mktime( year, mon, day, hour, min, sec, usec, zone = "Z" )
82
- usec = Rational(usec.to_s) * 1000000
83
- val = Time::utc( year.to_i, mon.to_i, day.to_i, hour.to_i, min.to_i, sec.to_i, usec )
84
- if zone != "Z"
85
- hour = zone[0,3].to_i * 3600
86
- min = zone[3,2].to_i * 60
87
- ofs = (hour + min)
88
- val = Time.at( val.tv_sec - ofs, val.tv_nsec / 1000.0 )
89
- end
90
- return val
91
- end
92
- end
93
- end
94
-
95
- # backport so that tests will run on 2.0.0
96
- unless Tempfile.respond_to? :create
97
- def Tempfile.create(basename, *rest)
98
- tmpfile = nil
99
- Dir::Tmpname.create(basename, *rest) do |tmpname, n, opts|
100
- mode = File::RDWR|File::CREAT|File::EXCL
101
- perm = 0600
102
- if opts
103
- mode |= opts.delete(:mode) || 0
104
- opts[:perm] = perm
105
- perm = nil
106
- else
107
- opts = perm
108
- end
109
- tmpfile = File.open(tmpname, mode, opts)
110
- end
111
- if block_given?
112
- begin
113
- yield tmpfile
114
- ensure
115
- tmpfile.close if !tmpfile.closed?
116
- File.unlink tmpfile
117
- end
118
- else
119
- tmpfile
120
- end
121
- end
122
- end
@@ -1,110 +0,0 @@
1
- # frozen_string_literal: false
2
- require 'psych/helper'
3
-
4
- module Psych
5
- module JSON
6
- class TestStream < TestCase
7
- def setup
8
- @io = StringIO.new
9
- @stream = Psych::JSON::Stream.new(@io)
10
- @stream.start
11
- end
12
-
13
- def test_explicit_documents
14
- @io = StringIO.new
15
- @stream = Psych::JSON::Stream.new(@io)
16
- @stream.start
17
-
18
- @stream.push({ 'foo' => 'bar' })
19
-
20
- assert !@stream.finished?, 'stream not finished'
21
- @stream.finish
22
- assert @stream.finished?, 'stream finished'
23
-
24
- assert_match(/^---/, @io.string)
25
- assert_match(/\.\.\.$/, @io.string)
26
- end
27
-
28
- def test_null
29
- @stream.push(nil)
30
- assert_match(/^--- null/, @io.string)
31
- end
32
-
33
- def test_string
34
- @stream.push "foo"
35
- assert_match(/(["])foo\1/, @io.string)
36
- end
37
-
38
- def test_symbol
39
- @stream.push :foo
40
- assert_match(/(["])foo\1/, @io.string)
41
- end
42
-
43
- def test_int
44
- @stream.push 10
45
- assert_match(/^--- 10/, @io.string)
46
- end
47
-
48
- def test_float
49
- @stream.push 1.2
50
- assert_match(/^--- 1.2/, @io.string)
51
- end
52
-
53
- def test_hash
54
- hash = { 'one' => 'two' }
55
- @stream.push hash
56
-
57
- json = @io.string
58
- assert_match(/}$/, json)
59
- assert_match(/^--- \{/, json)
60
- assert_match(/["]one['"]/, json)
61
- assert_match(/["]two['"]/, json)
62
- end
63
-
64
- def test_list_to_json
65
- list = %w{ one two }
66
- @stream.push list
67
-
68
- json = @io.string
69
- assert_match(/\]$/, json)
70
- assert_match(/^--- \[/, json)
71
- assert_match(/["]one["]/, json)
72
- assert_match(/["]two["]/, json)
73
- end
74
-
75
- class Foo; end
76
-
77
- def test_json_dump_exclude_tag
78
- @stream << Foo.new
79
- json = @io.string
80
- refute_match('Foo', json)
81
- end
82
-
83
- class Bar
84
- def encode_with coder
85
- coder.represent_seq 'omg', %w{ a b c }
86
- end
87
- end
88
-
89
- def test_json_list_dump_exclude_tag
90
- @stream << Bar.new
91
- json = @io.string
92
- refute_match('omg', json)
93
- end
94
-
95
- def test_time
96
- time = Time.utc(2010, 10, 10)
97
- @stream.push({'a' => time })
98
- json = @io.string
99
- assert_match "{\"a\": \"2010-10-10 00:00:00.000000000 Z\"}\n", json
100
- end
101
-
102
- def test_datetime
103
- time = Time.new(2010, 10, 10).to_datetime
104
- @stream.push({'a' => time })
105
- json = @io.string
106
- assert_match "{\"a\": \"#{time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")}\"}\n", json
107
- end
108
- end
109
- end
110
- end