Sha256: b89969ae9e7d8886c32413560780dc553dcbe2dac35744a9106832f8a2bd2f13

Contents?: true

Size: 809 Bytes

Versions: 65

Compression:

Stored size: 809 Bytes

Contents

require 'travis/cli'

module Travis
  module CLI
    class Console < ApiCommand
      description "interactive shell"
      on '-x', '--eval LINE', 'run line of ruby' do |c, line|
        c.instance_eval(line)
        exit
      end

      def run
        return unless pry_installed?

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

      private

      def pry_installed?
        require 'pry'
        true
      rescue LoadError
        $stderr.puts 'You need to install pry to use Travis CLI console. Try'
        $stderr.puts
        $stderr.puts '$ (sudo) gem install pry'
        false
      end
    end
  end
end

Version data entries

65 entries across 65 versions & 2 rubygems

Version Path
travis-1.8.9 lib/travis/cli/console.rb
travis-1.8.9.travis.919.11 lib/travis/cli/console.rb
travis-1.8.9.travis.918.11 lib/travis/cli/console.rb
travis-1.8.9.travis.916.11 lib/travis/cli/console.rb
travis-1.8.9.travis.875.3 lib/travis/cli/console.rb