funk_hands 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +134 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +93 -0
- data/Rakefile +3 -0
- data/funk_hands.gemspec +31 -0
- data/lib/funk_hands/hirb_ext.rb +18 -0
- data/lib/funk_hands/railtie.rb +74 -0
- data/lib/funk_hands/version.rb +3 -0
- data/lib/funk_hands.rb +66 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 305076cbe3e5e8bec4776908b89b58cfd76c8172
|
4
|
+
data.tar.gz: 75f2ebea243efa9ce363406ab605231bb64efd8f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3d04d53dbd6bba2e30b34e8c7343182f6c6c61781edac558bc9b8e9910a562470c9c4d74ed158270edad43078bf7c0bbe7f6f261132a5d1f47ac3c9bc6504285
|
7
|
+
data.tar.gz: fe10b66478beca391cb638b37e479990f11f16920214b19f7884be1b9fe073881eefa0b65e1a0a9af2e09ddb1dffdb1c084eda3fb1383ccb8551c3c428e5c3fc
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
## 1.0.0 (2017-12-11)
|
2
|
+
|
3
|
+
* Removed [pry-stack_explorer][pry-stack_explorer]
|
4
|
+
* Removed [pry-git][pry-git]
|
5
|
+
* Removed [pry-debugger][pry-debugger]
|
6
|
+
* Added [pry-byebug][pry-byebug]
|
7
|
+
* Upgraded all dependencies
|
8
|
+
* Fixed the custom Pry.config.print proc
|
9
|
+
* Improved the Pry prompt
|
10
|
+
|
11
|
+
## 0.5.2 (2013-10-24)
|
12
|
+
|
13
|
+
* Upgrade [pry-rails][pry-rails] to the latest 0.3.2,
|
14
|
+
[awesome_print][awesome_print] to 1.2 and loosen it's dependency, and removed
|
15
|
+
[coderay][coderay] as an explicit dependency since [pry][pry] already includes
|
16
|
+
it.
|
17
|
+
|
18
|
+
## 0.5.1 (2013-06-28)
|
19
|
+
|
20
|
+
* Upgrade [pry-rails][pry-rails] to the latest 0.3.1, [pry-doc][pry-doc] 0.4.6,
|
21
|
+
[coolline][coolline] 0.4.2.
|
22
|
+
|
23
|
+
|
24
|
+
## 0.5.0 (2013-03-13)
|
25
|
+
|
26
|
+
* Rails 4, Ruby 2.0.0 compatibility.
|
27
|
+
* Upgrade [pry][pry] to the latest 0.9.12,
|
28
|
+
[pry-stack_explorer][pry-stack_explorer] 0.4.9, [pry-remote][pry-remote]
|
29
|
+
0.1.7, [pry-debugger][pry-debugger] 0.2.2, [hirb][hirb] 0.7.1,
|
30
|
+
[coderay][coderay] 1.0.9.
|
31
|
+
|
32
|
+
|
33
|
+
## 0.4.0 (2012-12-27)
|
34
|
+
|
35
|
+
* Add [pry-rails][pry-rails] 0.2.2 for maintained console hooks and new
|
36
|
+
`show-routes`, `show-models`, and `show-middleware` commands.
|
37
|
+
* Add `JazzHands.colored_prompt` and `JazzHands.prompt_separator` options.
|
38
|
+
Detect readline library to turn off incompatible colored prompt or Unicode
|
39
|
+
prompt separator where appropriate. Fixes #1 and #2.
|
40
|
+
* Upgrade [pry][pry] to the latest 0.9.10, [pry-doc][pry-doc] 0.4.4,
|
41
|
+
[pry-stack_explorer][pry-stack_explorer] 0.4.7, [pry-remote][pry-remote]
|
42
|
+
0.1.6, [pry-debugger][pry-debugger] 0.2.1, [hirb][hirb] 0.7.0,
|
43
|
+
[Coolline][coolline] 0.4.0, [coderay][coderay] 1.0.8,
|
44
|
+
[awesome_print][awesome_print] 1.1.0. Fixes #4.
|
45
|
+
|
46
|
+
## 0.3.1 (2012-06-11)
|
47
|
+
|
48
|
+
* Upgrade [pry-debugger][pry-debugger] to 0.2.0.
|
49
|
+
|
50
|
+
## 0.3.0 (2012-06-07)
|
51
|
+
|
52
|
+
* Replace [pry-nav][pry-nav] with [pry-debugger][pry-debugger] for improved
|
53
|
+
performance and no segfaults. `JazzHands.enable_pry_nav` removed.
|
54
|
+
* Upgrade [pry][pry] to the latest 0.9.9, [pry-doc][pry-doc] 0.4.2,
|
55
|
+
[pry-git][pry-git] 0.2.3, [pry-stack_explorer][pry-stack_explorer] 0.4.2,
|
56
|
+
[pry-remote][pry-remote] 0.1.4, [coderay][coderay] 1.0.6.
|
57
|
+
|
58
|
+
## 0.2.0 (2012-03-19)
|
59
|
+
|
60
|
+
* Add [pry-stack_explorer][pry-stack_explorer] 0.4.1.
|
61
|
+
* Upgrade [pry-remote][pry-remote] to 0.1.1 and [pry-nav][pry-nav] to 0.2.0.
|
62
|
+
* Upgrade recommended gem minor versions: [pry][pry] 0.9.8.4, [pry-doc][pry-doc]
|
63
|
+
0.4.1, [hirb][hirb] 0.6.2, and [coderay][coderay] 1.0.5.
|
64
|
+
|
65
|
+
## 0.1.2 (2012-01-23)
|
66
|
+
|
67
|
+
* Improved Rails 3.2 compatibility. Console methods like `app`, `new_session`,
|
68
|
+
`reload!`, `helper`, and `controller` work as expected.
|
69
|
+
|
70
|
+
## 0.1.1 (2012-01-20)
|
71
|
+
|
72
|
+
* Rails 3.2 compatibility
|
73
|
+
|
74
|
+
## 0.1.0 (2012-01-04)
|
75
|
+
|
76
|
+
* For performance, enable [pry-nav][pry-nav] only on MRI 1.9.3 by default. To
|
77
|
+
use on MRI 1.9.2, add `JazzHands.enable_pry_nav` to a Rails initializer.
|
78
|
+
* Due to buggy behavior, syntax highlighting as you type via
|
79
|
+
[Coolline][coolline] and [Coderay][coderay] is disabled by default. Enable
|
80
|
+
with `JazzHands.enable_syntax_highlighting_as_you_type` in a Rails
|
81
|
+
initializer. MRI 1.9.3 only.
|
82
|
+
* Fix [Hirb][hirb] support.
|
83
|
+
* Upgrade [awesome_print][awesome_print] to 1.0.2.
|
84
|
+
|
85
|
+
## 0.0.6 (2011-12-03)
|
86
|
+
|
87
|
+
* Add line numbers to the prompt for easy reference when using `_in_` and
|
88
|
+
`_out`.
|
89
|
+
* Upgrade [pry-nav][pry-nav] to 0.0.4.
|
90
|
+
|
91
|
+
|
92
|
+
## 0.0.5 (2011-12-01)
|
93
|
+
|
94
|
+
* Add [Hirb][hirb] support. Enable with `Hirb.enable` in the console.
|
95
|
+
* Upgrade [pry-nav][pry-nav] to 0.0.3.
|
96
|
+
|
97
|
+
|
98
|
+
## 0.0.4 (2011-11-30)
|
99
|
+
|
100
|
+
* Add explicit requires for pry plugin gems.
|
101
|
+
|
102
|
+
|
103
|
+
## 0.0.3 (2011-11-30)
|
104
|
+
|
105
|
+
* Add [pry-nav][pry-nav].
|
106
|
+
* Upgrade [awesome_print][awesome_print] to 1.0.1.
|
107
|
+
|
108
|
+
|
109
|
+
## 0.0.2 (2011-11-25)
|
110
|
+
|
111
|
+
* Add [pry-doc][pry-doc].
|
112
|
+
|
113
|
+
|
114
|
+
## 0.0.1 (2011-11-25)
|
115
|
+
|
116
|
+
* First release. Combine [pry][pry], [awesome_print][awesome_print],
|
117
|
+
[coolline][coolline] + [coderay][coderay], [pry-remote][pry-remote],
|
118
|
+
[pry-git][pry-git]. Bit of glue to replace IRB with pry in Rails console,
|
119
|
+
pretty colors.
|
120
|
+
|
121
|
+
|
122
|
+
[pry]: http://pry.github.com
|
123
|
+
[awesome_print]: https://github.com/michaeldv/awesome_print
|
124
|
+
[pry-doc]: https://github.com/pry/pry-doc
|
125
|
+
[pry-git]: https://github.com/pry/pry-git
|
126
|
+
[pry-nav]: https://github.com/nixme/pry-nav
|
127
|
+
[pry-remote]: https://github.com/Mon-Ouie/pry-remote
|
128
|
+
[coolline]: https://github.com/Mon-Ouie/coolline
|
129
|
+
[coderay]: https://github.com/rubychan/coderay
|
130
|
+
[hirb]: https://github.com/cldwalker/hirb
|
131
|
+
[pry-stack_explorer]: https://github.com/pry/pry-stack_explorer
|
132
|
+
[pry-debugger]: https://github.com/nixme/pry-debugger
|
133
|
+
[pry-rails]: https://github.com/rweng/pry-rails
|
134
|
+
[pry-byebug]: https://github.com/deivid-rodriguez/pry-byebug
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
MIT License
|
2
|
+
Copyright (C) 2011 by Gopal Patel
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
12
|
+
all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
Funk Hands
|
2
|
+
==========
|
3
|
+
|
4
|
+
**Heads up!** Funk Hands is a updated fork of the [Jazz
|
5
|
+
Hands](https://github.com/nixme/jazz_hands) project.
|
6
|
+
|
7
|
+
Spending hours in the rails console? Spruce it up and show off those
|
8
|
+
hard-working hands!
|
9
|
+
|
10
|
+
**funk_hands** is an opinionated set of console-related gems and a bit of glue:
|
11
|
+
|
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
|
+
* [**Pry Rails**][pry-rails] for additional commands (`show-routes`,
|
16
|
+
`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_
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Ruby 2.0+, Rails 3+. Add to your project Gemfile:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
group :development, :test do
|
30
|
+
gem 'funk_hands'
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
That's it. Run `rails console` as usual.
|
35
|
+
|
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
|
+
## Contributing
|
77
|
+
|
78
|
+
Patches and bug reports are welcome. Just send a [pull request][pullrequests] or
|
79
|
+
file an [issue][issues]. [Project changelog][changelog].
|
80
|
+
|
81
|
+
[pry]: http://pry.github.com
|
82
|
+
[awesome_print]: https://github.com/michaeldv/awesome_print
|
83
|
+
[hirb]: https://github.com/cldwalker/hirb
|
84
|
+
[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
|
88
|
+
[coolline]: https://github.com/Mon-Ouie/coolline
|
89
|
+
[coderay]: https://github.com/rubychan/coderay
|
90
|
+
[rb-readline]: https://github.com/luislavena/rb-readline
|
91
|
+
[pullrequests]: https://github.com/Jack12816/jazz_hands/pulls
|
92
|
+
[issues]: https://github.com/Jack12816/jazz_hands/issues
|
93
|
+
[changelog]: https://github.com/Jack12816/jazz_hands/blob/master/CHANGELOG.md
|
data/Rakefile
ADDED
data/funk_hands.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path('../lib/funk_hands/version', __FILE__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = 'funk_hands'
|
7
|
+
gem.version = FunkHands::VERSION
|
8
|
+
gem.author = 'Gopal Patel'
|
9
|
+
gem.email = 'nixme@stillhope.com'
|
10
|
+
gem.license = 'MIT'
|
11
|
+
gem.homepage = 'https://github.com/Jack12816/funk_hands'
|
12
|
+
gem.summary = 'Exercise those fingers. Pry-based enhancements for the default Rails console.'
|
13
|
+
gem.description = "Spending hours in the rails console? Spruce it up and show off those hard-working hands! funk_hands replaces IRB with Pry, improves output through awesome_print, and has some other goodies up its sleeves."
|
14
|
+
|
15
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
|
20
|
+
# Dependencies
|
21
|
+
gem.required_ruby_version = '>= 1.9.2'
|
22
|
+
gem.add_runtime_dependency 'pry', '>= 0.9.12'
|
23
|
+
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', '>= 0.1.8'
|
26
|
+
gem.add_runtime_dependency 'pry-byebug', '~> 1.3'
|
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', '< 6.0'
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'pry-rails'
|
3
|
+
require 'pry-doc'
|
4
|
+
require 'pry-remote'
|
5
|
+
require 'awesome_print'
|
6
|
+
require 'funk_hands/hirb_ext'
|
7
|
+
require 'pry-byebug'
|
8
|
+
|
9
|
+
module FunkHands
|
10
|
+
class Railtie < Rails::Railtie
|
11
|
+
initializer 'Funk_hands.initialize' do |app|
|
12
|
+
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
|
+
# Friendlier prompt - line number, app name, nesting levels look like
|
30
|
+
# directory paths.
|
31
|
+
#
|
32
|
+
# Heavy use of lazy lambdas so configuration (like Pry.color) can be
|
33
|
+
# changed later or even during console usage.
|
34
|
+
#
|
35
|
+
# Custom color helpers using hints \001 and \002 so that good readline
|
36
|
+
# libraries (GNU, rb-readline) correctly ignore color codes when
|
37
|
+
# calculating line length.
|
38
|
+
|
39
|
+
color = -> { Pry.color && FunkHands.colored_prompt }
|
40
|
+
red = ->(text) { color[] ? "\001\e[0;31m\002#{text}\001\e[0m\002" : text.to_s }
|
41
|
+
blue = ->(text) { color[] ? "\001\e[0;34m\002#{text}\001\e[0m\002" : text.to_s }
|
42
|
+
bold = ->(text) { color[] ? "\001\e[1m\002#{text}\001\e[0m\002" : text.to_s }
|
43
|
+
|
44
|
+
separator = -> { red.(FunkHands.prompt_separator) }
|
45
|
+
name = app.class.parent_name.underscore
|
46
|
+
colored_name = -> { blue.(name) }
|
47
|
+
|
48
|
+
line = ->(pry) { "[#{bold.(pry.input_array.size)}] " }
|
49
|
+
target_string = ->(object, level) do
|
50
|
+
level = 0 if level < 0
|
51
|
+
unless (string = Pry.view_clip(object)) == 'main'
|
52
|
+
"(#{'../' * level}#{string})"
|
53
|
+
else
|
54
|
+
''
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
Pry.config.prompt = [
|
59
|
+
->(object, level, pry) do # Main prompt
|
60
|
+
"#{line.(pry)}#{colored_name.()}#{target_string.(object, level)} #{separator.()} "
|
61
|
+
end,
|
62
|
+
->(object, level, pry) do # Wait prompt in multiline input
|
63
|
+
spaces = ' ' * (
|
64
|
+
"[#{pry.input_array.size}] ".size + # Uncolored `line.(pry)`
|
65
|
+
name.size +
|
66
|
+
target_string.(object, level).size
|
67
|
+
)
|
68
|
+
"#{spaces} #{separator.()} "
|
69
|
+
end
|
70
|
+
]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/lib/funk_hands.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'funk_hands/version'
|
2
|
+
require 'funk_hands/railtie' if defined?(Rails)
|
3
|
+
require 'active_support'
|
4
|
+
require 'readline'
|
5
|
+
|
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'
|
42
|
+
|
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
|
metadata
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: funk_hands
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gopal Patel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.12
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.12
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.6
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-remote
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.8
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.1.8
|
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.3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !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
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.8'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !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
|
+
- - "<"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '6.0'
|
135
|
+
type: :runtime
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '3.0'
|
142
|
+
- - "<"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '6.0'
|
145
|
+
description: Spending hours in the rails console? Spruce it up and show off those
|
146
|
+
hard-working hands! funk_hands replaces IRB with Pry, improves output through awesome_print,
|
147
|
+
and has some other goodies up its sleeves.
|
148
|
+
email: nixme@stillhope.com
|
149
|
+
executables: []
|
150
|
+
extensions: []
|
151
|
+
extra_rdoc_files: []
|
152
|
+
files:
|
153
|
+
- ".gitignore"
|
154
|
+
- CHANGELOG.md
|
155
|
+
- Gemfile
|
156
|
+
- LICENSE
|
157
|
+
- README.md
|
158
|
+
- Rakefile
|
159
|
+
- funk_hands.gemspec
|
160
|
+
- lib/funk_hands.rb
|
161
|
+
- lib/funk_hands/hirb_ext.rb
|
162
|
+
- lib/funk_hands/railtie.rb
|
163
|
+
- lib/funk_hands/version.rb
|
164
|
+
homepage: https://github.com/Jack12816/funk_hands
|
165
|
+
licenses:
|
166
|
+
- MIT
|
167
|
+
metadata: {}
|
168
|
+
post_install_message:
|
169
|
+
rdoc_options: []
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: 1.9.2
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
requirements: []
|
183
|
+
rubyforge_project:
|
184
|
+
rubygems_version: 2.6.13
|
185
|
+
signing_key:
|
186
|
+
specification_version: 4
|
187
|
+
summary: Exercise those fingers. Pry-based enhancements for the default Rails console.
|
188
|
+
test_files: []
|