pry 0.9.9.4 → 0.9.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 09/05/2012 version 0.9.9.5 minor bugfix
2
+ * fixed ZeroDivisionError in correct_indentation, bug #558
3
+ * fix double highlighting in rdoc, bug #562
4
+ * autocreate configuration for plugins, bug #548
5
+
1
6
  26/4/2012 version 0.9.9.4 major bugfix
2
7
  * fixed `NoMethodError: undefined method `winsize' for #<IO:<STDOUT>>`, bug #549
3
8
  * fixes for jruby
@@ -11,7 +11,7 @@ class Pry
11
11
  gsub(/<i>(?:\s*\n)?(.*?)\s*<\/i>/m) { Pry.color ? "\e[1m#{$1}\e[0m" : $1 }.
12
12
  gsub(/\B\+(\w*?)\+\B/) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
13
13
  gsub(/((?:^[ \t]+.+(?:\n+|\Z))+)/) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }.
14
- gsub(/`(?:\s*\n)?(.*?)\s*`/) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }
14
+ gsub(/`(?:\s*\n)?([^\e]*?)\s*`/) { "`#{Pry.color ? CodeRay.scan($1, code_type).term : $1}`" }
15
15
  end
16
16
 
17
17
  def process_yardoc_tag(comment, tag)
@@ -292,15 +292,8 @@ class Pry
292
292
  full_line = prompt + code
293
293
  whitespace = ' ' * overhang
294
294
 
295
- if $stdout.tty? && $stdout.respond_to?(:winsize)
296
- _, cols = $stdout.winsize
297
- elsif Readline.respond_to?(:get_screen_size)
298
- _, cols = Readline.get_screen_size
299
- elsif ENV['COLUMNS'] && ENV['COLUMNS'] != ''
300
- cols = ENV['COLUMNS'].to_i
301
- end
302
-
303
- lines = cols ? (full_line.length / cols + 1) : 1
295
+ _, cols = screen_size
296
+ lines = cols && cols != 0 ? (full_line.length / cols + 1) : 1
304
297
 
305
298
  if defined?(Win32::Console)
306
299
  move_up = "\e[#{lines}F"
@@ -312,5 +305,24 @@ class Pry
312
305
 
313
306
  "#{move_up}#{prompt}#{colorize_code(code)}#{whitespace}#{move_down}"
314
307
  end
308
+
309
+ # Return a pair of [rows, columns] which gives the size of the window.
310
+ #
311
+ # If the window size cannot be determined, return nil.
312
+ def screen_size
313
+ [
314
+ # io/console adds a winsize method to IO streams.
315
+ $stdout.tty? && $stdout.respond_to?(:winsize) && $stdout.winsize,
316
+
317
+ # Some readlines also provides get_screen_size.
318
+ Readline.respond_to?(:get_screen_size) && Readline.get_screen_size,
319
+
320
+ # Otherwise try to use the environment (this may be out of date due
321
+ # to window resizing, but it better than nothing).
322
+ [ENV["ROWS"], ENV["COLUMNS"]]
323
+ ].detect do |(rows, cols)|
324
+ cols.to_i > 0
325
+ end
326
+ end
315
327
  end
316
328
  end
@@ -42,12 +42,16 @@ class Pry
42
42
  # disabled)
43
43
  # Does not reload plugin if it's already active.
44
44
  def activate!
45
+ # Create the configuration object for the plugin.
46
+ Pry.config.send("#{gem_name.gsub('-', '_')}=", OpenStruct.new)
47
+
45
48
  begin
46
49
  require gem_name if !active?
47
50
  rescue LoadError => e
48
51
  warn "Warning: The plugin '#{gem_name}' was not found! (gem found but could not be loaded)"
49
52
  warn e
50
53
  end
54
+
51
55
  self.active = true
52
56
  self.enabled = true
53
57
  end
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.9.9.4"
2
+ VERSION = "0.9.9.5"
3
3
  end
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "pry"
5
- s.version = "0.9.9.4"
5
+ s.version = "0.9.9.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Mair (banisterfiend)"]
9
- s.date = "2012-04-26"
9
+ s.date = "2012-05-09"
10
10
  s.description = "An IRB alternative and runtime developer console"
11
11
  s.email = "jrmair@gmail.com"
12
12
  s.executables = ["pry"]
