Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 49 lines (43 sloc) 1.139 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
# vim:set ft=ruby:

$LOAD_PATH.unshift(File.expand_path("~/.ruby"))
$LOAD_PATH.unshift(File.expand_path("."))
$LOAD_PATH.uniq!

%w{
  rubygems
  pry-editline
  jacknagel
}.each do |lib|
  begin
    require(lib)
  rescue LoadError
  end
end

Pry.config.history.file =
  if defined?(Homebrew)
    HOMEBREW_REPOSITORY.join("Meta/irb_history")
  elsif defined?(Bundler)
    Bundler.tmp.parent.join("history")
  else
    File.expand_path("~/.history/irb")
  end

Pry.config.prompt_name =
  if defined?(Homebrew)
    "brew"
  elsif defined?(Rails)
    Rails.application.class.parent_name
  elsif defined?(Bundler)
    Bundler.root
  else
    "pry"
  end.to_s.downcase.slice(0..7)

ruby_version = lambda {
  RUBY_VERSION >= "2.1" ? RUBY_VERSION : "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
}

Pry.config.prompt = [
  lambda { |obj, nest, pry|
    "[#{pry.input_array.size}] #{ruby_version.call} #{Pry.config.prompt_name}(#{Pry.view_clip(obj)})#{":#{nest}" unless nest.zero?}> "
  },
  lambda { |obj, nest, pry|
    "[#{pry.input_array.size}] #{ruby_version.call} #{Pry.config.prompt_name}(#{Pry.view_clip(obj)})#{":#{nest}" unless nest.zero?}* "
  }
]
Something went wrong with that request. Please try again.