Adding weneverize scheduling, setting prod db as mysql2

This commit is contained in:
Tyler Renelle 2012-02-01 12:32:38 -05:00
parent 6268c0fd6d
commit 4673d1b306
4 changed files with 36 additions and 9 deletions

View file

@ -38,3 +38,5 @@ gem 'jquery-rails'
# gem 'ruby-debug19', :require => 'ruby-debug'
gem 'devise', '>= 2.0'
gem 'whenever'
gem 'mysql2'

View file

@ -1,17 +1,9 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
@ -23,3 +15,12 @@ production:
database: db/production.sqlite3
pool: 5
timeout: 5000
production:
adapter: mysql2
database: habit_tracker_production
host: localhost
username: root
password: root
encoding: utf8

24
config/schedule.rb Normal file
View file

@ -0,0 +1,24 @@
# Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_method"
# rake "some:great:rake:task"
# end
#
# every 4.days do
# runner "AnotherModel.prune_old_records"
# end
# Learn more: http://github.com/javan/whenever
every 1.day, :at => '12:01 am' do
runner "Habit.clear_done"
end

View file

@ -6,7 +6,7 @@
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
lefnire = User.create!(email: "tylerrenelle@gmail.com", password: "riastlin", password_confirmation: "riastlin")
lefnire = User.create!(email: "tylerrenelle@gmail.com", password: "root", password_confirmation: "root")
Habit.create!([
{ name: "Focus", score: 8, position: 0, user_id: lefnire.id, notes: "(-1) 15m procrastination
(+1) Pomorodo" },