pry 0.9.12.4 → 0.9.12.5

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: ca2644d1fc36d71310d22774a431aab6abdfb9e8
4
- data.tar.gz: 75bd27d5ce4e629c84e8e424a069494466c57453
3
+ metadata.gz: d30aa9c1c9bdb6ed408d5964a955485fb8f83e08
4
+ data.tar.gz: b21a5d3f751cd1ec64a22b6443848f1453e67dfe
5
5
  SHA512:
6
- metadata.gz: 6d181cfb067a4a2b3acb346e90eca5aeae5758971a6bb5e29414353e46af0f48a2e374559a2c023ce13e3883d235151a3d067e60376e8661369ed6d37f371243
7
- data.tar.gz: 5bec33d0ac7949ebffe7d886ea0798eba3b98a38316aab33fc1409ca3774b31e28a18e03a009eaf27379a97d6acf4a55dce9f0fd1fe8c04b4e09197c7a19f59a
6
+ metadata.gz: d6c7bfedcc2b28f4852e89799bece299cec2c33cbfc02b387491a224b8d80e48cec1f4056189d1db98987c0ccab5931a7d6967396d025187ba1777ac71c1b292
7
+ data.tar.gz: 3e007ae61bafb3c3ad94346a7fd6ebb752df0110a9a8cfcdf962646f536b6bc161bb48b8187249f9675270ac62a340a8191d9292d08bda3ab559a1798876e94e
@@ -2,14 +2,19 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
5
7
  - ruby-head
6
8
  - ree
7
- - rbx-18mode
8
- - rbx-19mode
9
- - jruby-18mode
9
+ - rbx
10
10
  - jruby-19mode
11
11
  - jruby-head
12
12
 
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: ruby-head
16
+ - rvm: jruby-head
17
+
13
18
  notifications:
14
19
  irc: "irc.freenode.org#pry"
15
20
  recipients:
@@ -17,5 +22,4 @@ notifications:
17
22
 
18
23
  branches:
19
24
  only:
20
- - master
21
25
  - 0-9-12-stable
data/Gemfile CHANGED
@@ -1,9 +1,12 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
- # For Guard
5
4
  group :development do
6
5
  gem 'jist'
7
- gem 'rb-inotify', :require => 'false'
8
- gem 'rb-fsevent', :require => 'false'
6
+ end
7
+
8
+ if RbConfig::CONFIG['ruby_install_name'] == 'rbx'
9
+ gem 'rubysl-singleton'
10
+ gem 'rubysl-prettyprint'
11
+ gem 'rb-readline'
9
12
  end
data/Rakefile CHANGED
@@ -87,17 +87,17 @@ namespace :ruby do
87
87
  end
88
88
  end
89
89
 
90
- namespace :jruby do
91
- spec = modify_base_gemspec do |s|
92
- s.add_dependency('spoon', '~> 0.0')
93
- s.platform = 'java'
94
- end
95
-
96
- Gem::PackageTask.new(spec) do |pkg|
97
- pkg.need_zip = false
98
- pkg.need_tar = false
99
- end
100
- end
90
+ #namespace :jruby do
91
+ # spec = modify_base_gemspec do |s|
92
+ # s.add_dependency('spoon', '~> 0.0')
93
+ # s.platform = 'java'
94
+ # end
95
+ #
96
+ # Gem::PackageTask.new(spec) do |pkg|
97
+ # pkg.need_zip = false
98
+ # pkg.need_tar = false
99
+ # end
100
+ #end
101
101
 
102
102
 
103
103
  [:mingw32, :mswin32].each do |v|
@@ -115,7 +115,7 @@ end
115
115
  end
116
116
 
117
117
  desc "build all platform gems at once"
118
- task :gems => [:clean, :rmgems, 'ruby:gem', 'mswin32:gem', 'mingw32:gem', 'jruby:gem']
118
+ task :gems => [:clean, :rmgems, 'ruby:gem', 'mswin32:gem', 'mingw32:gem']
119
119
 
120
120
  desc "remove all platform gems"
121
121
  task :rmgems => ['ruby:clobber_package']
data/lib/pry.rb CHANGED
@@ -196,6 +196,16 @@ class Pry
196
196
  # IRB = Pry thing.
197
197
  module ExtendCommandBundle
198
198
  end
199
+
200
+ def self.require_readline
201
+ return false if @required_readline
202
+ require 'readline'
203
+ @required_readline = true
204
+ rescue LoadError
205
+ warn "Sorry, you can't use Pry without Readline or a compatible library."
206
+ warn "Please `gem install rb-readline` or recompile Ruby --with-readline."
207
+ raise
208
+ end
199
209
  end
