jazz_fingers 5.1.0.rc1 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfc72ca8fb88d61751cd5452ff6f597d769524e3164e87b9b139ee80c5811513
4
- data.tar.gz: cde39ec620a826e7a3148d7a8df8e86f033be1692bade1e00c376a92a2f2db41
3
+ metadata.gz: cbbbaa8fa627490beb072b4ea4b98e8d8d6e8714f29ec6685a41ca7578dc3ac9
4
+ data.tar.gz: fad27536ac01200b69d7f918e70967facaa826ec7c250f9d3505a0a69e7e1148
5
5
  SHA512:
6
- metadata.gz: d17ad8070588368567d2296e6a5c8da63866d71b7e993bdfd96af57dfa59a60d7ec8aade44d0abb65bbae4f7d49e4b3e8c0ebf2de24e775886a8ca8b07cd3c9e
7
- data.tar.gz: 949d5fb0d2d2e5836185f4f361c486db5e15c3aa6ccca61b3f8b9f97c434aafcc437b5b53613840ebca2c542eceab3ed040511656f9c8d021907579ad5c57104
6
+ metadata.gz: 224fa623b2a249d60c65157a15c91c653d864efc1dbb689c27fd13e0970050c871535cc07b6e60a711dd46a26d577eadb81a592c6382d44e0139d182d2a90ef6
7
+ data.tar.gz: ab4659a04f7974661d1cad67eea364c6060c1ea9f1616a729310faec6692e12f1e47691419f12ff9f517b31ed30e36935a9c77da1de08af1367aafe827222747
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 6.1.0 (2021-04-19)
4
+ * Update [amazing_print][amazing_print] to v1.3.0
5
+
6
+ ## 6.0.0.pre.rc1 (2020-10-22)
7
+ * Switched [awesome_print][awesome_print] with [amazing_print][amazing_print]
8
+
9
+ ## 5.2.0 (2020-07-22)
10
+ * Fixed application name
11
+
12
+ ## 5.2.1 (2020-07-16)
13
+ * Fix Rails deprecation
14
+
15
+ ## 5.2.0 (2020-05-09)
16
+ * Added Pry custom commands
17
+ * Customize AwesomePrint configuration
18
+ * Customize CodeRay colors
19
+
3
20
  ## 5.1.0.rc1 (2020-04-25)
4
21
  * Change deprecated method on pry > 0.13.0
5
22
  * Improve naming context
@@ -185,6 +202,7 @@
185
202
 
186
203
  [pry]: http://pry.github.com
187
204
  [awesome_print]: https://github.com/michaeldv/awesome_print
205
+ [amazing_print]: https://github.com/amazing-print/amazing_print
188
206
  [pry-doc]: https://github.com/pry/pry-doc
189
207
  [pry-git]: https://github.com/pry/pry-git
190
208
  [pry-nav]: https://github.com/nixme/pry-nav
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
- * [**Awesome Print**][awesome_print] for stylish pretty print.
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.awesome_print = false
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
- [awesome_print]: https://github.com/michaeldv/awesome_print
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 awesome_print, and has some other goodies up its sleeves.'
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 'awesome_print', '~> 1.6'
23
+ gem.add_runtime_dependency 'amazing_print', '~> 1.3'
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, :awesome_print?, :coolline?
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,7 @@
1
+ module JazzFingers
2
+ module Commands
3
+ autoload :CALLER_METHOD, 'jazz_fingers/commands/caller_method'
4
+ autoload :COPY, 'jazz_fingers/commands/copy'
5
+ autoload :SQL, 'jazz_fingers/commands/sql'
6
+ end
7
+ end
@@ -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,10 @@
1
+ module JazzFingers
2
+ module Commands
3
+ COPY = Pry::CommandSet.new do
4
+ command "copy", "Copy argument to the clip-board" do |str|
5
+ IO.popen('pbcopy', 'w') { |f| f << str.to_s }
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -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, :awesome_print,
3
+ attr_writer :colored_prompt, :prompt_separator, :coolline, :amazing_print,
4
4
  :application_name
5
5
 
6
6
  # Color the prompt?
@@ -32,15 +32,24 @@ module JazzFingers
32
32
  @coolline
33
33
  end
34
34
 
35
- def awesome_print?
36
- return true if @awesome_print.nil?
35
+ def amazing_print?
36
+ return true if @amazing_print.nil?
37
37
 
38
- @awesome_print
38
+ @amazing_print
39
39
  end
40
40
 
41
41
  def application_name
42
42
  return underscore(@application_name) unless @application_name.nil?
43
- return Rails.application.class.parent_name.underscore if defined?(Rails)
43
+
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
44
53
 
45
54
  "jazz_fingers"
46
55
  end
@@ -1,11 +1,11 @@
1
- require 'awesome_print'
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(indent: 2)
8
+ pretty = value.ai
9
9
  pry_object.pager.page("=> #{pretty}\n")
10
10
  end
11
11
  end
@@ -4,11 +4,12 @@ module JazzFingers
4
4
  class Prompt
5
5
  OBJECT_INSTANCE = /#<(.+)>/
6
6
 
7
+ autoload :PryVersion013AndLater, 'jazz_fingers/prompt/pry_version_013_and_later'
8
+ autoload :PryVersion012AndPrior, 'jazz_fingers/prompt/pry_version_012_and_prior'
9
+
7
10
  if Pry::VERSION >= "0.13.0"
8
- require_relative "prompt/pry_version_013_and_later"
9
11
  include PryVersion013AndLater
10
12
  else
11
- require_relative "prompt/pry_version_012_and_prior"
12
13
  include PryVersion012AndPrior
13
14
  end
14
15
 
@@ -1,3 +1,3 @@
1
1
  module JazzFingers
2
- VERSION = '5.1.0.rc1'.freeze
2
+ VERSION = '6.1.0'.freeze
3
3
  end
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: 5.1.0.rc1
4
+ version: 6.1.0
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: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: awesome_print
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.6'
19
+ version: '1.3'
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.6'
26
+ version: '1.3'
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 awesome_print,
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,6 +102,14 @@ 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
@@ -113,7 +121,7 @@ homepage: https://github.com/plribeiro3000/jazz_fingers
113
121
  licenses:
114
122
  - MIT
115
123
  metadata: {}
116
- post_install_message:
124
+ post_install_message:
117
125
  rdoc_options: []
118
126
  require_paths:
119
127
  - lib
@@ -124,12 +132,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
132
  version: '2.0'
125
133
  required_rubygems_version: !ruby/object:Gem::Requirement
126
134
  requirements:
127
- - - ">"
135
+ - - ">="
128
136
  - !ruby/object:Gem::Version
129
- version: 1.3.1
137
+ version: '0'
130
138
  requirements: []
131
- rubygems_version: 3.0.8
132
- signing_key:
139
+ rubygems_version: 3.1.3
140
+ signing_key:
133
141
  specification_version: 4
134
142
  summary: Exercise those fingers. Pry-based enhancements for the default Ruby console.
135
143
  test_files: []