Author: cutting
Date: Thu Dec 19 20:26:37 2013
New Revision: 1552417
URL: http://svn.apache.org/r1552417
Log:
AVRO-1063. Ruby: Use multi_json instead of requiring yajl. Contributed by Duke.
Modified:
avro/trunk/CHANGES.txt
avro/trunk/lang/ruby/Rakefile
avro/trunk/lang/ruby/lib/avro.rb
avro/trunk/lang/ruby/lib/avro/protocol.rb
avro/trunk/lang/ruby/lib/avro/schema.rb
avro/trunk/lang/ruby/test/test_datafile.rb
avro/trunk/lang/ruby/test/test_io.rb
Modified: avro/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1552417&r1=1552416&r2=1552417&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Thu Dec 19 20:26:37 2013
@@ -57,6 +57,9 @@ Trunk (not yet released)
getters and setters with field name argument.
(Iaroslav Zeigerman via thiru)
+ AVRO-1063. Ruby: Use multi_json instead of requiring yajl.
+ (Duke via cutting)
+
BUG FIXES
AVRO-1368. Fix SpecificDatumWriter to, when writing a string
Modified: avro/trunk/lang/ruby/Rakefile
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/ruby/Rakefile?rev=1552417&r1=1552416&r2=1552417&view=diff
==============================================================================
--- avro/trunk/lang/ruby/Rakefile (original)
+++ avro/trunk/lang/ruby/Rakefile Thu Dec 19 20:26:37 2013
@@ -23,7 +23,7 @@ Echoe.new('avro', VERSION) do |p|
p.summary = "Apache Avro for Ruby"
p.description = "Avro is a data serialization and RPC format"
p.url = "http://hadoop.apache.org/avro/"
- p.runtime_dependencies = %w[yajl-ruby]
+ p.runtime_dependencies = %w[multi-json]
end
t = Rake::TestTask.new(:interop)
Modified: avro/trunk/lang/ruby/lib/avro.rb
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro.rb?rev=1552417&r1=1552416&r2=1552417&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro.rb (original)
+++ avro/trunk/lang/ruby/lib/avro.rb Thu Dec 19 20:26:37 2013
@@ -5,16 +5,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'yajl'
+require 'multi_json'
require 'set'
require 'digest/md5'
require 'net/http'
Modified: avro/trunk/lang/ruby/lib/avro/protocol.rb
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/protocol.rb?rev=1552417&r1=1552416&r2=1552417&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/protocol.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/protocol.rb Thu Dec 19 20:26:37 2013
@@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@ module Avro
attr_reader :name, :namespace, :types, :messages, :md5
def self.parse(protocol_string)
- json_data = Yajl.load(protocol_string)
+ json_data = MultiJson.load(protocol_string)
if json_data.is_a? Hash
name = json_data['protocol']
@@ -58,7 +58,7 @@ module Avro
end
def to_s
- Yajl.dump to_avro
+ MultiJson.dump to_avro
end
def ==(other)
Modified: avro/trunk/lang/ruby/lib/avro/schema.rb
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/schema.rb?rev=1552417&r1=1552416&r2=1552417&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/schema.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/schema.rb Thu Dec 19 20:26:37 2013
@@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@ module Avro
LONG_MAX_VALUE = (1 << 63) - 1
def self.parse(json_string)
- real_parse(Yajl.load(json_string), {})
+ real_parse(MultiJson.load(json_string), {})
end
# Build Avro Schema from data parsed out of JSON string.
@@ -165,7 +165,7 @@ module Avro
end
def to_s
- Yajl.dump to_avro
+ MultiJson.dump to_avro
end
class NamedSchema < Schema
Modified: avro/trunk/lang/ruby/test/test_datafile.rb
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/ruby/test/test_datafile.rb?rev=1552417&r1=1552416&r2=1552417&view=diff
==============================================================================
--- avro/trunk/lang/ruby/test/test_datafile.rb (original)
+++ avro/trunk/lang/ruby/test/test_datafile.rb Thu Dec 19 20:26:37 2013
@@ -108,9 +108,9 @@ JSON
end
%w[fixed enum record error array map union].each do |s|
- reader = Yajl.load(writer_schema)
+ reader = MultiJson.load(writer_schema)
reader['fields'] = reader['fields'].reject{|f| f['type']['type'] == s}
- Avro::DataFile.open('data.avr', 'r', Yajl.dump(reader)) do |dr|
+ Avro::DataFile.open('data.avr', 'r', MultiJson.dump(reader)) do |dr|
dr.each_with_index do |obj, i|
reader['fields'].each do |field|
assert_equal data[i][field['name']], obj[field['name']]
Modified: avro/trunk/lang/ruby/test/test_io.rb
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/ruby/test/test_io.rb?rev=1552417&r1=1552416&r2=1552417&view=diff
==============================================================================
--- avro/trunk/lang/ruby/test/test_io.rb (original)
+++ avro/trunk/lang/ruby/test/test_io.rb Thu Dec 19 20:26:37 2013
@@ -308,8 +308,8 @@ EOS
# test that the round-trip didn't mess up anything
# NB: I don't think we should do this. Why enforce ordering?
- assert_equal(Yajl.load(str),
- Yajl.load(parsed_string))
+ assert_equal(MultiJson.load(str),
+ MultiJson.load(parsed_string))
# test __eq__
assert_equal(schema, Avro::Schema.parse(str))