13
13
  s.files = [".document", ".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG", "CONTRIBUTORS", "Gemfile", "LICENSE", "README.markdown", "Rakefile", "TODO", "bin/pry", "examples/example_basic.rb", "examples/example_command_override.rb", "examples/example_commands.rb", "examples/example_hooks.rb", "examples/example_image_edit.rb", "examples/example_input.rb", "examples/example_input2.rb", "examples/example_output.rb", "examples/example_print.rb", "examples/example_prompt.rb", "examples/helper.rb", "lib/pry.rb", "lib/pry/cli.rb", "lib/pry/code.rb", "lib/pry/command.rb", "lib/pry/command_set.rb", "lib/pry/commands.rb", "lib/pry/completion.rb", "lib/pry/config.rb", "lib/pry/core_extensions.rb", "lib/pry/custom_completions.rb", "lib/pry/default_commands/cd.rb", "lib/pry/default_commands/commands.rb", "lib/pry/default_commands/context.rb", "lib/pry/default_commands/easter_eggs.rb", "lib/pry/default_commands/editing.rb", "lib/pry/default_commands/find_method.rb", "lib/pry/default_commands/gems.rb", "lib/pry/default_commands/help.rb", "lib/pry/default_commands/hist.rb", "lib/pry/default_commands/input_and_output.rb", "lib/pry/default_commands/introspection.rb", "lib/pry/default_commands/ls.rb", "lib/pry/default_commands/misc.rb", "lib/pry/default_commands/navigating_pry.rb", "lib/pry/extended_commands/experimental.rb", "lib/pry/helpers.rb", "lib/pry/helpers/base_helpers.rb", "lib/pry/helpers/command_helpers.rb", "lib/pry/helpers/documentation_helpers.rb", "lib/pry/helpers/options_helpers.rb", "lib/pry/helpers/text.rb", "lib/pry/history.rb", "lib/pry/history_array.rb", "lib/pry/hooks.rb", "lib/pry/indent.rb", "lib/pry/method.rb", "lib/pry/plugins.rb", "lib/pry/pry_class.rb", "lib/pry/pry_instance.rb", "lib/pry/rbx_method.rb", "lib/pry/rbx_path.rb", "lib/pry/version.rb", "lib/pry/wrapped_module.rb", "man/pry.1", "man/pry.1.html", "man/pry.1.ronn", "pry.gemspec", "test/helper.rb", "test/test_cli.rb", "test/test_code.rb", "test/test_command.rb", "test/test_command_helpers.rb", "test/test_command_integration.rb", "test/test_command_set.rb", "test/test_completion.rb", "test/test_default_commands/test_cd.rb", "test/test_default_commands/test_context.rb", "test/test_default_commands/test_documentation.rb", "test/test_default_commands/test_find_method.rb", "test/test_default_commands/test_gems.rb", "test/test_default_commands/test_help.rb", "test/test_default_commands/test_input.rb", "test/test_default_commands/test_introspection.rb", "test/test_default_commands/test_ls.rb", "test/test_default_commands/test_shell.rb", "test/test_default_commands/test_show_source.rb", "test/test_exception_whitelist.rb", "test/test_history_array.rb", "test/test_hooks.rb", "test/test_indent.rb", "test/test_input_stack.rb", "test/test_method.rb", "test/test_pry.rb", "test/test_pry_defaults.rb", "test/test_pry_history.rb", "test/test_pry_output.rb", "test/test_sticky_locals.rb", "test/test_syntax_checking.rb", "test/test_wrapped_module.rb", "test/testrc", "test/testrcbad", "wiki/Customizing-pry.md", "wiki/Home.md"]
14
14
  s.homepage = "http://pry.github.com"
15
15
  s.require_paths = ["lib"]
16
- s.rubygems_version = "1.8.16"
16
+ s.rubygems_version = "1.8.23"
17
17
  s.summary = "An IRB alternative and runtime developer console"
18
18
  s.test_files = ["test/helper.rb", "test/test_cli.rb", "test/test_code.rb", "test/test_command.rb", "test/test_command_helpers.rb", "test/test_command_integration.rb", "test/test_command_set.rb", "test/test_completion.rb", "test/test_default_commands/test_cd.rb", "test/test_default_commands/test_context.rb", "test/test_default_commands/test_documentation.rb", "test/test_default_commands/test_find_method.rb", "test/test_default_commands/test_gems.rb", "test/test_default_commands/test_help.rb", "test/test_default_commands/test_input.rb", "test/test_default_commands/test_introspection.rb", "test/test_default_commands/test_ls.rb", "test/test_default_commands/test_shell.rb", "test/test_default_commands/test_show_source.rb", "test/test_exception_whitelist.rb", "test/test_history_array.rb", "test/test_hooks.rb", "test/test_indent.rb", "test/test_input_stack.rb", "test/test_method.rb", "test/test_pry.rb", "test/test_pry_defaults.rb", "test/test_pry_history.rb", "test/test_pry_output.rb", "test/test_sticky_locals.rb", "test/test_syntax_checking.rb", "test/test_wrapped_module.rb", "test/testrc", "test/testrcbad"]
19
19
 
@@ -65,6 +65,68 @@ if !mri18_and_no_real_source_location?
65
65
  end
66
66
  end
67
67
 
