ryanjm / rails-event-manager

Repeating schedule manager Rails.
MIT License
0 stars 0 forks source link

(WIP - NON FUNCTIONAL - NOT PUBLISHED) EventManager

EventManager is meant to make it easy to add and manage repeating schedules to your Rails models.

Installation

Add this line to your application's Gemfile:

gem 'event_manager'

And then execute:

$ bundle

Or install it yourself as:

$ gem install event_manager

Usage

This gem currently doesn't work, but the goal is to be able to use it as described here.

EventManager requires a few columns in your model, so to add them run the generator:

rails generate event_manager MODEL

The assumption is that you've already created the model, we are just adding columns to an existing table.

In your model add the following:

  event_manager

When you create a new event you'll need to specify a few attributes.

MODEL.update_attributes(
  freq: 'monthly',
  interval: '1',
  days_of_week: ['Mo'],
  days_of_week_offset: "1",
  duration: '0'
  starting_at: DateTime.new
)

See the wiki for explication of each attribute.

With a saved object you can now get information about the repeating events.

event.events_between(start_date, end_date)

event.next_event_after(date)

Contributing

I'd love for you to help out with the project. Please see the Contributing section.

Running Tests

There are some rspec tests already written.

$ bundle
$ rspec test

If you want to see some "examples" of it run:

$ rspec examples

Similar Projects

As far as I know these are the only other projects that are some what similar (for those looking for the best solution).