200
210
 
201
211
  if Pry::Helpers::BaseHelpers.mri_18?
@@ -213,19 +223,11 @@ require 'slop'
213
223
  require 'rbconfig'
214
224
  require 'tempfile'
215
225
 
216
- begin
217
- require 'readline'
218
- rescue LoadError
219
- warn "You're running a version of ruby with no Readline support"
220
- warn "Please `gem install rb-readline` or recompile ruby --with-readline."
221
- exit!
222
- end
223
-
224
226
  if Pry::Helpers::BaseHelpers.jruby?
225
227
  begin
226
228
  require 'ffi'
227
229
  rescue LoadError
228
- warn "Need to `gem install ffi`"
230
+ warn "For a better Pry experience on JRuby, please `gem install ffi`."
229
231
  end
230
232
  end
231
233
 
@@ -236,7 +238,8 @@ if Pry::Helpers::BaseHelpers.windows? && !Pry::Helpers::BaseHelpers.windows_ansi
236
238
  # only fail on jruby (where win32console doesn't work).
237
239
  # Instead we'll recommend ansicon, which does.
238
240
  rescue LoadError
239
- warn "For a better pry experience, please use ansicon: http://adoxa.3eeweb.com/ansicon/"
241
+ warn "For a better Pry experience on Windows, please use ansicon:"
242
+ warn " http://adoxa.3eeweb.com/ansicon/"
240
243
  end
241
244
  end
242
245
 
@@ -5,6 +5,14 @@ class Pry
5
5
  module BondCompleter
6
6
 
7
7
  def self.build_completion_proc(target, pry=nil, commands=[""])
8
+ Pry.require_readline
9
+
10
+ # If we're using libedit, don't use Bond.
11
+ if Readline::VERSION =~ /editline/i
12
+ Pry.config.completer = InputCompleter
13
+ return InputCompleter.build_completion_proc(target, pry, commands)
14
+ end
15
+
8
16
  if !@started
9
17
  @started = true
10
18
  start
@@ -28,13 +36,6 @@ class Pry
28
36
 
29
37
  # Implements tab completion for Readline in Pry
30
38
  module InputCompleter
31
-
32
- if Readline.respond_to?("basic_word_break_characters=")
33
- Readline.basic_word_break_characters = " \t\n\"\\'`><=;|&{("
34
- end
35
-
36
- Readline.completion_append_character = nil
37
-
38
39
  ReservedWords = [
39
40
  "BEGIN", "END",
40
41
  "alias", "and",
@@ -60,10 +61,26 @@ class Pry
60
61
  "[]", "[]=", "^", "!", "!=", "!~"
61
62
  ]
62
63
 
64
+ # If we haven't configured Readline for completion yet, do it now.
65
+ # @private
66
+ def self.initialize_readline
67
+ Pry.require_readline
68
+ return if @initialized_readline
69
+
70
+ if Readline.respond_to?("basic_word_break_characters=")
71
+ Readline.basic_word_break_characters = " \t\n\"\\'`><=;|&{("
72
+ end
73
+
74
+ Readline.completion_append_character = nil
75
+
76
+ @initialized_readline = true
77
+ end
78
+
63
79
  # Return a new completion proc for use by Readline.
64
80
  # @param [Binding] target The current binding context.
65
81
  # @param [Array<String>] commands The array of Pry commands.
66
82
  def self.build_completion_proc(target, pry=nil, commands=[""])
83
+ initialize_readline
67
84
 
68
85
  proc do |input|
69
86
 
@@ -5,13 +5,27 @@ class Pry
5
5
 
6
6
  # Get/Set the object to use for input by default by all Pry instances.
7
7
  # Pry.config.input is an option determining the input object - the object from
8
- # which Pry retrieves its lines of input. Pry accepts any object that implements the readline method.
9
- # This includes IO objects, StringIO, Readline, File and custom objects.
8
+ # which Pry retrieves its lines of input. Pry accepts any object that
9
+ # implements the readline method. This includes IO objects, StringIO,
10
+ # Readline, File and custom objects. It can also be a Proc which returns an
11
+ # object implementing the readline method.
10
12
  # @return [#readline] The object to use for input by default by all
11
13
  # Pry instances.
12
14
  # @example
13
15
  # Pry.config.input = StringIO.new("@x = 10\nexit")
