class Runbook::CLI
Public Instance Methods
__print_version()
click to toggle source
# File lib/runbook/cli.rb, line 86 def __print_version puts "Runbook v#{Runbook::VERSION}" end
exec(runbook)
click to toggle source
# File lib/runbook/cli.rb, line 57 def exec(runbook) runbook = _retrieve_runbook(runbook, :exec) Runbook::Runner.new(runbook).run( run: options[:run], noop: options[:noop], auto: options[:auto], paranoid: options[:"no-paranoid"] == nil, start_at: options[:start_at], ) end
init()
click to toggle source
# File lib/runbook/cli.rb, line 81 def init invoke(Runbook::Initializer) end
view(runbook)
click to toggle source
# File lib/runbook/cli.rb, line 23 def view(runbook) runbook = _retrieve_runbook(runbook, :view) puts Runbook::Viewer.new(runbook).generate( view: options[:view], ) end
Private Instance Methods
_retrieve_runbook(runbook, cmd)
click to toggle source
# File lib/runbook/cli.rb, line 92 def _retrieve_runbook(runbook, cmd) unless File.exist?(runbook) raise Thor::InvocationError, "#{cmd}: cannot access #{runbook}: No such file or directory" end begin load(runbook) Runbook.books.last || eval(File.read(runbook)) rescue NameError => e if Runbook.runtime_methods.include?(e.name) message = ( "Runtime method `#{e.name}` cannot be referenced at " \ "compile time. Wrap statements referencing it in a " \ "`ruby_command` block in order to invoke the code at " \ "runtime." ) raise e, message, e.backtrace end raise e end end