pry 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cbb3b43af90a5a4254181530c9f5138dd977b1a
4
- data.tar.gz: b35030de76cf1c5ea335c765eda2fa82c266a4bd
3
+ metadata.gz: c4b5511a43b1aac132c835425bc30425073db90f
4
+ data.tar.gz: 9ef96f53b4d97a16d58ee063a6281d94e804ed4b
5
5
  SHA512:
6
- metadata.gz: 9ad850b5ea04cd13a3842865024e9e57cb788826cd55cc7fbf77ef5acd0f57c0e2fd17f87441ca6a8e0be68a082f4e6ad7dc733f4d88c511b5b76f2baf1dd93c
7
- data.tar.gz: 940a6953bd599289c8f1a706bdc132652d630f8a6e54a45a70feef1657f6e96f1c8d182af6c961daa0ef0f5eab12da69318a072e61ffeb37c9f41c7bf568b26b
6
+ metadata.gz: 73fc5d3c0d448db136892e2bf0ac917995ca78f4961fa4b5b069a87bac1cdc0c50ba730127e7029f94731dd53cb43bd8bdc7b3c57f3d20c064bba9756bdd22a8
7
+ data.tar.gz: e94499c0d75d985a4fa22ce04410c5e2972e3b52edb4d567557666536d17bec5378e8d62250bdab7d571699846a9117805633f6f1e37cc93e354f923a897174c
@@ -1,4 +1,11 @@
1
- ### 0.10.0.pre2 (2014/??/??)
1
+ ### 0.10.1
2
+
3
+ * Fix bugs with jruby
4
+ * Move to rspec for testing (from bacon)
5
+ * Clean up ruby warnings
6
+
7
+
8
+ ### 0.10.0
2
9
 
3
10
  #### Features
4
11
  * Added a `watch` command that lets you see how values change over time.
@@ -16,7 +23,7 @@
16
23
  * See `Pry.config.prompt_safe_objects`
17
24
  * `whereami` is now aliased to `@`
18
25
  * Added arguments to `whereami`:
19
- * `-m` shows the surroungind method
26
+ * `-m` shows the surrounding method
20
27
  * `-c` shows the surrounding class
21
28
  * `-f` shows the entire file
