Skip to content

Commit

Permalink
Merge branch 'master' into nirvdrum-speed_up_node_mapping
Browse files Browse the repository at this point in the history
* master: (28 commits)
  merge changes from ruby trunk
  Strings that start with non-word characters should double quote without exclamation mark
  fixing rsync
  make some header file adjustments for ruby compile
  updating the version to 2.0
  add the license for libyaml
  Update README.rdoc
  fix c file name
  only do have_header checks if we are embedding libyaml
  mkmf has a global for this test
  fix build on windows
  only embed libyaml if the system does not have it
  * ext/psych/lib/psych/scalar_scanner.rb: avoid raising exceptions when   parsing Floats and Integers. Thanks riffraff [ruby-core:44426] * test/psych/test_numeric.rb: associated test
  * ext/psych/lib/psych/core_ext.rb: move Kernel#y so that it can   manually be required as 'psych/y'.
  for compiling on mswin
  embedding libyaml
  * ruby.c (load_file_internal): set default source encoding as   UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679]
  * ext/psych/lib/psych/handlers/recorder.rb: added a class for   recording YAML parse and emit events.
  Use literal style when emitting multiline strings, fixes ruby#64
  * ext/psych/lib/psych/visitors/yaml_tree.rb: `tree` should return the   same thing on every call.
  ...
  • Loading branch information
tenderlove committed Dec 17, 2012
2 parents 2ceb7b6 + 9ab3a70 commit f22f976
Show file tree
Hide file tree
Showing 45 changed files with 13,077 additions and 73 deletions.
7 changes: 4 additions & 3 deletions .gitignore
@@ -1,3 +1,4 @@
lib/psych/psych.bundle
tmp
pkg
*.swp
*.bundle
/pkg
/tmp
45 changes: 45 additions & 0 deletions CHANGELOG.rdoc
@@ -1,3 +1,48 @@
Sat Nov 17 12:03:41 2012 Aaron Patterson <aaron@tenderlovemaking.com>

* ext/psych/lib/psych/scalar_scanner.rb: avoid raising exceptions when
parsing Floats and Integers. Thanks riffraff [ruby-core:44426]
* test/psych/test_numeric.rb: associated test

Sat Nov 17 11:26:36 2012 Aaron Patterson <aaron@tenderlovemaking.com>

* ext/psych/lib/psych/core_ext.rb: move Kernel#y so that it can
manually be required as 'psych/y'.

* ext/psych/lib/psych/y.rb: ditto

Tue Nov 6 09:37:57 2012 NARUSE, Yui <naruse@ruby-lang.org>

* ruby.c (load_file_internal): set default source encoding as
UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679]

* parse.y (parser_initialize): set default parser encoding as
UTF-8 instead of US-ASCII.

Mon Oct 29 10:22:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>

* ext/psych/lib/psych/handlers/recorder.rb: added a class for
recording YAML parse and emit events.

* ext/psych/lib/psych/handler.rb: adding a list of events so that
handler classes can more easily be meta-programmed.

* test/psych/handlers/test_recorder.rb: tests for the change.

Sun Oct 28 10:12:15 2012 Aaron Patterson <aaron@tenderlovemaking.com>

* ext/psych/lib/psych/visitors/yaml_tree.rb: `tree` should return the
same thing on every call.

* test/psych/visitors/test_yaml_tree.rb: related test.

Sun Oct 28 10:05:03 2012 Aaron Patterson <aaron@tenderlovemaking.com>

* ext/psych/lib/psych/visitors/yaml_tree.rb: YAML Tree object should
be able to take an emitter object as it's output.

* test/psych/visitors/test_yaml_tree.rb: related test.

Thu Jul 19 09:33:46 2012 Aaron Patterson <aaron@tenderlovemaking.com>

* ext/psych/emitter.c (initialize): allow a configuration object to be
Expand Down
31 changes: 23 additions & 8 deletions Manifest.txt
Expand Up @@ -4,23 +4,36 @@ CHANGELOG.rdoc
Manifest.txt
README.rdoc
Rakefile
ext/psych/emitter.c
ext/psych/emitter.h
ext/psych/extconf.rb
ext/psych/parser.c
ext/psych/parser.h
ext/psych/psych.c
ext/psych/psych.h
ext/psych/to_ruby.c
ext/psych/to_ruby.h
ext/psych/yaml_tree.c
ext/psych/yaml_tree.h
ext/psych/psych_emitter.c
ext/psych/psych_emitter.h
ext/psych/psych_parser.c
ext/psych/psych_parser.h
ext/psych/psych_to_ruby.c
ext/psych/psych_to_ruby.h
ext/psych/psych_yaml_tree.c
ext/psych/psych_yaml_tree.h
ext/psych/yaml/LICENSE
ext/psych/yaml/api.c
ext/psych/yaml/config.h
ext/psych/yaml/dumper.c
ext/psych/yaml/emitter.c
ext/psych/yaml/loader.c
ext/psych/yaml/parser.c
ext/psych/yaml/reader.c
ext/psych/yaml/scanner.c
ext/psych/yaml/writer.c
ext/psych/yaml/yaml.h
ext/psych/yaml/yaml_private.h
lib/psych.rb
lib/psych/coder.rb
lib/psych/core_ext.rb
lib/psych/deprecated.rb
lib/psych/handler.rb
lib/psych/handlers/document_stream.rb
lib/psych/handlers/recorder.rb
lib/psych/json/ruby_events.rb
lib/psych/json/stream.rb
lib/psych/json/tree_builder.rb
Expand Down Expand Up @@ -48,6 +61,8 @@ lib/psych/visitors/json_tree.rb
lib/psych/visitors/to_ruby.rb
lib/psych/visitors/visitor.rb
lib/psych/visitors/yaml_tree.rb
lib/psych/y.rb
test/psych/handlers/test_recorder.rb
test/psych/helper.rb
test/psych/json/test_stream.rb
test/psych/nodes/test_enumerable.rb
Expand Down
24 changes: 22 additions & 2 deletions README.rdoc
Expand Up @@ -23,8 +23,28 @@ to and from the YAML format.

