pry 0.9.11.2-java → 0.9.11.3-java

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 17/01/2012 version 0.9.11.3
2
+ * fix Pry.run_command
3
+ * improve `ls` output
4
+ * add :requires_gem => "jist" to 'gist' command (so deps can be installed
5
+ via install-command)
6
+ * improve help for 'edit' command
7
+
1
8
  16/01/2012 version 0.9.11.2
2
9
  * minor bug fix for gist on windows, rescuing Jist::ClipboardError
3
10
  rather than letting the scary error spill out to users and potentially
@@ -7,6 +14,7 @@ have them think the gist didnt post.
7
14
  * fixed minor bug in 'gist' command where i neglected to remove
8
15
  a call to a non-existent method (no_arg) which was called when
9
16
  `gist` is invoked with no parameters
17
+
10
18
  16/01/2013 version 0.9.11
11
19
  dependency changes:
12
20
  * upgrade the slop gem to version ~> 3.4
@@ -15,6 +23,9 @@ dependency changes:
15
23
  new features:
16
24
  * #738 basic Ruby 2.0 support
17
25
  * #732 JRuby 1.7.0+ support
26
+ * new reload-code command, using it you can reload code for methods,
27
+ classes, commands, objects and so on. e.g reload-code MyCLass,
28
+ reload-code my_method, reload-code my_obj
18
29
  * added bond tabcompletion, much more powerful than standard tab
19
30
  completion. However, it requires a real 'readline' to work,
20
31
  so will not work on standard osx setup (since it uses Editline)
@@ -106,7 +117,7 @@ bug fixes &c.
106
117
 
107
118
  09/05/2012 version 0.9.9.6 fixes #558
108
119
  * #558 has been a thorn in our side for long enough, hopefully this properly fixes it
109
- (though im not to confident :P)
120
+ (though im not too confident :P)
110
121
 
111
122
  09/05/2012 version 0.9.9.5 minor bugfix
112
123
  * fixed ZeroDivisionError in correct_indentation, bug #558
@@ -570,8 +570,8 @@ class Pry
570
570
  slop.help
571
571
  end
572
572
 
573
- # Return an instance of Slop::Commands that can parse either subcommands
574
- # or the options that this command accepts.
573
+ # Return an instance of Slop that can parse either subcommands or the
574
+ # options that this command accepts.
575
575
  def slop
576
576
  Slop.parse do |opt|
577
577
  opt.banner(unindent(self.class.banner))
@@ -11,11 +11,12 @@ class Pry
11
11
  banner <<-'BANNER'
12
12
  Usage: edit [--no-reload|--reload|--patch] [--line LINE] [--temp|--ex|FILE[:LINE]|OBJECT|--in N]
13
13
 
14
- Open a text editor. When no FILE is given, edits the pry input buffer. Ensure
15
- `Pry.config.editor` is set to your editor of choice.
14
+ Open a text editor. When no FILE is given, edits the pry input buffer.
15
+ When a method/module/command is given, the code is opened in an editor.
16
+ Ensure `Pry.config.editor` is set to your editor of choice.
16
17
 
17
18
  edit sample.rb edit -p MyClass#my_method
18
- edit sample.rb --line 105 edit YourClass
19
+ edit sample.rb --line 105 edit MyClass
19
20
  edit MyClass#my_method edit --ex
20
21
  edit --method edit --ex -p
21
22
 
@@ -3,6 +3,7 @@ class Pry
3
3
  match 'gist'
4
4
  group 'Misc'
5
5
  description 'Playback a string variable or a method or a file as input.'
6
+ command_options :requires_gem => "jist"
6
7
 
7
8
  banner <<-'BANNER'
8
9
  Usage: gist [OPTIONS] [--help]
@@ -325,8 +325,8 @@ class Pry
325
325
  # Add a new section to the output. Outputs nothing if the section would be empty.
326
326
  def output_section(heading, body)
327
327
  return "" if body.compact.empty?
