spirit_hands 2.0.5 → 2.0.6

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: 1002bc8ffae4d6917d0455dfd5ebe5784de8e624
4
- data.tar.gz: 55c7b46bf8bd1431b281c1f3b8fde723afb5840a
3
+ metadata.gz: 590845694422a0817c0bce736814bed5e67635bb
4
+ data.tar.gz: 4615aca411d314b8cc77e013a6688dc02e0f0a5e
5
5
  SHA512:
6
- metadata.gz: 7b01ec935415a93cb93dc12e67c2311a8de91a156ca349fb5a123af9c0c5a1e0a3d1fd666302a1b5ea362304f7b4f402d7b49937e83cddc654fc8676b2dfd5c2
7
- data.tar.gz: 7ffeebd3e3a8c4c5f915925b7f50a86e4a0d73f4d4065a17e02d23d6b9c805507c6e9ec533db5e1133ca6775c07648cd0a425dbd9f1bf8e22fcc5cf90130dbec
6
+ metadata.gz: fbea8143374a525caaea715c409100f7c24067936488b4ce359a8437db1d87bce4ac41faa0120f889c05b85a7822f544702750916c4372a7fbaff71b668f7032
7
+ data.tar.gz: d223bf632976c6605907096dda0b136ebe5075a80ab3f0b20c8ec0032cd2404d1972d28fb115d0b5ba935a66ae3393c8e4d398a5f068db0f73d55cc3d2633304
checksums.yaml.gz.sig CHANGED
Binary file
@@ -2,24 +2,22 @@
2
2
  require 'hirb'
3
3
  require 'pry'
4
4
 
5
- module Hirb
6
- class << self
7
- @enabled = false
8
- def enabled?
9
- !!@enabled
10
- end
5
+ class << Hirb
6
+ @enabled = false
7
+ def enabled?
8
+ !!@enabled
9
+ end
11
10
 
12
- protected
11
+ protected
13
12
 
14
- def set_enabled
15
- @enabled = true
16
- end
13
+ def set_enabled
14
+ @enabled = true
15
+ end
17
16
 
18
- def set_disabled
19
- @enabled = false
20
- end
17
+ def set_disabled
18
+ @enabled = false
21
19
  end
22
- end
20
+ end # Hirb.self
23
21
 
24
22
  class << Hirb::View
25
23
  alias_method :enable_output_method_existing, :enable_output_method
@@ -35,4 +33,4 @@ class << Hirb::View
35
33
  ::Hirb.send :set_disabled
36
34
  disable_output_method_existing
37
35
  end
38
- end
36
+ end # Hirb::View.self
@@ -140,5 +140,5 @@ module Hirb
140
140
  def resize(width, height) #:nodoc:
141
141
  @width, @height = View.determine_terminal_size(width, height)
142
142
  end
143
- end
144
- end
143
+ end # Pager
144
+ end # Hirb
@@ -1,23 +1,19 @@
1
1
  require 'hirb'
2
2
  require 'pathname'
3
3
 
4
- module Hirb
5
- module Util
6
- class << self
7
- # Determines if a shell command exists by searching for it in ENV['PATH'].
8
- # (Fixed version)
9
- def command_exists?(command)
10
- if c = Pathname.new(command)
11
- return true if c.absolute? && c.exist?
12
- end
13
- executable_file_exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
14
- ENV['PATH'].split(File::PATH_SEPARATOR).any? do |d|
15
- executable_file_exts.any? do |ext|
16
- f = File.expand_path(command + ext, d)
17
- File.executable?(f) && !File.directory?(f)
18
- end
19
- end
4
+ class << Hirb::Util
5
+ # Determines if a shell command exists by searching for it in ENV['PATH'].
6
+ # (Fixed version)
7
+ def command_exists?(command)
8
+ if c = Pathname.new(command)
9
+ return true if c.absolute? && c.exist?
10
+ end
11
+ executable_file_exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
12
+ ENV['PATH'].split(File::PATH_SEPARATOR).any? do |d|
13
+ executable_file_exts.any? do |ext|
14
+ f = File.expand_path(command + ext, d)
15
+ File.executable?(f) && !File.directory?(f)
20
16
  end
21
17
  end
22
18
  end
23
- end
19
+ end # Hirb::Util.self
@@ -7,4 +7,4 @@ class << Hirb::View
7
7
  view_output(str) ||
