Class: Kuroko2::Workflow::Task::RailsEnv

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

Constant Summary collapse

RAILS_ENVS =
%w(development test staging production)

Instance Method Summary collapse

Methods inherited from Base

#initialize, #validate

Constructor Details

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

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/autoload/kuroko2/workflow/task/rails_env.rb', line 7

def execute
  if option
    if !RAILS_ENVS.include?(option) || RAILS_ENVS.index(option) > RAILS_ENVS.index(Rails.env)
      raise(
        Workflow::AssertionError,
        "Argment error: option value of rails_env: #{option} is not settable."
      )
    end

    token.context['RAILS_ENV'] = option
  end

  :next
end