Class: Venus::Generators::CronGenerator
- Inherits:
-
Base
- Object
- Rails::Generators::Base
- Base
- Venus::Generators::CronGenerator
show all
- Defined in:
- lib/generators/venus/cron/cron_generator.rb
Instance Method Summary
collapse
Methods inherited from Base
next_migration_number, source_root
Instance Method Details
#asks ⇒ Object
10
11
12
|
# File 'lib/generators/venus/cron/cron_generator.rb', line 10
def asks
@capistrano = ask?("integrate to capistrano?", true) if has_gem?('capistrano') && has_file?('config/deploy.rb')
end
|
#capistrano ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/generators/venus/cron/cron_generator.rb', line 20
def capistrano
if @capistrano
content = load_template('capistrano.erb')
to_file = 'config/deploy.rb'
unless file_has_content?(to_file, /[^#]*require[ ]*['"]whenever\/capistrano['"]/)
prepend_file(to_file, content)
end
end
end
|
#gemfile ⇒ Object
14
15
16
17
18
|
# File 'lib/generators/venus/cron/cron_generator.rb', line 14
def gemfile
add_gem('whenever')
bundle_install
bundle_exec('wheneverize .')
end
|
#name ⇒ Object
6
7
8
|
# File 'lib/generators/venus/cron/cron_generator.rb', line 6
def name
"Cron"
end
|