Created
March 3, 2014 06:08
-
-
Save ywatase/9319332 to your computer and use it in GitHub Desktop.
debugger for rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snippet from http://qiita.com/yusabana/items/8ce54577d959bb085b37 | |
## Settings | |
Pry.config.color = true | |
Pry.config.editor = "vim" | |
Pry.config.prompt = proc do |obj, level, _| | |
prompt = "" | |
prompt << "#{Rails.version}@" if defined?(Rails) | |
prompt << "#{RUBY_VERSION}" | |
"#{prompt} (#{obj})> " | |
end | |
## Alias | |
Pry.config.commands.alias_command "lM", "ls -M" | |
# Ever get lost in pryland? try w! | |
Pry.config.commands.alias_command 'w', 'whereami' | |
# Clear Screen | |
Pry.config.commands.alias_command '.clr', '.clear' | |
## Below others cooperation | |
# refs: https://github.com/pry/pry/wiki/FAQ#wiki-awesome_print | |
if defined? AwesomePrint | |
begin | |
require 'awesome_print' | |
Pry.config.print = proc { |output, value| Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output) } | |
# Pry.config.print = proc { |output, value| output.puts value.ai } #ページングなし | |
rescue LoadError => err | |
puts "no awesome_print :(" | |
puts err | |
end | |
end | |
# refs: https://github.com/pry/pry/wiki/FAQ#wiki-hirb | |
if defined? Hirb | |
Hirb::View.instance_eval do | |
def enable_output_method | |
@output_method = true | |
@old_print = Pry.config.print | |
Pry.config.print = proc do |output, value| | |
Hirb::View.view_or_page_output(value) || @old_print.call(output, value) | |
end | |
end | |
def disable_output_method | |
Pry.config.print = @old_print | |
@output_method = nil | |
end | |
end | |
Hirb.enable | |
end | |
# refs: https://github.com/nixme/pry-debugger#tips | |
if defined?(PryDebugger) | |
Pry.commands.alias_command 'c', 'continue' | |
Pry.commands.alias_command 's', 'step' | |
Pry.commands.alias_command 'n', 'next' | |
Pry.commands.alias_command 'f', 'finish' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snippet from http://qiita.com/yusabana/items/8ce54577d959bb085b37 | |
group :test, :development do | |
gem "pry-rails" | |
gem "pry-doc" | |
gem "pry-stack_explorer" | |
gem "pry-byebug" | |
gem "hirb" | |
gem "hirb-unicode" | |
gem "tapp" | |
gem "awesome_print" | |
gem "better_errors" | |
gem "binding_of_caller" | |
gem "quiet_assets" | |
gem "annotate", github: "ctran/annotate_models" | |
gem "timecop" | |
gem "colorize_unpermitted_parameters" | |
gem "rack-mini-profiler" | |
gem "xray-rails" | |
gem "rspec", "~> 3.0.0.beta" | |
gem "rspec-rails", "~> 3.0.0.beta" | |
gem "guard-rspec", require: false | |
gem "spring-commands-rspec" | |
gem "factory_girl_rails" | |
gem "database_rewinder" | |
gem "faker" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment