diff --git a/Gemfile b/Gemfile index 612da7fad8..5915b7a96d 100644 --- a/Gemfile +++ b/Gemfile @@ -38,3 +38,5 @@ gem 'jquery-rails' # gem 'ruby-debug19', :require => 'ruby-debug' gem 'devise', '>= 2.0' +gem 'whenever' +gem 'mysql2' diff --git a/config/database.yml b/config/database.yml index 51a4dd459d..f623808fea 100644 --- a/config/database.yml +++ b/config/database.yml @@ -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 + diff --git a/config/schedule.rb b/config/schedule.rb new file mode 100644 index 0000000000..839994b263 --- /dev/null +++ b/config/schedule.rb @@ -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 diff --git a/db/seeds.rb b/db/seeds.rb index d744a46816..c55e004730 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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" },