14
- attr_accessor :input
16
+ def input
17
+ @reified_input ||=
18
+ if @input.respond_to?(:call)
19
+ @input.call
20
+ else
21
+ @input
22
+ end
23
+ end
24
+
25
+ def input=(input)
26
+ @reified_input = nil
27
+ @input = input
28
+ end
15
29
 
16
30
  # Get/Set the object to use for output by default by all Pry instances.
17
31
  # Pry.config.output is an option determining the output object - the object to which
@@ -1,6 +1,6 @@
1
1
  class Pry
2
- # The History class is responsible for maintaining the user's input history, both
3
- # internally and within Readline.
2
+ # The History class is responsible for maintaining the user's input history,
3
+ # both internally and within Readline.
4
4
  class History
5
5
  attr_accessor :loader, :saver, :pusher, :clearer
6
6
 
@@ -111,11 +111,13 @@ class Pry
111
111
  # The default pusher. Appends the given line to Readline::HISTORY.
112
112
  # @param [String] line
113
113
  def push_to_readline(line)
114
+ Pry.require_readline
114
115
  Readline::HISTORY << line
115
116
  end
116
117
 
117
118
  # The default clearer. Clears Readline::HISTORY.
118
119
  def clear_readline
120
+ Pry.require_readline
119
121
  Readline::HISTORY.shift until Readline::HISTORY.empty?
120
122
  end
121
123
  end
@@ -107,8 +107,7 @@ class Pry
107
107
  # Including: loading .pryrc, loading plugins, loading requires, and
108
108
  # loading history.
109
109
  def self.initial_session_setup
110
-
111
- return if !initial_session?
110
+ return unless initial_session?
112
111
 
113
112
  # note these have to be loaded here rather than in pry_instance as
114
113
  # we only want them loaded once per entire Pry lifetime.
@@ -262,6 +261,7 @@ class Pry
262
261
  end
263
262
 
264
263
  def self.auto_resize!
264
+ Pry.require_readline
265
265
  ver = Readline::VERSION
266
266
  if ver[/edit/i]
267
267
  warn <<-EOT
@@ -286,7 +286,7 @@ Readline version #{ver} detected - will not auto_resize! correctly.
286
286
  end
287
287
 
288
288
  def self.set_config_defaults
289
- config.input = Readline
289
+ config.input = proc { Pry.require_readline; Readline }
290
290
  config.output = $stdout
291
291
  config.commands = Pry::Commands
292
292
  config.prompt_name = DEFAULT_PROMPT_NAME
@@ -310,12 +310,7 @@ Readline version #{ver} detected - will not auto_resize! correctly.
310
310
  config.correct_indent = true
311
311
  config.collision_warning = false
312
312
  config.output_prefix = "=> "
313
-
314
- if defined?(Bond) && Readline::VERSION !~ /editline/i
315
- config.completer = Pry::BondCompleter
316
- else
317
- config.completer = Pry::InputCompleter
318
- end
313
+ config.completer = Pry::BondCompleter
319
314
 
320
315
  config.gist ||= OpenStruct.new
321
316
  config.gist.inspecter = proc(&:pretty_inspect)
@@ -619,7 +619,7 @@ class Pry
619
619
  input.completion_proc = completion_proc
620
620
  end
621
621
 
622
- if input == Readline
622
+ if defined?(Readline) && input == Readline
623
623
  if !$stdout.tty? && $stdin.tty? && !Pry::Helpers::BaseHelpers.windows?
624
624
  Readline.output = File.open('/dev/tty', 'w')
625
625
  end
@@ -53,7 +53,7 @@ class Pry::Terminal
53
53
  end
54
54
 
55
55
  def screen_size_according_to_readline
56
- if Readline.respond_to?(:get_screen_size)
56
+ if defined?(Readline) && Readline.respond_to?(:get_screen_size)
57
57
  size = Readline.get_screen_size
58
58
  size if nonzero_column?(size)
59
59
  end
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.9.12.4"
2
+ VERSION = "0.9.12.5"
3
3
  end
@@ -120,7 +120,11 @@ class Pry
120
120
  # Is this a singleton class?
121
121
  # @return [Boolean]
122
122
  def singleton_class?
123
- wrapped != wrapped.ancestors.first
123
+ if wrapped.respond_to?(:singleton_class?)
124
+ wrapped.singleton_class?
125
+ else
126
+ wrapped != wrapped.ancestors.first
127
+ end
124
128
  end
125
129
 
126
130
  # Is this strictly a module? (does not match classes)
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency 'bacon', '~> 1.2'
24
24
  s.add_development_dependency 'open4', '~> 1.3'
