34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/locomotive/steam/services/action_service.rb', line 34
def run(script, params = {}, liquid_context)
context = Duktape::Context.new
define_built_in_functions(context, liquid_context)
script = <<-JS
function locomotiveAction(site, params) {
#{script}
}
JS
begin
context.exec_string script
context.call_prop('locomotiveAction', site.as_json, params)
rescue Locomotive::Steam::RedirectionException
raise
rescue Exception => e
raise Locomotive::Steam::ActionError.new(e, script)
end
end
|