Gomon

Ruby wrappers around mongodb cli tools.

Prerequisites

Build Status

This gem is built upon novelys/clue. It is tested agains many rubies: 1.8.7, 1.9.3, 2.0.0, jruby-18, jruby-19, rubinius-18, rubinius-19.

It assumes the presence of mongorestore and mongodump commands. It was built around the latest mongodb tools at the moment of this writing, meaning version 2.2.2. Therefore, it is possible that arguments format and/or names have changed from previous versions, making them potentially not compatible with Gomon.

Installation

Directly : gem install gomon

Gemfile : gem 'gomon'

Usage

The tools currently supported are mongodump and mongorestore.
They are wrapped in Gomon::Dump and Gomon::Restore respectively.

They are used in the same way as any instance of clue is used, so you should refer to clue's documentation. What makes gomon different is its support fort parsing mongodb uris.

Example

> gd = Gomon::Dump.new options: ['journal', uri: "mongodb://user:pass@host:12345/database"]
> gd.cli_command
=> "mongodump --username 'user' --password 'pass' --host 'host' --port '12345' --db 'database' --journal"
> gd.call
# Dumping `database` from host...
# Executing: mongodump --host 'host' --port '12345' --username 'user' --password 'pass' --db 'database' --journal
# ....
# Done dumping.
=> nil

No validation of options is done, so you should be careful about supplying only options accepted by mongodump or mongorestore. Refer to the MongoDB Manual for more on the topic.

Contributions

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. In the first case, please include a use-case.
  2. Fork the repository on Github, make a feature branch, work on this branch.
  3. If necessary, write a test which shows that the bug was fixed or that the feature works as expected.
  4. Send a pull request and annoy us until we notice it. :)

Changelog

  • 1.0.0: Tagged '1.0.0'. Uses novelys/clue as foundation.
  • 0.4: Better options handling. Many ruby versions are now supported.
  • 0.3: Ruby 1.8 support
  • 0.2: Test coverage.
  • 0.1: First version. Provices basic functionnality for Gomon::Dump & Gomon::Restore