Windows under Pry Installation and Configuration
Pry is an enhanced interactive command-line tool that IRB powerful.
Auto-complete function, auto indent, color. There are more powerful debugging functions.
Pry installation is simple.
in the terminal input :
Gem Install pry
It will then be automatically downloaded and installed on the Internet.
Set
in the Windows on Pry the Auto indent and color feature is not turned on by default.
Need to be configured.
PryConfiguration
put it in the personal directory. PRYRC in the file ( file path :%userprofile%\. PRYRC).
Configuration file does not exist by default, you need to create a new one, enter it inside
# this is Pry the configuration file, Pry The configuration of this file is read before running,
# This file needs to be in the user directory
# More Configurations :
Https://github.com/pry/pry/wiki/Customization-and-configuration
Pry.config.color=true
Pry.config.auto_indent=true
Pry.config.correct_indent = True
# change the color of some keywords, first get Coderay in the module terminal.rb the keywords and colors Map ,
# then change the color of the relevant keywords,
# If you use the Pry-theme , then this modification is useless and needs to be modified. Pry-theme the configuration file : ~\.pry\themes\xx
if! (Prytheme::version rescue Nil)
# if not installed Pry-theme
#p "Not install Pry-theme"
#CodeRay. Scan ("Example",: Ruby). Term
# Just to load necessary files
My_token_colors = Nil
if (coderay::encoders::terminal::token_colors rescue nil)
# Coderay 1.0.0
My_token_colors = Coderay::encoders::terminal::token_colors
Else
# Coderay 0.9
Begin
Require ' coderay/encoders/term '
My_token_colors = Coderay::encoders::term::token_colors
Rescue = E
End
End
If my_token_colors
my_token_colors[:d efinition] = "1;30″
My_token_colors[:string][:modifier] = "1;30″
my_token_colors[:string][:d Elimiter] = "1;30″
My_token_colors[:symbol] = "1;30″
#p coderay::encoders::term::token_colors ,
End
End
The configuration content has a code that modifies the color of the keyword because the Windows on those bright green color display errors, resulting in the content is not visible, so I added the code modified, will be bright green (Bright_green) colors are changed to other colors.
now run at Terminal Pry , there is color in the output.
refer to the previous article for information on how to use auto-complete : Windows Ruby installation and IRB,ri settings
In addition, if you need to Pry to see the help, you need to install Pry-doc .
run at Terminal : Gem install Pry-doc
and then in Pry , such as the input
? String#strip
is to view string Class of Strip
Pry installation and configuration under Windows