Skip to content

Commit

Permalink
Merge pull request #3 from hackatron/develop
Browse files Browse the repository at this point in the history
Add whenever support
  • Loading branch information
breezeight committed Nov 20, 2013
2 parents db915ca + b8a2936 commit 6d5e304
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/tasks/eb_fast_deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'aws-sdk'
require 'dotenv/environment'
require 'fog'
require 'erb'

module EbFastDeploy

Expand Down Expand Up @@ -267,6 +268,28 @@ def print_env

end

desc "Set eb extension to run whenever on all instances"
task :whenever_ebextension do
set_vars
if @eb_ruby_container_options["WHENEVER_ALL"] == "true"
template=<<-EOF
commands:
01whenever:
command: bundle exec whenever --set environment=$RACK_ENV -u webapp --update-crontab >/tmp/whenever_command.log 2>&1
leader_only: false
EOF
output_file = ".ebextensions/whenever_all.config"
dir = File.dirname output_file
unless File.directory?(dir)
FileUtils.mkdir_p(dir)
end
File.delete output_file if File.exists? output_file
output = File.open(File.join(Rails.root, output_file), "w")
output << ERB.new( template).result(binding)
end
end


desc "print the current env status"
task :print_current_status do
set_vars
Expand Down Expand Up @@ -339,6 +362,7 @@ def print_env
desc "deploy to elastic beanstalk"
task :deploy => [
:assets,
:whenever_ebextension,
:bundle_pack,
:upload,
:create_and_deploy_version
Expand Down

0 comments on commit 6d5e304

Please sign in to comment.