summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorConrad Irwin <conrad.irwin@gmail.com>2014-04-29 00:03:15 -0700
committerConrad Irwin <conrad.irwin@gmail.com>2014-04-29 00:03:15 -0700
commit259248b77ec6356525cad6274f9fb750849b4c13 (patch)
tree84036043fde194cfc8116b16e9390bcdd49dc88f /lib
parentc9affb2c166f2bb9d8f56014d3b8799a620d79db (diff)
downloadpry-make-global-config-greppable.tar.gz
Stop using compatibility aliases for Pry.configmake-global-config-greppable
Diffstat (limited to 'lib')
-rw-r--r--lib/pry/cli.rb2
-rw-r--r--lib/pry/code.rb2
-rw-r--r--lib/pry/color_printer.rb4
-rw-r--r--lib/pry/command_set.rb6
-rw-r--r--lib/pry/commands/easter_eggs.rb6
-rw-r--r--lib/pry/helpers/base_helpers.rb8
-rw-r--r--lib/pry/helpers/documentation_helpers.rb4
-rw-r--r--lib/pry/helpers/text.rb10
-rw-r--r--lib/pry/hooks.rb4
-rw-r--r--lib/pry/pager.rb8
-rw-r--r--lib/pry/pry_class.rb6
-rw-r--r--lib/pry/test/helper.rb4
12 files changed, 32 insertions, 32 deletions
diff --git a/lib/pry/cli.rb b/lib/pry/cli.rb
index 620fbb48..ef738694 100644
--- a/lib/pry/cli.rb
+++ b/lib/pry/cli.rb
@@ -128,7 +128,7 @@ Copyright (c) 2013 John Mair (banisterfiend)
end
on "no-color", "Disable syntax highlighting for session" do
- Pry.color = false
+ Pry.config.color = false
end
on :f, "Suppress loading of ~/.pryrc and ./.pryrc" do
diff --git a/lib/pry/code.rb b/lib/pry/code.rb
index ec72c0eb..03c7355f 100644
--- a/lib/pry/code.rb
+++ b/lib/pry/code.rb
@@ -262,7 +262,7 @@ class Pry
def print_to_output(output)
@lines.each do |loc|
loc = loc.dup
- loc.colorize(@code_type) if Pry.color
+ loc.colorize(@code_type) if Pry.config.color
loc.add_line_number(max_lineno_width) if @with_line_numbers
loc.add_marker(@marker_lineno) if @with_marker
loc.indent(@indentation_num) if @with_indentation
diff --git a/lib/pry/color_printer.rb b/lib/pry/color_printer.rb
index 39d9a9ae..31f9d48a 100644
--- a/lib/pry/color_printer.rb
+++ b/lib/pry/color_printer.rb
@@ -18,7 +18,7 @@ class Pry
end
def text(str, width = str.length)
- super(*if !Pry.color
+ super(*if !Pry.config.color
[str, width]
# Don't recolorize output with color [Issue #751]
elsif str.include?("\e[")
@@ -43,7 +43,7 @@ class Pry
obj_id = obj.__id__.to_s(16) rescue 0
str = "#<#{klass}:0x#{obj_id}>"
- text(Pry.color ? highlight_object_literal(str) : str)
+ text(Pry.config.color ? highlight_object_literal(str) : str)
end
private
diff --git a/lib/pry/command_set.rb b/lib/pry/command_set.rb
index bb90fc15..9483ab0f 100644
--- a/lib/pry/command_set.rb
+++ b/lib/pry/command_set.rb
@@ -122,7 +122,7 @@ class Pry
# @param [String, Regexp] search The match or listing of the command.
# @yield The block to be run before the command.
# @example Display parameter before invoking command
- # Pry.commands.before_command("whereami") do |n|
+ # Pry.config.commands.before_command("whereami") do |n|
# output.puts "parameter passed was #{n}"
# end
def before_command(search, &block)
@@ -136,7 +136,7 @@ class Pry
# @param [String, Regexp] search The match or listing of the command.
# @yield The block to be run after the command.
# @example Display text 'command complete' after invoking command
- # Pry.commands.after_command("whereami") do |n|
+ # Pry.config.commands.after_command("whereami") do |n|
# output.puts "command complete!"
# end
def after_command(search, &block)
@@ -336,7 +336,7 @@ class Pry
# Returns the new command (matched with "pattern".)
#
# @example
- # Pry.commands["help"] = MyHelpCommand
+ # Pry.config.commands["help"] = MyHelpCommand
#
def []=(pattern, command)
if command.equal?(nil)
diff --git a/lib/pry/commands/easter_eggs.rb b/lib/pry/commands/easter_eggs.rb
index 784e1cbe..aad200c8 100644
--- a/lib/pry/commands/easter_eggs.rb
+++ b/lib/pry/commands/easter_eggs.rb
@@ -83,8 +83,8 @@ TEXT
end
command "test-ansi", "" do
- prev_color = Pry.color
- Pry.color = true
+ prev_color = Pry.config.color
+ Pry.config.color = true
picture = unindent <<-'EOS'.gsub(/[[:alpha:]!]/) { |s| text.red(s) }
____ _______________________
@@ -106,7 +106,7 @@ TEXT
output.puts "\n" * 6
output.puts "** ENV['TERM'] is #{ENV['TERM']} **\n\n"
- Pry.color = prev_color
+ Pry.config.color = prev_color
end
end
end
diff --git a/lib/pry/helpers/base_helpers.rb b/lib/pry/helpers/base_helpers.rb
index b4b3f13d..7182c8c2 100644
--- a/lib/pry/helpers/base_helpers.rb
+++ b/lib/pry/helpers/base_helpers.rb
@@ -47,7 +47,7 @@ class Pry
end
def colorize_code(code)
- if Pry.color
+ if Pry.config.color
CodeRay.scan(code, :ruby).term
else
code
@@ -61,7 +61,7 @@ class Pry
# formatting
def heading(text)
text = "#{text}\n--"
- Pry.color ? "\e[1m#{text}\e[0m": text
+ Pry.config.color ? "\e[1m#{text}\e[0m": text
end
# have fun on the Windows platform.
@@ -102,7 +102,7 @@ class Pry
mri? && RUBY_VERSION =~ /2.1/
end
- # Send the given text through the best available pager (if Pry.pager is
+ # Send the given text through the best available pager (if Pry.config.pager is
# enabled). Infers where to send the output if used as a mixin.
def stagger_output(text, out = nil)
out ||= case
@@ -111,7 +111,7 @@ class Pry
output
when Pry.respond_to?(:output)
# Parent.
- Pry.output
+ Pry.config.output
else
# Sys.
$stdout
diff --git a/lib/pry/helpers/documentation_helpers.rb b/lib/pry/helpers/documentation_helpers.rb
index 95fd6193..3d1a8990 100644
--- a/lib/pry/helpers/documentation_helpers.rb
+++ b/lib/pry/helpers/documentation_helpers.rb
@@ -8,7 +8,7 @@ class Pry
module_function
def process_rdoc(comment)
- return comment unless Pry.color
+ return comment unless Pry.config.color
comment = comment.dup
comment.gsub(/<code>(?:\s*\n)?(.*?)\s*<\/code>/m) { CodeRay.scan($1, :ruby).term }.
gsub(/<em>(?:\s*\n)?(.*?)\s*<\/em>/m) { "\e[1m#{$1}\e[0m" }.
@@ -37,7 +37,7 @@ class Pry
yard_tags = ["param", "return", "option", "yield", "attr", "attr_reader", "attr_writer",
"deprecate", "example", "raise"]
(yard_tags - ["example"]).inject(comment) { |a, v| process_yardoc_tag(a, v) }.
- gsub(/^@(#{yard_tags.join("|")})/) { Pry.color ? "\e[33m#{$1}\e[0m": $1 }
+ gsub(/^@(#{yard_tags.join("|")})/) { Pry.config.color ? "\e[33m#{$1}\e[0m": $1 }
end
def process_comment_markup(comment)
diff --git a/lib/pry/helpers/text.rb b/lib/pry/helpers/text.rb
index f62c309f..826a6402 100644
--- a/lib/pry/helpers/text.rb
+++ b/lib/pry/helpers/text.rb
@@ -21,11 +21,11 @@ class Pry
COLORS.each_pair do |color, value|
define_method color do |text|
- Pry.color ? "\033[0;#{30+value}m#{text}\033[0m" : text.to_s
+ Pry.config.color ? "\033[0;#{30+value}m#{text}\033[0m" : text.to_s
end
define_method "bright_#{color}" do |text|
- Pry.color ? "\033[1;#{30+value}m#{text}\033[0m" : text.to_s
+ Pry.config.color ? "\033[1;#{30+value}m#{text}\033[0m" : text.to_s
end
end
@@ -38,12 +38,12 @@ class Pry
end
# Returns _text_ as bold text for use on a terminal.
- # _Pry.color_ must be true for this method to perform any transformations.
+ # _Pry.config.color_ must be true for this method to perform any transformations.
#
# @param [String, #to_s] text
# @return [String] _text_
def bold(text)
- Pry.color ? "\e[1m#{text}\e[0m" : text.to_s
+ Pry.config.color ? "\e[1m#{text}\e[0m" : text.to_s
end
# Returns `text` in the default foreground colour.
@@ -56,7 +56,7 @@ class Pry
end
alias_method :bright_default, :bold
- # Executes the block with `Pry.color` set to false.
+ # Executes the block with `Pry.config.color` set to false.
# @yield
# @return [void]
def no_color(&block)
diff --git a/lib/pry/hooks.rb b/lib/pry/hooks.rb
index 496e344d..0407a17e 100644
--- a/lib/pry/hooks.rb
+++ b/lib/pry/hooks.rb
@@ -52,7 +52,7 @@ class Pry
# FIXME:
# This is a hack to alert people of the new API.
def [](event_name)
- warn "`Pry.hooks[]` is deprecated! Please use the new `Pry::Hooks` API! http://rubydoc.info/github/pry/pry/master/Pry/Hooks"
+ warn "`Pry.config.hooks[]` is deprecated! Please use the new `Pry::Hooks` API! http://rubydoc.info/github/pry/pry/master/Pry/Hooks"
get_hook(event_name, nil)
end
@@ -60,7 +60,7 @@ class Pry
# FIXME:
# This is a hack to alert people of the new API.
def []=(event_name, callable)
- warn "`Pry.hooks[]=` is deprecated! Please use the new `Pry::Hooks` API! http://rubydoc.info/github/pry/pry/master/Pry/Hooks"
+ warn "`Pry.config.hooks[]=` is deprecated! Please use the new `Pry::Hooks` API! http://rubydoc.info/github/pry/pry/master/Pry/Hooks"
add_hook(event_name, nil, callable)
end
diff --git a/lib/pry/pager.rb b/lib/pry/pager.rb
index 3c01b44b..dae67f71 100644
--- a/lib/pry/pager.rb
+++ b/lib/pry/pager.rb
@@ -7,7 +7,7 @@ module Pry::Pager
class StopPaging < StandardError
end
- # Send the given text through the best available pager (if `Pry.pager` is
+ # Send the given text through the best available pager (if `Pry.config.pager` is
# enabled).
# @param [String] text A piece of text to run through a pager.
# @param [IO] output (`$stdout`) An object to send output to.
@@ -36,7 +36,7 @@ module Pry::Pager
# These requirements can be avoided by using `.with_pager` instead.
# @param [#<<] output ($stdout) An object to send output to.
def self.best_available(output)
- if !Pry.pager
+ if !Pry.config.pager
NullPager.new(output)
elsif !SystemPager.available? || Pry::Helpers::BaseHelpers.jruby?
SimplePager.new(output)
@@ -46,7 +46,7 @@ module Pry::Pager
end
# `NullPager` is a "pager" that actually just prints all output as it comes
- # in. Used when `Pry.pager` is false.
+ # in. Used when `Pry.config.pager` is false.
class NullPager
def initialize(out)
@out = out
@@ -94,7 +94,7 @@ module Pry::Pager
if @tracker.page?
@out.print "\n"
- @out.print "\e[0m" if Pry.color
+ @out.print "\e[0m" if Pry.config.color
@out.print "<page break> --- Press enter to continue " \
"( q<enter> to break ) --- <page break>\n"
raise StopPaging if Readline.readline("").chomp == "q"
diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb
index 7e9e4adc..d8b135b2 100644
--- a/lib/pry/pry_class.rb
+++ b/lib/pry/pry_class.rb
@@ -212,7 +212,7 @@ class Pry
end
# Run a Pry command from outside a session. The commands available are
- # those referenced by `Pry.commands` (the default command set).
+ # those referenced by `Pry.config.commands` (the default command set).
# @param [String] command_string The Pry command (including arguments,
# if any).
# @param [Hash] options Optional named parameters.
@@ -231,8 +231,8 @@ class Pry
options = {
:target => TOPLEVEL_BINDING,
:show_output => true,
- :output => Pry.output,
- :commands => Pry.commands
+ :output => Pry.config.output,
+ :commands => Pry.config.commands
}.merge!(options)
# :context for compatibility with <= 0.9.11.4
diff --git a/lib/pry/test/helper.rb b/lib/pry/test/helper.rb
index 86be8aaa..d0976f59 100644
--- a/lib/pry/test/helper.rb
+++ b/lib/pry/test/helper.rb
@@ -7,8 +7,8 @@ class << Pry
def reset_defaults
orig_reset_defaults
- Pry.color = false
- Pry.pager = false
+ Pry.config.color = false
+ Pry.config.pager = false
Pry.config.should_load_rc = false
Pry.config.should_load_local_rc= false
Pry.config.should_load_plugins = false