25
25
  s.add_development_dependency 'rake', '~> 0.9'
26
- s.add_development_dependency 'guard', '~> 1.3.2'
27
26
  s.add_development_dependency 'mocha', '~> 0.13.1'
28
27
  # TODO: make this a plain dependency:
29
28
  s.add_development_dependency 'bond', '~> 0.4.2'
@@ -45,7 +45,7 @@ describe 'cd' do
45
45
  describe 'when an error was raised' do
46
46
  it 'should not toggle and should keep correct stacks' do
47
47
  proc {
48
- @t.eval 'cd @'
48
+ @t.eval 'cd %'
49
49
  }.should.raise(Pry::CommandError)
50
50
 
51
51
  @t.old_stack.should == []
@@ -10,6 +10,8 @@ def completer_test(bind, pry=nil, assert_flag=true)
10
10
  return proc {|*symbols| symbols.each(&test) }
11
11
  end
12
12
 
13
+ Pry.require_readline
14
+
13
15
  if defined?(Bond) && Readline::VERSION !~ /editline/i
14
16
  describe 'bond-based completion' do
15
17
  it 'should pull in Bond by default' do
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.12.4
4
+ version: 0.9.12.5
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: 2013-11-24 00:00:00.000000000 Z
13
+ date: 2014-01-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coderay
@@ -96,20 +96,6 @@ dependencies:
96
96
  - - ~>
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0.9'
99
- - !ruby/object:Gem::Dependency
100
- name: guard
101
- requirement: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - ~>
104
- - !ruby/object:Gem::Version
105
- version: 1.3.2
106
- type: :development
107
- prerelease: false
108
- version_requirements: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - ~>
111
- - !ruby/object:Gem::Version
112
- version: 1.3.2
113
99
  - !ruby/object:Gem::Dependency
114
100
  name: mocha
115
101
  requirement: !ruby/object:Gem::Requirement
@@ -155,7 +141,6 @@ files:
155
141
  - CHANGELOG
156
142
  - CONTRIBUTORS
157
143
  - Gemfile
158
- - Guardfile
159
144
  - LICENSE
160
145
  - README.markdown
161
146
  - Rakefile
@@ -343,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
343
328
  version: '0'
344
329
  requirements: []
345
330
  rubyforge_project:
346
- rubygems_version: 2.0.14
331
+ rubygems_version: 2.2.1
347
332
  signing_key:
348
333
  specification_version: 4
349
334
  summary: An IRB alternative and runtime developer console
data/Guardfile DELETED
@@ -1,62 +0,0 @@
1
- require 'guard/guard'
2
-
3
- module ::Guard
4
- class Bacon < Guard
5
- def run_all
6
- system "rake spec"
7
- puts
8
- true
9
- end
10
-
11
- def run_on_changes(paths)
12
- paths.delete('some_lib')
13
- puts "Running: #{paths.join ' '}"
14
- if paths.size.zero?
15
- warn 'Running all tests'
16
- system 'rake recspec'
17
- else
18
- paths.each do |path|
19
- warn "Running #{path}"
20
- system "rake spec run=#{path}" or return
21
- warn "\e[32;1mNice!!\e[0m Now running all specs, just to be sure."
22
- run_all
23
- end
24
- end
25
- end
26
- end
27
- end
28
-
29
- guard 'bacon' do
30
- def deduce_spec_from(token)
31
- %W(
32
- spec/#{token}_spec.rb
33
- spec/pry_#{token}_spec.rb
34
- spec/commands/#{token}_spec.rb
35
- ).each do |e|
36
- return e if File.exists? e
37
- end
38
- nil
39
- end
40
-
41
- Dir['lib/pry/**/*.rb'].each do |rb|
42
- rb[%r(lib/pry/(.+)\.rb$)]
43
- spec_rb = deduce_spec_from($1)
44
- if spec_rb
45
- # run as 'bundle exec guard -d' to see these.
46
- ::Guard::UI.debug "'#{rb}' maps to '#{spec_rb}'"
47
- else
48
- ::Guard::UI.debug "No map, so run all for: '#{rb}'"
49
- end
50
- next unless spec_rb
51
- watch(rb) do |m| spec_rb end
52
- end
53
-
54
- watch(%r{^lib/.+\.rb$}) do |m|
55
- return if deduce_spec_from(m[0])
56
- 'some_lib'
57
- end
58
-
59
- watch(%r{^spec/.+\.rb$}) do |m| m end
60
- end
61
-
62
- # vim:ft=ruby