diff options
author | Micah Anderson <micah@riseup.net> | 2013-12-04 11:01:33 -0500 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2013-12-04 11:01:33 -0500 |
commit | 7ac2149cdc9f9ca0ce00f70c4e7ac48c896889ec (patch) | |
tree | 515af0ec7b33b8d83f63d32c570480d63ba34a5b /files | |
parent | d38d80ccb19947984ea9d4ecc8d826144c33dff4 (diff) |
add new couch-doc-update that uses MultiJson instead, this could prevent the outdated json errors (#4622)
Diffstat (limited to 'files')
-rw-r--r-- | files/couch-doc-update | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/files/couch-doc-update b/files/couch-doc-update index 08f8cfe..47b89a4 100644 --- a/files/couch-doc-update +++ b/files/couch-doc-update @@ -33,7 +33,6 @@ require 'syslog' begin; require 'rubygems'; rescue LoadError; end # optionally load rubygems require 'couchrest' -require 'json' def main db, id, data = process_options @@ -75,14 +74,14 @@ def process_options end end usage("Missing required option") unless db_name && doc_id && new_data - new_data = JSON.parse(new_data) + new_data = MultiJson.load(new_data) new_data.merge!(read_file(filename)) if filename db = CouchRest.database(connection_string(db_name, host)) return db, doc_id, new_data end def read_file(filename) - data = JSON.parse( IO.read(filename) ) + data = MultiJson.load( IO.read(filename) ) # strip off _id and _rev to avoid conflicts data.reject! {|k,v| k.start_with? '_'} end |