jazz_hands2 1.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dee07e9b13d89af715d0cdffe52834c8574a71a4
4
+ data.tar.gz: ea2105a22d52f48050a05c914fdc9073b27044bd
5
+ SHA512:
6
+ metadata.gz: 5fd812f1b816e6d95c05c6ac77d7addac5e0da7641771aab491ab16fd3ce6281ca899a937d219543df3b72e398bbcc78e3217651e5be33258818bce89e4b3912
7
+ data.tar.gz: 3b50efc5c5fe503c94cf2950b21f3974e15ff5fd63739c4fceef7af185a1f1c2f68f614833d078e4b364bda6702a5a865616d2be953650e32023c92e3124ef78
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jazz_hands2.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Enrico Carlesso
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # JazzHands2
2
+
3
+ JazzHands2 aims to be the successor of the abandoned [JazzHand2](https://github.com/nixme/jazz_hands)
4
+
5
+ The dependencies has been updated, this only supports Ruby 2+.
6
+
7
+ Some of the codes comes from the [new_jazz_hands](https://github.com/billywatson/jazz_hands) gem, but without
8
+ some conflict in names.
9
+
10
+ List of gems included:
11
+
12
+ * [**Pry**][pry] for a powerful shell alternative to IRB.
13
+ * [**Hirb**][hirb] for tabular collection output.
14
+ * [**Pry Rails**][pry-rails] for additional commands (`show-routes`,
15
+ `show-models`, `show-middleware`) in the Rails console.
16
+ * [**Pry Doc**][pry-doc] to browse Ruby source, including C, directly from the
17
+ console.
18
+ * [**Pry Git**][pry-git] to teach the console about git. Diffs, blames, and
19
+ commits on methods and classes, not just files.
20
+ * [**Pry Remote**][pry-remote] to connect remotely to a Pry console.
21
+ * [**Pry Debugger**][pry-debugger] to turn the console into a simple debugger.
22
+ * [**Pry Stack Explorer**][pry-stack_explorer] to navigate the call stack and
23
+ frames.
24
+
25
+ ## Usage
26
+
27
+ Ruby 2+, Rails 3, 4 only.
28
+
29
+ Add this line to your application's Gemfile:
30
+
31
+ ```ruby
32
+ group :development, :test do # well, this can be useful in production too...
33
+ gem 'jazz_hands2'
34
+ end
35
+ ```
36
+
37
+ And then execute:
38
+
39
+ $ bundle
40
+
41
+ From now on, firing up a `rails console` will require all the gems above and turns on `Hirb`. You can disable `Hirb`
42
+ if you want with a `Hirb.disable`.
43
+
44
+ In my experience is much better to turn off it a couple of times instead of needing to turn on it all the times except a couple.
45
+
46
+ **Note:** even if [**AwesomePrint**] is a wonderful gem, due some existing bugs it is not included.
47
+ [eoinkelly](https://github.com/eoinkelly/awesome_print) forks seems to work fine and solve a lot of issues
48
+ while we wait for AwesomePrint v2, from the readme:
49
+
50
+ > **NOTE:** awesome_print v1.2.0 is the last release supporting Ruby versions prior to v1.9.3 and Rails versions prior to v3.0. The upcoming awesome_print v2.0 will require Ruby v1.9.3 or later and Rails v3.0 or later.
51
+
52
+ So if you are an AwesomePrint addicted, add this to your gemfile:
53
+
54
+ ```ruby
55
+ group :development, :test do # well, this can be useful in production too...
56
+ gem 'jazz_hands2'
57
+ gem 'awesome_print', github: 'eoinkelly/awesome_print'
58
+ end
59
+ ```
60
+
61
+ **Don't** call `AwesomePrint.pry!`, the `railtie.rb` automatically uses AwesomePrint if present.
62
+
63
+ ## Contributing
64
+
65
+ 1. Fork it ( https://github.com/[my-github-username]/jazz_hands2/fork )
66
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
67
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
68
+ 4. Push to the branch (`git push origin my-new-feature`)
69
+ 5. Create a new Pull Request
70
+
71
+
72
+ [pry]: http://pry.github.com
73
+ [awesome_print]: https://github.com/michaeldv/awesome_print
74
+ [hirb]: https://github.com/cldwalker/hirb
75
+ [pry-rails]: https://github.com/rweng/pry-rails
76
+ [pry-doc]: https://github.com/pry/pry-doc
77
+ [pry-git]: https://github.com/pry/pry-git
78
+ [pry-debugger]: https://github.com/nixme/pry-debugger
79
+ [pry-remote]: https://github.com/Mon-Ouie/pry-remote
80
+ [pry-stack_explorer]: https://github.com/pry/pry-stack_explorer
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jazz_hands2/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jazz_hands2"
8
+ spec.version = JazzHands2::VERSION
9
+ spec.authors = ["Enrico Carlesso"]
10
+ spec.email = ["enricocarlesso@gmail.com"]
11
+ spec.summary = "Successor of abandoned jazz_hands gem. Exercise those fingers. Pry-based enhancements for the default Rails console."
12
+ spec.description = 'Spending hours in the rails console? Spruce it up and '\
13
+ 'show off those hard-working hands! jazz_hands replaces IRB with Pry, '\
14
+ 'improves output through awesome_print, and has some other goodies up its '\
15
+ 'sleeves. Only Ruby >= 2'
16
+ spec.homepage = "https://github.com/coders51/jazz_hands2"
17
+ spec.license = "MIT"
18
+
19
+ spec.files = `git ls-files -z`.split("\x0")
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.required_ruby_version = '>= 2.0.0'
25
+ spec.add_development_dependency "bundler", "~> 1.7"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_runtime_dependency 'pry', '~> 0.9', '>= 0.9.12'
28
+ spec.add_runtime_dependency 'pry-rails', '~> 0.3', '>= 0.3.2'
29
+ spec.add_runtime_dependency 'pry-doc', '~> 0.4', '>= 0.4.6'
30
+ spec.add_runtime_dependency 'pry-git', '~> 0.2', '>= 0.2.3'
31
+ spec.add_runtime_dependency 'pry-stack_explorer', '~> 0.4', '>= 0.4.9'
32
+ spec.add_runtime_dependency 'pry-remote', '~> 0.1', '>= 0.1.7'
33
+ spec.add_runtime_dependency 'pry-byebug', '>= 2.0'
34
+ spec.add_runtime_dependency 'hirb', '~> 0.7', '>= 0.7.1'
35
+ spec.add_runtime_dependency 'railties', '>= 3.0', '< 5.0'
36
+ end
@@ -0,0 +1,30 @@
1
+ require "jazz_hands2/version"
2
+ require "jazz_hands2/railtie" if defined?(Rails)
3
+ require 'active_support'
4
+ require 'readline'
5
+
6
+ module JazzHands2
7
+ # Color the prompt?
8
+ #
9
+ # A different setting than Pry.color since some may like colored output, but a
10
+ # plain prompt.
11
+ #
12
+ # Default: 'true' for GNU readline or rb-readline which correctly count line
13
+ # widths with color codes when using \001 and \002 hints. 'false' for
14
+ # libedit-based wrapper (standard on OS X unless ruby is explicitly compiled
15
+ # otherwise).
16
+ #
17
+ mattr_accessor :colored_prompt
18
+ self.colored_prompt = (Readline::VERSION !~ /EditLine/)
19
+
20
+ # Separator between application name and input in the prompt.
21
+ #
22
+ # Default: right angle quote, or '>' when using rb-readline which doesn't
23
+ # handle mixed encodings well.
24
+ #
25
+ mattr_accessor :prompt_separator
26
+ self.prompt_separator = defined?(RbReadline) ? '>' : "\u00BB"
27
+
28
+ ### Internal methods ###
29
+ mattr_accessor :_hirb_output
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
+ JazzHands2._hirb_output = true
11
+ enable_output_method_existing
12
+ end
13
+
14
+ def disable_output_method
15
+ JazzHands2._hirb_output = false
16
+ disable_output_method_existing
17
+ end
18
+ end
@@ -0,0 +1,65 @@
1
+ require 'pry'
2
+ require 'pry-rails'
3
+ require 'pry-doc'
4
+ require 'pry-git'
5
+ require 'pry-remote'
6
+ require 'pry-stack_explorer'
7
+ require 'jazz_hands2/hirb_ext'
8
+ require 'pry-byebug'
9
+
10
+ module JazzHands2
11
+ class Railtie < Rails::Railtie
12
+ initializer 'jazz_hands2.initialize' do |app|
13
+ silence_warnings do
14
+ Pry.config.should_load_plugins = false
15
+
16
+ # Hirb in pry
17
+ Pry.config.print = -> (output, value, _pry_ = Pry) do
18
+ if JazzHands2._hirb_output
19
+ return if Hirb::View.view_or_page_output(value)
20
+ end
21
+ if defined?(AwesomePrint)
22
+ pretty = value.ai(indent: 2)
23
+ output.puts "=> #{pretty}"
24
+ else
25
+ output.puts value
26
+ end
27
+ end
28
+ Hirb.enable
29
+
30
+ color = -> { Pry.color && JazzHands2.colored_prompt }
31
+ red = ->(text) { color[] ? "\001\e[0;31m\002#{text}\001\e[0m\002" : text.to_s }
32
+ blue = ->(text) { color[] ? "\001\e[0;34m\002#{text}\001\e[0m\002" : text.to_s }
33
+ bold = ->(text) { color[] ? "\001\e[1m\002#{text}\001\e[0m\002" : text.to_s }
34
+
35
+ separator = -> { red.(JazzHands2.prompt_separator) }
36
+ name = app.class.parent_name.underscore
37
+ colored_name = -> { blue.(name) }
38
+
39
+ line = ->(pry) { "[#{bold.(pry.input_array.size)}] " }
40
+ target_string = ->(object, level) do
41
+ level = 0 if level < 0
42
+ unless (string = Pry.view_clip(object)) == 'main'
43
+ "(#{'../' * level}#{string})"
44
+ else
45
+ ''
46
+ end
47
+ end
48
+
49
+ Pry.config.prompt = [
50
+ ->(object, level, pry) do # Main prompt
51
+ "#{line.(pry)}#{colored_name.()}#{target_string.(object, level)} #{separator.()} "
52
+ end,
53
+ ->(object, level, pry) do # Wait prompt in multiline input
54
+ spaces = ' ' * (
55
+ "[#{pry.input_array.size}] ".size + # Uncolored `line.(pry)`
56
+ name.size +
57
+ target_string.(object, level).size
58
+ )
59
+ "#{spaces} #{separator.()} "
60
+ end
61
+ ]
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,3 @@
1
+ module JazzHands2
2
+ VERSION = "1.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,260 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jazz_hands2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Enrico Carlesso
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.9'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.9.12
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '0.9'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.9.12
61
+ - !ruby/object:Gem::Dependency
62
+ name: pry-rails
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.3'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 0.3.2
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '0.3'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.3.2
81
+ - !ruby/object:Gem::Dependency
82
+ name: pry-doc
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '0.4'
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 0.4.6
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.4'
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 0.4.6
101
+ - !ruby/object:Gem::Dependency
102
+ name: pry-git
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '0.2'
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 0.2.3
111
+ type: :runtime
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.2'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 0.2.3
121
+ - !ruby/object:Gem::Dependency
122
+ name: pry-stack_explorer
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '0.4'
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 0.4.9
131
+ type: :runtime
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '0.4'
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 0.4.9
141
+ - !ruby/object:Gem::Dependency
142
+ name: pry-remote
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '0.1'
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: 0.1.7
151
+ type: :runtime
152
+ prerelease: false
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: '0.1'
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: 0.1.7
161
+ - !ruby/object:Gem::Dependency
162
+ name: pry-byebug
163
+ requirement: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '2.0'
168
+ type: :runtime
169
+ prerelease: false
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '2.0'
175
+ - !ruby/object:Gem::Dependency
176
+ name: hirb
177
+ requirement: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '0.7'
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: 0.7.1
185
+ type: :runtime
186
+ prerelease: false
187
+ version_requirements: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - "~>"
190
+ - !ruby/object:Gem::Version
191
+ version: '0.7'
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: 0.7.1
195
+ - !ruby/object:Gem::Dependency
196
+ name: railties
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '3.0'
202
+ - - "<"
203
+ - !ruby/object:Gem::Version
204
+ version: '5.0'
205
+ type: :runtime
206
+ prerelease: false
207
+ version_requirements: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ version: '3.0'
212
+ - - "<"
213
+ - !ruby/object:Gem::Version
214
+ version: '5.0'
215
+ description: Spending hours in the rails console? Spruce it up and show off those
216
+ hard-working hands! jazz_hands replaces IRB with Pry, improves output through awesome_print,
217
+ and has some other goodies up its sleeves. Only Ruby >= 2
218
+ email:
219
+ - enricocarlesso@gmail.com
220
+ executables: []
221
+ extensions: []
222
+ extra_rdoc_files: []
223
+ files:
224
+ - ".gitignore"
225
+ - Gemfile
226
+ - LICENSE.txt
227
+ - README.md
228
+ - Rakefile
229
+ - jazz_hands2.gemspec
230
+ - lib/jazz_hands2.rb
231
+ - lib/jazz_hands2/hirb_ext.rb
232
+ - lib/jazz_hands2/railtie.rb
233
+ - lib/jazz_hands2/version.rb
234
+ homepage: https://github.com/coders51/jazz_hands2
235
+ licenses:
236
+ - MIT
237
+ metadata: {}
238
+ post_install_message:
239
+ rdoc_options: []
240
+ require_paths:
241
+ - lib
242
+ required_ruby_version: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - ">="
245
+ - !ruby/object:Gem::Version
246
+ version: 2.0.0
247
+ required_rubygems_version: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - ">="
250
+ - !ruby/object:Gem::Version
251
+ version: '0'
252
+ requirements: []
253
+ rubyforge_project:
254
+ rubygems_version: 2.2.2
255
+ signing_key:
256
+ specification_version: 4
257
+ summary: Successor of abandoned jazz_hands gem. Exercise those fingers. Pry-based
258
+ enhancements for the default Rails console.
259
+ test_files: []
260
+ has_rdoc: