Skip to content

Instantly share code, notes, and snippets.

@mikeymckay
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeymckay/9090984 to your computer and use it in GitHub Desktop.
Save mikeymckay/9090984 to your computer and use it in GitHub Desktop.
Embedding ruby in bash
echo "Retrieving application files from cloud to put in local database:"
printf '%s\n%s\n' `echo "
require 'rubygems'
require 'couchrest'
cloud_db_url = 'http://example.org/zanzibar'
local_db_url = 'http://localhost:5984/zanzibar'
@cloud_db = CouchRest.database(cloud_db_url)
@local_db = CouchRest.database(local_db_url)
#puts @cloud_db.view('zanzibar/docIDsForUpdating', {:include_docs => true})['rows']
@cloud_db.view('zanzibar/docIDsForUpdating', {:include_docs => true})['rows'].each do |doc|
puts doc['id']
@local_db.save_doc(doc)
end
" | /usr/bin/ruby`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment