class Travis::CLI::Console

Public Instance Methods

run() click to toggle source
# File lib/travis/cli/console.rb, line 12
def run
  ensure_pry

  Object.send(:include, Client::Namespace.new(session))
  hooks = defined?(Pry::Hooks) ? Pry::Hooks.new : {}
  opts = {quiet: true, output: $stdout, hooks: hooks }
  opts.merge!({prompt: prompt}) if prompt
  binding.pry(opts)
end

Private Instance Methods

ensure_pry() click to toggle source
# File lib/travis/cli/console.rb, line 24
def ensure_pry
  require 'pry'
rescue LoadError
  msg = [
    'You need to install pry to use Travis CLI console. Try',
    nil,
    '$ (sudo) gem install pry'
  ].join("\n")
  error msg
end
prompt() click to toggle source
# File lib/travis/cli/console.rb, line 35
def prompt
  if Pry.const_defined? :SIMPLE_PROMPT
    Pry::SIMPLE_PROMPT
  elsif defined?(Pry::Prompt)
    Pry::Prompt[:simple]
  else
    nil
  end
end