Sha256: bc6e3086d08c7318d44037a7494a54b800663ece07ce7b183f225164a24a54a9

Contents?: true

Size: 837 Bytes

Versions: 2

Compression:

Stored size: 837 Bytes

Contents

class Recipes::Schedule < Rails::AppBuilder
  def ask
    use_schedule = answer(:clockwork) { Ask.confirm("Do you need to schedule processes or tasks?") }
    set(:scheduled, use_schedule)
  end

  def create
    if selected?(:scheduled)
      gather_gem 'clockwork'
      template '../assets/config/clock.rb.erb', 'config/clock.rb'
      add_readme_section :internal_dependencies, :clockwork

      if selected?(:heroku)
        procfile('scheduler', 'bundle exec clockwork config/clock.rb')
      end
    end
  end

  def install
    heroku = load_recipe(:heroku)
    set(:heroku, heroku.installed?)

    error_reporting = load_recipe(:error_reporting)
    set(:report_error, error_reporting.installed?)

    set(:scheduled, true)
    create
  end

  def installed?
    gem_exists?(/clock/) && file_exist?('config/clock.rb')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
potassium-3.0.0 lib/potassium/recipes/schedule.rb
potassium-2.3.0 lib/potassium/recipes/schedule.rb