Ruboty::Moneta
Store Ruboty's memory in backend via moneta.
Installation
Add this line to your application's Gemfile:
gem 'ruboty-moneta'
Usage
setting moneta backend
please setting backend_type to MONETA_BACKEND
MONETA_BACKEND="{backend_type}"
setting initialize options
please setting options
MONETA_#{バックエンドの形式}_{initialize時のoptionパラメータに渡したいキー名}で 指定してください。
Sqlite3のfileパラメータを指定したいときは下記のようになります。
# MONETA_#{Backend}_#{Options Hash}
MONETA_SQLITE_FILE = "{file path}"
Setting replicate
複数のbackendに同時に書き込みます。 MONETA_BACKENDで設定されたbackendのデータをmasterとして扱います。 ストアの移行作業時などに使ってください
MONETA_BACKEND_SLAVE={"backend" or ["backend1", "backend2"]}
# example
# Replicate in YAML
MONETA_BACKEND_SLAVE="YAML"
MONETA_YAML_FILE="./ruboty.yml"
# Replicate in YAML and File
MONETA_BACKEND_SLAVE=["YAML", "File"]
MONETA_FILE_DIR="./db"
MONETA_YAML_FILE="./ruboty.yml"
example
use memory
gem 'ruboty-moneta'
use File
gem 'ruboty-moneta'
MONETA_BACKEND="File"
MONETA_FILE_DIR="./db"
use Sqlite
gem 'ruboty-moneta'
gem 'sqlite3'
MONETA_BACKEND="Sqlite"
MONETA_SQLITE_FILE="./ruboty.db"
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/rike422/ruboty-moneta. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.