spirit_hands 2.1.1 → 2.1.3

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: 7aa7bbd9fad87fa0953ca912bb32c1fb02fd9946
4
- data.tar.gz: d8d12590be0d0ca1dc4ad5e1e6300b21fdb71e7a
3
+ metadata.gz: a188f19cfea293256ed5686225cf5a4e5a8940e2
4
+ data.tar.gz: 66d00406a3c10f1f56553e00f8e93f4ac730ba74
5
5
  SHA512:
6
- metadata.gz: d6184cfb06afb91e91b62e79fe6c79efb37419e8d950a9021b9b5679b0d53b8a3f74eb290e5d445f75d936aa2585d563ea3085db6f0c41b3d98628a128420cb0
7
- data.tar.gz: a39e844f8835d72c0a5a61a20eb9a2fb1f3bd2715c16a5522d0084f4714d1ee7cb666505f1943d0029ee6b5c3ddf808d6bcb36e68795c198e0d7d6f8b58c2be9
6
+ metadata.gz: 2bff4bf6b2745acc52008d68c67f9e97421f0f0031d2b68a94c07ee9a9b702b64e6cbc32c76f1fbe1c1231ddef9200f62ec63ab729833019dbf5666b273a58c0
7
+ data.tar.gz: 8d8ca39c9aa492b4c11f1fc77fc3c7f06d909df5084369445db83537abb12a8b28ce4dd97a833fbfced9635c7cfe700575db1f6df4c2801aa6e6072a774cab20
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 2.1.0 (2016-11-19)
2
+ * Remove [pry-remote][pry-remote]
3
+
1
4
  ## 2.0.0 (2015-05-27)
2
5
  * Way more configurable
3
6
 
data/CONTRIBUTORS.md CHANGED
@@ -1,10 +1,12 @@
1
+ # Current Maintainers
2
+ * Barry Allard <barry.allard@gmail.com>
3
+
1
4
  # Original Author
2
5
  * Gopal Patel <nixme@stillhope.com>
3
6
 
4
- # Contributors
7
+ # Past Contributors
5
8
  * Andrew Volozhanin <linuxheadrus@gmail.com>
6
9
  * Casey Lang <hello@casey-lang.com>
7
10
  * Fernando Paredes <nano@fdp.io>
8
11
  * Micah Gates <github@mgates.com>
9
12
  * Paulo Henrique Lopes Ribeiro <plribeiro3000@gmail.com>
10
- * Barry Allard <barry.allard@gmail.com>
@@ -6,10 +6,16 @@ class << SpiritHands
6
6
  return false if @installed
7
7
  @installed = true
8
8
 
9
+ Pry.config.should_load_plugins = false
9
10
  SpiritHands.app = app unless app.nil?
10
11
  setup_less_colorize
11
12
  setup_less_show_raw_unicode
12
13
  setup_hirb
14
+ disable_remote
15
+ setup_coolline # setup Pry.config.input
16
+ setup_nav
17
+ setup_byebug
18
+ setup_doc
13
19
 
14
20
  # Use awesome_print for output, but keep pry's pager. If Hirb is
15
21
  # enabled, try printing with it first.
@@ -21,4 +27,42 @@ class << SpiritHands
21
27
  # Configuration (like Pry.color) can be changed later or even during console usage.
22
28
  ::SpiritHands::Prompt.install!
23
29
  end
30
+
31
+ private
32
+
33
+ def setup_nav
34
+ return if Pry.plugins['nav'].is_a? Pry::PluginManager::NoPlugin
35
+ require 'pry-nav'
36
+ if jruby?
37
+ Pry.plugins['nav'].activate!
38
+ else
39
+ Pry.plugins['nav'].disable!
40
+ end
41
+ rescue LoadError
42
+ end
43
+
44
+ def setup_byebug
45
+ return if Pry.plugins['byebug'].is_a? Pry::PluginManager::NoPlugin
46
+ require 'pry-byebug'
47
+ if jruby?
48
+ Pry.plugins['byebug'].disable!
49
+ else
50
+ Pry.plugins['byebug'].activate!
51
+ end
52
+ rescue LoadError
53
+ end
54
+
55
+ def setup_doc
56
+ require 'pry-doc'
57
+ Pry.plugins['doc'].activate!
58
+ end
59
+
60
+ def disable_remote
61
+ return if Pry.plugins['remote'].is_a? Pry::PluginManager::NoPlugin
62
+ Pry.plugins['remote'].disable!
63
+ end
64
+
65
+ def jruby?
66
+ RUBY_ENGINE == 'jruby'
67
+ end
24
68
  end # SpiritHands.self
