funk_hands 1.5.0 → 2.0.0

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
  SHA256:
3
- metadata.gz: b5fd4daf03a9dbe72d9706ef7b5a3d524cc1acc839236eebf0173d99c44e4062
4
- data.tar.gz: bb293f27d8d0672f60fd9014565dc4dd6d5626769af6bba55c6444c38e09539f
3
+ metadata.gz: 9b767a0fd1432f3f77e2f5d2efd21a083dd269dcb76baf695e1cf49a9a6a0d29
4
+ data.tar.gz: 20d6a66b7fb724d233676e5cde198a35e6e79f383e234765c35187bc80bd8fba
5
5
  SHA512:
6
- metadata.gz: 3008c6c44a94ea4e35eb97704d70a6cba5e9868d0603e291fc0cc1533c9f6fbd4d3220f0a8f541e342650ed3d2d51aeebd91f942147de7acd941b382788aa564
7
- data.tar.gz: b034f7cba65ac25b2b53e8050edd1b48e71be6e3a0743d715922983d12a935e1d63ad930d33c8b6482f638a73400081b3e05930eea0ee535c2fd0242abd44013
6
+ metadata.gz: 3e299da70760635b89a099c29d2271008a0d5cf8562a81fb2582237df3af3ea0eec370dcb273aebbefb9cd66ec9494a71d184e5c0e7e93a8b3c9f8d7c4791913
7
+ data.tar.gz: f1b2490159619399114f21c680b45a19d02813c00d6cc2040e016484d00e809634f0adfbe5b2139e59c4a44813044e8b10c1b03cffd2416faadb209bb57e3878
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.0.0 (2023-12-07)
2
+
3
+ * Dropped Pry prompt modifications, Hirb and awesome_print, coolline, coderay
4
+
1
5
  ## 1.5.0 (2023-06-23)
2
6
 
3
7
  * Added support for the new module_parent_name method, required by
data/README.md CHANGED
@@ -10,20 +10,14 @@ hard-working hands!
10
10
  **funk_hands** is an opinionated set of console-related gems and a bit of glue:
11
11
 
12
12
  * [**Pry**][pry] for a powerful shell alternative to IRB.
13
- * [**Awesome Print**][awesome_print] for stylish pretty print.
14
- * [**Hirb**][hirb] for tabular collection output.
15
13
  * [**Pry Rails**][pry-rails] for additional commands (`show-routes`,
16
14
  `show-models`, `show-middleware`) in the Rails console.
17
- * [**Pry Doc**][pry-doc] to browse Ruby source, including C, directly from the
18
- console.
19
- * [**Pry Remote**][pry-remote] to connect remotely to a Pry console.
20
- * [**Pry Byebug**][pry-byebug] to turn the console into a debugger.
21
- * [**Coolline**][coolline] and [**Coderay**][coderay] for syntax highlighting as
22
- you type. _Optional. MRI 1.9.3/2.0.0 only_
15
+ * [**Pry Remote**][pry-remote-reloaded] to connect remotely to a Pry console.
16
+ * [**Pry Byebug**][pry-byebug-reloaded] to turn the console into a debugger.
23
17
 
24
18
  ## Usage
25
19
 
26
- Ruby 2.0+, Rails 3+. Add to your project Gemfile:
20
+ Ruby 2.0+, Rails 5+. Add to your project Gemfile:
27
21
 
