psych 2.0.12 → 5.2.3
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/CONTRIBUTING.md +24 -0
- data/{ext/psych/yaml/LICENSE → LICENSE} +9 -7
- data/README.md +80 -0
- data/ext/psych/depend +14 -0
- data/ext/psych/extconf.rb +43 -28
- data/ext/psych/psych.c +6 -4
- data/ext/psych/psych.h +0 -3
- data/ext/psych/psych_emitter.c +165 -132
- data/ext/psych/psych_parser.c +298 -331
- data/ext/psych/psych_to_ruby.c +0 -5
- data/ext/psych/psych_yaml_tree.c +0 -13
- data/lib/psych/class_loader.rb +11 -8
- data/lib/psych/coder.rb +1 -0
- data/lib/psych/core_ext.rb +3 -19
- data/lib/psych/exception.rb +17 -2
- data/lib/psych/handler.rb +8 -2
- data/lib/psych/handlers/document_stream.rb +2 -1
- data/lib/psych/handlers/recorder.rb +2 -1
- data/lib/psych/json/ruby_events.rb +1 -0
- data/lib/psych/json/stream.rb +3 -2
- data/lib/psych/json/tree_builder.rb +2 -1
- data/lib/psych/json/yaml_events.rb +1 -0
- data/lib/psych/nodes/alias.rb +3 -0
- data/lib/psych/nodes/document.rb +3 -0
- data/lib/psych/nodes/mapping.rb +3 -0
- data/lib/psych/nodes/node.rb +25 -5
- data/lib/psych/nodes/scalar.rb +4 -1
- data/lib/psych/nodes/sequence.rb +3 -0
- data/lib/psych/nodes/stream.rb +3 -0
- data/lib/psych/nodes.rb +8 -7
- data/lib/psych/omap.rb +1 -0
- data/lib/psych/parser.rb +14 -0
- data/lib/psych/scalar_scanner.rb +41 -49
- data/lib/psych/set.rb +1 -0
- data/lib/psych/stream.rb +1 -0
- data/lib/psych/streaming.rb +1 -0
- data/lib/psych/syntax_error.rb +2 -1
- data/lib/psych/tree_builder.rb +48 -7
- data/lib/psych/versions.rb +10 -0
- data/lib/psych/visitors/depth_first.rb +1 -0
- data/lib/psych/visitors/emitter.rb +1 -0
- data/lib/psych/visitors/json_tree.rb +2 -1
- data/lib/psych/visitors/to_ruby.rb +64 -33
- data/lib/psych/visitors/visitor.rb +18 -3
- data/lib/psych/visitors/yaml_tree.rb +128 -149
- data/lib/psych/visitors.rb +7 -6
- data/lib/psych/y.rb +1 -0
- data/lib/psych.rb +360 -95
- metadata +36 -169
- data/.autotest +0 -18
- data/.gemtest +0 -0
- data/.travis.yml +0 -11
- data/CHANGELOG.rdoc +0 -562
- data/Manifest.txt +0 -112
- data/README.rdoc +0 -71
- data/Rakefile +0 -74
- data/ext/psych/yaml/api.c +0 -1415
- data/ext/psych/yaml/config.h +0 -10
- data/ext/psych/yaml/dumper.c +0 -394
- data/ext/psych/yaml/emitter.c +0 -2329
- data/ext/psych/yaml/loader.c +0 -459
- data/ext/psych/yaml/parser.c +0 -1370
- data/ext/psych/yaml/reader.c +0 -469
- data/ext/psych/yaml/scanner.c +0 -3583
- data/ext/psych/yaml/writer.c +0 -141
- data/ext/psych/yaml/yaml.h +0 -1971
- data/ext/psych/yaml/yaml_private.h +0 -664
- data/lib/psych/deprecated.rb +0 -85
- data/test/psych/handlers/test_recorder.rb +0 -25
- data/test/psych/helper.rb +0 -114
- data/test/psych/json/test_stream.rb +0 -109
- data/test/psych/nodes/test_enumerable.rb +0 -43
- data/test/psych/test_alias_and_anchor.rb +0 -96
- data/test/psych/test_array.rb +0 -57
- data/test/psych/test_boolean.rb +0 -36
- data/test/psych/test_class.rb +0 -36
- data/test/psych/test_coder.rb +0 -184
- data/test/psych/test_date_time.rb +0 -38
- data/test/psych/test_deprecated.rb +0 -214
- data/test/psych/test_document.rb +0 -46
- data/test/psych/test_emitter.rb +0 -93
- data/test/psych/test_encoding.rb +0 -259
- data/test/psych/test_exception.rb +0 -157
- data/test/psych/test_hash.rb +0 -94
- data/test/psych/test_json_tree.rb +0 -65
- data/test/psych/test_marshalable.rb +0 -54
- data/test/psych/test_merge_keys.rb +0 -180
- data/test/psych/test_nil.rb +0 -18
- data/test/psych/test_null.rb +0 -19
- data/test/psych/test_numeric.rb +0 -45
- data/test/psych/test_object.rb +0 -44
- data/test/psych/test_object_references.rb +0 -71
- data/test/psych/test_omap.rb +0 -75
- data/test/psych/test_parser.rb +0 -339
- data/test/psych/test_psych.rb +0 -168
- data/test/psych/test_safe_load.rb +0 -97
- data/test/psych/test_scalar.rb +0 -11
- data/test/psych/test_scalar_scanner.rb +0 -106
- data/test/psych/test_serialize_subclasses.rb +0 -38
- data/test/psych/test_set.rb +0 -49
- data/test/psych/test_stream.rb +0 -93
- data/test/psych/test_string.rb +0 -226
- data/test/psych/test_struct.rb +0 -49
- data/test/psych/test_symbol.rb +0 -25
- data/test/psych/test_tainted.rb +0 -130
- data/test/psych/test_to_yaml_properties.rb +0 -63
- data/test/psych/test_tree_builder.rb +0 -79
- data/test/psych/test_yaml.rb +0 -1288
- data/test/psych/test_yamldbm.rb +0 -193
- data/test/psych/test_yamlstore.rb +0 -85
- data/test/psych/visitors/test_depth_first.rb +0 -49
- data/test/psych/visitors/test_emitter.rb +0 -144
- data/test/psych/visitors/test_to_ruby.rb +0 -326
- data/test/psych/visitors/test_yaml_tree.rb +0 -173
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e8c48b70d7c4ff53b1d536997a6e63173cb7e123e3f6e70f82c5de8596d93c4c
|
4
|
+
data.tar.gz: c49d610314f1628a1e84267010dcfac5a076276eac2cad8dbbba9079ede9e08f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d3d710995bfd6eb317994dd13024e5e3fd2967dbd379a1d510f86f7517177d2cc5e292a7d3b14c999071cc35ce625715ee3549fab90ce966567ba6e91f2475c
|
7
|
+
data.tar.gz: f1570e565d5dd8c9e5984155dfbc1418a594aaa871fab7b7fabe62f05bc0a3e72ab141dd9f39c09689f8f4949a5c6e58fa9b1ca99c26db3552b0c9866a6032ad
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
## How to contribute to Psych
|
2
|
+
|
3
|
+
Full details [here](https://bugs.ruby-lang.org/projects/ruby/wiki/HowToContribute)
|
4
|
+
|
5
|
+
#### **Did you find a bug?**
|
6
|
+
|
7
|
+
* **Do not open an issue if the bug is a security vulnerability
|
8
|
+
in Psych**, instead refer to our [security policy](https://www.ruby-lang.org/en/security/) and email [here](security@ruby-lang.org).
|
9
|
+
|
10
|
+
* **Ensure the bug was not already reported** by searching on ruby-core, the ruby github repo and on Psych's github repo. More info [here](https://bugs.ruby-lang.org/projects/ruby/wiki/HowToReport)
|
11
|
+
|
12
|
+
* If you're unable to find an open issue addressing the problem, [open a new one](https://bugs.ruby-lang.org/). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
|
13
|
+
|
14
|
+
#### **Did you write a patch that fixes a bug?**
|
15
|
+
|
16
|
+
* Open a new GitHub pull request with the patch for small fixes. Anything larger look [here](https://bugs.ruby-lang.org/projects/ruby/wiki/HowToContribute); submit a Feature.
|
17
|
+
|
18
|
+
* Ensure you clearly describe the problem and solution. Include the relevant ticket/issue number if applicable.
|
19
|
+
|
20
|
+
Psych is a volunteer effort. We encourage you to pitch in and [join the team](https://github.com/ruby/psych/contributors)!
|
21
|
+
|
22
|
+
Thanks! :heart: :heart: :heart:
|
23
|
+
|
24
|
+
The Psych Team
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
Copyright (c) 2009 Aaron Patterson, et al.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
9
11
|
|
10
12
|
The above copyright notice and this permission notice shall be included in all
|
11
13
|
copies or substantial portions of the Software.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# Psych
|
2
|
+
|
3
|
+
* https://github.com/ruby/psych
|
4
|
+
* https://docs.ruby-lang.org/en/master/Psych.html
|
5
|
+
|
6
|
+
## Description
|
7
|
+
|
8
|
+
Psych is a YAML parser and emitter. Psych leverages
|
9
|
+
[libyaml](https://pyyaml.org/wiki/LibYAML) for its YAML parsing and emitting
|
10
|
+
capabilities. In addition to wrapping libyaml, Psych also knows how to
|
11
|
+
serialize and de-serialize most Ruby objects to and from the YAML format.
|
12
|
+
|
13
|
+
## Examples
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
# Safely load YAML in to a Ruby object
|
17
|
+
Psych.safe_load('--- foo') # => 'foo'
|
18
|
+
|
19
|
+
# Emit YAML from a Ruby object
|
20
|
+
Psych.dump("foo") # => "--- foo\n...\n"
|
21
|
+
```
|
22
|
+
|
23
|
+
## Dependencies
|
24
|
+
|
25
|
+
* libyaml
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
|
29
|
+
Psych has been included with MRI since 1.9.2, and is the default YAML parser
|
30
|
+
in 1.9.3.
|
31
|
+
|
32
|
+
If you want a newer gem release of Psych, you can use RubyGems:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
gem install psych
|
36
|
+
```
|
37
|
+
|
38
|
+
Psych supported the static build with specific version of libyaml sources. You can build psych with libyaml-0.2.5 like this.
|
39
|
+
|
40
|
+
```bash
|
41
|
+
gem install psych -- --with-libyaml-source-dir=/path/to/libyaml-0.2.5
|
42
|
+
```
|
43
|
+
|
44
|
+
In order to use the gem release in your app, and not the stdlib version,
|
45
|
+
you'll need the following:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
gem 'psych'
|
49
|
+
require 'psych'
|
50
|
+
```
|
51
|
+
|
52
|
+
Or if you use Bundler add this to your `Gemfile`:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
gem 'psych'
|
56
|
+
```
|
57
|
+
|
58
|
+
JRuby ships with a pure Java implementation of Psych.
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
Copyright 2009 Aaron Patterson, et al.
|
63
|
+
|
64
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
65
|
+
of this software and associated documentation files (the 'Software'), to deal
|
66
|
+
in the Software without restriction, including without limitation the rights
|
67
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
68
|
+
copies of the Software, and to permit persons to whom the Software is
|
69
|
+
furnished to do so, subject to the following conditions:
|
70
|
+
|
71
|
+
The above copyright notice and this permission notice shall be included in all
|
72
|
+
copies or substantial portions of the Software.
|
73
|
+
|
74
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
75
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
76
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
77
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
78
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
79
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
80
|
+
SOFTWARE.
|
data/ext/psych/depend
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
$(TARGET_SO): $(LIBYAML)
|
2
|
+
|
3
|
+
libyaml $(LIBYAML):
|
4
|
+
cd libyaml && $(MAKE)
|
5
|
+
$(AR) $(ARFLAGS) $(LIBYAML) $(LIBYAML_OBJDIR)/*.$(OBJEXT)
|
6
|
+
$(RANLIB) $(LIBYAML)
|
7
|
+
|
8
|
+
clean-so::
|
9
|
+
-cd libyaml && $(MAKE) clean
|
10
|
+
|
11
|
+
distclean-so::
|
12
|
+
-cd libyaml && $(MAKE) distclean
|
13
|
+
-$(Q)$(RMDIRS) libyaml/* libyaml
|
14
|
+
|
1
15
|
$(OBJS): $(HDRS) $(ruby_headers) \
|
2
16
|
$(hdrdir)/ruby/encoding.h \
|
3
17
|
$(hdrdir)/ruby/oniguruma.h
|
data/ext/psych/extconf.rb
CHANGED
@@ -1,38 +1,53 @@
|
|
1
1
|
# -*- coding: us-ascii -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'mkmf'
|
3
|
-
require 'fileutils'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
if enable_config("bundled-libyaml", false) || !(find_header('yaml.h') && find_library('yaml', 'yaml_get_version'))
|
10
|
-
# Embed libyaml since we could not find it.
|
11
|
-
|
12
|
-
$VPATH << "$(srcdir)/yaml"
|
13
|
-
$INCFLAGS << " -I$(srcdir)/yaml"
|
14
|
-
|
15
|
-
$srcs = Dir.glob("#{$srcdir}/{,yaml/}*.c").map {|n| File.basename(n)}
|
5
|
+
if $mswin or $mingw or $cygwin
|
6
|
+
$CPPFLAGS << " -DYAML_DECLARE_STATIC"
|
7
|
+
end
|
16
8
|
|
17
|
-
|
18
|
-
|
9
|
+
yaml_source = with_config("libyaml-source-dir")
|
10
|
+
if yaml_source
|
11
|
+
yaml_source = yaml_source.gsub(/\$\((\w+)\)|\$\{(\w+)\}/) {ENV[$1||$2]}
|
12
|
+
yaml_source = yaml_source.chomp("/")
|
13
|
+
yaml_configure = "#{File.expand_path(yaml_source)}/configure"
|
14
|
+
unless File.exist?(yaml_configure)
|
15
|
+
raise "Configure script not found in #{yaml_source.quote}"
|
19
16
|
end
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
18
|
+
puts("Configuring libyaml source in #{yaml_source.quote}")
|
19
|
+
yaml = "libyaml"
|
20
|
+
Dir.mkdir(yaml) unless File.directory?(yaml)
|
21
|
+
shared = $enable_shared || !$static
|
22
|
+
args = [
|
23
|
+
yaml_configure,
|
24
|
+
"--enable-#{shared ? 'shared' : 'static'}",
|
25
|
+
"--host=#{RbConfig::CONFIG['host'].sub(/-unknown-/, '-').sub(/arm64/, 'arm')}",
|
26
|
+
"CC=#{RbConfig::CONFIG['CC']}",
|
27
|
+
*(["CFLAGS=-w"] if RbConfig::CONFIG["GCC"] == "yes"),
|
28
|
+
]
|
29
|
+
puts(args.quote.join(' '))
|
30
|
+
unless system(*args, chdir: yaml)
|
31
|
+
raise "failed to configure libyaml"
|
32
|
+
end
|
33
|
+
inc = yaml_source.start_with?("#$srcdir/") ? "$(srcdir)#{yaml_source[$srcdir.size..-1]}" : yaml_source
|
34
|
+
$INCFLAGS << " -I#{yaml}/include -I#{inc}/include"
|
35
|
+
puts("INCFLAGS=#$INCFLAGS")
|
36
|
+
libyaml = "libyaml.#$LIBEXT"
|
37
|
+
$cleanfiles << libyaml
|
38
|
+
$LOCAL_LIBS.prepend("$(LIBYAML) ")
|
39
|
+
else # default to pre-installed libyaml
|
40
|
+
pkg_config('yaml-0.1')
|
41
|
+
dir_config('libyaml')
|
42
|
+
find_header('yaml.h') or abort "yaml.h not found"
|
43
|
+
find_library('yaml', 'yaml_get_version') or abort "libyaml not found"
|
34
44
|
end
|
35
45
|
|
36
|
-
create_makefile 'psych'
|
46
|
+
create_makefile 'psych' do |mk|
|
47
|
+
mk << "LIBYAML = #{libyaml}".strip << "\n"
|
48
|
+
mk << "LIBYAML_OBJDIR = libyaml/src#{shared ? '/.libs' : ''}\n"
|
49
|
+
mk << "OBJEXT = #$OBJEXT"
|
50
|
+
mk << "RANLIB = #{config_string('RANLIB') || config_string('NULLCMD')}\n"
|
51
|
+
end
|
37
52
|
|
38
53
|
# :startdoc:
|
data/ext/psych/psych.c
CHANGED
@@ -11,9 +11,9 @@ static VALUE libyaml_version(VALUE module)
|
|
11
11
|
|
12
12
|
yaml_get_version(&major, &minor, &patch);
|
13
13
|
|
14
|
-
list[0] = INT2NUM(
|
15
|
-
list[1] = INT2NUM(
|
16
|
-
list[2] = INT2NUM(
|
14
|
+
list[0] = INT2NUM(major);
|
15
|
+
list[1] = INT2NUM(minor);
|
16
|
+
list[2] = INT2NUM(patch);
|
17
17
|
|
18
18
|
return rb_ary_new4((long)3, list);
|
19
19
|
}
|
@@ -22,6 +22,9 @@ VALUE mPsych;
|
|
22
22
|
|
23
23
|
void Init_psych(void)
|
24
24
|
{
|
25
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
26
|
+
RB_EXT_RACTOR_SAFE(true);
|
27
|
+
#endif
|
25
28
|
mPsych = rb_define_module("Psych");
|
26
29
|
|
27
30
|
rb_define_singleton_method(mPsych, "libyaml_version", libyaml_version, 0);
|
@@ -31,4 +34,3 @@ void Init_psych(void)
|
|
31
34
|
Init_psych_to_ruby();
|
32
35
|
Init_psych_yaml_tree();
|
33
36
|
}
|
34
|
-
/* vim: set noet sws=4 sw=4: */
|