8
8
  page_output(::SpiritHands::Print.pretty(str), true)
9
9
  end
10
- end
10
+ end # Hirb::View.self
@@ -41,8 +41,4 @@ class Module
41
41
  end
42
42
  end
43
43
  end
44
-
45
- private
46
-
47
- NO_OP = -> { }.freeze
48
- end
44
+ end # Module
@@ -1,41 +1,24 @@
1
1
  require 'pry'
2
2
 
3
- # We're managing the loading of plugins. So don't let pry autoload them.
4
- ::Pry.config.should_load_plugins = false
5
-
6
- if defined? ::Rails
7
- STDERR.puts 'JF pry-rails' if ENV['SPIRIT_FINGERS_PLUGIN_DEBUG']
8
- require 'pry-rails'
9
- end
10
-
11
- module SpiritHands
12
- autoload :Print, 'spirit_hands/print'
13
- autoload :Prompt, 'spirit_hands/prompt'
14
-
15
- class << self
16
- @installed = false
17
- # This modifies pry to play our tune
18
- def melody!(app = nil)
19
- return false if @installed
20
-
21
- # Require all of our pry plugins
22
- require 'spirit_hands/load_plugins'
23
-
24
- setup_less_colorize
25
- setup_less_show_raw_unicode
26
- setup_hirb
27
-
28
- # Use awesome_print for output, but keep pry's pager. If Hirb is
29
- # enabled, try printing with it first.
30
- ::SpiritHands::Print.install!
31
-
32
- # Friendlier prompt - line number, app name, nesting levels look like
33
- # directory paths.
34
- #
35
- # Configuration (like Pry.color) can be changed later or even during console usage.
36
- ::SpiritHands::Prompt.install!(app)
37
-
38
- @installed = true
39
- end
3
+ class << SpiritHands
4
+ # This modifies pry to play our tune
5
+ def melody!(app = nil)
6
+ return false if @installed
7
+ @installed = true
8
+
9
+ SpiritHands.app = app unless app.nil?
10
+ setup_less_colorize
11
+ setup_less_show_raw_unicode
12
+ setup_hirb
13
+
14
+ # Use awesome_print for output, but keep pry's pager. If Hirb is
15
+ # enabled, try printing with it first.
16
+ ::SpiritHands::Print.install!
17
+
18
+ # Friendlier prompt - line number, app name, nesting levels look like
19
+ # directory paths.
20
+ #
21
+ # Configuration (like Pry.color) can be changed later or even during console usage.
22
+ ::SpiritHands::Prompt.install!
40
23
  end
41
- end
24
+ end # SpiritHands.self
@@ -1,12 +1,10 @@
1
- module SpiritHands
2
- class << self
3
- # Alias for Pry.color
4
- def color
5
- ::Pry.color
6
- end
1
+ class << SpiritHands
2
+ # Alias for Pry.color
3
+ def color
4
+ ::Pry.color
5
+ end
7
6
 
8
- def color=(v)
9
- ::Pry.color = v
10
- end
7
+ def color=(v)
8
+ ::Pry.color = v
11
9
  end
12
- end
10
+ end # SpiritHands.self
@@ -1,7 +1,12 @@
1
1
  require 'shellwords'
2
2
 
3
3
  module SpiritHands
4
+ DEFAULT_LESS_COLORIZE = true
5
+ LESS_R_LONG = '--RAW-CONTROL-CHARS'.freeze
6
+ LESS_R = /\A(.*-[^-R]*)R(.*)\z/.freeze
7
+
4
8
  class << self
9
+
5
10
  # Allow less to display colorized output (default: true)
6
11
  # (If, set updates LESS env var)
7
12
  def less_colorize
@@ -33,10 +38,4 @@ module SpiritHands
33
38
  self.less_colorize = nil unless @less_colorize
34
39
  end
35
40
  end
36
-
37
- private
38
-
39
- DEFAULT_LESS_COLORIZE = true
40
- LESS_R_LONG = '--RAW-CONTROL-CHARS'.freeze
41
- LESS_R = /\A(.*-[^-R]*)R(.*)\z/.freeze
42
41
  end
@@ -1,6 +1,9 @@
1
1
  require 'shellwords'
2
2
 
3
3
  module SpiritHands