68
+ describe "rdoc highlighting" do
69
+ it "should syntax highlight code in rdoc" do
70
+ c = Class.new{
71
+ # This can initialize your class:
72
+ #
73
+ # a = c.new :foo
74
+ #
75
+ # @param foo
76
+ def initialize(foo); end
77
+ }
78
+
79
+ begin
80
+ mock_pry(binding, "show-doc c#initialize").should =~ /c.new :foo/
81
+ Pry.config.color = true
82
+ # I don't want the test to rely on which colour codes are there, just to
83
+ # assert that "something" is being colourized.
84
+ mock_pry(binding, "show-doc c#initialize").should.not =~ /c.new :foo/
85
+ ensure
86
+ Pry.config.color = false
87
+ end
88
+ end
89
+
90
+ it "should syntax highlight `code` in rdoc" do
91
+ c = Class.new{
92
+ # After initializing your class with `c.new(:foo)`, go have fun!
93
+ #
94
+ # @param foo
95
+ def initialize(foo); end
96
+ }
97
+
98
+ begin
99
+ mock_pry(binding, "show-doc c#initialize").should =~ /c.new\(:foo\)/
100
+ Pry.config.color = true
101
+ # I don't want the test to rely on which colour codes are there, just to
102
+ # assert that "something" is being colourized.
103
+ mock_pry(binding, "show-doc c#initialize").should.not =~ /c.new\(:foo\)/
104
+ ensure
105
+ Pry.config.color = false
106
+ end
107
+
108
+ end
109
+
110
+ it "should not syntax highlight `` inside code" do
111
+ c = Class.new{
112
+ # Convert aligned output (from many shell commands) into nested arrays:
113
+ #
114
+ # a = decolumnize `ls -l $HOME`
115
+ #
116
+ # @param output
117
+ def decolumnize(output); end
118
+ }
119
+
120
+ begin
121
+ Pry.config.color = true
122
+ mock_pry(binding, "show-doc c#decolumnize").should =~ /ls -l \$HOME/
123
+ mock_pry(binding, "show-doc c#decolumnize").should.not =~ /`ls -l \$HOME`/
124
+ ensure
125
+ Pry.config.color = false
126
+ end
127
+ end
128
+ end
129
+
68
130
  describe "on modules" do
69
131
  before do
70
132
  # god this is boring1
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.9.9.4
4
+ version: 0.9.9.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-26 00:00:00.000000000 Z
12
+ date: 2012-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coderay
16
- requirement: &70146509151200 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 1.0.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70146509151200
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.5
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: slop
27
- requirement: &70146509149520 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -35,10 +40,18 @@ dependencies:
35
40
  version: '3'
36
41
  type: :runtime
37
42
  prerelease: false
38
- version_requirements: *70146509149520
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: 2.4.4
49
+ - - <
50
+ - !ruby/object:Gem::Version
51
+ version: '3'
39
52
  - !ruby/object:Gem::Dependency
40
53
  name: method_source
41
- requirement: &70146509146680 !ruby/object:Gem::Requirement
54
+ requirement: !ruby/object:Gem::Requirement
42
55
  none: false
43
56
  requirements:
44
57
  - - ~>
@@ -46,10 +59,15 @@ dependencies:
46
59
  version: 0.7.1
47
60
  type: :runtime
48
61
  prerelease: false
49
- version_requirements: *70146509146680
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 0.7.1
50
68
  - !ruby/object:Gem::Dependency
51
69
  name: bacon
52
- requirement: &70146509157160 !ruby/object:Gem::Requirement
70
+ requirement: !ruby/object:Gem::Requirement
53
71
  none: false
54
72
  requirements:
55
73
  - - ~>
@@ -57,10 +75,15 @@ dependencies:
57
75
  version: '1.1'
58
76
  type: :development
59
77
  prerelease: false
60
- version_requirements: *70146509157160
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: '1.1'
61
84
  - !ruby/object:Gem::Dependency
62
85
  name: open4
63
- requirement: &70146509154460 !ruby/object:Gem::Requirement
86
+ requirement: !ruby/object:Gem::Requirement
64
87
  none: false
65
88
  requirements:
66
89
  - - ~>
@@ -68,10 +91,15 @@ dependencies:
68
91
  version: '1.3'
69
92
  type: :development
70
93
  prerelease: false
71
- version_requirements: *70146509154460
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: '1.3'
72
100
  - !ruby/object:Gem::Dependency
73
101
  name: rake
74
- requirement: &70146509169040 !ruby/object:Gem::Requirement
102
+ requirement: !ruby/object:Gem::Requirement
75
103
  none: false
76
104
  requirements:
77
105
  - - ~>
@@ -79,7 +107,12 @@ dependencies:
79
107
  version: '0.9'
80
108
  type: :development
81
109
  prerelease: false
82
- version_requirements: *70146509169040
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ~>
114
+ - !ruby/object:Gem::Version
115
+ version: '0.9'
83
116
  description: An IRB alternative and runtime developer console
84
117
  email: jrmair@gmail.com
85
118
  executables:
@@ -214,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
247
  version: '0'
215
248
  requirements: []
216
249
  rubyforge_project:
217
- rubygems_version: 1.8.16
250
+ rubygems_version: 1.8.23
218
251
  signing_key:
219
252
  specification_version: 3
220
253
  summary: An IRB alternative and runtime developer console