6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/generators/backup/s3/s3_generator.rb', line 6
def copy_initializer_file
template 's3_backup.rake', "lib/tasks/s3_backup.rake"
template 'schedule.rb', "config/schedule.rb"
append_file 'config/deploy.rb' do
<<-RUBY
set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"
RUBY
end
inject_into_file 'config/deploy/production.rb', before: "load 'deploy/assets'" do
<<-RUBY
set :whenever_environment, 'production'
RUBY
end
append_file 'Gemfile' do
<<-RUBY
# Backup
gem 'aws-sdk', '~> 2'
# Crontab
gem 'whenever', require: false
RUBY
end
Bundler.with_clean_env do
run "bundle install"
end
end
|