Shifter is a web app that aids in scheduling shifts. It is based on Ruby on Rails and was written by Jeremy Cushman.
Running ruby in a virtual environment is recommended. Note: This guide uses rbenv; if you are already using RVM or chruby, use the equivalent commands and do not install rbenv.
- Install
rbenv: See instructions at https://github.com/rbenv/rbenv (apt-get install rbenvon Ubuntu) - Install
ruby-buildwithgit clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build cdinto the script directory (cd /path/to/shifter)- Install Ruby with
rbenv install 2.3.0(or a newer version) - Ensure that
which rubypoints to~/.rbenv/shims/ruby. If not, addeval "$(rbenv init -)"to the end of your~/.bashrcfile. - Run
gem install bundlerto installbundler. Note: Do not usesudo - Run
rbenv rehashto tellrbenvthat you now havebundler - Run
bundleto install the required gems - Install
sqlite3if not already present on your system (apt-get install sqlite3or equivalent) - Install
nodejsif not already present (sudo apt-get install nodejsor equivalent) - Run
bin/rake db:migrate(in/path/to/shifter) to create the empty database - Create a production key to run the server in production mode. Run
RAILS_ENV=production rake secret, copy the code generated, and paste it into a file namedconfig/application.ymlin the formatSECRET_KEY_BASE: secret_key_output(wheresecret_key_outputis the generated secret key) - For email sending through Gmail, add two more lines to
config/application.yml:GMAIL_USERNAME: "my_username"andGMAIL_PASSWORD: "my_password" - Run
RAILS_ENV=production bin/rake rake db:schema:loadto populate the database - Run
bin/rails server -e productionto start the server - For daily reminder and other emails, add
30 9 * * * /bin/bash -l -c 'cd /path/to/shifter && RAILS_ENV=production bundle exec rake reminders --silent'to your crontab
- Any number of Calendars can be created. These are things like "On-site shift" or "Remote shift (0:00 - 8:00 CET)" or "Analysis Shift" or something along those lines. Each calendar has a title and a description, which can be any length. It has a parameter called "Simultaneous" that controls the number of simultaneous reservations that can be made on one calendar (this will probably be 1, or 2 if we want people to have slightly overlapping shifts). It also has a parameter called "Days per credit". This is for calculating shift credits. For example, if Days per credit is 7, then a 7-day reservation on that calendar is 1 shift credit.
- Groups exist and have Shifters. Groups are institutions that are summed together for the purpose of calculating shift credits. Shifters are members of those institutions.
- Calendars have Reservations. Each Reservation is a certain number of days, on a certain Calendar, and associated with a Shifter and, by proxy, a Group.
- The site has Users (username and password pairs). Users can create reservations on any calendars but can only edit the reservations that they make. Users don't have to correspond to Shifters, but in many cases will. This is slightly confusing, but gives us more flexibility to have one site user register shifts for several Shifters.
- Users can have an Admin flag set. Admins are the only ones who can can create, delete, or edit calendars, and admins can edit anyone's reservations, not just their own.
The application always:
- Sends emails to new users when they create an account
- Sends emails to the user making the shift reservation, the shifter, and anyone on the relevant calendar's "watchers" list when shifts are created, updated, or deleted
When rake reminders is run as a daily cron job, the application:
- Sends reminder emails 1 day, 7 days, and 30 days in advance of shifts