class Omnitest::Psychic::CLI
Constants
- BUILT_IN_TASKS
Public Instance Methods
code2doc(*script_names)
click to toggle source
# File lib/omnitest/psychic/cli.rb, line 155 def code2doc(*script_names) script_names.each do | script_name | script = psychic.script(script_name) target_file = File.expand_path(script.name + ".#{options[:format]}", options[:destination]) create_file(target_file, script.code2doc(options)) end end
script(script_name = nil)
click to toggle source
# File lib/omnitest/psychic/cli.rb, line 103 def script(script_name = nil) # rubocop:disable Metrics/AbcSize abort 'You must specify a script name, run `psychic list scripts` for a list of known scripts' unless script_name command = psychic.script(script_name, *extra_args) if options[:print] say command.command(*extra_args) << "\n" else command.execute(*extra_args) end rescue ScriptNotRunnable => e abort "No usable command was found for script #{script_name}" rescue Omnitest::Shell::ExecutionError => e say_status :failed, script_name, :red say e.execution_result if e.execution_result end
task(task_alias = nil)
click to toggle source
# File lib/omnitest/psychic/cli.rb, line 71 def task(task_alias = nil) # rubocop:disable Metrics/AbcSize abort 'You must specify a task name, run `psychic list tasks` for a list of known tasks' unless task_alias command = psychic.task(task_alias) if options[:print] say command else psychic.execute(command, *extra_args) end rescue TaskNotImplementedError => e abort "No usable command was found for task #{task_alias}" rescue Omnitest::Shell::ExecutionError => e say_status :failed, task_alias, :red say e.execution_result if e.execution_result end
workflow(*tasks)
click to toggle source
# File lib/omnitest/psychic/cli.rb, line 125 def workflow(*tasks) abort 'Please specify at least one task' if tasks.empty? workflow = psychic.workflow(options[:name], options) do tasks.each do | task_alias | begin task task_alias rescue TaskNotImplementedError => e abort "No usable command was found for task #{task_alias}" end end end if options[:print] say workflow.command else workflow.execute({}, {}, *extra_args) end rescue Omnitest::Shell::ExecutionError => e say_status :failed, options[:name], :red say e.execution_result if e.execution_result end