Sha256: d0f1e822220a5815132191b02967a40a5bdc04fb312f6c7f76f9a36cb318dc1a

Contents?: true

Size: 701 Bytes

Versions: 8

Compression:

Stored size: 701 Bytes

Contents

module Low
  module Mongo
    # The `Heroku` module provides helper methods for Mongo on Heroku.
    module Heroku
      def self.current_remote
        # If a mongodb URI can be extracted from `heroku config`,
        if uri = Mongo::Util.extract_mongodb_uris(`heroku config`).first

          # build a Mongo::Remote with it.
          Mongo::Remote.new(uri)
        end
      end


      def self.sync_current_remote(local_database_or_mongo)
        # If there is a remote Heroku Mongo,
        if remote = Heroku.current_remote

          # sync it to the specified database or Mongo.
          Mongo::Util.sync_from_remote(local_database_or_mongo, remote)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
low-0.0.12 lib/low/mongo/heroku.rb
low-0.0.11 lib/low/mongo/heroku.rb
low-0.0.10 lib/low/mongo/heroku.rb
low-0.0.9 lib/low/mongo/heroku.rb
low-0.0.8 lib/low/mongo/heroku.rb
low-0.0.7 lib/low/mongo/heroku.rb
low-0.0.6 lib/low/mongo/heroku.rb
low-0.0.5 lib/low/mongo/heroku.rb