bin/flapjack-populator in flapjack-0.7.18 vs bin/flapjack-populator in flapjack-0.7.19
- old
+ new
@@ -1,10 +1,13 @@
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
-require 'yajl/json_gem'
+
+require 'oj'
+Oj.default_options = { :indent => 0, :mode => :strict }
+
require 'redis'
# add lib to the default include path
unless $:.include?(File.dirname(__FILE__) + '/../lib/')
$: << File.dirname(__FILE__) + '/../lib'
@@ -58,11 +61,11 @@
file = File.new(filename)
end
case command
when "import-contacts"
- contacts = JSON.parse(file)
+ contacts = Oj.load(file)
if contacts && contacts.is_a?(Enumerable) && contacts.any? {|e| !e['id'].nil?}
@persistence = Redis.new(redis_options)
contacts.each do |contact|
unless contact['id']
@@ -73,10 +76,10 @@
end
@persistence.quit
end
when "import-entities"
- entities = JSON.parse(file)
+ entities = Oj.load(file)
if entities && entities.is_a?(Enumerable) && entities.any? {|e| !e['id'].nil?}
@persistence = Redis.new(redis_options)
entities.each do |entity|
unless entity['id']