# Do NOT modify this file. It is generated by BenchmarkSchedule.
# DSL for cron jobs: "Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs."
# Docs: https://github.com/javan/whenever

# Keep in mind that in 'whenever_schedule.rb' the Rails environment is not available.
# Therefore environment specific variables like Rails.env must be passed via erb syntax.
set :environment, '<%= Rails.env %>'
set :output, '<%= Rails.application.config.benchmark_schedule_log %>'

env :PATH, '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'

production_env = 'BUNDLE_GEMFILE=<%= File.join(Rails.root, 'Gemfile') %>'
job_type :runner,  "cd :path && #{production_env if @environment == 'production'} :runner_command -e :environment ':task' :output"

# Create cron job for each active schedule with the Whenever DSL
<% BenchmarkSchedule.actives.each do |active_schedule| %>
  every '<%= active_schedule.cron_expression %>' do
    runner "BenchmarkDefinition.start_execution_async_for_id(<%= active_schedule.benchmark_definition_id %>)"
  end
<% end %>
# Do NOT modify this file. It is generated by BenchmarkSchedule.
# DSL for cron jobs: "Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs."
# Docs: https://github.com/javan/whenever

# Keep in mind that in 'whenever_schedule.rb' the Rails environment is not available.
# Therefore environment specific variables like Rails.env must be passed via erb syntax.
set :environment, '<%= Rails.env %>'
set :output, '<%= Rails.application.config.benchmark_schedule_log %>'

# TODO: Fix hardcoded Ruby path => this creates a dependency on the Ruby version
env :PATH, '/usr/local/ruby-2.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'

# Create a cron job for each active schedule with the Whenever DSL
<% BenchmarkSchedule.actives.each do |active_schedule| %>
  every '<%= active_schedule.cron_expression %>' do
    runner "BenchmarkDefinition.start_execution_async_for_id(<%= active_schedule.benchmark_definition_id %>)"
  end
<% end %>

Fix whenever schedule template with Ruby 2.5.1 path
Fix whenever schedule template with Ruby 2.5.1 path
