jazz_fingers 5.0.1 → 6.0.0.pre.rc1
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 +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +3 -3
- data/jazz_fingers.gemspec +2 -2
- data/lib/jazz_fingers.rb +24 -2
- data/lib/jazz_fingers/amazing_print.rb +26 -0
- data/lib/jazz_fingers/coderay.rb +20 -0
- data/lib/jazz_fingers/coderay/escaped_colors.rb +74 -0
- data/lib/jazz_fingers/coderay/unescaped_colors.rb +74 -0
- data/lib/jazz_fingers/commands.rb +7 -0
- data/lib/jazz_fingers/commands/caller_method.rb +16 -0
- data/lib/jazz_fingers/commands/copy.rb +10 -0
- data/lib/jazz_fingers/commands/sql.rb +14 -0
- data/lib/jazz_fingers/configuration.rb +16 -7
- data/lib/jazz_fingers/print.rb +2 -2
- data/lib/jazz_fingers/prompt.rb +68 -28
- data/lib/jazz_fingers/prompt/pry_version_012_and_prior.rb +24 -0
- data/lib/jazz_fingers/prompt/pry_version_013_and_later.rb +26 -0
- data/lib/jazz_fingers/version.rb +1 -1
- metadata +22 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 532d4660c48c061acd71789b37a2192a234ee1a9c758e7a558a6d84f4e9a2e17
|
4
|
+
data.tar.gz: 10dda140b0286c7ef7c7639703742d07b11e0e1c27edde9d4f66a4d41d01dd48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1673af4271d78fb52ce3537a09f963af085a5afd1a8382af3664e9f67b7573e1a4e98e1ab60a38ef0c6f57a83aaa877cd79df99a43ed22b795c5d3c0e1a0dd8
|
7
|
+
data.tar.gz: a8ffbb30aeb64be2a37955274645e740137a4f404bb68190d05ea8412acd2ade3b145214c1c9ac26f8762dba31dd5605e014644a1a062ac3d3057ce88648317c
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ hard-working fingers!
|
|
9
9
|
**jazz_fingers** is an opinionated set of console-related gems and a bit of glue:
|
10
10
|
|
11
11
|
* [**Pry**][pry] for a powerful shell alternative to IRB.
|
12
|
-
* [**
|
12
|
+
* [**Amazing Print**][amazing_print] for stylish pretty print.
|
13
13
|
console.
|
14
14
|
* [**Pry Coolline**][pry-coolline] for syntax highlighting as you type.
|
15
15
|
|
@@ -46,7 +46,7 @@ Some configurations can be overwritten:
|
|
46
46
|
if defined?(JazzFingers)
|
47
47
|
JazzFingers.configure do |config|
|
48
48
|
config.colored_prompt = false
|
49
|
-
config.
|
49
|
+
config.amazing_print = false
|
50
50
|
config.coolline = false
|
51
51
|
config.application_name = MyAwesomeProject
|
52
52
|
end
|
@@ -69,7 +69,7 @@ mixed encodings.
|
|
69
69
|
|
70
70
|
|
71
71
|
[pry]: http://pry.github.com
|
72
|
-
[
|
72
|
+
[amazing_print]: https://github.com/amazing-print/amazing_print
|
73
73
|
[hirb]: https://github.com/cldwalker/hirb
|
74
74
|
[pry-doc]: https://github.com/pry/pry-doc
|
75
75
|
[pry-coolline]: https://github.com/pry/pry-coolline
|
data/jazz_fingers.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.summary = 'Exercise those fingers. Pry-based enhancements for the default Ruby console.'
|
11
11
|
description =
|
12
12
|
'Spending hours in the ruby console? Spruce it up and show off those hard-working hands! jazz_fingers'\
|
13
|
-
'replaces IRB with Pry, improves output through
|
13
|
+
'replaces IRB with Pry, improves output through amazing_print, and has some other goodies up its sleeves.'
|
14
14
|
gem.description = description
|
15
15
|
|
16
16
|
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
# Dependencies
|
22
22
|
gem.required_ruby_version = '>= 2.0'
|
23
|
-
gem.add_runtime_dependency '
|
23
|
+
gem.add_runtime_dependency 'amazing_print', '~> 1.2'
|
24
24
|
gem.add_runtime_dependency 'pry', '~> 0.10'
|
25
25
|
gem.add_runtime_dependency 'pry-byebug', '~> 3.4'
|
26
26
|
gem.add_runtime_dependency 'pry-coolline', '~> 0.2'
|
data/lib/jazz_fingers.rb
CHANGED
@@ -6,6 +6,9 @@ require 'readline'
|
|
6
6
|
require 'forwardable'
|
7
7
|
|
8
8
|
module JazzFingers
|
9
|
+
autoload :AMAZING_PRINT, 'jazz_fingers/amazing_print'
|
10
|
+
autoload :CodeRay, 'jazz_fingers/coderay'
|
11
|
+
autoload :Commands, 'jazz_fingers/commands'
|
9
12
|
autoload :Configuration, 'jazz_fingers/configuration'
|
10
13
|
autoload :Input, 'jazz_fingers/input'
|
11
14
|
autoload :Print, 'jazz_fingers/print'
|
@@ -15,7 +18,7 @@ module JazzFingers
|
|
15
18
|
class << self
|
16
19
|
extend Forwardable
|
17
20
|
|
18
|
-
def_delegators :config, :
|
21
|
+
def_delegators :config, :amazing_print?, :coolline?
|
19
22
|
|
20
23
|
def print
|
21
24
|
@print ||= Print.config
|
@@ -45,13 +48,32 @@ module JazzFingers
|
|
45
48
|
end
|
46
49
|
|
47
50
|
def setup!
|
48
|
-
Pry.print = print if JazzFingers.awesome_print?
|
49
51
|
Pry.prompt = prompt
|
50
52
|
Pry.input = input if JazzFingers.coolline?
|
51
53
|
Pry.config.should_load_plugins = false
|
52
54
|
Pry.commands.alias_command('c', 'continue')
|
53
55
|
Pry.commands.alias_command('s', 'step')
|
54
56
|
Pry.commands.alias_command('n', 'next')
|
57
|
+
Pry.editor = 'vi'
|
58
|
+
Pry.config.ls.separator = "\n"
|
59
|
+
Pry.config.ls.heading_color = :magenta
|
60
|
+
Pry.config.ls.public_method_color = :green
|
61
|
+
Pry.config.ls.protected_method_color = :yellow
|
62
|
+
Pry.config.ls.private_method_color = :bright_black
|
63
|
+
|
64
|
+
JazzFingers::Commands.constants(false).each do |constant|
|
65
|
+
command = JazzFingers::Commands.const_get(constant)
|
66
|
+
Pry.config.commands.import(command)
|
67
|
+
end
|
68
|
+
|
69
|
+
if JazzFingers.amazing_print?
|
70
|
+
require 'amazing_print'
|
71
|
+
|
72
|
+
AmazingPrint.defaults = JazzFingers::AMAZING_PRINT
|
73
|
+
Pry.print = print
|
74
|
+
end
|
75
|
+
|
76
|
+
JazzFingers::CodeRay.setup!
|
55
77
|
|
56
78
|
true
|
57
79
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module JazzFingers
|
2
|
+
AMAZING_PRINT = {
|
3
|
+
indent: 2,
|
4
|
+
sort_keys: true,
|
5
|
+
color: {
|
6
|
+
args: :greenish,
|
7
|
+
array: :whiteish,
|
8
|
+
bigdecimal: :blue,
|
9
|
+
class: :yellow,
|
10
|
+
date: :greenish,
|
11
|
+
falseclass: :red,
|
12
|
+
fixnum: :blue,
|
13
|
+
float: :blue,
|
14
|
+
hash: :whiteish,
|
15
|
+
keyword: :cyan,
|
16
|
+
method: :purpleish,
|
17
|
+
nilclass: :red,
|
18
|
+
string: :yellowish,
|
19
|
+
struct: :whiteish,
|
20
|
+
symbol: :cyanish,
|
21
|
+
time: :greenish,
|
22
|
+
trueclass: :green,
|
23
|
+
variable: :cyanish
|
24
|
+
}
|
25
|
+
}
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module JazzFingers
|
2
|
+
module CodeRay
|
3
|
+
autoload :ESCAPED_COLORS, 'jazz_fingers/coderay/escaped_colors'
|
4
|
+
autoload :UNESCAPED_COLORS, 'jazz_fingers/coderay/unescaped_colors'
|
5
|
+
|
6
|
+
def self.setup!
|
7
|
+
::CodeRay.scan("example", :ruby).term
|
8
|
+
|
9
|
+
if ::CodeRay::VERSION >= '1.1.0'
|
10
|
+
ESCAPED_COLORS.each do |key, value|
|
11
|
+
::CodeRay::Encoders::Terminal::TOKEN_COLORS[key] = value
|
12
|
+
end
|
13
|
+
else
|
14
|
+
UNESCAPED_COLORS.each do |key, value|
|
15
|
+
::CodeRay::Encoders::Terminal::TOKEN_COLORS[key] = value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module JazzFingers
|
2
|
+
module CodeRay
|
3
|
+
ESCAPED_COLORS = {
|
4
|
+
attribute_name: "\e[33m",
|
5
|
+
attribute_value: "\e[31m",
|
6
|
+
binary: "\e[1;35m",
|
7
|
+
char: {
|
8
|
+
self: "\e[36m",
|
9
|
+
delimiter: "\e[34m"
|
10
|
+
},
|
11
|
+
class: "\e[1;35m",
|
12
|
+
class_variable: "\e[36m",
|
13
|
+
color: "\e[32m",
|
14
|
+
comment: "\e[37m",
|
15
|
+
complex: "\e[34m",
|
16
|
+
constant: "\e[34m\e[4m",
|
17
|
+
decoration: "\e[35m",
|
18
|
+
definition: "\e[1;32m",
|
19
|
+
directive: "\e[32m\e[4m",
|
20
|
+
doc: "\e[46m",
|
21
|
+
doctype: "\e[1;30m",
|
22
|
+
doc_string: "\e[31m\e[4m",
|
23
|
+
entity: "\e[33m",
|
24
|
+
error: "\e[1;33m\e[41m",
|
25
|
+
exception: "\e[1;31m",
|
26
|
+
float: "\e[1;35m",
|
27
|
+
function: "\e[1;34m",
|
28
|
+
global_variable: "\e[42m",
|
29
|
+
hex: "\e[1;36m",
|
30
|
+
include: "\e[33m",
|
31
|
+
integer: "\e[1;34m",
|
32
|
+
key: "\e[35m",
|
33
|
+
label: "\e[1;15m",
|
34
|
+
local_variable: "\e[33m",
|
35
|
+
octal: "\e[1;35m",
|
36
|
+
operator_name: "\e[1;29m",
|
37
|
+
predefined_constant: "\e[1;36m",
|
38
|
+
predefined_type: "\e[1;30m",
|
39
|
+
predefined: "\e[4m\e[1;34m",
|
40
|
+
preprocessor: "\e[36m",
|
41
|
+
pseudo_class: "\e[34m",
|
42
|
+
regexp: {
|
43
|
+
self: "\e[31m",
|
44
|
+
content: "\e[31m",
|
45
|
+
delimiter: "\e[1;29m",
|
46
|
+
modifier: "\e[35m",
|
47
|
+
function: "\e[1;29m"
|
48
|
+
},
|
49
|
+
reserved: "\e[1;31m",
|
50
|
+
shell: {
|
51
|
+
self: "\e[42m",
|
52
|
+
content: "\e[1;29m",
|
53
|
+
delimiter: "\e[37m",
|
54
|
+
},
|
55
|
+
string: {
|
56
|
+
self: "\e[36m",
|
57
|
+
modifier: "\e[1;32m",
|
58
|
+
escape: "\e[1;36m",
|
59
|
+
delimiter: "\e[1;32m",
|
60
|
+
},
|
61
|
+
symbol: "\e[1;31m",
|
62
|
+
tag: "\e[34m",
|
63
|
+
type: "\e[1;34m",
|
64
|
+
value: "\e[36m",
|
65
|
+
variable: "\e[34m",
|
66
|
+
|
67
|
+
insert: "\e[42m",
|
68
|
+
delete: "\e[41m",
|
69
|
+
change: "\e[44m",
|
70
|
+
head: "\e[45m"
|
71
|
+
}.freeze
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module JazzFingers
|
2
|
+
module CodeRay
|
3
|
+
UNESCAPED_COLORS = {
|
4
|
+
attribute_name: '33',
|
5
|
+
attribute_value: '31',
|
6
|
+
binary: '1;35',
|
7
|
+
char: {
|
8
|
+
self: '36',
|
9
|
+
delimiter: '34'
|
10
|
+
},
|
11
|
+
class: '1;35',
|
12
|
+
class_variable: '36',
|
13
|
+
color: '32',
|
14
|
+
comment: '37',
|
15
|
+
complex: '34',
|
16
|
+
constant: ['34', '4'],
|
17
|
+
decoration: '35',
|
18
|
+
definition: '1;32',
|
19
|
+
directive: ['32', '4'],
|
20
|
+
doc: '46',
|
21
|
+
doctype: '1;30',
|
22
|
+
doc_string: ['31', '4'],
|
23
|
+
entity: '33',
|
24
|
+
error: ['1;33', '41'],
|
25
|
+
exception: '1;31',
|
26
|
+
float: '1;35',
|
27
|
+
function: '1;34',
|
28
|
+
global_variable: '42',
|
29
|
+
hex: '1;36',
|
30
|
+
include: '33',
|
31
|
+
integer: '1;34',
|
32
|
+
key: '35',
|
33
|
+
label: '1;15',
|
34
|
+
local_variable: '33',
|
35
|
+
octal: '1;35',
|
36
|
+
operator_name: '1;29',
|
37
|
+
predefined_constant: '1;36',
|
38
|
+
predefined_type: '1;30',
|
39
|
+
predefined: ['4', '1;34'],
|
40
|
+
preprocessor: '36',
|
41
|
+
pseudo_class: '34',
|
42
|
+
regexp: {
|
43
|
+
self: '31',
|
44
|
+
content: '31',
|
45
|
+
delimiter: '1;29',
|
46
|
+
modifier: '35',
|
47
|
+
function: '1;29'
|
48
|
+
},
|
49
|
+
reserved: '1;31',
|
50
|
+
shell: {
|
51
|
+
self: '42',
|
52
|
+
content: '1;29',
|
53
|
+
delimiter: '37',
|
54
|
+
},
|
55
|
+
string: {
|
56
|
+
self: '36',
|
57
|
+
modifier: '1;32',
|
58
|
+
escape: '1;36',
|
59
|
+
delimiter: '1;32',
|
60
|
+
},
|
61
|
+
symbol: '1;31',
|
62
|
+
tag: '34',
|
63
|
+
type: '1;34',
|
64
|
+
value: '36',
|
65
|
+
variable: '34',
|
66
|
+
|
67
|
+
insert: '42',
|
68
|
+
delete: '41',
|
69
|
+
change: '44',
|
70
|
+
head: '45'
|
71
|
+
}.freeze
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module JazzFingers
|
2
|
+
module Commands
|
3
|
+
CALLER_METHOD = Pry::CommandSet.new do
|
4
|
+
command "caller_method" do |depth|
|
5
|
+
depth = depth.to_i || 1
|
6
|
+
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ caller(depth+1).first
|
7
|
+
file = Regexp.last_match[1]
|
8
|
+
line = Regexp.last_match[2].to_i
|
9
|
+
method = Regexp.last_match[3]
|
10
|
+
output.puts [file, line, method]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module JazzFingers
|
2
|
+
module Commands
|
3
|
+
SQL = Pry::CommandSet.new do
|
4
|
+
command "sql", "Send sql over AR." do |query|
|
5
|
+
if defined?(Rails)
|
6
|
+
pp ActiveRecord::Base.connection.select_all(query)
|
7
|
+
else
|
8
|
+
pp "Rails not defined"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module JazzFingers
|
2
2
|
class Configuration
|
3
|
-
attr_writer :colored_prompt, :prompt_separator, :coolline, :
|
3
|
+
attr_writer :colored_prompt, :prompt_separator, :coolline, :amazing_print,
|
4
4
|
:application_name
|
5
5
|
|
6
6
|
# Color the prompt?
|
@@ -32,17 +32,26 @@ module JazzFingers
|
|
32
32
|
@coolline
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
return true if @
|
35
|
+
def amazing_print?
|
36
|
+
return true if @amazing_print.nil?
|
37
37
|
|
38
|
-
@
|
38
|
+
@amazing_print
|
39
39
|
end
|
40
40
|
|
41
41
|
def application_name
|
42
|
-
return
|
43
|
-
return "(#{Rails.application.class.parent_name.underscore})" if defined?(Rails)
|
42
|
+
return underscore(@application_name) unless @application_name.nil?
|
44
43
|
|
45
|
-
|
44
|
+
if defined?(Rails)
|
45
|
+
application_class = Rails.application.class
|
46
|
+
|
47
|
+
if application_class.respond_to?(:module_parent_name)
|
48
|
+
return application_class.module_parent_name.underscore
|
49
|
+
else
|
50
|
+
return application_class.parent_name.underscore
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
"jazz_fingers"
|
46
55
|
end
|
47
56
|
|
48
57
|
private
|
data/lib/jazz_fingers/print.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'amazing_print'
|
2
2
|
|
3
3
|
module JazzFingers
|
4
4
|
class Print
|
5
5
|
class << self
|
6
6
|
def config
|
7
7
|
lambda do |_output, value, pry_object|
|
8
|
-
pretty = value.ai
|
8
|
+
pretty = value.ai
|
9
9
|
pry_object.pager.page("=> #{pretty}\n")
|
10
10
|
end
|
11
11
|
end
|
data/lib/jazz_fingers/prompt.rb
CHANGED
@@ -1,5 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module JazzFingers
|
2
4
|
class Prompt
|
5
|
+
OBJECT_INSTANCE = /#<(.+)>/
|
6
|
+
|
7
|
+
autoload :PryVersion013AndLater, 'jazz_fingers/prompt/pry_version_013_and_later'
|
8
|
+
autoload :PryVersion012AndPrior, 'jazz_fingers/prompt/pry_version_012_and_prior'
|
9
|
+
|
10
|
+
if Pry::VERSION >= "0.13.0"
|
11
|
+
include PryVersion013AndLater
|
12
|
+
else
|
13
|
+
include PryVersion012AndPrior
|
14
|
+
end
|
15
|
+
|
3
16
|
def initialize(options = {})
|
4
17
|
@colored = options.fetch(:colored)
|
5
18
|
@separator = options.fetch(:separator)
|
@@ -28,48 +41,75 @@ module JazzFingers
|
|
28
41
|
"\001\e[1m\002#{text}\001\e[0m\002"
|
29
42
|
end
|
30
43
|
|
31
|
-
def
|
44
|
+
def main_separator
|
32
45
|
red_text(@separator)
|
33
46
|
end
|
34
47
|
|
35
|
-
def
|
36
|
-
|
48
|
+
def wait_separator
|
49
|
+
"*"
|
37
50
|
end
|
38
51
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
52
|
+
# Return the current Pry context
|
53
|
+
#
|
54
|
+
# When the Pry context is `"main"` or `"nil"`, use the application name from
|
55
|
+
# the JazzFingers config. Examples: "(my_rails_app_name)", "(jazz_fingers)".
|
56
|
+
#
|
57
|
+
# When in the context of an object instance, use the abbreviated object
|
58
|
+
# path. Example: "(#<Pry::Prompt>)", "(#<RSpec::...::ClassName>)"
|
59
|
+
#
|
60
|
+
# Fall back to the raw context provided by Pry.view_clip.
|
61
|
+
# Example: "(Pry::Prompt)"
|
62
|
+
def context(module_name = "main")
|
63
|
+
name =
|
64
|
+
case module_name
|
65
|
+
when "main", "nil"
|
66
|
+
@application_name
|
67
|
+
when OBJECT_INSTANCE
|
68
|
+
abbreviated_context(module_name)
|
69
|
+
else
|
70
|
+
module_name
|
71
|
+
end
|
46
72
|
|
47
|
-
|
48
|
-
|
49
|
-
text = Pry.view_clip(object)
|
73
|
+
blue_text("(#{name})")
|
74
|
+
end
|
50
75
|
|
51
|
-
|
52
|
-
|
76
|
+
def line_number(pry)
|
77
|
+
if pry.respond_to? :input_ring
|
78
|
+
bold_text(pry.input_ring.size)
|
53
79
|
else
|
54
|
-
|
80
|
+
bold_text(pry.input_array.size)
|
55
81
|
end
|
56
82
|
end
|
57
83
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
84
|
+
# Abbreviate the object path in the given `object_label` string so the
|
85
|
+
# prompt doesn't overflow. Display only the root and leaf namespaces.
|
86
|
+
#
|
87
|
+
# Examples:
|
88
|
+
# In: #<Class1::Class2::Class3::Class4::Class5>
|
89
|
+
# Out: #<Class1::...::Class5>
|
90
|
+
#
|
91
|
+
# In: #<Class1::Class2>
|
92
|
+
# Out: #<Class1::Class2>
|
93
|
+
#
|
94
|
+
# In: #<NoPathJustASingleLongClassName>
|
95
|
+
# Out: #<NoPathJustASingleLongClassName>
|
96
|
+
def abbreviated_context(object_label)
|
97
|
+
object_path = object_label[OBJECT_INSTANCE, 1]
|
98
|
+
object_path_components = object_path.split("::")
|
99
|
+
return object_label if object_path_components.length <= 2
|
63
100
|
|
64
|
-
|
65
|
-
|
66
|
-
spaces = ' ' * level
|
67
|
-
"#{RUBY_VERSION} #{name}#{line_number(pry)} * #{spaces}"
|
68
|
-
end
|
101
|
+
root, *_, leaf = object_path_components
|
102
|
+
"#<#{root}::...::#{leaf}>"
|
69
103
|
end
|
70
104
|
|
71
|
-
def
|
72
|
-
|
105
|
+
def template(module_name, pry, separator)
|
106
|
+
format(
|
107
|
+
"%<ruby>s %<context>s[%<line>s] %<separator>s ",
|
108
|
+
ruby: RUBY_VERSION,
|
109
|
+
context: context(module_name),
|
110
|
+
line: line_number(pry),
|
111
|
+
separator: separator
|
112
|
+
)
|
73
113
|
end
|
74
114
|
end
|
75
115
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JazzFingers
|
4
|
+
class Prompt
|
5
|
+
# For Pry < 0.13.
|
6
|
+
module PryVersion012AndPrior
|
7
|
+
def config
|
8
|
+
[main_prompt, wait_prompt]
|
9
|
+
end
|
10
|
+
|
11
|
+
def main_prompt
|
12
|
+
lambda do |context, _nesting, pry|
|
13
|
+
template(Pry.view_clip(context), pry, main_separator)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def wait_prompt
|
18
|
+
lambda do |context, _nesting, pry|
|
19
|
+
template(Pry.view_clip(context), pry, wait_separator)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JazzFingers
|
4
|
+
class Prompt
|
5
|
+
# For Pry >= 0.13.
|
6
|
+
module PryVersion013AndLater
|
7
|
+
# Add the JazzFingers prompt to the Pry::Prompt hash to enable changing it
|
8
|
+
# with `change-prompt`.
|
9
|
+
#
|
10
|
+
# Return the Pry::Prompt object.
|
11
|
+
def config
|
12
|
+
return Pry::Prompt[:jazz_fingers] if Pry::Prompt[:jazz_fingers]
|
13
|
+
|
14
|
+
Pry::Prompt.add(
|
15
|
+
:jazz_fingers,
|
16
|
+
"A spruced-up prompt provided by jazz_fingers.",
|
17
|
+
[main_separator, wait_separator]
|
18
|
+
) do |context, _nesting, pry, separator|
|
19
|
+
template(Pry.view_clip(context), pry, separator)
|
20
|
+
end
|
21
|
+
|
22
|
+
Pry::Prompt[:jazz_fingers]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/jazz_fingers/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jazz_fingers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo Henrique Lopes Ribeiro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: amazing_print
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.2'
|
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: '1.
|
26
|
+
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Spending hours in the ruby console? Spruce it up and show off those hard-working
|
84
|
-
hands! jazz_fingersreplaces IRB with Pry, improves output through
|
84
|
+
hands! jazz_fingersreplaces IRB with Pry, improves output through amazing_print,
|
85
85
|
and has some other goodies up its sleeves.
|
86
86
|
email: plribeiro3000@gmail.com
|
87
87
|
executables: []
|
@@ -102,16 +102,26 @@ files:
|
|
102
102
|
- Rakefile
|
103
103
|
- jazz_fingers.gemspec
|
104
104
|
- lib/jazz_fingers.rb
|
105
|
+
- lib/jazz_fingers/amazing_print.rb
|
106
|
+
- lib/jazz_fingers/coderay.rb
|
107
|
+
- lib/jazz_fingers/coderay/escaped_colors.rb
|
108
|
+
- lib/jazz_fingers/coderay/unescaped_colors.rb
|
109
|
+
- lib/jazz_fingers/commands.rb
|
110
|
+
- lib/jazz_fingers/commands/caller_method.rb
|
111
|
+
- lib/jazz_fingers/commands/copy.rb
|
112
|
+
- lib/jazz_fingers/commands/sql.rb
|
105
113
|
- lib/jazz_fingers/configuration.rb
|
106
114
|
- lib/jazz_fingers/input.rb
|
107
115
|
- lib/jazz_fingers/print.rb
|
108
116
|
- lib/jazz_fingers/prompt.rb
|
117
|
+
- lib/jazz_fingers/prompt/pry_version_012_and_prior.rb
|
118
|
+
- lib/jazz_fingers/prompt/pry_version_013_and_later.rb
|
109
119
|
- lib/jazz_fingers/version.rb
|
110
120
|
homepage: https://github.com/plribeiro3000/jazz_fingers
|
111
121
|
licenses:
|
112
122
|
- MIT
|
113
123
|
metadata: {}
|
114
|
-
post_install_message:
|
124
|
+
post_install_message:
|
115
125
|
rdoc_options: []
|
116
126
|
require_paths:
|
117
127
|
- lib
|
@@ -122,12 +132,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
132
|
version: '2.0'
|
123
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
134
|
requirements:
|
125
|
-
- - "
|
135
|
+
- - ">"
|
126
136
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
137
|
+
version: 1.3.1
|
128
138
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
130
|
-
signing_key:
|
139
|
+
rubygems_version: 3.1.3
|
140
|
+
signing_key:
|
131
141
|
specification_version: 4
|
132
142
|
summary: Exercise those fingers. Pry-based enhancements for the default Ruby console.
|
133
143
|
test_files: []
|