psych 3.0.2-java → 3.0.3-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.
- checksums.yaml +5 -5
- data/README.md +6 -4
- data/Rakefile +3 -1
- data/ext/java/PsychEmitter.java +17 -11
- data/ext/java/PsychLibrary.java +7 -1
- data/ext/java/PsychParser.java +19 -16
- data/ext/psych/psych_emitter.c +1 -0
- data/ext/psych/psych_parser.c +1 -0
- data/lib/psych.rb +27 -4
- data/lib/psych/nodes/alias.rb +2 -0
- data/lib/psych/nodes/document.rb +2 -0
- data/lib/psych/nodes/mapping.rb +2 -0
- data/lib/psych/nodes/node.rb +7 -0
- data/lib/psych/nodes/scalar.rb +2 -0
- data/lib/psych/nodes/sequence.rb +2 -0
- data/lib/psych/nodes/stream.rb +2 -0
- data/lib/psych/versions.rb +2 -2
- data/psych.gemspec +3 -4
- metadata +4 -5
- data/ext/psych/.gitignore +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7aed9d05032bc444bab436880e7451b18b177a162de7796189801eaa5197932c
|
4
|
+
data.tar.gz: e525367cd2cfe469492166b957bfdf55db72865525c3c507253e92b100d47112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccc121b4129b153433fac77601a600d843df7ef89511b24113c4d3aa63661c092f240e4753fdf7f3c4821be95010c70a52489eb51326d2247ea7b3f3f1ff6b8b
|
7
|
+
data.tar.gz: 4174038bcdd55991e3c3c76d025832ac403edab7e47c805799e48de59bf2a143e5c3b99801d627700efc6bb0e1755c779ba5c1f5524c9d1370047a46f0ae8b4a
|
data/README.md
CHANGED
@@ -14,11 +14,13 @@ serialize and de-serialize most Ruby objects to and from the YAML format.
|
|
14
14
|
|
15
15
|
## Examples
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
```ruby
|
18
|
+
# Load YAML in to a Ruby object
|
19
|
+
Psych.load('--- foo') # => 'foo'
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
# Emit YAML from a Ruby object
|
22
|
+
Psych.dump("foo") # => "--- foo\n...\n"
|
23
|
+
```
|
22
24
|
|
23
25
|
## Dependencies
|
24
26
|
|
data/Rakefile
CHANGED
@@ -14,11 +14,13 @@ if RUBY_PLATFORM =~ /java/
|
|
14
14
|
require 'rake/javaextensiontask'
|
15
15
|
Rake::JavaExtensionTask.new("psych") do |ext|
|
16
16
|
require 'maven/ruby/maven'
|
17
|
+
# force load of versions to overwrite constants with values from repo.
|
18
|
+
load './lib/psych/versions.rb'
|
17
19
|
# uses Mavenfile to write classpath into pkg/classpath
|
18
20
|
# and tell maven via system properties the snakeyaml version
|
19
21
|
# this is basically the same as running from the commandline:
|
20
22
|
# rmvn dependency:build-classpath -Dsnakeyaml.version='use version from Psych::DEFAULT_SNAKEYAML_VERSION here'
|
21
|
-
Maven::Ruby::Maven.new.exec('dependency:build-classpath', "-Dsnakeyaml.version=1.
|
23
|
+
Maven::Ruby::Maven.new.exec('dependency:build-classpath', "-Dsnakeyaml.version=1.23", '-Dverbose=true')
|
22
24
|
ext.source_version = '1.7'
|
23
25
|
ext.target_version = '1.7'
|
24
26
|
ext.classpath = File.read('pkg/classpath')
|
data/ext/java/PsychEmitter.java
CHANGED
@@ -202,7 +202,7 @@ public class PsychEmitter extends RubyObject {
|
|
202
202
|
value.asJavaString(),
|
203
203
|
NULL_MARK,
|
204
204
|
NULL_MARK,
|
205
|
-
SCALAR_STYLES[
|
205
|
+
SCALAR_STYLES[style.convertToInteger().getIntValue()]);
|
206
206
|
emit(context, event);
|
207
207
|
return this;
|
208
208
|
}
|
@@ -222,7 +222,7 @@ public class PsychEmitter extends RubyObject {
|
|
222
222
|
implicit.isTrue(),
|
223
223
|
NULL_MARK,
|
224
224
|
NULL_MARK,
|
225
|
-
|
225
|
+
FLOW_STYLES[style.convertToInteger().getIntValue()]);
|
226
226
|
emit(context, event);
|
227
227
|
return this;
|
228
228
|
}
|
@@ -249,7 +249,7 @@ public class PsychEmitter extends RubyObject {
|
|
249
249
|
implicit.isTrue(),
|
250
250
|
NULL_MARK,
|
251
251
|
NULL_MARK,
|
252
|
-
|
252
|
+
FLOW_STYLES[style.convertToInteger().getIntValue()]);
|
253
253
|
emit(context, event);
|
254
254
|
return this;
|
255
255
|
}
|
@@ -332,16 +332,22 @@ public class PsychEmitter extends RubyObject {
|
|
332
332
|
DumperOptions options = new DumperOptions();
|
333
333
|
IRubyObject io;
|
334
334
|
|
335
|
-
private static final Mark NULL_MARK = new Mark(
|
335
|
+
private static final Mark NULL_MARK = new Mark("", 0, 0, 0, new int[0], 0);
|
336
336
|
|
337
337
|
// Map style constants from Psych values (ANY = 0 ... FOLDED = 5)
|
338
338
|
// to SnakeYaml values; see psych/nodes/scalar.rb.
|
339
|
-
private static final
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
339
|
+
private static final DumperOptions.ScalarStyle[] SCALAR_STYLES = {
|
340
|
+
DumperOptions.ScalarStyle.PLAIN, // ANY
|
341
|
+
DumperOptions.ScalarStyle.PLAIN,
|
342
|
+
DumperOptions.ScalarStyle.SINGLE_QUOTED,
|
343
|
+
DumperOptions.ScalarStyle.DOUBLE_QUOTED,
|
344
|
+
DumperOptions.ScalarStyle.LITERAL,
|
345
|
+
DumperOptions.ScalarStyle.FOLDED
|
346
|
+
};
|
347
|
+
|
348
|
+
private static final DumperOptions.FlowStyle[] FLOW_STYLES = {
|
349
|
+
DumperOptions.FlowStyle.AUTO,
|
350
|
+
DumperOptions.FlowStyle.BLOCK,
|
351
|
+
DumperOptions.FlowStyle.FLOW
|
346
352
|
};
|
347
353
|
}
|
data/ext/java/PsychLibrary.java
CHANGED
@@ -57,7 +57,13 @@ public class PsychLibrary implements Library {
|
|
57
57
|
catch( IOException e ) {
|
58
58
|
// ignored
|
59
59
|
}
|
60
|
-
|
60
|
+
String snakeyamlVersion = props.getProperty("version", "0.0");
|
61
|
+
|
62
|
+
if (snakeyamlVersion.endsWith("-SNAPSHOT")) {
|
63
|
+
snakeyamlVersion = snakeyamlVersion.substring(0, snakeyamlVersion.length() - "-SNAPSHOT".length());
|
64
|
+
}
|
65
|
+
|
66
|
+
RubyString version = runtime.newString(snakeyamlVersion + ".0");
|
61
67
|
version.setFrozen(true);
|
62
68
|
psych.setConstant("SNAKEYAML_VERSION", version);
|
63
69
|
|
data/ext/java/PsychParser.java
CHANGED
@@ -41,6 +41,7 @@ import org.jruby.Ruby;
|
|
41
41
|
import org.jruby.RubyArray;
|
42
42
|
import org.jruby.RubyClass;
|
43
43
|
import org.jruby.RubyEncoding;
|
44
|
+
import org.jruby.RubyFixnum;
|
44
45
|
import org.jruby.RubyIO;
|
45
46
|
import org.jruby.RubyKernel;
|
46
47
|
import org.jruby.RubyModule;
|
@@ -295,7 +296,7 @@ public class PsychParser extends RubyObject {
|
|
295
296
|
IRubyObject tag = stringOrNilFor(runtime, se.getTag(), tainted);
|
296
297
|
IRubyObject plain_implicit = runtime.newBoolean(se.getImplicit().canOmitTagInPlainScalar());
|
297
298
|
IRubyObject quoted_implicit = runtime.newBoolean(se.getImplicit().canOmitTagInNonPlainScalar());
|
298
|
-
IRubyObject style = runtime.newFixnum(translateStyle(se.
|
299
|
+
IRubyObject style = runtime.newFixnum(translateStyle(se.getScalarStyle()));
|
299
300
|
IRubyObject val = stringFor(runtime, se.getValue(), tainted);
|
300
301
|
|
301
302
|
invoke(context, handler, "scalar", val, anchor, tag, plain_implicit,
|
@@ -359,24 +360,26 @@ public class PsychParser extends RubyObject {
|
|
359
360
|
RubyKernel.raise(context, runtime.getKernel(), new IRubyObject[] { exception }, Block.NULL_BLOCK);
|
360
361
|
}
|
361
362
|
|
362
|
-
private static int translateStyle(
|
363
|
+
private static int translateStyle(DumperOptions.ScalarStyle style) {
|
363
364
|
if (style == null) return 0; // any
|
364
365
|
|
365
366
|
switch (style) {
|
366
|
-
case
|
367
|
-
case
|
368
|
-
case
|
369
|
-
case
|
370
|
-
case
|
367
|
+
case PLAIN: return 1; // plain
|
368
|
+
case SINGLE_QUOTED: return 2; // single-quoted
|
369
|
+
case DOUBLE_QUOTED: return 3; // double-quoted
|
370
|
+
case LITERAL: return 4; // literal
|
371
|
+
case FOLDED: return 5; // folded
|
371
372
|
default: return 0; // any
|
372
373
|
}
|
373
374
|
}
|
374
375
|
|
375
|
-
private static int translateFlowStyle(
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
376
|
+
private static int translateFlowStyle(DumperOptions.FlowStyle flowStyle) {
|
377
|
+
switch (flowStyle) {
|
378
|
+
case AUTO: return 0;
|
379
|
+
case BLOCK: return 1;
|
380
|
+
case FLOW:
|
381
|
+
default: return 2;
|
382
|
+
}
|
380
383
|
}
|
381
384
|
|
382
385
|
@JRubyMethod
|
@@ -394,9 +397,9 @@ public class PsychParser extends RubyObject {
|
|
394
397
|
if (event == null) {
|
395
398
|
return ((RubyClass)context.runtime.getClassFromPath("Psych::Parser::Mark")).newInstance(
|
396
399
|
context,
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
+
RubyFixnum.zero(runtime),
|
401
|
+
RubyFixnum.zero(runtime),
|
402
|
+
RubyFixnum.zero(runtime),
|
400
403
|
Block.NULL_BLOCK
|
401
404
|
);
|
402
405
|
}
|
@@ -405,7 +408,7 @@ public class PsychParser extends RubyObject {
|
|
405
408
|
|
406
409
|
return ((RubyClass)context.runtime.getClassFromPath("Psych::Parser::Mark")).newInstance(
|
407
410
|
context,
|
408
|
-
|
411
|
+
RubyFixnum.zero(runtime),
|
409
412
|
runtime.newFixnum(mark.getLine()),
|
410
413
|
runtime.newFixnum(mark.getColumn()),
|
411
414
|
Block.NULL_BLOCK
|
data/ext/psych/psych_emitter.c
CHANGED
@@ -521,6 +521,7 @@ static VALUE set_line_width(VALUE self, VALUE width)
|
|
521
521
|
|
522
522
|
void Init_psych_emitter(void)
|
523
523
|
{
|
524
|
+
#undef rb_intern
|
524
525
|
VALUE psych = rb_define_module("Psych");
|
525
526
|
VALUE handler = rb_define_class_under(psych, "Handler", rb_cObject);
|
526
527
|
cPsychEmitter = rb_define_class_under(psych, "Emitter", handler);
|
data/ext/psych/psych_parser.c
CHANGED
data/lib/psych.rb
CHANGED
@@ -3,7 +3,12 @@ require 'psych/versions'
|
|
3
3
|
case RUBY_ENGINE
|
4
4
|
when 'jruby'
|
5
5
|
require 'psych_jars'
|
6
|
-
|
6
|
+
if JRuby::Util.respond_to?(:load_ext)
|
7
|
+
JRuby::Util.load_ext('org.jruby.ext.psych.PsychLibrary')
|
8
|
+
else
|
9
|
+
require 'java'; require 'jruby'
|
10
|
+
org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
|
11
|
+
end
|
7
12
|
else
|
8
13
|
begin
|
9
14
|
require "#{RUBY_VERSION[/\d+\.\d+/]}/psych.so"
|
@@ -418,6 +423,24 @@ module Psych
|
|
418
423
|
# to control the output format. If an IO object is passed in, the YAML will
|
419
424
|
# be dumped to that IO object.
|
420
425
|
#
|
426
|
+
# Currently supported options are:
|
427
|
+
#
|
428
|
+
# [<tt>:indentation</tt>] Number of space characters used to indent.
|
429
|
+
# Acceptable value should be in <tt>0..9</tt> range,
|
430
|
+
# otherwise option is ignored.
|
431
|
+
#
|
432
|
+
# Default: <tt>2</tt>.
|
433
|
+
# [<tt>:line_width</tt>] Max character to wrap line at.
|
434
|
+
#
|
435
|
+
# Default: <tt>0</tt> (meaning "wrap at 81").
|
436
|
+
# [<tt>:canonical</tt>] Write "canonical" YAML form (very verbose, yet
|
437
|
+
# strictly formal).
|
438
|
+
#
|
439
|
+
# Default: <tt>false</tt>.
|
440
|
+
# [<tt>:header</tt>] Write <tt>%YAML [version]</tt> at the beginning of document.
|
441
|
+
#
|
442
|
+
# Default: <tt>false</tt>.
|
443
|
+
#
|
421
444
|
# Example:
|
422
445
|
#
|
423
446
|
# # Dump an array, get back a YAML string
|
@@ -427,10 +450,10 @@ module Psych
|
|
427
450
|
# Psych.dump(['a', 'b'], StringIO.new) # => #<StringIO:0x000001009d0890>
|
428
451
|
#
|
429
452
|
# # Dump an array with indentation set
|
430
|
-
# Psych.dump(['a', ['b']], :
|
453
|
+
# Psych.dump(['a', ['b']], indentation: 3) # => "---\n- a\n- - b\n"
|
431
454
|
#
|
432
455
|
# # Dump an array to an IO with indentation set
|
433
|
-
# Psych.dump(['a', ['b']], StringIO.new, :
|
456
|
+
# Psych.dump(['a', ['b']], StringIO.new, indentation: 3)
|
434
457
|
def self.dump o, io = nil, options = {}
|
435
458
|
if Hash === io
|
436
459
|
options = io
|
@@ -492,7 +515,7 @@ module Psych
|
|
492
515
|
###
|
493
516
|
# Load the document contained in +filename+. Returns the yaml contained in
|
494
517
|
# +filename+ as a Ruby object, or if the file is empty, it returns
|
495
|
-
# the specified
|
518
|
+
# the specified +fallback+ return value, which defaults to +false+.
|
496
519
|
def self.load_file filename, fallback: false
|
497
520
|
File.open(filename, 'r:bom|utf-8') { |f|
|
498
521
|
self.load f, filename, fallback: FALLBACK.new(fallback)
|
data/lib/psych/nodes/alias.rb
CHANGED
data/lib/psych/nodes/document.rb
CHANGED
data/lib/psych/nodes/mapping.rb
CHANGED
data/lib/psych/nodes/node.rb
CHANGED
data/lib/psych/nodes/scalar.rb
CHANGED
data/lib/psych/nodes/sequence.rb
CHANGED
data/lib/psych/nodes/stream.rb
CHANGED
data/lib/psych/versions.rb
CHANGED
data/psych.gemspec
CHANGED
@@ -3,10 +3,9 @@
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "psych"
|
6
|
-
s.version = "3.0.
|
6
|
+
s.version = "3.0.3"
|
7
7
|
s.authors = ["Aaron Patterson", "SHIBATA Hiroshi", "Charles Oliver Nutter"]
|
8
8
|
s.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org", "headius@headius.com"]
|
9
|
-
s.date = "2017-12-04"
|
10
9
|
s.summary = "Psych is a YAML parser and emitter"
|
11
10
|
s.description = <<-DESCRIPTION
|
12
11
|
Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
|
@@ -20,7 +19,7 @@ DESCRIPTION
|
|
20
19
|
# for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
20
|
s.files = [
|
22
21
|
".gitignore", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "Mavenfile", "README.md", "Rakefile", "bin/console",
|
23
|
-
"bin/setup", "ext/psych
|
22
|
+
"bin/setup", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h",
|
24
23
|
"ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h",
|
25
24
|
"ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h",
|
26
25
|
"ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c",
|
@@ -54,7 +53,7 @@ DESCRIPTION
|
|
54
53
|
"ext/java/PsychEmitter.java", "ext/java/PsychLibrary.java", "ext/java/PsychParser.java", "ext/java/PsychToRuby.java",
|
55
54
|
"ext/java/PsychYamlTree.java", "lib/psych_jars.rb", "lib/psych.jar"
|
56
55
|
]
|
57
|
-
s.requirements = "jar org.yaml:snakeyaml, 1.
|
56
|
+
s.requirements = "jar org.yaml:snakeyaml, 1.23"
|
58
57
|
s.add_dependency 'jar-dependencies', '>= 0.1.7'
|
59
58
|
s.add_development_dependency 'ruby-maven'
|
60
59
|
else
|
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: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-10-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +96,6 @@ files:
|
|
96
96
|
- ext/java/PsychParser.java
|
97
97
|
- ext/java/PsychToRuby.java
|
98
98
|
- ext/java/PsychYamlTree.java
|
99
|
-
- ext/psych/.gitignore
|
100
99
|
- ext/psych/depend
|
101
100
|
- ext/psych/extconf.rb
|
102
101
|
- ext/psych/psych.c
|
@@ -182,9 +181,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
181
|
- !ruby/object:Gem::Version
|
183
182
|
version: '0'
|
184
183
|
requirements:
|
185
|
-
- jar org.yaml:snakeyaml, 1.
|
184
|
+
- jar org.yaml:snakeyaml, 1.23
|
186
185
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.6
|
186
|
+
rubygems_version: 2.7.6
|
188
187
|
signing_key:
|
189
188
|
specification_version: 4
|
190
189
|
summary: Psych is a YAML parser and emitter
|