== Installation

* sudo port install libyaml +universal
* sudo install_ruby.sh
Psych has been included with MRI since 1.9.2,
and is the default YAML parser in 1.9.3.

If you want a newer gem release of Psych, you can use rubygems:

gem install psych

In order to use the gem release in your app,
and not the stdlib version, you'll need the following:

gem 'psych'
require 'psych'

Or if you use Bundler add this to your +Gemfile+:

gem 'psych'

JRuby ships with a pure Java implementation of Psych.

If you're on Rubinius, Psych is available in 1.9 mode, please refer to the
{Rubinius Documentation}[http://rubini.us/doc/en/build-system/] for more
information on building and 1.9 mode.

== License

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -53,7 +53,7 @@ namespace :merge do
[basedir, 'test', 'psych/'] => [rubydir, 'test', 'psych/'],
}

rsync = 'rsync -av --exclude extconf.rb --exclude lib --exclude ".*" --exclude "*.o" --exclude Makefile --exclude mkmf.log --delete'
rsync = 'rsync -av --exclude lib --exclude ".*" --exclude "*.o" --exclude Makefile --exclude mkmf.log --delete'

task :to_ruby do
mergedirs.each do |from, to|
Expand Down
11 changes: 11 additions & 0 deletions ext/psych/.gitignore
@@ -0,0 +1,11 @@
/api.c
/config.h
/dumper.c
/emitter.c
/loader.c
/parser.c
/reader.c
/scanner.c
/writer.c
/yaml.h
/yaml_private.h
38 changes: 27 additions & 11 deletions ext/psych/extconf.rb
@@ -1,21 +1,37 @@
# -*- coding: us-ascii -*-
require 'mkmf'
require 'fileutils'

# :stopdoc:

RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
dir_config 'libyaml'

INCLUDEDIR = RbConfig::CONFIG['includedir']
LIBDIR = RbConfig::CONFIG['libdir']
LIB_DIRS = ['/opt/local/lib', '/usr/local/lib', LIBDIR, '/usr/lib']
libyaml = dir_config 'libyaml', '/opt/local/include', '/opt/local/lib'
if enable_config("bundled-libyaml", false) || !(find_header('yaml.h') && find_library('yaml', 'yaml_get_version'))
# Embed libyaml since we could not find it.

def asplode missing
abort "#{missing} is missing. Try 'port install libyaml +universal' " +
"or 'yum install libyaml-devel'"
end
$VPATH << "$(srcdir)/yaml"
$INCFLAGS << " -I$(srcdir)/yaml"

$srcs = Dir.glob("#{$srcdir}/{,yaml/}*.c").map {|n| File.basename(n)}

if have_macro("_WIN32")
$CPPFLAGS << " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
end

asplode('yaml.h') unless find_header 'yaml.h'
asplode('libyaml') unless find_library 'yaml', 'yaml_get_version'
have_header 'dlfcn.h'
have_header 'inttypes.h'
have_header 'memory.h'
have_header 'stdint.h'
have_header 'stdlib.h'
have_header 'strings.h'
have_header 'string.h'
have_header 'sys/stat.h'
have_header 'sys/types.h'
have_header 'unistd.h'

find_header 'yaml.h'
have_header 'config.h'
end

create_makefile 'psych'

Expand Down
8 changes: 4 additions & 4 deletions ext/psych/psych.h
Expand Up @@ -9,10 +9,10 @@

#include <yaml.h>

#include <parser.h>
#include <emitter.h>
#include <to_ruby.h>
#include <yaml_tree.h>
#include <psych_parser.h>
#include <psych_emitter.h>
#include <psych_to_ruby.h>
#include <psych_yaml_tree.h>

extern VALUE mPsych;

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ext/psych/parser.c → ext/psych/psych_parser.c
Expand Up @@ -557,7 +557,7 @@ void Init_psych_parser()
rb_define_const(cPsychParser, "UTF16BE", INT2NUM(YAML_UTF16BE_ENCODING));

rb_require("psych/syntax_error");
ePsychSyntaxError = rb_define_class_under(mPsych, "SyntaxError", rb_eSyntaxError);
ePsychSyntaxError = rb_const_get(mPsych, rb_intern("SyntaxError"));

rb_define_method(cPsychParser, "parse", parse, -1);
rb_define_method(cPsychParser, "mark", mark, 0);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions ext/psych/yaml/LICENSE
@@ -0,0 +1,19 @@
Copyright (c) 2006 Kirill Simonov

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit f22f976

Please sign in to comment.