jazz_fingers 5.1.0.rc1 → 5.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfc72ca8fb88d61751cd5452ff6f597d769524e3164e87b9b139ee80c5811513
4
- data.tar.gz: cde39ec620a826e7a3148d7a8df8e86f033be1692bade1e00c376a92a2f2db41
3
+ metadata.gz: 68eb4443091b5d11a09fe647b29ec39a0285e8194cf160773ea2c648d4a0c6fb
4
+ data.tar.gz: afef7c899f5a9d8cf40d9395a6890a62ba27ad915afda4ce11ff1bc9b48ea666
5
5
  SHA512:
6
- metadata.gz: d17ad8070588368567d2296e6a5c8da63866d71b7e993bdfd96af57dfa59a60d7ec8aade44d0abb65bbae4f7d49e4b3e8c0ebf2de24e775886a8ca8b07cd3c9e
7
- data.tar.gz: 949d5fb0d2d2e5836185f4f361c486db5e15c3aa6ccca61b3f8b9f97c434aafcc437b5b53613840ebca2c542eceab3ed040511656f9c8d021907579ad5c57104
6
+ metadata.gz: ebf8563fc9845812c5898b8ac79b56f7a322202e3e3ed18108551cf35561a50d068179a8031e62f94aae43af2dd01671ae59d335de29b5cfe78cde2cdba43f6c
7
+ data.tar.gz: 5cc24c6094438c859fbc41590acefe95bf5be2056237955ba86aa6275ddd03f18340ba24f9f44ae73181c5d1a8f0932752722d11b9d231eb0c791d38933cb7fe
data/lib/jazz_fingers.rb CHANGED
@@ -6,6 +6,9 @@ require 'readline'
6
6
  require 'forwardable'
7
7
 
8
8
  module JazzFingers
9
+ autoload :AWESOME_PRINT, 'jazz_fingers/awesome_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'
@@ -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.awesome_print?
70
+ require 'awesome_print'
71
+
72
+ AwesomePrint.defaults = JazzFingers::AWESOME_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
+ AWESOME_PRINT = {
3
+ indent: 2,
4
+ sort_keys: true,
5
+ color: {
6
+ args: :greenish,
7
+ array: :pale,
8
+ bigdecimal: :blue,
9
+ class: :yellow,
10
+ date: :greenish,
11
+ falseclass: :red,
12
+ fixnum: :blue,
13
+ float: :blue,
14
+ hash: :pale,
15
+ keyword: :cyan,
16
+ method: :purpleish,
17
+ nilclass: :red,
18
+ string: :yellowish,
19
+ struct: :pale,
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
+
@@ -5,7 +5,7 @@ module JazzFingers
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 = '5.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Henrique Lopes Ribeiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2020-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -102,6 +102,14 @@ files:
102
102
  - Rakefile
103
103
  - jazz_fingers.gemspec
104
104
  - lib/jazz_fingers.rb
105
+ - lib/jazz_fingers/awesome_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
@@ -124,9 +132,9 @@ 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
139
  rubygems_version: 3.0.8
132
140
  signing_key: