Projects
home:vanmeeuwen:lesb
rubygem-json
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
rubygem-json.spec
Changed
@@ -1,8 +1,16 @@ %global gem_name json +%{!?gem_dir: %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)} +%{!?gem_cache: %global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem} +%{!?gem_docdir: %global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}} +%{!?gem_extdir_mri: %global gem_extdir_mri %(ruby -rrbconfig -e "puts Config::CONFIG'sitearchdir'")} +%{!?gem_instdir: %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}} +%{!?gem_libdir: %global gem_libdir %{gem_instdir}/lib} +%{!?gem_spec: %global gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec} + Name: rubygem-%{gem_name} -Version: 1.7.7 -Release: 101%{?dist} +Version: 1.8.1 +Release: 1%{?dist} Summary: A JSON implementation in Ruby @@ -62,7 +70,19 @@ %build -%gem_install +mkdir -p .%{gem_dir} +CONFIGURE_ARGS="--with-cflags='%{optflags}' $CONFIGURE_ARGS" \ + gem install \ + -V \ + --local \ + --install-dir .%{gem_dir} \ + --bindir .%{_bindir} \ + --force \ + --rdoc \ + --no-ri \ + --backtrace \ + %{SOURCE0} + find . -name \*gem -exec chmod 0644 {} \;
View file
json-1.8.1.gem/checksums.yaml.gz
Added
@@ -0,0 +1,7 @@ +--- +SHA1: + metadata.gz: 9016ff2aa2d28e082036d6bda0c41d67aa19fb6b + data.tar.gz: 81c089fba888ace41a14e87f371fab7af97efd03 +SHA512: + metadata.gz: c1af77673b72b02011bd9cf2b655ffbe73cdb6e27c8abf96defa7da1b3297a3c1c6e167c7317859bc58f2905cca8f2b126bbd23b2167f59966116d636c9e81c4 + data.tar.gz: a3737f56ecc087a5fe00f0c775bec1128a68b07971f9207d72f0cfb11ee42f7f85e07d7c824de5fe96a0106ad87e31268dae143402da1b01ed2fe5757ddfdd01
View file
json-1.7.7.gem/data/./tests/test_json_generate.rb -> json-1.8.1.gem/data/./tests/test_json_generate.rb
Changed
@@ -251,6 +251,22 @@ assert_equal '5', state2.array_nl end + def test_configure_hash_conversion + state = JSON.state.new + state.configure(:indent => '1') + assert_equal '1', state.indent + state = JSON.state.new + foo = 'foo' + assert_raise(TypeError) do + state.configure(foo) + end + def foo.to_h + { :indent => '2' } + end + state.configure(foo) + assert_equal '2', state.indent + end + if defined?(JSON::Ext::Generator) def test_broken_bignum # ruby-core:38867 pid = fork do @@ -297,4 +313,10 @@ assert_kind_of Hash, state_hash assert_equal :bar, state_hash:foo end + + def test_json_generate + assert_raise JSON::GeneratorError do + assert_equal true, JSON.generate("\xea") + end + end end
View file
json-1.7.7.gem/data/./tests/test_json_generic_object.rb -> json-1.8.1.gem/data/./tests/test_json_generic_object.rb
Changed
@@ -49,6 +49,21 @@ assert_equal true, GenericObject.from_hash(true) end + def test_json_generic_object_load + empty = JSON::GenericObject.load(nil) + assert_kind_of JSON::GenericObject, empty + simple_json = '{"json_class":"JSON::GenericObject","hello":"world"}' + simple = JSON::GenericObject.load(simple_json) + assert_kind_of JSON::GenericObject, simple + assert_equal "world", simple.hello + converting = JSON::GenericObject.load('{ "hello": "world" }') + assert_kind_of JSON::GenericObject, converting + assert_equal "world", converting.hello + + json = JSON::GenericObject.dump(JSON::GenericObject:hello => 'world') + assert_equal JSON(json), JSON('{"json_class":"JSON::GenericObject","hello":"world"}') + end + private def switch_json_creatable
View file
json-1.7.7.gem/data/.gitignore -> json-1.8.1.gem/data/.gitignore
Changed
@@ -10,3 +10,4 @@ *.rbc .rbx .AppleDouble +.DS_Store
View file
json-1.7.7.gem/data/.travis.yml -> json-1.8.1.gem/data/.travis.yml
Changed
@@ -6,6 +6,7 @@ - 1.8.7 - 1.9.2 - 1.9.3 + - 2.0.0 - ree - rbx-18mode - rbx-19mode
View file
json-1.7.7.gem/data/CHANGES -> json-1.8.1.gem/data/CHANGES
Changed
@@ -1,3 +1,15 @@ +2013-05-13 (1.8.1) + * Remove Rubinius exception since transcoding should be working now. +2013-05-13 (1.8.0) + * Fix https://github.com/flori/json/issues/162 reported by Marc-Andre + Lafortune <github_rocks@marc-andre.ca>. Thanks! + * Applied patches by Yui NARUSE <naruse@airemix.jp> to suppress warning with + -Wchar-subscripts and better validate UTF-8 strings. + * Applied patch by ginriki@github to remove unnecessary if. + * Add load/dump interface to JSON::GenericObject to make + serialize :some_attribute, JSON::GenericObject + work in Rails active models for convenient SomeModel#some_attribute.foo.bar + access to serialised JSON data. 2013-02-04 (1.7.7) * Security fix for JSON create_additions default value and JSON::GenericObject. It should not be possible to create additions unless @@ -5,7 +17,7 @@ using the JSON.load/dump interface. If JSON::GenericObject is supposed to be automatically deserialised, this has to be explicitely enabled by setting - JSON::GenericObject.json_createble = true + JSON::GenericObject.json_creatable = true as well. * Remove useless assert in fbuffer implementation. * Apply patch attached to https://github.com/flori/json/issues#issue/155
View file
json-1.7.7.gem/data/Gemfile -> json-1.8.1.gem/data/Gemfile
Changed
@@ -1,6 +1,6 @@ # vim: set ft=ruby: -source :rubygems +source 'https://rubygems.org' gemspec :name => 'json' gemspec :name => 'json_pure'
View file
json-1.7.7.gem/data/VERSION -> json-1.8.1.gem/data/VERSION
Changed
@@ -1,1 +1,1 @@ -1.7.7 +1.8.1
View file
json-1.7.7.gem/data/ext/json/ext/generator/generator.c -> json-1.8.1.gem/data/ext/json/ext/generator/generator.c
Changed
@@ -273,7 +273,18 @@ escape_len = 2; break; default: - end++; + { + unsigned short clen = trailingBytesForUTF8c + 1; + if (end + clen > len) { + rb_raise(rb_path2class("JSON::GeneratorError"), + "partial character in source, but hit end"); + } + if (!isLegalUTF8((UTF8 *) p, clen)) { + rb_raise(rb_path2class("JSON::GeneratorError"), + "source sequence is illegal/malformed utf-8"); + } + end += clen; + } continue; break; } @@ -511,11 +522,8 @@ { VALUE tmp; GET_STATE(self); - tmp = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); + tmp = rb_check_convert_type(opts, T_HASH, "Hash", "to_hash"); if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h"); - if (NIL_P(tmp)) { - rb_raise(rb_eArgError, "opts has to be hash like or convertable into a hash"); - } opts = tmp; tmp = rb_hash_aref(opts, ID2SYM(i_indent)); if (RTEST(tmp)) { @@ -894,8 +902,8 @@ long string_len = RSTRING_LEN(string); char *p = RSTRING_PTR(string), *q = p + string_len - 1; if (string_len < 2) return 0; - for (; p < q && isspace(*p); p++); - for (; q > p && isspace(*q); q--); + for (; p < q && isspace((unsigned char)*p); p++); + for (; q > p && isspace((unsigned char)*q); q--); return (*p == '' && *q == '') || (*p == '{' && *q == '}'); }
View file
json-1.7.7.gem/data/java/src/json/ext/OptionsReader.java -> json-1.8.1.gem/data/java/src/json/ext/OptionsReader.java
Changed
@@ -24,13 +24,14 @@ OptionsReader(ThreadContext context, IRubyObject vOpts) { this.context = context; this.runtime = context.getRuntime(); - if (vOpts == null || vOpts.isNil()) { opts = null; } else if (vOpts.respondsTo("to_hash")) { opts = vOpts.convertToHash(); - } else { + } else if (vOpts.respondsTo("to_h")) { opts = vOpts.callMethod(context, "to_h").convertToHash(); + } else { + opts = vOpts.convertToHash(); /* Should just raise the correct TypeError */ } }
View file
json-1.7.7.gem/data/json.gemspec -> json-1.8.1.gem/data/json.gemspec
Changed
@@ -1,12 +1,13 @@ # -*- encoding: utf-8 -*- +# stub: json 1.8.1 ruby lib Gem::Specification.new do |s| s.name = "json" - s.version = "1.7.7" + s.version = "1.8.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = "Florian Frank" - s.date = "2013-02-11" + s.date = "2013-10-17" s.description = "This is a JSON implementation as a Ruby extension in C." s.email = "flori@ping.de" s.extensions = "ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb" @@ -16,12 +17,12 @@ s.licenses = "Ruby" s.rdoc_options = "--title", "JSON implemention for Ruby", "--main", "README.rdoc" s.require_paths = "lib" - s.rubygems_version = "1.8.25" + s.rubygems_version = "2.1.9" s.summary = "JSON Implementation for Ruby" s.test_files = "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb" if s.respond_to? :specification_version then - s.specification_version = 3 + s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q<permutation>, ">= 0")
View file
json-1.7.7.gem/data/json_pure.gemspec -> json-1.8.1.gem/data/json_pure.gemspec
Changed
@@ -1,12 +1,13 @@ # -*- encoding: utf-8 -*- +# stub: json_pure 1.8.1 ruby lib Gem::Specification.new do |s| s.name = "json_pure" - s.version = "1.7.7" + s.version = "1.8.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = "Florian Frank" - s.date = "2013-02-11" + s.date = "2013-10-17" s.description = "This is a JSON implementation in pure Ruby." s.email = "flori@ping.de" s.extra_rdoc_files = "README.rdoc" @@ -15,12 +16,12 @@ s.licenses = "Ruby" s.rdoc_options = "--title", "JSON implemention for ruby", "--main", "README.rdoc" s.require_paths = "lib" - s.rubygems_version = "1.8.25" + s.rubygems_version = "2.1.9" s.summary = "JSON Implementation for Ruby" s.test_files = "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb" if s.respond_to? :specification_version then - s.specification_version = 3 + s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q<permutation>, ">= 0")
View file
json-1.7.7.gem/data/lib/json/common.rb -> json-1.8.1.gem/data/lib/json/common.rb
Changed
@@ -412,10 +412,7 @@ end # Shortuct for iconv. - if ::String.method_defined?(:encode) && - # XXX Rubinius doesn't support ruby 1.9 encoding yet - defined?(RUBY_ENGINE) && RUBY_ENGINE != 'rbx' - then + if ::String.method_defined?(:encode) # Encodes string using Ruby's _String.encode_ def self.iconv(to, from, string) string.encode(to, from)
View file
json-1.7.7.gem/data/lib/json/generic_object.rb -> json-1.8.1.gem/data/lib/json/generic_object.rb
Changed
@@ -31,6 +31,15 @@ object end end + + def load(source, proc = nil, opts = {}) + result = ::JSON.load(source, proc, opts.merge(:object_class => self)) + result.nil? ? new : result + end + + def dump(obj, *args) + ::JSON.dump(obj, *args) + end end self.json_creatable = false
View file
json-1.7.7.gem/data/lib/json/pure/generator.rb -> json-1.8.1.gem/data/lib/json/pure/generator.rb
Changed
@@ -70,6 +70,13 @@ rescue => e raise GeneratorError.wrap(e) end + + def valid_utf8?(string) + encoding = string.encoding + (encoding == Encoding::UTF_8 || encoding == Encoding::ASCII) && + string.valid_encoding? + end + module_function :valid_utf8? else def utf8_to_json(string) # :nodoc: string.gsub(/"\\\x0-\x1f/n) { MAP$& } @@ -93,8 +100,22 @@ rescue => e raise GeneratorError.wrap(e) end + + def valid_utf8?(string) + string =~ + /\A( \x09\x0a\x0d\x20-\x7e # ASCII + | \xc2-\xdf\x80-\xbf # non-overlong 2-byte + | \xe0\xa0-\xbf\x80-\xbf # excluding overlongs + | \xe1-\xec\xee\xef\x80-\xbf{2} # straight 3-byte + | \xed\x80-\x9f\x80-\xbf # excluding surrogates + | \xf0\x90-\xbf\x80-\xbf{2} # planes 1-3 + | \xf1-\xf3\x80-\xbf{3} # planes 4-15 + | \xf4\x80-\x8f\x80-\xbf{2} # plane 16 + )*\z/nx + end end - module_function :utf8_to_json, :utf8_to_json_ascii + module_function :utf8_to_json, :utf8_to_json_ascii, :valid_utf8? + module Pure module Generator @@ -220,6 +241,13 @@ # Configure this State instance with the Hash _opts_, and return # itself. def configure(opts) + if opts.respond_to?(:to_hash) + opts = opts.to_hash + elsif opts.respond_to?(:to_h) + opts = opts.to_h + else + raise TypeError, "can't convert #{opts.class} into Hash" + end for key, value in opts instance_variable_set "@#{key}", value end @@ -263,6 +291,8 @@ # GeneratorError exception. def generate(obj) result = obj.to_json(self) + JSON.valid_utf8?(result) or raise GeneratorError, + "source sequence #{result.inspect} is illegal/malformed utf-8" unless @quirks_mode unless result =~ /\A\s*\/ && result =~ /\\s*\Z/ || result =~ /\A\s*\{/ && result =~ /\}\s*\Z/ @@ -338,7 +368,7 @@ } depth = state.depth -= 1 result << state.object_nl - result << state.indent * depth if indent if indent + result << state.indent * depth if indent result << '}' result end
View file
json-1.7.7.gem/data/lib/json/version.rb -> json-1.8.1.gem/data/lib/json/version.rb
Changed
@@ -1,6 +1,6 @@ module JSON # JSON version - VERSION = '1.7.7' + VERSION = '1.8.1' VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc: VERSION_MAJOR = VERSION_ARRAY0 # :nodoc: VERSION_MINOR = VERSION_ARRAY1 # :nodoc:
View file
json-1.7.7.gem/data/tests/test_json_generate.rb -> json-1.8.1.gem/data/tests/test_json_generate.rb
Changed
@@ -251,6 +251,22 @@ assert_equal '5', state2.array_nl end + def test_configure_hash_conversion + state = JSON.state.new + state.configure(:indent => '1') + assert_equal '1', state.indent + state = JSON.state.new + foo = 'foo' + assert_raise(TypeError) do + state.configure(foo) + end + def foo.to_h + { :indent => '2' } + end + state.configure(foo) + assert_equal '2', state.indent + end + if defined?(JSON::Ext::Generator) def test_broken_bignum # ruby-core:38867 pid = fork do @@ -297,4 +313,10 @@ assert_kind_of Hash, state_hash assert_equal :bar, state_hash:foo end + + def test_json_generate + assert_raise JSON::GeneratorError do + assert_equal true, JSON.generate("\xea") + end + end end
View file
json-1.7.7.gem/data/tests/test_json_generic_object.rb -> json-1.8.1.gem/data/tests/test_json_generic_object.rb
Changed
@@ -49,6 +49,21 @@ assert_equal true, GenericObject.from_hash(true) end + def test_json_generic_object_load + empty = JSON::GenericObject.load(nil) + assert_kind_of JSON::GenericObject, empty + simple_json = '{"json_class":"JSON::GenericObject","hello":"world"}' + simple = JSON::GenericObject.load(simple_json) + assert_kind_of JSON::GenericObject, simple + assert_equal "world", simple.hello + converting = JSON::GenericObject.load('{ "hello": "world" }') + assert_kind_of JSON::GenericObject, converting + assert_equal "world", converting.hello + + json = JSON::GenericObject.dump(JSON::GenericObject:hello => 'world') + assert_equal JSON(json), JSON('{"json_class":"JSON::GenericObject","hello":"world"}') + end + private def switch_json_creatable
View file
json-1.7.7.gem/metadata.gz -> json-1.8.1.gem/metadata.gz
Changed
@@ -1,36 +1,32 @@ --- !ruby/object:Gem::Specification name: json version: !ruby/object:Gem::Version - version: 1.7.7 - prerelease: + version: 1.8.1 platform: ruby authors: - Florian Frank autorequire: bindir: bin cert_chain: -date: 2013-02-11 00:00:00.000000000 Z +date: 2013-10-17 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: permutation requirement: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: sdoc requirement: !ruby/object:Gem::Requirement - none: false requirements: - - ~> - !ruby/object:Gem::Version @@ -38,7 +34,6 @@ type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement - none: false requirements: - - ~> - !ruby/object:Gem::Version @@ -170,6 +165,7 @@ homepage: http://flori.github.com/json licenses: - Ruby +metadata: {} post_install_message: rdoc_options: - --title @@ -179,25 +175,20 @@ require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - '>=' - !ruby/object:Gem::Version version: '0' - segments: - - 0 - hash: -3737191669219953404 required_rubygems_version: !ruby/object:Gem::Requirement - none: false requirements: - - - ! '>=' + - - '>=' - !ruby/object:Gem::Version version: '0' requirements: rubyforge_project: -rubygems_version: 1.8.25 +rubygems_version: 2.1.9 signing_key: -specification_version: 3 +specification_version: 4 summary: JSON Implementation for Ruby test_files: - ./tests/test_json.rb
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.