28
22
  ```ruby
29
23
  group :development, :test do
@@ -33,62 +27,15 @@ end
33
27
 
34
28
  That's it. Run `rails console` as usual.
35
29
 
36
- [Hirb][hirb] isn't enabled by default. To use, run `Hirb.enable` in the console.
37
-
38
- Ruby compiled against a proper readline library, ideally GNU readline, is
39
- recommended. Alternatively, [`gem install rb-readline`][rb-readline] for an
40
- acceptible backup. Using ruby compiled against a `libedit` wrapper (primarily OS
41
- X) will work but is not recommended.
42
-
43
- ## Options
44
-
45
- Change the following options by creating an initializer in your Rails project
46
- Example `config/initializers/funk_hands.rb`:
47
-
48
- ```ruby
49
- if defined?(FunkHands)
50
- FunkHands.colored_prompt = false
51
- FunkHands.enable_syntax_highlighting_as_you_type!
52
- end
53
- ```
54
-
55
- ### `colored_prompt`
56
-
57
- Color the console prompt? Defaults to `true` when the current ruby is compiled
58
- against GNU readline or `rb-readline`, which don't have issues counting
59
- characters in colored prompts. `false` for libedit.
60
-
61
- Note: `Pry.color = false` trumps this setting and disables all console coloring.
62
-
63
- ### `prompt_separator`
64
-
65
- Separator string between the application name and line input. Defaults to `»`
66
- for GNU readline or libedit. Defaults to `>` for `rb-readline` which fails on
67
- mixed encodings.
68
-
69
- ### Syntax highlighting
70
-
71
- Syntax highlighting as you type via [Coolline][coolline] and [Coderay][coderay]
72
- is disabled by default due to slightly buggy behavior. To enable, add
73
- `FunkHands.enable_syntax_highlighting_as_you_type!` to the initializer. Only
74
- works with MRI 1.9.3 or 2.0.0.
75
-
76
30
  ## Contributing
77
31
 
78
32
  Patches and bug reports are welcome. Just send a [pull request][pullrequests] or
79
33
  file an [issue][issues]. [Project changelog][changelog].
80
34
 
81
35
  [pry]: http://pry.github.com
82
- [awesome_print]: https://github.com/michaeldv/awesome_print
83
- [hirb]: https://github.com/cldwalker/hirb
84
36
  [pry-rails]: https://github.com/rweng/pry-rails
85
- [pry-doc]: https://github.com/pry/pry-doc
86
- [pry-byebug]: https://github.com/deivid-rodriguez/pry-byebug
87
- [pry-remote]: https://github.com/Mon-Ouie/pry-remote
37
+ [pry-byebug-reloaded]: https://github.com/Jack12816/pry-byebug-reloaded
88
38
  [pry-remote-reloaded]: https://github.com/Jack12816/pry-remote-reloaded
89
- [coolline]: https://github.com/Mon-Ouie/coolline
90
- [coderay]: https://github.com/rubychan/coderay
91
- [rb-readline]: https://github.com/luislavena/rb-readline
92
- [pullrequests]: https://github.com/Jack12816/jazz_hands/pulls
93
- [issues]: https://github.com/Jack12816/jazz_hands/issues
94
- [changelog]: https://github.com/Jack12816/jazz_hands/blob/master/CHANGELOG.md
39
+ [pullrequests]: https://github.com/Jack12816/funk_hands/pulls
40
+ [issues]: https://github.com/Jack12816/funk_hands/issues
41
+ [changelog]: https://github.com/Jack12816/funk_hands/blob/master/CHANGELOG.md
data/funk_hands.gemspec CHANGED
@@ -17,15 +17,11 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  gem.require_paths = ['lib']
19
19
 
20
+ gem.required_ruby_version = '>= 2.5'
21
+
20
22
  # Dependencies
21
- gem.required_ruby_version = '>= 1.9.2'
22
- gem.add_runtime_dependency 'pry', '>= 0.12.0'
23
+ gem.add_runtime_dependency 'pry', '>= 0.14.0'
23
24
  gem.add_runtime_dependency 'pry-rails', '>= 0.3.6'
24
- gem.add_runtime_dependency 'pry-doc', '>= 0.11.1'
25
- gem.add_runtime_dependency 'pry-remote-reloaded', '~> 1.0'
26
- gem.add_runtime_dependency 'pry-byebug', '>= 1.0'
27
- gem.add_runtime_dependency 'hirb', '>= 0.7.3'
28
- gem.add_runtime_dependency 'coolline', '>= 0.4.2'
29
- gem.add_runtime_dependency 'awesome_print', '~> 1.8'
30
- gem.add_runtime_dependency 'railties', '>= 3.0'
25
+ gem.add_runtime_dependency 'pry-remote-reloaded', '~> 1.1'
26
+ gem.add_runtime_dependency 'pry-byebug-reloaded', '~> 3.10'
31
27
  end
@@ -1,31 +1,9 @@
1
- require 'pry'
2
- require 'pry-rails'
3
- require 'pry-doc'
4
- require 'pry-remote-reloaded'
5
- require 'awesome_print'
6
- require 'funk_hands/hirb_ext'
7
- require 'pry-byebug'
1
+ # frozen_string_literal: true
8
2
 
9
3
  module FunkHands
10
4
  class Railtie < Rails::Railtie
11
- initializer 'Funk_hands.initialize' do |app|
5
+ initializer 'FunkHands.initialize' do |app|
12
6
  silence_warnings do
13
- # We're managing the loading of plugins. So don't let pry autoload them.
14
- Pry.config.should_load_plugins = false
15
-
16
- # Use awesome_print for output, but keep pry's pager. If Hirb is
17
- # enabled, try printing with it first.
18
- # See: https://github.com/pry/pry/blob/v0.11.3/lib/pry.rb#L20
19
- Pry.config.print = ->(output, value, _pry_) do
20
- if FunkHands._hirb_output
21
- return output.puts(Hirb::View.view_or_page_output(value))
22
- end
23
- if Pry.pager
24
- return Pry::DEFAULT_PRINT.call(output, value, _pry_)
25
- end
26
- output.puts("=> #{value.ai(indent: 2)}")
27
- end
28
-
29
7
  # Friendlier prompt - line number, app name, nesting levels look like
30
8
  # directory paths.
31
9
  #
@@ -36,7 +14,7 @@ module FunkHands
36
14
  # libraries (GNU, rb-readline) correctly ignore color codes when
37
15
  # calculating line length.
38
16
 
39
- color = -> { Pry.color && FunkHands.colored_prompt }
17
+ color = -> { Pry.color }
40
18
  red = ->(text) { color[] ? "\001\e[0;31m\002#{text}\001\e[0m\002" : text.to_s }
41
19
  blue = ->(text) { color[] ? "\001\e[0;34m\002#{text}\001\e[0m\002" : text.to_s }
42
20
  bold = ->(text) { color[] ? "\001\e[1m\002#{text}\001\e[0m\002" : text.to_s }
@@ -44,10 +22,10 @@ module FunkHands
44
22
  name = app.class.module_parent_name \
45
23
  if app.class.respond_to?(:module_parent_name)
46
24
  name ||= app.class.parent_name
47
- name = name.underscore
25
+ name = name.underscore.gsub('_', '-')
48
26
 
49
- separator = -> { red.(FunkHands.prompt_separator) }
50
- colored_name = -> { blue.(name) }
27
+ separator = red.(defined?(RbReadline) ? '>' : "\u00BB")
28
+ colored_name = blue.(name)
51
29
 
52
30
  line = ->(pry) { "[#{bold.(pry.input_ring.size)}] " }
53
31
  target_string = ->(object, level) do
@@ -59,19 +37,26 @@ module FunkHands
59
37
  end
60
38
  end
61
39
 
62
- Pry.config.prompt = [
63
- ->(object, level, pry) do # Main prompt
64
- "#{line.(pry)}#{colored_name.()}#{target_string.(object, level)} #{separator.()} "
65
- end,
66
- ->(object, level, pry) do # Wait prompt in multiline input
67
- spaces = ' ' * (
68
- "[#{pry.input_ring.size}] ".size + # Uncolored `line.(pry)`
69
- name.size +
70
- target_string.(object, level).size
71
- )
72
- "#{spaces} #{separator.()} "
73
- end
74
- ]
40
+ Pry.config.prompt = Pry::Prompt.new(
41
+ 'funk_hands',
42
+ 'funk_hands',
43
+ [
44
+ # Main prompt
45
+ proc do |object, level, pry|
46
+ "#{line.(pry)}#{colored_name}#{target_string.(object, level)} #{separator} "
47
+ end,
48
+
49
+ # Wait prompt in multiline input
50
+ proc do |object, level, pry|
51
+ spaces = ' ' * (
52
+ "[#{pry.input_ring.size}] ".size + # Uncolored `line.(pry)`
53
+ name.size +
54
+ target_string.(object, level).size
55
+ )
56
+ "#{spaces} #{separator.()} "
57
+ end
58
+ ]
59
+ )
75
60
  end
76
61
  end
77
62
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FunkHands
2
- VERSION = '1.5.0'
4
+ VERSION = '2.0.0'
3
5
  end
data/lib/funk_hands.rb CHANGED
@@ -1,66 +1,14 @@
1
- require 'funk_hands/version'
2
- require 'funk_hands/railtie' if defined?(Rails)
1
+ # frozen_string_literal: true
2
+
3
3
  require 'active_support'
4
4
  require 'readline'
5
+ require 'pry'
6
+ require 'pry-rails'
7
+ require 'pry-byebug'
8
+ require 'pry-byebug/pry_remote_ext'
9
+ require 'pry-remote-reloaded'
5
10
 
6
- module FunkHands
7
-
8
- ### Options ###
9
-
10
- # Color the prompt?
11
- #
12
- # A different setting than Pry.color since some may like colored output, but a
13
- # plain prompt.
14
- #
15
- # Default: 'true' for GNU readline or rb-readline which correctly count line
16
- # widths with color codes when using \001 and \002 hints. 'false' for
17
- # libedit-based wrapper (standard on OS X unless ruby is explicitly compiled
18
- # otherwise).
19
- #
20
- mattr_accessor :colored_prompt
21
- self.colored_prompt = (Readline::VERSION !~ /EditLine/)
22
-
23
- # Separator between application name and input in the prompt.
24
- #
25
- # Default: right angle quote, or '>' when using rb-readline which doesn't
26
- # handle mixed encodings well.
27
- #
28
- mattr_accessor :prompt_separator
29
- self.prompt_separator = defined?(RbReadline) ? '>' : "\u00BB"
30
-
31
-
32
- class << self
33
- # Enable syntax highlighting as you type in the Rails console via coolline and
34
- # coderay (MRI 1.9.3+ only). Disabled by default as it's a bit buggy.
35
- #
36
- # Call from a Rails initializer:
37
- #
38
- # FunkHands.enable_syntax_highlighting_as_you_type!
39
- #
40
- def enable_syntax_highlighting_as_you_type!
41
- raise 'Syntax highlighting only supported on 1.9.3+' unless RUBY_VERSION >= '1.9.3'
11
+ module FunkHands; end
42
12
 
43
- # Use coolline with CodeRay for syntax highlighting as you type.
44
- # Only works on >= 1.9.3 because coolline depends on io/console.
45
-
46
- require 'coolline'
47
- require 'coderay'
48
-
49
- Pry.config.input = Coolline.new do |c|
50
- c.transform_proc = proc do
51
- CodeRay.scan(c.line, :ruby).term
52
- end
53
-
54
- c.completion_proc = proc do
55
- word = c.completed_word
56
- Object.constants.map(&:to_s).select { |w| w.start_with? word }
57
- end
58
- end
59
- end
60
- alias :enable_syntax_highlighting_as_you_type :enable_syntax_highlighting_as_you_type!
61
- end
62
-
63
- ### Internal methods ###
64
-
65
- mattr_accessor :_hirb_output
66
- end
13
+ require 'funk_hands/version'
14
+ require 'funk_hands/railtie' if defined?(Rails)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: funk_hands
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gopal Patel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-23 00:00:00.000000000 Z
11
+ date: 2023-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.0
19
+ version: 0.14.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.12.0
26
+ version: 0.14.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,104 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.3.6
41
- - !ruby/object:Gem::Dependency
42
- name: pry-doc
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 0.11.1
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 0.11.1
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: pry-remote-reloaded
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '1.0'
47
+ version: '1.1'
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '1.0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-byebug
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '1.0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '1.0'
54
+ version: '1.1'
83
55
  - !ruby/object:Gem::Dependency
84
- name: hirb
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: 0.7.3
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 0.7.3
97
- - !ruby/object:Gem::Dependency
98
- name: coolline
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: 0.4.2
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: 0.4.2
111
- - !ruby/object:Gem::Dependency
112
- name: awesome_print
56
+ name: pry-byebug-reloaded
113
57
  requirement: !ruby/object:Gem::Requirement
114
58
  requirements:
115
59
  - - "~>"
116
60
  - !ruby/object:Gem::Version
117
- version: '1.8'
61
+ version: '3.10'
118
62
  type: :runtime
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
65
  requirements:
122
66
  - - "~>"
123
67
  - !ruby/object:Gem::Version
124
- version: '1.8'
125
- - !ruby/object:Gem::Dependency
126
- name: railties
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '3.0'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '3.0'
68
+ version: '3.10'
139
69
  description: Spending hours in the rails console? Spruce it up and show off those
140
70
  hard-working hands! funk_hands replaces IRB with Pry, improves output through awesome_print,
141
71
  and has some other goodies up its sleeves.
@@ -152,7 +82,6 @@ files:
152
82
  - Rakefile
153
83
  - funk_hands.gemspec
154
84
  - lib/funk_hands.rb
155
- - lib/funk_hands/hirb_ext.rb
156
85
  - lib/funk_hands/railtie.rb
157
86
  - lib/funk_hands/version.rb
158
87
  homepage: https://github.com/Jack12816/funk_hands
@@ -167,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
96
  requirements:
168
97
  - - ">="
169
98
  - !ruby/object:Gem::Version
170
- version: 1.9.2
99
+ version: '2.5'
171
100
  required_rubygems_version: !ruby/object:Gem::Requirement
172
101
  requirements:
173
102
  - - ">="
@@ -1,18 +0,0 @@
1
- require 'hirb'
2
- require 'pry'
3
-
4
- class << Hirb::View
5
- alias_method :enable_output_method_existing, :enable_output_method
6
- alias_method :disable_output_method_existing, :disable_output_method
7
-
8
- def enable_output_method
9
- @output_method = true
10
- FunkHands._hirb_output = true
11
- enable_output_method_existing
12
- end
13
-
14
- def disable_output_method
15
- FunkHands._hirb_output = false
16
- disable_output_method_existing
17
- end
18
- end