debbie 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +134 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +98 -0
- data/Rakefile +3 -0
- data/debbie.gemspec +30 -0
- data/lib/debbie/hirb_ext.rb +18 -0
- data/lib/debbie/railtie.rb +69 -0
- data/lib/debbie/version.rb +3 -0
- data/lib/debbie.rb +66 -0
- metadata +175 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
NjNhZTA4N2RhYTFlNGRjZjQ1YmM4ZDYxMzRlZTNlYjk2ODg3NjU0ZA==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
YmNlMWUxMTQyMjZjOTg1MzM4YjIxMzMwYjczMjljOWNjYTMzNTZjMw==
|
|
7
|
+
SHA512:
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
ZWUxNTQ3Yjg2NmUwODEzZjhiYjEwNDAzM2M3YmZiMjYxZGFjZGVmODlkZTJi
|
|
10
|
+
ZjNkZjAxODgzMmVlMTkyMWI0MTEwN2VkOGM4ZDFlZDM0NDg3OTAwZjdhNDFl
|
|
11
|
+
MGVlZThiZDE5MTYwMWNkYzJiYzA1NDgyZGYzY2JjMTBkNmY1MzI=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
MmNmZWNlYzc4NTM1MTRlMzZkNWRiNjI3OGEyNWE1ODMzNjViOWQzZDMyMmFh
|
|
14
|
+
NzBiZmU1YzY2MDMwYmRiYjIwODZjM2MxNGNmOTA5N2Q2ZTFlZDg0NmM0NzI4
|
|
15
|
+
MmIxMTU5ZDQ4ZmJlZmNmMzhiOGQyNDMzNTU5N2NmY2QwZjQ4ZTU=
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-1.9.3-p547
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
## 0.6.0 (2014-11-27)
|
|
2
|
+
|
|
3
|
+
* Rename from [jazz_hands][jazz_hands] to [debbie][debbie]
|
|
4
|
+
* Remove unused gems like,
|
|
5
|
+
- [**Pry Doc**][pry-doc] to browse Ruby source, including C, directly from the console.
|
|
6
|
+
- [**Pry Git**][pry-git] to teach the console about git. Diffs, blames, and
|
|
7
|
+
commits on methods and classes, not just files.
|
|
8
|
+
- [**Pry Debugger**][pry-debugger] to turn the console into a simple debugger.]
|
|
9
|
+
|
|
10
|
+
## 0.5.2 (2013-10-24)
|
|
11
|
+
|
|
12
|
+
* Upgrade [pry-rails][pry-rails] to the latest 0.3.2,
|
|
13
|
+
[awesome_print][awesome_print] to 1.2 and loosen it's dependency, and removed
|
|
14
|
+
[coderay][coderay] as an explicit dependency since [pry][pry] already includes
|
|
15
|
+
it.
|
|
16
|
+
|
|
17
|
+
## 0.5.1 (2013-06-28)
|
|
18
|
+
|
|
19
|
+
* Upgrade [pry-rails][pry-rails] to the latest 0.3.1, [pry-doc][pry-doc] 0.4.6,
|
|
20
|
+
[coolline][coolline] 0.4.2.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## 0.5.0 (2013-03-13)
|
|
24
|
+
|
|
25
|
+
* Rails 4, Ruby 2.0.0 compatibility.
|
|
26
|
+
* Upgrade [pry][pry] to the latest 0.9.12,
|
|
27
|
+
[pry-stack_explorer][pry-stack_explorer] 0.4.9, [pry-remote][pry-remote]
|
|
28
|
+
0.1.7, [pry-debugger][pry-debugger] 0.2.2, [hirb][hirb] 0.7.1,
|
|
29
|
+
[coderay][coderay] 1.0.9.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## 0.4.0 (2012-12-27)
|
|
33
|
+
|
|
34
|
+
* Add [pry-rails][pry-rails] 0.2.2 for maintained console hooks and new
|
|
35
|
+
`show-routes`, `show-models`, and `show-middleware` commands.
|
|
36
|
+
* Add `JazzHands.colored_prompt` and `JazzHands.prompt_separator` options.
|
|
37
|
+
Detect readline library to turn off incompatible colored prompt or Unicode
|
|
38
|
+
prompt separator where appropriate. Fixes #1 and #2.
|
|
39
|
+
* Upgrade [pry][pry] to the latest 0.9.10, [pry-doc][pry-doc] 0.4.4,
|
|
40
|
+
[pry-stack_explorer][pry-stack_explorer] 0.4.7, [pry-remote][pry-remote]
|
|
41
|
+
0.1.6, [pry-debugger][pry-debugger] 0.2.1, [hirb][hirb] 0.7.0,
|
|
42
|
+
[Coolline][coolline] 0.4.0, [coderay][coderay] 1.0.8,
|
|
43
|
+
[awesome_print][awesome_print] 1.1.0. Fixes #4.
|
|
44
|
+
|
|
45
|
+
## 0.3.1 (2012-06-11)
|
|
46
|
+
|
|
47
|
+
* Upgrade [pry-debugger][pry-debugger] to 0.2.0.
|
|
48
|
+
|
|
49
|
+
## 0.3.0 (2012-06-07)
|
|
50
|
+
|
|
51
|
+
* Replace [pry-nav][pry-nav] with [pry-debugger][pry-debugger] for improved
|
|
52
|
+
performance and no segfaults. `JazzHands.enable_pry_nav` removed.
|
|
53
|
+
* Upgrade [pry][pry] to the latest 0.9.9, [pry-doc][pry-doc] 0.4.2,
|
|
54
|
+
[pry-git][pry-git] 0.2.3, [pry-stack_explorer][pry-stack_explorer] 0.4.2,
|
|
55
|
+
[pry-remote][pry-remote] 0.1.4, [coderay][coderay] 1.0.6.
|
|
56
|
+
|
|
57
|
+
## 0.2.0 (2012-03-19)
|
|
58
|
+
|
|
59
|
+
* Add [pry-stack_explorer][pry-stack_explorer] 0.4.1.
|
|
60
|
+
* Upgrade [pry-remote][pry-remote] to 0.1.1 and [pry-nav][pry-nav] to 0.2.0.
|
|
61
|
+
* Upgrade recommended gem minor versions: [pry][pry] 0.9.8.4, [pry-doc][pry-doc]
|
|
62
|
+
0.4.1, [hirb][hirb] 0.6.2, and [coderay][coderay] 1.0.5.
|
|
63
|
+
|
|
64
|
+
## 0.1.2 (2012-01-23)
|
|
65
|
+
|
|
66
|
+
* Improved Rails 3.2 compatibility. Console methods like `app`, `new_session`,
|
|
67
|
+
`reload!`, `helper`, and `controller` work as expected.
|
|
68
|
+
|
|
69
|
+
## 0.1.1 (2012-01-20)
|
|
70
|
+
|
|
71
|
+
* Rails 3.2 compatibility
|
|
72
|
+
|
|
73
|
+
## 0.1.0 (2012-01-04)
|
|
74
|
+
|
|
75
|
+
* For performance, enable [pry-nav][pry-nav] only on MRI 1.9.3 by default. To
|
|
76
|
+
use on MRI 1.9.2, add `JazzHands.enable_pry_nav` to a Rails initializer.
|
|
77
|
+
* Due to buggy behavior, syntax highlighting as you type via
|
|
78
|
+
[Coolline][coolline] and [Coderay][coderay] is disabled by default. Enable
|
|
79
|
+
with `JazzHands.enable_syntax_highlighting_as_you_type` in a Rails
|
|
80
|
+
initializer. MRI 1.9.3 only.
|
|
81
|
+
* Fix [Hirb][hirb] support.
|
|
82
|
+
* Upgrade [awesome_print][awesome_print] to 1.0.2.
|
|
83
|
+
|
|
84
|
+
## 0.0.6 (2011-12-03)
|
|
85
|
+
|
|
86
|
+
* Add line numbers to the prompt for easy reference when using `_in_` and
|
|
87
|
+
`_out`.
|
|
88
|
+
* Upgrade [pry-nav][pry-nav] to 0.0.4.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## 0.0.5 (2011-12-01)
|
|
92
|
+
|
|
93
|
+
* Add [Hirb][hirb] support. Enable with `Hirb.enable` in the console.
|
|
94
|
+
* Upgrade [pry-nav][pry-nav] to 0.0.3.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## 0.0.4 (2011-11-30)
|
|
98
|
+
|
|
99
|
+
* Add explicit requires for pry plugin gems.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 0.0.3 (2011-11-30)
|
|
103
|
+
|
|
104
|
+
* Add [pry-nav][pry-nav].
|
|
105
|
+
* Upgrade [awesome_print][awesome_print] to 1.0.1.
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
## 0.0.2 (2011-11-25)
|
|
109
|
+
|
|
110
|
+
* Add [pry-doc][pry-doc].
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## 0.0.1 (2011-11-25)
|
|
114
|
+
|
|
115
|
+
* First release. Combine [pry][pry], [awesome_print][awesome_print],
|
|
116
|
+
[coolline][coolline] + [coderay][coderay], [pry-remote][pry-remote],
|
|
117
|
+
[pry-git][pry-git]. Bit of glue to replace IRB with pry in Rails console,
|
|
118
|
+
pretty colors.
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
[debbie]: https://github.com/goodpeople/debbie
|
|
122
|
+
[jazz_hands]: https://github.com/nixme/jazz_hands
|
|
123
|
+
[pry]: http://pry.github.com
|
|
124
|
+
[awesome_print]: https://github.com/michaeldv/awesome_print
|
|
125
|
+
[pry-doc]: https://github.com/pry/pry-doc
|
|
126
|
+
[pry-git]: https://github.com/pry/pry-git
|
|
127
|
+
[pry-nav]: https://github.com/nixme/pry-nav
|
|
128
|
+
[pry-remote]: https://github.com/Mon-Ouie/pry-remote
|
|
129
|
+
[coolline]: https://github.com/Mon-Ouie/coolline
|
|
130
|
+
[coderay]: https://github.com/rubychan/coderay
|
|
131
|
+
[hirb]: https://github.com/cldwalker/hirb
|
|
132
|
+
[pry-stack_explorer]: https://github.com/pry/pry-stack_explorer
|
|
133
|
+
[pry-debugger]: https://github.com/nixme/pry-debugger
|
|
134
|
+
[pry-rails]: https://github.com/rweng/pry-rails
|
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,98 @@
|
|
|
1
|
+
Debbie
|
|
2
|
+
==========
|
|
3
|
+
Fully based on the amazing work of [@nixme][nixme] (Gopal Patel) on his gem [**Jazz Hands**][jazz_hands]
|
|
4
|
+
|
|
5
|
+
__**We only removed some stuff that we're not using it and also remove some stuff that are not compatible with ruby > 2.0.0**__
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Spending hours in the rails console? Spruce it up and show off those
|
|
10
|
+
hard-working hands!
|
|
11
|
+
|
|
12
|
+
**debbie** is an opinionated set of console-related gems and a bit of glue:
|
|
13
|
+
|
|
14
|
+
* [**Pry**][pry] for a powerful shell alternative to IRB.
|
|
15
|
+
* [**Awesome Print**][awesome_print] for stylish pretty print.
|
|
16
|
+
* [**Hirb**][hirb] for tabular collection output.
|
|
17
|
+
* [**Pry Rails**][pry-rails] for additional commands (`show-routes`,
|
|
18
|
+
`show-models`, `show-middleware`) in the Rails console.
|
|
19
|
+
* [**Pry Stack Explorer**][pry-stack_explorer] to navigate the call stack and
|
|
20
|
+
frames.
|
|
21
|
+
* [**Pry Remote**][pry-remote] to connect remotely to a Pry console.
|
|
22
|
+
* [**Coolline**][coolline][**Coderay**][coderay] for syntax highlighting as
|
|
23
|
+
you type. _Optional. MRI 1.9.3/2.0.0 only_
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
Ruby 1.9.2+, Rails 3 or 4 only. Add to your project Gemfile:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
group :development, :test do
|
|
32
|
+
gem 'debbie', git: 'git@github.com:goodpeople/debbie.git'
|
|
33
|
+
end
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
That's it. Run `rails console` as usual.
|
|
37
|
+
|
|
38
|
+
[Hirb][hirb] isn't enabled by default. To use, run `Hirb.enable` in the console.
|
|
39
|
+
|
|
40
|
+
Ruby compiled against a proper readline library, ideally GNU readline, is
|
|
41
|
+
recommended. Alternatively, [`gem install rb-readline`][rb-readline] for an
|
|
42
|
+
acceptible backup. Using ruby compiled against a `libedit` wrapper (primarily OS
|
|
43
|
+
X) will work but is not recommended.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Options
|
|
47
|
+
|
|
48
|
+
Change the following options by creating an initializer in your Rails project
|
|
49
|
+
Example `config/initializers/debbie.rb`:
|
|
50
|
+
|
|
51
|
+
```ruby
|
|
52
|
+
if defined?(Debbie)
|
|
53
|
+
Debbie.colored_prompt = false
|
|
54
|
+
Debbie.enable_syntax_highlighting_as_you_type!
|
|
55
|
+
end
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `colored_prompt`
|
|
59
|
+
|
|
60
|
+
Color the console prompt? Defaults to `true` when the current ruby is compiled
|
|
61
|
+
against GNU readline or `rb-readline`, which don't have issues counting
|
|
62
|
+
characters in colored prompts. `false` for libedit.
|
|
63
|
+
|
|
64
|
+
Note: `Pry.color = false` trumps this setting and disables all console coloring.
|
|
65
|
+
|
|
66
|
+
### `prompt_separator`
|
|
67
|
+
|
|
68
|
+
Separator string between the application name and line input. Defaults to `»`
|
|
69
|
+
for GNU readline or libedit. Defaults to `>` for `rb-readline` which fails on
|
|
70
|
+
mixed encodings.
|
|
71
|
+
|
|
72
|
+
### Syntax highlighting
|
|
73
|
+
|
|
74
|
+
Syntax highlighting as you type via [Coolline][coolline] and [Coderay][coderay]
|
|
75
|
+
is disabled by default due to slightly buggy behavior. To enable, add
|
|
76
|
+
`Debbie.enable_syntax_highlighting_as_you_type!` to the initializer. Only
|
|
77
|
+
works with MRI 1.9.3 or 2.0.0.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
Patches and bug reports are welcome. Just send a [pull request][pullrequests] or
|
|
83
|
+
file an [issue][issues]. [Project changelog][changelog].
|
|
84
|
+
|
|
85
|
+
[nixme]: https://github.com/nixme
|
|
86
|
+
[jazz_hands]: https://github.com/nixme/jazz_hands
|
|
87
|
+
[pry]: http://pry.github.com
|
|
88
|
+
[awesome_print]: https://github.com/michaeldv/awesome_print
|
|
89
|
+
[hirb]: https://github.com/cldwalker/hirb
|
|
90
|
+
[pry-rails]: https://github.com/rweng/pry-rails
|
|
91
|
+
[pry-remote]: https://github.com/Mon-Ouie/pry-remote
|
|
92
|
+
[pry-stack_explorer]: https://github.com/pry/pry-stack_explorer
|
|
93
|
+
[coolline]: https://github.com/Mon-Ouie/coolline
|
|
94
|
+
[coderay]: https://github.com/rubychan/coderay
|
|
95
|
+
[rb-readline]: https://github.com/luislavena/rb-readline
|
|
96
|
+
[pullrequests]: https://github.com/goodpeople/debbie/pulls
|
|
97
|
+
[issues]: https://github.com/goodpeople/debbie/issues
|
|
98
|
+
[changelog]: https://github.com/goodpeople/debbie/blob/master/CHANGELOG.md
|
data/Rakefile
ADDED
data/debbie.gemspec
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require File.expand_path('../lib/debbie/version', __FILE__)
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |gem|
|
|
6
|
+
gem.name = 'debbie'
|
|
7
|
+
gem.version = Debbie::VERSION
|
|
8
|
+
gem.author = 'Gopal Patel'
|
|
9
|
+
gem.email = 'nixme@stillhope.com'
|
|
10
|
+
gem.license = 'MIT'
|
|
11
|
+
gem.homepage = 'https://github.com/goodpeople/debbie'
|
|
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! Debbie 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.2'
|
|
24
|
+
gem.add_runtime_dependency 'pry-stack_explorer', '~> 0.4.9'
|
|
25
|
+
gem.add_runtime_dependency 'pry-remote', '>= 0.1.7'
|
|
26
|
+
gem.add_runtime_dependency 'hirb', '~> 0.7.1'
|
|
27
|
+
gem.add_runtime_dependency 'coolline', '>= 0.4.2'
|
|
28
|
+
gem.add_runtime_dependency 'awesome_print', '~> 1.2'
|
|
29
|
+
gem.add_runtime_dependency 'railties', '>= 3.0', '< 5.0'
|
|
30
|
+
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
|
+
Debbie._hirb_output = true
|
|
11
|
+
enable_output_method_existing
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def disable_output_method
|
|
15
|
+
Debbie._hirb_output = false
|
|
16
|
+
disable_output_method_existing
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require 'pry'
|
|
2
|
+
require 'pry-rails'
|
|
3
|
+
require 'pry-remote'
|
|
4
|
+
require 'pry-stack_explorer'
|
|
5
|
+
require 'awesome_print'
|
|
6
|
+
require 'debbie/hirb_ext'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
module Debbie
|
|
10
|
+
class Railtie < Rails::Railtie
|
|
11
|
+
initializer 'debbie.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
|
+
Pry.config.print = ->(output, value) do
|
|
19
|
+
return if Debbie._hirb_output && Hirb::View.view_or_page_output(value)
|
|
20
|
+
pretty = value.ai(indent: 2)
|
|
21
|
+
Pry::Helpers::BaseHelpers.stagger_output("=> #{pretty}", output)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Friendlier prompt - line number, app name, nesting levels look like
|
|
25
|
+
# directory paths.
|
|
26
|
+
#
|
|
27
|
+
# Heavy use of lazy lambdas so configuration (like Pry.color) can be
|
|
28
|
+
# changed later or even during console usage.
|
|
29
|
+
#
|
|
30
|
+
# Custom color helpers using hints \001 and \002 so that good readline
|
|
31
|
+
# libraries (GNU, rb-readline) correctly ignore color codes when
|
|
32
|
+
# calculating line length.
|
|
33
|
+
|
|
34
|
+
color = -> { Pry.color && Debbie.colored_prompt }
|
|
35
|
+
red = ->(text) { color[] ? "\001\e[0;31m\002#{text}\001\e[0m\002" : text.to_s }
|
|
36
|
+
blue = ->(text) { color[] ? "\001\e[0;34m\002#{text}\001\e[0m\002" : text.to_s }
|
|
37
|
+
bold = ->(text) { color[] ? "\001\e[1m\002#{text}\001\e[0m\002" : text.to_s }
|
|
38
|
+
|
|
39
|
+
separator = -> { red.(Debbie.prompt_separator) }
|
|
40
|
+
name = app.class.parent_name.underscore
|
|
41
|
+
colored_name = -> { blue.(name) }
|
|
42
|
+
|
|
43
|
+
line = ->(pry) { "[#{bold.(pry.input_array.size)}] " }
|
|
44
|
+
target_string = ->(object, level) do
|
|
45
|
+
level = 0 if level < 0
|
|
46
|
+
unless (string = Pry.view_clip(object)) == 'main'
|
|
47
|
+
"(#{'../' * level}#{string})"
|
|
48
|
+
else
|
|
49
|
+
''
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
Pry.config.prompt = [
|
|
54
|
+
->(object, level, pry) do # Main prompt
|
|
55
|
+
"#{line.(pry)}#{colored_name.()}#{target_string.(object, level)} #{separator.()} "
|
|
56
|
+
end,
|
|
57
|
+
->(object, level, pry) do # Wait prompt in multiline input
|
|
58
|
+
spaces = ' ' * (
|
|
59
|
+
"[#{pry.input_array.size}] ".size + # Uncolored `line.(pry)`
|
|
60
|
+
name.size +
|
|
61
|
+
target_string.(object, level).size
|
|
62
|
+
)
|
|
63
|
+
"#{spaces} #{separator.()} "
|
|
64
|
+
end
|
|
65
|
+
]
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
data/lib/debbie.rb
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'debbie/version'
|
|
2
|
+
require 'debbie/railtie' if defined?(Rails)
|
|
3
|
+
require 'active_support'
|
|
4
|
+
require 'readline'
|
|
5
|
+
|
|
6
|
+
module Debbie
|
|
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
|
+
# Debbie.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,175 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: debbie
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.6.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Gopal Patel
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-11-27 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.2
|
|
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.2
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: pry-stack_explorer
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ~>
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 0.4.9
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ~>
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 0.4.9
|
|
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.7
|
|
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.7
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: hirb
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ~>
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 0.7.1
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ~>
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 0.7.1
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: coolline
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ! '>='
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 0.4.2
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ! '>='
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 0.4.2
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: awesome_print
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ~>
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '1.2'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ~>
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '1.2'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: railties
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ! '>='
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '3.0'
|
|
118
|
+
- - <
|
|
119
|
+
- !ruby/object:Gem::Version
|
|
120
|
+
version: '5.0'
|
|
121
|
+
type: :runtime
|
|
122
|
+
prerelease: false
|
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
124
|
+
requirements:
|
|
125
|
+
- - ! '>='
|
|
126
|
+
- !ruby/object:Gem::Version
|
|
127
|
+
version: '3.0'
|
|
128
|
+
- - <
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '5.0'
|
|
131
|
+
description: Spending hours in the rails console? Spruce it up and show off those
|
|
132
|
+
hard-working hands! Debbie replaces IRB with Pry, improves output through awesome_print,
|
|
133
|
+
and has some other goodies up its sleeves.
|
|
134
|
+
email: nixme@stillhope.com
|
|
135
|
+
executables: []
|
|
136
|
+
extensions: []
|
|
137
|
+
extra_rdoc_files: []
|
|
138
|
+
files:
|
|
139
|
+
- .gitignore
|
|
140
|
+
- .ruby-version
|
|
141
|
+
- CHANGELOG.md
|
|
142
|
+
- Gemfile
|
|
143
|
+
- LICENSE
|
|
144
|
+
- README.md
|
|
145
|
+
- Rakefile
|
|
146
|
+
- debbie.gemspec
|
|
147
|
+
- lib/debbie.rb
|
|
148
|
+
- lib/debbie/hirb_ext.rb
|
|
149
|
+
- lib/debbie/railtie.rb
|
|
150
|
+
- lib/debbie/version.rb
|
|
151
|
+
homepage: https://github.com/goodpeople/debbie
|
|
152
|
+
licenses:
|
|
153
|
+
- MIT
|
|
154
|
+
metadata: {}
|
|
155
|
+
post_install_message:
|
|
156
|
+
rdoc_options: []
|
|
157
|
+
require_paths:
|
|
158
|
+
- lib
|
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
|
+
requirements:
|
|
161
|
+
- - ! '>='
|
|
162
|
+
- !ruby/object:Gem::Version
|
|
163
|
+
version: 1.9.2
|
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
|
+
requirements:
|
|
166
|
+
- - ! '>='
|
|
167
|
+
- !ruby/object:Gem::Version
|
|
168
|
+
version: '0'
|
|
169
|
+
requirements: []
|
|
170
|
+
rubyforge_project:
|
|
171
|
+
rubygems_version: 2.2.2
|
|
172
|
+
signing_key:
|
|
173
|
+
specification_version: 4
|
|
174
|
+
summary: Exercise those fingers. Pry-based enhancements for the default Rails console.
|
|
175
|
+
test_files: []
|