0.0
No commit activity in last 3 years
No release in over 3 years
Simple YAML backed Storage for Cinch plugins.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.1, >= 0.1.2
~> 0.7
~> 12.3.3
~> 3

Runtime

~> 2, >= 2.0.8
~> 2.0, >= 2.0.4
 Project Readme

Cinch::Storage

Gem Version Dependency Status Build Status Coverage Status Code Climate

Simple YAML backed Storage solution for Cinch plugins.

Warning: Once Cinch's author finishes Cinch::Storage I will deprecate this gem.

Installation

Add this line to your application's Gemfile:

gem 'cinch-storage'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cinch-storage

Usage

First, require it.

require 'cinch/storage'

In your plugin you will need to spin up a Storage object as part of your init.

def initialize(*args)
  super
  @storage = CinchStorage.new('yaml/plugin_name.yml')
  @storage.data ||= {}
end

Then once you add or alter data and you want to write it out to the file you can call Storage#save, but be sure to wrap it in a synchronize to avoid data collision.

synchronize(:plugin_name_save) do
  @storage.save
end

Think this is terrible?

I wouldn't disagree; this is my first time writing anyting remotely ORM-like. Please feel free to fork and submit pulls to increase sanity.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request