@@ -0,0 +1,67 @@
1
+ module SpiritHands
2
+ class << self
3
+ # Is cooline enabled?
4
+ def coolline
5
+ @coolline = DEFAULT_COOLLINE if @coolline.nil?
6
+ @coolline
7
+ end
8
+
9
+ # Set whether hirb is enabled (default: true)
10
+ def coolline=(c)
11
+ c = DEFAULT_COOLLINE if c.nil?
12
+ @coolline = !!c
13
+ end
14
+
15
+ protected
16
+
17
+ def install_coolline!
18
+ return if coolline_installed?
19
+ @orig_input ||= Pry.input
20
+ @orig_completer ||= Pry.config.completer
21
+ require 'pry-coolline'
22
+ Pry.plugins['coolline'].activate!
23
+ begin
24
+ require 'pry-bond'
25
+ Pry.plugins['bond'].activate!
26
+ rescue LoadError
27
+ end
28
+ @coolline_input ||= Pry.input
29
+ @coolline_completer ||= Pry.config.completer
30
+ Pry.config.completer = @coolline_completer
31
+ Pry.input = @coolline_input
32
+ end
33
+
34
+ def uninstall_coolline!
35
+ return unless coolline_installed?
36
+ Pry.plugins['coolline'].disable!
37
+ if !Pry.plugins['bond'].is_a? Pry::PluginManager::NoPlugin
38
+ Pry.plugins['bond'].disable!
39
+ end
40
+ Pry.config.completer = @orig_completer
41
+ Pry.input = @orig_input
42
+ end
43
+
44
+ def coolline_installed?
45
+ !@orig_input.nil? && @orig_input != Pry.input
46
+ end
47
+
48
+ def setup_coolline!
49
+ if SpiritHands.coolline
50
+ SpiritHands.install_coolline!
51
+ else
52
+ SpiritHands.uninstall_coolline!
53
+ end
54
+ end
55
+
56
+ def setup_coolline
57
+ Pry.hooks.add_hook(:after_read, "setup_coolline0") do |code, pry|
58
+ setup_coolline!
59
+ end
60
+ Pry.hooks.add_hook(:before_session, "setup_coolline1") do |output, binding, pry|
61
+ setup_coolline!
62
+ end
63
+ end
64
+ end
65
+
66
+ DEFAULT_COOLLINE = false # TODO: fix pry-coolline and/or integration
67
+ end
@@ -1,6 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require 'readline'
3
3
  require 'spirit_hands/mattr_accessor_with_default'
4
+ require 'spirit_hands/options/coolline'
4
5
  require 'spirit_hands/options/color'
5
6
  require 'spirit_hands/options/less'
6
7
  require 'spirit_hands/options/hirb'
@@ -56,4 +57,21 @@ module SpiritHands
56
57
 
57
58
  # Enable or disable AwesomePrint (default: true)
58
59
  mattr_accessor_with_default :awesome_print, true
60
+
61
+ def self.app_name
62
+ if app.class.respond_to?(:parent_name) && \
63
+ app.class.parent_name.respond_to?(:underscore)
64
+ app.class.parent_name.underscore
65
+ elsif app
66
+ app.to_s
67
+ else
68
+ ::SpiritHands.app
69
+ end
70
+ end
71
+
72
+ def self.config
73
+ c = SpiritHands.singleton_methods.select { |x| x != :config && x =~ /\A[a-z_]+\z/ }
74
+ .map { |k| [k, (k == :app) ? app_name : SpiritHands.public_send(k)] }
75
+ Hash[c]
76
+ end
59
77
  end
@@ -1,3 +1,5 @@
1
+ require 'awesome_print'
2
+
1
3
  module SpiritHands
2
4
  module Print
3
5
  class << self
@@ -11,7 +13,6 @@ module SpiritHands
11
13
 
12
14
  def pretty(value)
13
15
  if ::SpiritHands.awesome_print
14
- require 'awesome_print' unless defined?(AwesomePrint)
15
16
  opts = { :indent => ::SpiritHands.value_indent }
16
17
  opts[:plain] = true if !SpiritHands.color
17
18
  value.ai(opts)
@@ -1,3 +1,3 @@
1
1
  module SpiritHands
2
- VERSION = '2.1.1'
2
+ VERSION = '2.1.3'
3
3
  end
data/lib/spirit_hands.rb CHANGED
@@ -17,6 +17,7 @@ require 'spirit_hands/melody'
17
17
  if defined? ::Rails
18
18
  require 'pry-rails'
19
19
  require 'spirit_hands/railtie'
20
+ Pry.plugins['rails'].activate!
20
21
  else
21
22
  SpiritHands.melody!
22
23
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spirit_hands
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barry Allard
@@ -41,7 +41,7 @@ cert_chain:
41
41
  b4WKJs00+KO3etYQG7qD/wH7WEwu3QoLNapYz58Jc0OsDnwBWW0IDPSAFsENoTcY
42
42
  8m+dgfPonsYSqnDDfLuAmtKhLAA=
43
43
  -----END CERTIFICATE-----
44
- date: 2016-11-20 00:00:00.000000000 Z
44
+ date: 2016-11-23 00:00:00.000000000 Z
45
45
  dependencies:
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: pry
@@ -191,6 +191,7 @@ files:
191
191
  - lib/spirit_hands/melody.rb
192
192
  - lib/spirit_hands/options.rb
193
193
  - lib/spirit_hands/options/color.rb
194
+ - lib/spirit_hands/options/coolline.rb
194
195
  - lib/spirit_hands/options/hirb.rb
195
196
  - lib/spirit_hands/options/less.rb
196
197
  - lib/spirit_hands/options/less/colorize.rb
@@ -226,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
227
  version: '0'
227
228
  requirements: []
228
229
  rubyforge_project:
229
- rubygems_version: 2.6.7
230
+ rubygems_version: 2.5.2
230
231
  signing_key:
231
232
  specification_version: 4
232
233
  summary: Exercise those fingers. Pry-based enhancements for the default Rails console.
metadata.gz.sig CHANGED
Binary file