22
29
  * Lazy load configuration values (Pry.config). (#1096)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![Build Status](https://img.shields.io/travis/pry/pry.svg)](https://travis-ci.org/pry/pry)
2
2
  [![Code Climate](https://img.shields.io/codeclimate/github/pry/pry.svg)](https://codeclimate.com/github/pry/pry)
3
- [![Inline docs](http://inch-pages.github.io/github/pry/pry.svg)](http://inch-pages.github.io/github/pry/pry)
3
+ [![Inline docs](http://inch-ci.org/github/pry/pry.svg)](http://inch-ci.org/github/pry/pry)
4
4
 
5
5
  <center>
6
6
  ![The Pry Logo](https://dl.dropbox.com/u/26521875/pry%20stuff/logo/pry_logo_350.png)
@@ -253,7 +253,12 @@ class Pry
253
253
  # @return [String] a formatted representation (based on the configuration of
254
254
  # the object).
255
255
  def to_s
256
- print_to_output("")
256
+ print_to_output("", false)
257
+ end
258
+
259
+ # @return [String] a (possibly highlighted) copy of the source code.
260
+ def highlighted
261
+ print_to_output("", true)
257
262
  end
258
263
 
259
264
  # Writes a formatted representation (based on the configuration of the
@@ -261,7 +266,7 @@ class Pry
261
266
  def print_to_output(output, color=false)
262
267
  @lines.each do |loc|
263
268
  loc = loc.dup
264
- loc.colorize(@code_type)
269
+ loc.colorize(@code_type) if color
265
270
  loc.add_line_number(max_lineno_width, color) if @with_line_numbers
266
271
  loc.add_marker(@marker_lineno) if @with_marker
267
272
  loc.indent(@indentation_num) if @with_indentation
@@ -1,6 +1,6 @@
1
1
  class Pry
2
2
  class Command::Bang < Pry::ClassCommand
3
- match /^\s*!\s*$/
3
+ match(/^\s*!\s*$/)
4
4
  group 'Editing'
5
5
  description 'Clear the input buffer.'
6
6
  command_options :use_prefix => false
@@ -8,7 +8,7 @@ class Pry
8
8
  def decorate(content)
9
9
  content.code_type = code_type
10
10
  content.between(*between_lines).
11
- with_line_numbers(use_line_numbers?)
11
+ with_line_numbers(use_line_numbers?).highlighted
12
12
  end
13
13
 
14
14
  def code_type
@@ -51,7 +51,7 @@ class Pry
51
51
  code_type = @code_from_file.code_type
52
52
 
53
53
  if code_type == :unknown
54
- name, ext = File.basename(file_name).split('.', 2)
54
+ name = File.basename(file_name).split('.', 2).first
55
55
  case name
56
56
  when "Rakefile", "Gemfile"
57
57
  :ruby
@@ -1,7 +1,7 @@
1
1
  class Pry
2
2
  class Command::Ls < Pry::ClassCommand
3
3
  class Formatter
4
- attr_accessor :grep
4
+ attr_writer :grep
5
5
  attr_reader :_pry_
6
6
 
7
7
  def initialize(_pry_)
@@ -40,7 +40,7 @@ class Pry
40
40
  # The source for code_object prepared for display.
41
41
  def content_for(code_object)
42
42
  Code.new(code_object.source, start_line_for(code_object)).
43
- with_line_numbers(use_line_numbers?)
43
+ with_line_numbers(use_line_numbers?).highlighted
44
44
  end
45
45
  end
46
46
 
@@ -88,7 +88,7 @@ class Pry
88
88
 
89
89
  def add_expression(arguments)
90
90
  expressions << Expression.new(_pry_, target, arg_string)
91
- output.puts "Watching #{Code.new(arg_string)}"
91
+ output.puts "Watching #{Code.new(arg_string).highlighted}"
92
92
  end
93
93
 
94
94
  def add_hook
@@ -6,7 +6,7 @@ class Pry
6
6
  def initialize(_pry_, target, source)
7
7
  @_pry_ = _pry_
8
8
  @target = target
9
- @source = source.strip
9
+ @source = Code.new(source).strip
10
10
  end
11
11
 
12
12
  def eval!
@@ -15,7 +15,7 @@ class Pry
15
15
  end
16
16
 
17
17
  def to_s
18
- "#{Code.new(source).strip} => #{value}"
18
+ "#{Code.new(source).highlighted.strip} => #{value}"
19
19
  end
20
20
 
21
21
  # Has the value of the expression changed?
@@ -89,7 +89,7 @@ class Pry
89
89
  set_file_and_dir_locals(@file)
90
90
 
91
91
  out = "\n#{text.bold('From:')} #{location}:\n\n" <<
92
- code.with_line_numbers(use_line_numbers?).with_marker(marker) << "\n"
92
+ code.with_line_numbers(use_line_numbers?).with_marker(marker).highlighted << "\n"
93
93
 
94
94
  _pry_.pager.page out
95
95
  end
@@ -54,7 +54,7 @@ module Pry::Config::Behavior
54
54
  value = @default.public_send(name, *args, &block)
55
55
  # FIXME: refactor Pry::Hook so that it stores config on the config object,
56
56
  # so that we can use the normal strategy.
57
- self[key] = value.dup if key == 'hooks'
57
+ self[key] = value = value.dup if key == 'hooks'
58
58
  value
59
59
  else
60
60
  nil
@@ -5,7 +5,6 @@ module Pry::Config::Convenience
5
5
  :commands,
6
6
  :print,
7
7
  :exception_handler,
8
- :quiet?,
9
8
  :hooks,
10
9
  :color,
11
10
  :pager,
@@ -119,10 +119,6 @@ class Pry::Config::Default
119
119
  configure_history
120
120
  end
121
121
 
122
- def quiet?
123
- quiet
124
- end
125
-
126
122
  default.each do |key, value|
127
123
  define_method(key) do
128
124
  if default[key].equal?(value)
@@ -84,7 +84,7 @@ class Pry
84
84
  '--nofork' if blocking
85
85
  when /^jedit/
86
86
  '-wait' if blocking
87
- when /^mate/, /^subl/
87
+ when /^mate/, /^subl/, /^redcar/
88
88
  '-w' if blocking
89
89
  end
90
90
  end
@@ -106,6 +106,8 @@ class Pry
106
106
  "#{file_name}/#{line_number}"
107
107
  when /^jedit/
108
108
  "#{file_name} +line:#{line_number}"
109
+ when /^redcar/
110
+ "-l#{line_number} #{file_name}"
109
111
  else
110
112
  if windows?
111
113
  "#{file_name}"
@@ -81,10 +81,10 @@ class Pry
81
81
 
82
82
  # The default loader. Yields lines from `Pry.history.config.file`.
83
83
  def read_from_file
84
- filename = File.expand_path(Pry.config.history.file)
84
+ path = history_file_path
85
85
 
86
- if File.exists?(filename)
87
- File.foreach(filename) { |line| yield(line) }
86
+ if File.exists?(path)
87
+ File.foreach(path) { |line| yield(line) }
88
88
  end
89
89
  rescue => error
90
90
  warn "History file not loaded: #{error.message}"
@@ -111,15 +111,17 @@ class Pry
111
111
  if defined?(@history_file)
112
112
  @history_file
113
113
  else
114
- @history_file = File.open(file_path, 'a', 0600).tap { |f| f.sync = true }
114
+ @history_file = File.open(history_file_path, 'a', 0600).tap do |file|
115
+ file.sync = true
116
+ end
115
117
  end
116
118
  rescue Errno::EACCES
117
119
  warn 'History not saved; unable to open your history file for writing.'
118
120
  @history_file = false
119
121
  end
120
122
 
121
- def file_path
122
- @file_path || Pry.config.history.file
123
+ def history_file_path
124
+ File.expand_path(@file_path || Pry.config.history.file)
123
125
  end
124
126
  end
125
127
  end
@@ -164,7 +164,7 @@ class Pry
164
164
  end
165
165
 
166
166
  def valid_file?(file)
167
- (File.exists?(file) && !File.directory?(file)) || Pry.eval_path == file
167
+ (File.exist?(file) && !File.directory?(file)) || Pry.eval_path == file
168
168
  end
169
169
 
170
170
  def lines_for_file(file)
@@ -38,9 +38,10 @@ class Pry::Pager
38
38
 
39
39
  private
40
40
 
41
- attr_reader :output
42
41
  def enabled?; !!@enabled; end
43
42
 
43
+ def output; @output; end
44
+
44
45
  # Return an instance of the "best" available pager class -- `SystemPager` if
45
46
  # possible, `SimplePager` if `SystemPager` isn't available, and `NullPager`
46
47
  # if the user has disabled paging. All pagers accept output with `#puts`,
@@ -35,7 +35,7 @@ class Pry
35
35
  # Load the Command line options defined by this plugin (if they exist)
36
36
  def load_cli_options
37
37
  cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb")
38
- require cli_options_file if File.exists?(cli_options_file)
38
+ require cli_options_file if File.exist?(cli_options_file)
39
39
  end
40
40
  # Activate the plugin (require the gem - enables/loads the
41
41
  # plugin immediately at point of call, even if plugin is
@@ -19,7 +19,7 @@ class Pry
19
19
  def_delegators :@plugin_manager, :plugins, :load_plugins, :locate_plugins
20
20
 
21
21
  extend Pry::Config::Convenience
22
- config_shortcut *Pry::Config.shortcuts
22
+ config_shortcut(*Pry::Config.shortcuts)
23
23
 
24
24
  def prompt=(value)
25
25
  config.prompt = value
@@ -39,7 +39,7 @@ class Pry
39
39
  attr_reader :config
40
40
 
41
41
  extend Pry::Config::Convenience
42
- config_shortcut *Pry::Config.shortcuts
42
+ config_shortcut(*Pry::Config.shortcuts)
43
43
  EMPTY_COMPLETIONS = [].freeze
44
44
 
45
45
  # Create a new {Pry} instance.
@@ -167,12 +167,14 @@ class Pry
167
167
  end
168
168
  end
169
169
 
170
+ undef :memory_size if method_defined? :memory_size
170
171
  # @return [Integer] The maximum amount of objects remembered by the inp and
171
172
  # out arrays. Defaults to 100.
172
173
  def memory_size
173
174
  @output_array.max_size
174
175
  end
175
176
 
177
+ undef :memory_size= if method_defined? :memory_size=
176
178
  def memory_size=(size)
177
179
  @input_array = Pry::HistoryArray.new(size)
178
180
  @output_array = Pry::HistoryArray.new(size)
@@ -503,7 +505,7 @@ class Pry
503
505
  @input_array << code
504
506
  if code
505
507
  Pry.line_buffer.push(*code.each_line)
506
- Pry.current_line += code.each_line.count
508
+ Pry.current_line += code.lines.count
507
509
  end
508
510
  end
509
511
 
@@ -596,6 +598,7 @@ class Pry
596
598
  prompt_stack.size > 1 ? prompt_stack.pop : prompt
597
599
  end
598
600
 
601
+ undef :pager if method_defined? :pager
599
602
  # Returns the currently configured pager
600
603
  # @example
601
604
  # _pry_.pager.page text
@@ -603,6 +606,7 @@ class Pry
603
606
  Pry::Pager.new(self)
604
607
  end
605
608
 
609
+ undef :output if method_defined? :output
606
610
  # Returns an output device
607
611
  # @example
608
612
  # _pry_.output.puts "ohai!"
@@ -651,4 +655,10 @@ class Pry
651
655
  end
652
656
  def raise_up(*args); raise_up_common(false, *args); end
653
657
  def raise_up!(*args); raise_up_common(true, *args); end
658
+
659
+ # Convenience accessor for the `quiet` config key.
660
+ # @return [Boolean]
661
+ def quiet?
662
+ config.quiet
663
+ end
654
664
  end
@@ -5,7 +5,7 @@ class Pry::Terminal
5
5
  # If the window size cannot be determined, return nil.
6
6
  def screen_size
7
7
  rows, cols = actual_screen_size
8
- if rows && cols
8
+ if rows.to_i != 0 && cols.to_i != 0
9
9
  [rows.to_i, cols.to_i]
10
10
  else
11
11
  nil
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.1"
3
3
  end
@@ -107,6 +107,10 @@ class Pry
107
107
  def singleton_class?
108
108
  if Pry::Method.safe_send(wrapped, :respond_to?, :singleton_class?)
109
109
  Pry::Method.safe_send(wrapped, :singleton_class?)
110
+ elsif defined?(Rubinius)
111
+ # https://github.com/rubinius/rubinius/commit/2e71722dba53d1a92c54d5e3968d64d1042486fe singleton_class? added 30 Jul 2014
112
+ # https://github.com/rubinius/rubinius/commit/4310f6b2ef3c8fc88135affe697db4e29e4621c4 has been around since 2011
113
+ !!Rubinius::Type.singleton_class_object(wrapped)
110
114
  else
111
115
  wrapped != Pry::Method.safe_send(wrapped, :ancestors).first
112
116
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mair (banisterfiend)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-09 00:00:00.000000000 Z
13
+ date: 2014-08-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coderay