4
+ DEFAULT_LESS_SHOW_RAW_UNICODE = true
5
+ LESS_SHOW_RAW_BINFMT = '*n%c'.freeze
6
+
4
7
  class << self
5
8
  # Allow less to display colorized output (default: true)
6
9
  # (If, set updates LESS env var)
@@ -30,9 +33,4 @@ module SpiritHands
30
33
  self.less_show_raw_unicode = nil unless @less_show_raw_unicode
31
34
  end
32
35
  end
33
-
34
- private
35
-
36
- DEFAULT_LESS_SHOW_RAW_UNICODE = true
37
- LESS_SHOW_RAW_BINFMT = '*n%c'.freeze
38
36
  end
@@ -6,8 +6,6 @@ require 'spirit_hands/options/less'
6
6
  require 'spirit_hands/options/hirb'
7
7
 
8
8
  module SpiritHands
9
- autoload :Terminal, 'spirit_hands/terminal'
10
-
11
9
  ### Options ###
12
10
 
13
11
  # When printing values, start with this (default: '=> ')
@@ -1,6 +1,10 @@
1
1
  module SpiritHands
2
2
  module Print
3
3
  class << self
4
+ PRINT_FUNCTION = ->(_output, value, _pry_) do
5
+ ::SpiritHands::Print.print(_output, value, _pry_)
6
+ end
7
+
4
8
  def install!
5
9
  ::Pry.config.print = PRINT_FUNCTION
6
10
  end
@@ -34,10 +38,6 @@ module SpiritHands
34
38
 
35
39
  private
36
40
 
37
- PRINT_FUNCTION = ->(_output, value, _pry_) do
38
- ::SpiritHands::Print.print(_output, value, _pry_)
39
- end
40
-
41
41
  def hirb_unicode_enable
42
42
  return false unless ::SpiritHands::Terminal.unicode?
43
43
  require 'hirb/unicode'
@@ -67,6 +67,6 @@ module SpiritHands
67
67
  end
68
68
  nil
69
69
  end
70
- end
71
- end
72
- end
70
+ end # self
71
+ end # Print
72
+ end # SpiritHands
@@ -0,0 +1,231 @@
1
+ module SpiritHands
2
+ module Prompt
3
+ # <....>
4
+ # <..../>
5
+ # </....>
6
+ #
7
+ class Render
8
+ # <tag> ... </tag>, tag -> inner part of escape codes
9
+ MATCHED_TAG_CODES = {
10
+ 'b' => 1,
11
+ 'bold' => 1,
12
+ 'bright' => 1,
13
+ 'strong' => 1,
14
+
15
+ 'dark' => 2,
16
+ 'faint' => 2,
17
+
18
+ 'i' => 3,
19
+ 'italic' => 3,
20
+ 'em' => 3,
21
+
22
+ 'u' => 4,
23
+ 'underline' => 4,
24
+
25
+ 'blink' => 5, # evil
26
+ 'flash' => 5,
27
+
28
+ 'rapid-blink' => 6, # sinister
29
+ 'rapid-flash' => 6,
30
+
31
+ 'reverse' => 7,
32
+ 'negative' => 7,
33
+ 'inverse' => 7,
34
+
35
+ 'concealed' => 8,
36
+
37
+ 'strike' => 9,
38
+ 'strikethrough' => 9,
39
+
40
+ 'black' => 30,
41
+ 'red' => 31,
42
+ 'green' => 32,
43
+ 'yellow' => 33,
44
+ 'blue' => 34,
45
+ 'magenta' => 35,
46
+ 'cyan' => 36,
47
+ 'white' => 37,
48
+
49
+ 'bgblack' => 40,
50
+ 'bgred' => 41,
51
+ 'bggreen' => 42,
52
+ 'bgyellow' => 43,
53
+ 'bgblue' => 44,
54
+ 'bgmagenta' => 45,
55
+ 'bgcyan' => 46,
56
+ 'bgwhite' => 47,
57
+ }
58
+
59
+ # <.../>
60
+ SINGLE_TAGS = {
61
+ # <cmd/>: command number
62
+ 'cmd' => ->(state) { state.pry.input_array.size },
63
+
64
+ # <tgt/>: target string
65
+ 'tgt' => ->(state) {
66
+ unless (str = Pry.view_clip(state.object)) == 'main'
67
+ state.level = 0 if state.level < 0
68
+ "(#{'../' * state.level}#{str})"
69
+ else
70
+ ''
71
+ end
72
+ },
73
+
74
+ # <app/>: state.app (Object) converted to String
75
+ 'app' => ->(state) {
76
+ app = state.app
77
+ if app.class.respond_to?(:parent_name) && \
78
+ app.class.parent_name.respond_to?(:underscore)
79
+ app.class.parent_name.underscore
80
+ elsif app
81
+ app.to_s
82
+ else
83
+ ::SpiritHands.app
84
+ end
85
+ },
86
+
87
+ # <sep/>: SpiritHands.prompt_separator
88
+ 'sep' => ->(_state) {
89
+ ::SpiritHands.prompt_separator
90
+ }
91
+ }
92
+
93
+ # Array<String>
94
+ attr_reader :errors
95
+
96
+ def errors?
97
+ errors.any?
98
+ end
99
+
100
+ # :state SpiritHands::Prompt::State
101
+ # :prompt String
102
+ # :color true or false/nil
103
+ def initialize(state, prompt, color)
104
+ @state = state
105
+ @prompt = prompt
106
+ @color = color
107
+ end
108
+
109
+ def to_s
110
+ @errors = []
111
+ @tag_stack = []
112
+ @result = ''
113
+ @color_applied = false
114
+ @in_tag = false
115
+
116
+ @prompt.each_char do |c|
117
+ if @in_tag
118
+ tag_char(c)
119
+ else
120
+ nontag_char(c)
121
+ end
122
+ end
123
+
124
+ # @tag_stack.any? --> error/s
125
+ @tag_stack.each { |t| errors << "<#{t}>: Missing </#{t}>" }
126
+
127
+ (errors?) ? '' : @result
128
+ end
129
+
130
+ private
131
+
132
+ def tag_char(c)
133
+ case c
134
+ when '/'
135
+ # close: </
136
+ # single <.+/
137
+ @tag_type = (@tag.nil? || @tag.empty?) ? :close : :single
138
+ when '>' # close tag
139
+ @tag.downcase!
140
+ send @tag_type # :start, :close or :single
141
+ @in_tag = false
142
+ else # append to existing tag
143
+ @tag += c
144
+ end
145
+ end
146
+
147
+ def nontag_char(c)
148
+ if @escape
149
+ nontag_escaped_char(c)
150
+ else
151
+ nontag_unescaped_char(c)
152
+ end
153
+ end
154
+
155
+ def nontag_escaped_char(c)
156
+ @escape = false
157
+ @result += (@state.multiline) ? ' ' : c
158
+ end
159
+
160
+ def nontag_unescaped_char(c)
161
+ case c
162
+ when '\\' # escape next char
163
+ @escape = true
164
+ when '<' # start tag
165
+ @in_tag = true
166
+ @tag_type = :start
167
+ @tag = ''
168
+ else # normal char
169
+ @result += (@state.multiline) ? ' ' : c
170
+ end
171
+ end
172
+
173
+ # <...>
174
+ def start
175
+ code = MATCHED_TAG_CODES[@tag]
176
+ if !code
177
+ errors << "Unknown <#{@tag}>"
178
+ return
179
+ end
180
+ @result += esc(code)
181
+ @tag_stack << @tag
182
+ end
183
+
184
+ # </...>
185
+ def close
186
+ code = MATCHED_TAG_CODES[@tag]
187
+ if !code
188
+ errors << "Unknown </#{@tag}>"
189
+ return
190
+ end
191
+ idx = @tag_stack.rindex @tag
192
+ if idx.nil?
193
+ errors << "</#{@tag}>: missing start <#{@tag}>"
194
+ return
195
+ end
196
+ # remove the now closed tag from the stack
197
+ @tag_stack.delete_at idx
198
+ # reset and reapply all codes on the @tag_stack
199
+ @result += reset
200
+ @tag_stack.each { |tag| @result += esc(MATCHED_TAG_CODES[tag]) }
201
+ end
202
+
203
+ # <.../>
204
+ def single
205
+ f = SINGLE_TAGS[@tag]
206
+ if !f
207
+ errors << "Unknown </#{@tag}>"
208
+ return
209
+ end
210
+ result = f.(@state).to_s
211
+
212
+ # blank out all but sep for multiline prompt, vs. main (normal)
213
+ if @state.multiline && @tag != 'sep'
214
+ result = ' ' * result.length
215
+ end
216
+ @result += result
217
+ end
218
+
219
+ def reset
220
+ esc(0)
221
+ end
222
+
223
+ # convert a code to an actual character
224
+ def esc(code)
225
+ return '' if !@color
226
+ @color_applied = true
227
+ "\001\e[#{code}m\002".freeze
228
+ end
229
+ end # Render
230
+ end # Prompt
231
+ end # SpiritHands
@@ -1,15 +1,18 @@
1
1
  module SpiritHands
2
2
  module Prompt
3
+ autoload :Render, 'spirit_hands/prompt/base/render'
4
+
3
5
  class << self
4
6
  private
5
7
 
8
+
6
9
  def render(state, prompt, color = true)
7
10
  r = Render.new(state, prompt, color)
8
11
  res = r.to_s
9
12
  STDERR.puts "\n" + (r.errors * "\n") + "\n" if r.errors?
10
13
  res
11
14
  end
12
- end
15
+ end # self
13
16
 
14
17
  # :object Object
15
18
  # :level Fixnum
@@ -17,233 +20,5 @@ module SpiritHands
17
20
  # :app String or Rails::Application
18
21
  # :multiline false: normal prompt, true: multiline prompt
19
22
  State = Struct.new(:object, :level, :pry, :app, :multiline)
20
-
21
- # <....>
22
- # <..../>
23
- # </....>
24
- #
25
- class Render
26
- # <tag> ... </tag>, tag -> inner part of escape codes
27
- MATCHED_TAG_CODES = {
28
- 'b' => 1,
29
- 'bold' => 1,
30
- 'bright' => 1,
31
- 'strong' => 1,
32
-
33
- 'dark' => 2,
34
- 'faint' => 2,
35
-
36
- 'i' => 3,
37
- 'italic' => 3,
38
- 'em' => 3,
39
-
40
- 'u' => 4,
41
- 'underline' => 4,
42
-
43
- 'blink' => 5, # evil
44
- 'flash' => 5,
45
-
46
- 'rapid-blink' => 6, # sinister
47
- 'rapid-flash' => 6,
48
-
49
- 'reverse' => 7,
50
- 'negative' => 7,
51
- 'inverse' => 7,
52
-
53
- 'concealed' => 8,
54
-
55
- 'strike' => 9,
56
- 'strikethrough' => 9,
57
-
58
- 'black' => 30,
59
- 'red' => 31,
60
- 'green' => 32,
61
- 'yellow' => 33,
62
- 'blue' => 34,
63
- 'magenta' => 35,
64
- 'cyan' => 36,
65
- 'white' => 37,
66
-
67
- 'bgblack' => 40,
68
- 'bgred' => 41,
69
- 'bggreen' => 42,
70
- 'bgyellow' => 43,
71
- 'bgblue' => 44,
72
- 'bgmagenta' => 45,
73
- 'bgcyan' => 46,
74
- 'bgwhite' => 47,
75
- }
76
-
77
- # <.../>
78
- SINGLE_TAGS = {
79
- # <cmd/>: command number
80
- 'cmd' => ->(state) { state.pry.input_array.size },
81
-
82
- # <tgt/>: target string
83
- 'tgt' => ->(state) {
84
- unless (str = Pry.view_clip(state.object)) == 'main'
85
- state.level = 0 if state.level < 0
86
- "(#{'../' * state.level}#{str})"
87
- else
88
- ''
89
- end
90
- },
91
-
92
- # <app/>: state.app (Object) converted to String
93
- 'app' => ->(state) {
94
- app = state.app
95
- if app.class.respond_to?(:parent_name) && \
96
- app.class.parent_name.respond_to?(:underscore)
97
- app.class.parent_name.underscore
98
- elsif app
99
- app.to_s
100
- else
101
- ::SpiritHands.app
102
- end
103
- },
104
-
105
- # <sep/>: SpiritHands.prompt_separator
106
- 'sep' => ->(_state) {
107
- ::SpiritHands.prompt_separator
108
- }
109
- }
110
-
111
- # Array<String>
112
- attr_reader :errors
113
-
114
- def errors?
115
- errors.any?
116
- end
117
-
118
- # :state SpiritHands::Prompt::State
119
- # :prompt String
120
- # :color true or false/nil
121
- def initialize(state, prompt, color)
122
- @state = state
123
- @prompt = prompt
124
- @color = color
125
- end
126
-
127
- def to_s
128
- @errors = []
129
- @tag_stack = []
130
- @result = ''
131
- @color_applied = false
132
- @in_tag = false
133
-
134
- @prompt.each_char do |c|
135
- if @in_tag
136
- tag_char(c)
137
- else
138
- nontag_char(c)
139
- end
140
- end
141
-
142
- # @tag_stack.any? --> error/s
143
- @tag_stack.each { |t| errors << "<#{t}>: Missing </#{t}>" }
144
-
145
- (errors?) ? '' : @result
146
- end
147
-
148
- private
149
-
150
- def tag_char(c)
151
- case c
152
- when '/'
153
- # close: </
154
- # single <.+/
155
- @tag_type = (@tag.nil? || @tag.empty?) ? :close : :single
156
- when '>' # close tag
157
- @tag.downcase!
158
- send @tag_type # :start, :close or :single
159
- @in_tag = false
160
- else # append to existing tag
161
- @tag += c
162
- end
163
- end
164
-
165
- def nontag_char(c)
166
- if @escape
167
- nontag_escaped_char(c)
168
- else
169
- nontag_unescaped_char(c)
170
- end
171
- end
172
-
173
- def nontag_escaped_char(c)
174
- @escape = false
175
- @result += (@state.multiline) ? ' ' : c
176
- end
177
-
178
- def nontag_unescaped_char(c)
179
- case c
180
- when '\\' # escape next char
181
- @escape = true
182
- when '<' # start tag
183
- @in_tag = true
184
- @tag_type = :start
185
- @tag = ''
186
- else # normal char
187
- @result += (@state.multiline) ? ' ' : c
188
- end
189
- end
190
-
191
- # <...>
192
- def start
193
- code = MATCHED_TAG_CODES[@tag]
194
- if !code
195
- errors << "Unknown <#{@tag}>"
196
- return
197
- end
198
- @result += esc(code)
199
- @tag_stack << @tag
200
- end
201
-
202
- # </...>
203
- def close
204
- code = MATCHED_TAG_CODES[@tag]
205
- if !code
206
- errors << "Unknown </#{@tag}>"
207
- return
208
- end
209
- idx = @tag_stack.rindex @tag
210
- if idx.nil?
211
- errors << "</#{@tag}>: missing start <#{@tag}>"
212
- return
213
- end
214
- # remove the now closed tag from the stack
215
- @tag_stack.delete_at idx
216
- # reset and reapply all codes on the @tag_stack
217
- @result += reset
218
- @tag_stack.each { |tag| @result += esc(MATCHED_TAG_CODES[tag]) }
219
- end
220
-
221
- # <.../>
222
- def single
223
- f = SINGLE_TAGS[@tag]
224
- if !f
225
- errors << "Unknown </#{@tag}>"
226
- return
227
- end
228
- result = f.(@state).to_s
229
-
230
- # blank out all but sep for multiline prompt, vs. main (normal)
231
- if @state.multiline && @tag != 'sep'
232
- result = ' ' * result.length
233
- end
234
- @result += result
235
- end
236
-
237
- def reset
238
- esc(0)
239
- end
240
-
241
- # convert a code to an actual character
242
- def esc(code)
243
- return '' if !@color
244
- @color_applied = true
245
- "\001\e[#{code}m\002".freeze
246
- end
247
- end
248
- end
249
- end
23
+ end # Prompt
24
+ end # SpiritHands
@@ -4,9 +4,9 @@ require 'spirit_hands/prompt/multiline'
4
4
  module SpiritHands
5
5
  module Prompt
6
6
  class << self
7
- def install!(app = nil)
7
+ def install!
8
8
  ::Pry.config.prompt = [ main, multiline ].freeze
9
9
  end
10
- end
11
- end
12
- end
10
+ end # self
11
+ end # Prompt
12
+ end # SpiritHands
@@ -4,4 +4,4 @@ class Railtie < Rails::Railtie
4
4
  ::SpiritHands.melody!(app)
5
5
  end
6
6
  end
7
- end
7
+ end # Railtie
@@ -1,3 +1,3 @@
1
1
  module SpiritHands
2
- VERSION = '2.0.5'
2
+ VERSION = '2.0.6'
3
3
  end
data/lib/spirit_hands.rb CHANGED
@@ -1,13 +1,21 @@
1
1
  # Do this to use SpiritHands outside Rails
2
2
  #
3
3
  # # .pryrc
4
+ # require 'spirit_hands'
4
5
  # # ...
5
- # SpiritHands.melody!
6
6
  #
7
7
  #
8
8
  module SpiritHands
9
- autoload :VERSION, 'spirit_hands/version'
9
+ autoload :VERSION, 'spirit_hands/version'
10
+ autoload :Print, 'spirit_hands/print'
11
+ autoload :Prompt, 'spirit_hands/prompt'
12
+ autoload :Terminal, 'spirit_hands/terminal'
10
13
  end
14
+
11
15
  require 'spirit_hands/options'
12
16
  require 'spirit_hands/melody'
13
- require 'spirit_hands/railtie' if defined? ::Rails
17
+ if defined? ::Rails
18
+ require 'spirit_hands/railtie'
19
+ else
20
+ SpiritHands.melody!
21
+ 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.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barry Allard
@@ -41,7 +41,7 @@ cert_chain:
41
41
  TE/ChTQStrIVMKgW+FbU3E6AmrM6HcwTi7mwsDM8S36y2NZ5DVaZPCpvkiTDgPSW
42
42
  t/HWh1yhriCUe/y8+De8M87btOs=
43
43
  -----END CERTIFICATE-----
44
- date: 2015-08-27 00:00:00.000000000 Z
44
+ date: 2015-09-10 00:00:00.000000000 Z
45
45
  dependencies:
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: pry
@@ -209,7 +209,6 @@ files:
209
209
  - lib/spirit_hands/hirb/fixes/pager.rb
210
210
  - lib/spirit_hands/hirb/fixes/util.rb
211
211
  - lib/spirit_hands/hirb/fixes/view.rb
212
- - lib/spirit_hands/load_plugins.rb
213
212
  - lib/spirit_hands/mattr_accessor_with_default.rb
214
213
  - lib/spirit_hands/melody.rb
215
214
  - lib/spirit_hands/options.rb
@@ -218,10 +217,10 @@ files:
218
217
  - lib/spirit_hands/options/less.rb
219
218
  - lib/spirit_hands/options/less/colorize.rb
220
219
  - lib/spirit_hands/options/less/show_raw_unicode.rb
221
- - lib/spirit_hands/plugin.rb
222
220
  - lib/spirit_hands/print.rb
223
221
  - lib/spirit_hands/prompt.rb
224
222
  - lib/spirit_hands/prompt/base.rb
223
+ - lib/spirit_hands/prompt/base/render.rb
225
224
  - lib/spirit_hands/prompt/main.rb
226
225
  - lib/spirit_hands/prompt/multiline.rb
227
226
  - lib/spirit_hands/railtie.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,10 +0,0 @@
1
- require 'spirit_hands/plugin'
2
-
3
- # awesome_print is autoloaded by Hirb::View patch and/or SpiritHands::Print
4
- # pry was loaded earlier
5
- SpiritHands.plugin 'pry-coolline'
6
- SpiritHands.plugin 'pry-doc'
7
- SpiritHands.plugin 'pry-git'
8
- # pry-rails was loaded earlier (if needed)
9
- SpiritHands.plugin 'pry-remote'
10
- # hirb is autoloaded by SpiritHands.hirb = true
@@ -1,28 +0,0 @@
1
- module SpiritHands
2
- class << self
3
- # A thin wrapper around require for troubleshooting
4
- def plugin(*requires)
5
- cond = requires.pop if requires.last.respond_to? :call
6
- requires.each do |r|
7
- begin
8
- if cond && !cond.()
9
- plugin_debug "JF require #{r} (skipped)"
10
- next
11
- end
12
- res = require r
13
- rescue LoadError
14
- plugin_debug "JF require #{r} FAILED"
15
- else
16
- plugin_debug "JF require #{r} -> #{res}"
17
- end
18
- end
19
- end
20
-
21
- private
22
-
23
- def plugin_debug(*args)
24
- return if !ENV['SPIRIT_FINGERS_PLUGIN_DEBUG']
25
- STDERR.puts(*args)
26
- end
27
- end
28
- end