328
- table = Pry::Helpers.tablify_to_screen_width(body)
329
- "#{text.bold(color(:heading, heading))}: \n#{table}\n"
328
+ fancy_heading = text.bold(color(:heading, heading))
329
+ Pry::Helpers.tablify_or_one_line(fancy_heading, body)
330
330
  end
331
331
 
332
332
  # Color output based on config.ls.*_color
@@ -1,14 +1,23 @@
1
1
  class Pry
2
2
  module Helpers
3
- def self.tablify_to_screen_width(things)
4
- things = things.compact
5
-
6
- if TerminalInfo.screen_size.nil?
7
- return things.join(Pry.config.ls.separator)
3
+ def self.tablify_or_one_line(heading, things)
4
+ plain_heading = Pry::Helpers::Text.strip_color(heading)
5
+ attempt = Table.new(things, :column_count => things.size)
6
+ if attempt.fits_on_line?(TerminalInfo.width! - plain_heading.size - 2)
7
+ "#{heading}: #{attempt}\n"
8
+ else
9
+ "#{heading}: \n#{tablify_to_screen_width(things, :indent => ' ')}\n"
8
10
  end
11
+ end
9
12
 
10
- screen_width = (TerminalInfo.screen_size || [25, 80])[1]
11
- tablify(things, screen_width)
13
+ def self.tablify_to_screen_width(things, options = {})
14
+ things = things.compact
15
+ if indent = options[:indent]
16
+ usable_width = TerminalInfo.width! - indent.size
17
+ tablify(things, usable_width).to_s.gsub(/^/, indent)
18
+ else
19
+ tablify(things, TerminalInfo.width!).to_s
20
+ end
12
21
  end
13
22
 
14
23
  def self.tablify(things, line_length)
@@ -239,7 +239,9 @@ class Pry
239
239
 
240
240
  output = options[:show_output] ? options[:output] : StringIO.new
241
241
 
242
- Pry.new(:output => output, :input => StringIO.new(command_string), :commands => options[:commands], :prompt => proc {""}, :hooks => Pry::Hooks.new).rep(options[:context])
242
+ Pry.new(:output => output, :input => StringIO.new("#{command_string}\nexit-all\n"),
243
+ :commands => options[:commands],
244
+ :prompt => proc {""}, :hooks => Pry::Hooks.new).repl(options[:context])
243
245
  end
244
246
 
245
247
  def self.default_editor_for_platform
@@ -255,6 +257,14 @@ class Pry
255
257
  end
256
258
  end
257
259
 
260
+ def self.auto_resize!
261
+ trap :WINCH do
262
+ size = `stty size`.split(/\s+/).map &:to_i
263
+ Readline.set_screen_size *size
264
+ Readline.refresh_line
265
+ end
266
+ end
267
+
258
268
  def self.set_config_defaults
259
269
  config.input = Readline
260
270
  config.output = $stdout
@@ -313,11 +323,11 @@ class Pry
313
323
  config.extra_sticky_locals = {}
314
324
 
