psych 3.0.0.beta2-x86-mingw32

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 (77) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.travis.yml +20 -0
  4. data/CHANGELOG.rdoc +576 -0
  5. data/Gemfile +3 -0
  6. data/Mavenfile +7 -0
  7. data/README.md +73 -0
  8. data/Rakefile +46 -0
  9. data/bin/console +7 -0
  10. data/bin/setup +6 -0
  11. data/ext/psych/.gitignore +11 -0
  12. data/ext/psych/depend +3 -0
  13. data/ext/psych/extconf.rb +39 -0
  14. data/ext/psych/psych.c +34 -0
  15. data/ext/psych/psych.h +17 -0
  16. data/ext/psych/psych_emitter.c +554 -0
  17. data/ext/psych/psych_emitter.h +8 -0
  18. data/ext/psych/psych_parser.c +568 -0
  19. data/ext/psych/psych_parser.h +6 -0
  20. data/ext/psych/psych_to_ruby.c +39 -0
  21. data/ext/psych/psych_to_ruby.h +8 -0
  22. data/ext/psych/psych_yaml_tree.c +24 -0
  23. data/ext/psych/psych_yaml_tree.h +8 -0
  24. data/ext/psych/yaml/LICENSE +19 -0
  25. data/ext/psych/yaml/api.c +1392 -0
  26. data/ext/psych/yaml/config.h +10 -0
  27. data/ext/psych/yaml/dumper.c +394 -0
  28. data/ext/psych/yaml/emitter.c +2329 -0
  29. data/ext/psych/yaml/loader.c +444 -0
  30. data/ext/psych/yaml/parser.c +1374 -0
  31. data/ext/psych/yaml/reader.c +469 -0
  32. data/ext/psych/yaml/scanner.c +3576 -0
  33. data/ext/psych/yaml/writer.c +141 -0
  34. data/ext/psych/yaml/yaml.h +1971 -0
  35. data/ext/psych/yaml/yaml_private.h +662 -0
  36. data/lib/2.2/psych.so +0 -0
  37. data/lib/2.3/psych.so +0 -0
  38. data/lib/2.4/psych.so +0 -0
  39. data/lib/psych/class_loader.rb +102 -0
  40. data/lib/psych/coder.rb +95 -0
  41. data/lib/psych/core_ext.rb +19 -0
  42. data/lib/psych/exception.rb +14 -0
  43. data/lib/psych/handler.rb +250 -0
  44. data/lib/psych/handlers/document_stream.rb +23 -0
  45. data/lib/psych/handlers/recorder.rb +40 -0
  46. data/lib/psych/json/ruby_events.rb +20 -0
  47. data/lib/psych/json/stream.rb +17 -0
  48. data/lib/psych/json/tree_builder.rb +13 -0
  49. data/lib/psych/json/yaml_events.rb +30 -0
  50. data/lib/psych/nodes/alias.rb +19 -0
  51. data/lib/psych/nodes/document.rb +61 -0
  52. data/lib/psych/nodes/mapping.rb +57 -0
  53. data/lib/psych/nodes/node.rb +56 -0
  54. data/lib/psych/nodes/scalar.rb +68 -0
  55. data/lib/psych/nodes/sequence.rb +82 -0
  56. data/lib/psych/nodes/stream.rb +38 -0
  57. data/lib/psych/nodes.rb +78 -0
  58. data/lib/psych/omap.rb +5 -0
  59. data/lib/psych/parser.rb +52 -0
  60. data/lib/psych/scalar_scanner.rb +149 -0
  61. data/lib/psych/set.rb +5 -0
  62. data/lib/psych/stream.rb +38 -0
  63. data/lib/psych/streaming.rb +28 -0
  64. data/lib/psych/syntax_error.rb +22 -0
  65. data/lib/psych/tree_builder.rb +97 -0
  66. data/lib/psych/versions.rb +9 -0
  67. data/lib/psych/visitors/depth_first.rb +27 -0
  68. data/lib/psych/visitors/emitter.rb +52 -0
  69. data/lib/psych/visitors/json_tree.rb +25 -0
  70. data/lib/psych/visitors/to_ruby.rb +401 -0
  71. data/lib/psych/visitors/visitor.rb +20 -0
  72. data/lib/psych/visitors/yaml_tree.rb +551 -0
  73. data/lib/psych/visitors.rb +7 -0
  74. data/lib/psych/y.rb +10 -0
  75. data/lib/psych.rb +511 -0
  76. data/psych.gemspec +64 -0
  77. metadata +175 -0
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Psych
2
+
3
+ [![Build Status](https://travis-ci.org/ruby/psych.svg?branch=master)](https://travis-ci.org/ruby/psych)
4
+ [![Build status](https://ci.appveyor.com/api/projects/status/2t6x109xfmbx209k/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/psych/branch/master)
5
+
6
+ * https://github.com/ruby/psych
7
+
8
+ ## Description
9
+
10
+ Psych is a YAML parser and emitter. Psych leverages
11
+ [libyaml](http://pyyaml.org/wiki/LibYAML) for its YAML parsing and emitting
12
+ capabilities. In addition to wrapping libyaml, Psych also knows how to
13
+ serialize and de-serialize most Ruby objects to and from the YAML format.
14
+
15
+ ## Examples
16
+
17
+ # Load YAML in to a Ruby object
18
+ Psych.load('--- foo') # => 'foo'
19
+
20
+ # Emit YAML from a Ruby object
21
+ Psych.dump("foo") # => "--- foo\n...\n"
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
+ gem install psych
35
+
36
+ In order to use the gem release in your app, and not the stdlib version,
37
+ you'll need the following:
38
+
39
+ gem 'psych'
40
+ require 'psych'
41
+
42
+ Or if you use Bundler add this to your `Gemfile`:
43
+
44
+ gem 'psych'
45
+
46
+ JRuby ships with a pure Java implementation of Psych.
47
+
48
+ If you're on Rubinius, Psych is available in 1.9 mode, please refer to the
49
+ Language Modes section of the [Rubinius
50
+ README](https://github.com/rubinius/rubinius#readme) for more information on
51
+ building and 1.9 mode.
52
+
53
+ ## License
54
+
55
+ Copyright 2009 Aaron Patterson, et al.
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining a copy
58
+ of this software and associated documentation files (the 'Software'), to deal
59
+ in the Software without restriction, including without limitation the rights
60
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
61
+ copies of the Software, and to permit persons to whom the Software is
62
+ furnished to do so, subject to the following conditions:
63
+
64
+ The above copyright notice and this permission notice shall be included in all
65
+ copies or substantial portions of the Software.
66
+
67
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
68
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
69
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
70
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
71
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
72
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
73
+ SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,46 @@
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require "rake/testtask"
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << "test"
7
+ t.libs << "lib"
8
+ t.test_files = FileList['test/**/test_*.rb']
9
+ t.verbose = true
10
+ t.warning = true
11
+ end
12
+
13
+ if RUBY_PLATFORM =~ /java/
14
+ require 'rake/javaextensiontask'
15
+ Rake::JavaExtensionTask.new("psych") do |ext|
16
+ require 'maven/ruby/maven'
17
+ # uses Mavenfile to write classpath into pkg/classpath
18
+ # and tell maven via system properties the snakeyaml version
19
+ # this is basically the same as running from the commandline:
20
+ # 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.18", '-Dverbose=true')
22
+ ext.source_version = '1.7'
23
+ ext.target_version = '1.7'
24
+ ext.classpath = File.read('pkg/classpath')
25
+ ext.ext_dir = 'ext/java'
26
+ end
27
+ else
28
+ require 'rake/extensiontask'
29
+ spec = eval File.read("psych.gemspec")
30
+ Rake::ExtensionTask.new("psych", spec) do |ext|
31
+ ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
32
+ ext.cross_compile = true
33
+ ext.cross_platform = %w[x86-mingw32 x64-mingw32]
34
+ ext.cross_compiling do |s|
35
+ s.files.concat ["lib/2.2/psych.so", "lib/2.3/psych.so", "lib/2.4/psych.so"]
36
+ end
37
+ end
38
+ end
39
+
40
+ desc "Compile binaries for mingw platform using rake-compiler-dock"
41
+ task 'build:mingw' do
42
+ require 'rake_compiler_dock'
43
+ RakeCompilerDock.sh "bundle && rake cross native gem RUBY_CC_VERSION=2.2.2:2.3.0:2.4.0"
44
+ end
45
+
46
+ task :default => [:compile, :test]
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "psych"
5
+
6
+ require "irb"
7
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -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
data/ext/psych/depend ADDED
@@ -0,0 +1,3 @@
1
+ $(OBJS): $(HDRS) $(ruby_headers) \
2
+ $(hdrdir)/ruby/encoding.h \
3
+ $(hdrdir)/ruby/oniguruma.h
@@ -0,0 +1,39 @@
1
+ # -*- coding: us-ascii -*-
2
+ # frozen_string_literal: true
3
+ require 'mkmf'
4
+ require 'fileutils'
5
+
6
+ # :stopdoc:
7
+
8
+ dir_config 'libyaml'
9
+
10
+ if enable_config("bundled-libyaml", false) || !(find_header('yaml.h') && find_library('yaml', 'yaml_get_version'))
11
+ # Embed libyaml since we could not find it.
12
+
13
+ $VPATH << "$(srcdir)/yaml"
14
+ $INCFLAGS << " -I$(srcdir)/yaml"
15
+
16
+ $srcs = Dir.glob("#{$srcdir}/{,yaml/}*.c").map {|n| File.basename(n)}
17
+
18
+ if have_macro("_WIN32")
19
+ $CPPFLAGS << " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
20
+ end
21
+
22
+ have_header 'dlfcn.h'
23
+ have_header 'inttypes.h'
24
+ have_header 'memory.h'
25
+ have_header 'stdint.h'
26
+ have_header 'stdlib.h'
27
+ have_header 'strings.h'
28
+ have_header 'string.h'
29
+ have_header 'sys/stat.h'
30
+ have_header 'sys/types.h'
31
+ have_header 'unistd.h'
32
+
33
+ find_header 'yaml.h'
34
+ have_header 'config.h'
35
+ end
36
+
37
+ create_makefile 'psych'
38
+
39
+ # :startdoc:
data/ext/psych/psych.c ADDED
@@ -0,0 +1,34 @@
1
+ #include <psych.h>
2
+
3
+ /* call-seq: Psych.libyaml_version
4
+ *
5
+ * Returns the version of libyaml being used
6
+ */
7
+ static VALUE libyaml_version(VALUE module)
8
+ {
9
+ int major, minor, patch;
10
+ VALUE list[3];
11
+
12
+ yaml_get_version(&major, &minor, &patch);
13
+
14
+ list[0] = INT2NUM((long)major);
15
+ list[1] = INT2NUM((long)minor);
16
+ list[2] = INT2NUM((long)patch);
17
+
18
+ return rb_ary_new4((long)3, list);
19
+ }
20
+
21
+ VALUE mPsych;
22
+
23
+ void Init_psych(void)
24
+ {
25
+ mPsych = rb_define_module("Psych");
26
+
27
+ rb_define_singleton_method(mPsych, "libyaml_version", libyaml_version, 0);
28
+
29
+ Init_psych_parser();
30
+ Init_psych_emitter();
31
+ Init_psych_to_ruby();
32
+ Init_psych_yaml_tree();
33
+ }
34
+ /* vim: set noet sws=4 sw=4: */
data/ext/psych/psych.h ADDED
@@ -0,0 +1,17 @@
1
+ #ifndef PSYCH_H
2
+ #define PSYCH_H
3
+
4
+ #include <ruby.h>
5
+ #include <ruby/encoding.h>
6
+
7
+ #include <yaml.h>
8
+
9
+ #include <psych_parser.h>
10
+ #include <psych_emitter.h>
11
+ #include <psych_to_ruby.h>
12
+ #include <psych_yaml_tree.h>
13
+
14
+ extern VALUE mPsych;
15
+
16
+
17
+ #endif