Class: Kuroko2::Workflow::Task::KurokoRunner

Inherits:
Execute
  • Object
show all
Defined in:
lib/autoload/kuroko2/workflow/task/kuroko_runner.rb

Instance Method Summary collapse

Methods inherited from Execute

#execute, #validate

Methods inherited from Base

#execute, #initialize, #validate

Constructor Details

This class inherits a constructor from Kuroko2::Workflow::Task::Base

Instance Method Details

#before_executeObject



5
6
7
8
9
10
# File 'lib/autoload/kuroko2/workflow/task/kuroko_runner.rb', line 5

def before_execute
  env = token.context['ENV'] || {}
  env.merge!('BUNDLE_GEMFILE' => Rails.root.join('Gemfile').to_s)

  token.context['ENV'] = env
end

#chdirObject



12
13
14
# File 'lib/autoload/kuroko2/workflow/task/kuroko_runner.rb', line 12

def chdir
  Rails.root.to_s
end

#shellObject



16
17
18
19
20
# File 'lib/autoload/kuroko2/workflow/task/kuroko_runner.rb', line 16

def shell
  rails = Rails.root.join('bin/rails').to_s
  kuroko_script = Kuroko2::Engine.root.join("bin/#{option}.rb")
  "bundle exec #{rails} runner -e #{Rails.env} #{kuroko_script}"
end