315
325
  config.ls ||= OpenStruct.new({
316
- :heading_color => :default,
326
+ :heading_color => :bright_blue,
317
327
 
318
328
  :public_method_color => :default,
319
- :private_method_color => :green,
320
- :protected_method_color => :yellow,
329
+ :private_method_color => :blue,
330
+ :protected_method_color => :blue,
321
331
  :method_missing_color => :bright_red,
322
332
 
323
333
  :local_var_color => :yellow,
@@ -11,6 +11,11 @@ class Pry::TerminalInfo
11
11
  end
12
12
  end
13
13
 
14
+ # Return a screen width or a default if it fails.
15
+ def self.width! default = 80
16
+ (screen_size || [nil, default])[1]
17
+ end
18
+
14
19
  def self.actual_screen_size
15
20
  [
16
21
  # Some readlines also provides get_screen_size.
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.9.11.2"
2
+ VERSION = "0.9.11.3"
3
3
  end
@@ -2,10 +2,14 @@
2
2
  # THey need to be updated for the new 'gist' API, but im too sleepy to
3
3
  # do that now.
4
4
 
5
+ require 'helper'
5
6
 
6
- # require 'helper'
7
+ describe 'gist' do
8
+ it 'has a dependency on the jist gem' do
9
+ Pry::Command::Gist.command_options[:requires_gem].should == "jist"
10
+ end
11
+ end
7
12
 
8
- # describe 'gist' do
9
13
  # before do
10
14
  # Pad.jist_calls = {}
11
15
  # end
@@ -37,7 +37,7 @@ describe "ls" do
37
37
  describe "methods" do
38
38
  it "should show public methods by default" do
39
39
  output = pry_eval("ls Class.new{ def goo; end; public :goo }.new")
40
- output.should =~ /methods: \ngoo/
40
+ output.should =~ /methods: goo/
41
41
  end
42
42
 
43
43
  it "should not show protected/private by default" do
@@ -46,12 +46,12 @@ describe "ls" do
46
46
  end
47
47
 
48
48
  it "should show public methods with -p" do
49
- pry_eval("ls -p Class.new{ def goo; end }.new").should =~ /methods: \ngoo/
49
+ pry_eval("ls -p Class.new{ def goo; end }.new").should =~ /methods: goo/
50
50
  end
51
51
 
52
52
  it "should show protected/private methods with -p" do
53
- pry_eval("ls -pM Class.new{ def goo; end; protected :goo }").should =~ /methods: \ngoo/
54
- pry_eval("ls -p Class.new{ def goo; end; private :goo }.new").should =~ /methods: \ngoo/
53
+ pry_eval("ls -pM Class.new{ def goo; end; protected :goo }").should =~ /methods: goo/
54
+ pry_eval("ls -p Class.new{ def goo; end; private :goo }.new").should =~ /methods: goo/
55
55
  end
56
56
 
57
57
  it "should work for objects with an overridden method method" do
@@ -80,4 +80,7 @@ asfadsssaaad fasfaafdssd s
80
80
  end
81
81
  end
82
82
 
83
+ describe 'decide between one-line or indented output' do
84
+ Pry::Helpers.tablify_or_one_line('head', %w(ing)).should == 'head: ing'
85
+ end
83
86
  end
@@ -0,0 +1,25 @@
1
+ require 'helper'
2
+
3
+ describe "Pry.run_command" do
4
+ before do
5
+ o = Object.new
6
+ def o.drum
7
+ "roken is dodelijk"
8
+ end
9
+ @context = Pry.binding_for(o)
10
+ end
11
+
12
+ it 'performs a simple ls' do
13
+ @context.eval("hokey_pokey = 10")
14
+ Pry.run_command "ls", :context => @context, :output => out = StringIO.new
15
+ out.string.should =~ /hokey_pokey/
16
+ end
17
+
18
+ if !PryTestHelpers.mri18_and_no_real_source_location?
19
+ # This is a regression test as 0.9.11 broke this behaviour
20
+ it 'can perform a show-source' do
21
+ Pry.run_command "show-source drum", :context => @context, :output => out = StringIO.new
22
+ out.string.should =~ /roken is dodelijk/
23
+ end
24
+ end
25
+ 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.9.11.2
4
+ version: 0.9.11.3
5
5
  prerelease:
6
6
  platform: java
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-17 00:00:00.000000000 Z
14
+ date: 2013-01-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: coderay
@@ -349,6 +349,7 @@ files:
349
349
  - spec/pry_history_spec.rb
350
350
  - spec/pry_output_spec.rb
351
351
  - spec/pry_spec.rb
352
+ - spec/run_command_spec.rb
352
353
  - spec/sticky_locals_spec.rb
353
354
  - spec/syntax_checking_spec.rb
354
355
  - spec/wrapped_module_spec.rb
@@ -434,6 +435,7 @@ test_files:
434
435
  - spec/pry_history_spec.rb
435
436
  - spec/pry_output_spec.rb
436
437
  - spec/pry_spec.rb
438
+ - spec/run_command_spec.rb
437
439
  - spec/sticky_locals_spec.rb
438
440
  - spec/syntax_checking_spec.rb
439
441
  - spec/wrapped_module_spec.rb