Gomon
Ruby wrappers around mongodb cli tools.
Prerequisites
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
- 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.
- Fork the repository on Github, make a feature branch, work on this branch.
- If necessary, write a test which shows that the bug was fixed or that the feature works as expected.
- 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 support0.2
: Test coverage.0.1
: First version. Provices basic functionnality forGomon::Dump
&Gomon::Restore