Class: SpreeDelayedJob::DelayedRake

Inherits:
Struct
  • Object
show all
Defined in:
lib/spree_delayed_job/delayed_rake.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



5
6
7
# File 'lib/spree_delayed_job/delayed_rake.rb', line 5

def options
  @options
end

#taskObject

Returns the value of attribute task

Returns:

  • (Object)

    the current value of task



5
6
7
# File 'lib/spree_delayed_job/delayed_rake.rb', line 5

def task
  @task
end

Instance Method Details

#performObject



6
7
8
9
10
11
12
# File 'lib/spree_delayed_job/delayed_rake.rb', line 6

def perform
  env_options = ''
  options && options.stringify_keys!.each do |key, value|
    env_options << " #{key.upcase}=#{value}"
  end
  system("cd #{Rails.root} && RAILS_ENV=#{Rails.env} bundle exec rake #{task} #{env_options} >> log/#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')}_#{task}.log")
end