lib/gloo/verbs/run.rb in gloo-0.4.0 vs lib/gloo/verbs/run.rb in gloo-0.5.0

- old
+ new

@@ -9,23 +9,37 @@ module Verbs class Run < Gloo::Core::Verb KEYWORD = 'run'.freeze KEYWORD_SHORT = 'r'.freeze + EVALUATE_RUN = '~>'.freeze # # Run the verb. # def run - name = @tokens.second - pn = Gloo::Core::Pn.new name - o = pn.resolve - - if o - o.send_message 'run' + if @tokens.second == EVALUATE_RUN + run_expression else - $log.error "Could not send message to object. Bad path: #{name}" + run_script end + end + + # + # Run a script specified by pathname + # + def run_script + Gloo::Exec::Runner.run @tokens.second + end + + # + # Evaluate an expression and run that. + # + def run_expression + return unless @tokens.token_count > 2 + + expr = Gloo::Expr::Expression.new( @tokens.params[ 1..-1 ] ) + $engine.parser.run expr.evaluate end # # Get the Verb's keyword. #