Skip to content

Commit

Permalink
Merge branch 'whenever'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ania committed Nov 30, 2010
2 parents 3aae003 + fbb922c commit dd461ac
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ config/database.yml
config/deploy.rb
config/local_config.rb
config/rcov_stats.yml
config/schedule.rb

# regenerable
coverage/*
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ gem 'nokogiri', '1.4.1' # for rack_revision_info
# TODO: revision info doesn't work on the production now (which was the whole point) because Vlad deletes .git
# directory from deployed code so there's no way to check current revision... this should be fixed when we switch
# to Capistrano
gem 'whenever', :require => false
gem 'i18n' # for whenever

group :development do
gem 'vlad', '2.0.0', :require => []
Expand Down
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ GIT
GEM
remote: http://rubygems.org/
specs:
aaronh-chronic (0.3.9)
abstract (1.0.0)
activesupport (3.0.3)
addressable (2.2.0)
bcrypt-ruby (2.1.2)
builder (2.1.2)
Expand Down Expand Up @@ -76,6 +78,7 @@ GEM
html5 (0.10.0)
chardet (>= 0.9.0)
hoe (>= 1.2.0)
i18n (0.5.0)
icalendar (1.1.5)
jslint_on_rails (1.0.3)
json_pure (1.2.4)
Expand Down Expand Up @@ -144,6 +147,9 @@ GEM
open4 (~> 0.9.0)
rake (~> 0.8.0)
vlad-git (2.0.0)
whenever (0.6.2)
aaronh-chronic (>= 0.3.9)
activesupport (>= 2.3.4)

PLATFORMS
ruby
Expand All @@ -164,6 +170,7 @@ DEPENDENCIES
dm-validations (= 0.10.2)
do_mysql
fastercsv (= 1.5.3)
i18n
icalendar (~> 1.1.0)
jslint_on_rails
merb-assets (= 1.1.0.pre)
Expand All @@ -187,3 +194,4 @@ DEPENDENCIES
ruby-debug
vlad (= 2.0.0)
vlad-git (= 2.0.0)
whenever
6 changes: 5 additions & 1 deletion config/deploy.rb.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ task :production do
end

namespace :vlad do
remote_task :update_crontab, :roles => [:app] do
run "cd #{current_path}; MERB_ENV=#{merb_env} bundle exec whenever --update-crontab #{application}"
end

remote_task :symlink_configs, :roles => [:app] do
run "ln -s #{shared_path}/config/database.yml #{current_path}/config/database.yml"
run "ln -s #{shared_path}/config/local_config.rb #{current_path}/config/local_config.rb"
Expand Down Expand Up @@ -67,7 +71,7 @@ namespace :vlad do
end

PREPARING_TASKS = [
'vlad:stop', 'vlad:update', 'vlad:symlink_configs', 'vlad:install_gems', 'vlad:build_asset_bundles'
'vlad:stop', 'vlad:update', 'vlad:symlink_configs', 'vlad:install_gems', 'vlad:build_asset_bundles', 'vlad:update_crontab'
]

task :deploy => PREPARING_TASKS + ['vlad:start']
Expand Down
19 changes: 19 additions & 0 deletions config/schedule.rb.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
set :output, "log/cron.log"

job_type :rake, "cd :path && MERB_ENV=:environment bundle exec rake :task :output"

every 1.day, :at => '10:00 am' do
rake "rubytime:send_timesheet_nagger_emails_for_previous_weekday"
end

every 1.day, :at => '12:00 am' do
rake "rubytime:send_timesheet_report_email_for_previous_weekday"
end

every :friday do
rake "rubytime:send_timesheet_summary_emails_for_last_five_days"
end

every 1.day do
rake "rubytime:send_emails"
end
4 changes: 4 additions & 0 deletions lib/tasks/cron.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
desc "send emails for RubyTime users"
namespace :rubytime do

task :test_task => :merb_env do
puts 'ania'
end

# personal notification sent to all employees that missed a day this month,
# with a list of days without activities
# TODO: rename this?...
Expand Down

0 comments on commit dd461ac

Please sign in to comment.