betterp 0.1.6 → 0.1.7

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: 14eca65c37298f3f7f28bd0ea317eb12fcc739db2e7502a0487addeef5997c90
4
- data.tar.gz: b6fc5f08ca75600e220cc153593ca0b1bdec8a239e7af9266d4301792ba46484
3
+ metadata.gz: 501b9d46dac9e320503237bdf36b11ff4cc8fc132e38544c8983ab88a011ce02
4
+ data.tar.gz: 3a7c7f5f22b2c682efd2420fdb209ff7585bcaf45d8e172d2eabaaf435037e9a
5
5
  SHA512:
6
- metadata.gz: 782f0b93d39771daaa86e13b8655a13aa1ac41c349bef5e04a0e93015ff65475a2561bdf8beda5b03b314804591b8fb75a60b7a1a942940f9aaefaffdcf22431
7
- data.tar.gz: 509b64a135cc221547a497c1e6f94edf0d5cceb2a9528c0b117b95c482de535a0861b4573211ec475518d2cf4353d07e178829561c5e7cd0707c2c981e2a60e8
6
+ metadata.gz: 1f7ced07d0ba538d63852fd208c10f5b1cc0bcc0f2748db0eb96bfec3d30d7d8b7d90d1820fcab60c13ebfc6f6e501663cfc4385dd7350ac81f287099ca104fe
7
+ data.tar.gz: 28de19d8ab67d915a18c659938cd01936a6561ef8b4874e6c10983c081b94a4d448125732b0cb4d8f267d61b8cd846db4fb9fc93f90a0d9cd084da186c637823
data/.gitignore CHANGED
@@ -6,11 +6,11 @@
6
6
  /spec/reports/
7
7
  /tmp/
8
8
 
9
- Gemfile.lock
10
-
11
9
  .ruby-version
12
10
  .rspec_status
13
11
  .byebug_history
14
12
  *.swp
15
13
  *.swo
16
14
  betterp-*.gem
15
+
16
+ /rspec-documentation/bundle/
data/.rubocop.yml CHANGED
@@ -1,18 +1,8 @@
1
- Style/Documentation:
2
- Enabled: false
3
-
4
- Style/StringLiterals:
5
- Exclude:
6
- - 'lib/betterp/output.rb'
7
-
8
- Style/FormatString:
9
- Exclude:
10
- - 'lib/betterp/output.rb'
11
-
12
- Style/FormatStringToken:
13
- Exclude:
14
- - 'lib/betterp/output.rb'
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
15
4
 
16
5
  AllCops:
6
+ NewCops: enable
17
7
  Exclude:
18
8
  - 'bin/**/*'
data/Gemfile CHANGED
@@ -6,3 +6,12 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  # Specify your gem's dependencies in betterp.gemspec
8
8
  gemspec
9
+
10
+ gem 'rake', '~> 13.0'
11
+ gem 'rspec', '~> 3.12'
12
+ gem 'rspec-documentation', '~> 0.0.11'
13
+ gem 'rspec-its', '~> 1.3'
14
+ gem 'rubocop', '~> 1.57'
15
+ gem 'rubocop-rake', '~> 0.6.0'
16
+ gem 'rubocop-rspec', '~> 2.24'
17
+ gem 'strong_versions', '~> 0.4.5'
data/Gemfile.lock ADDED
@@ -0,0 +1,106 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ betterp (0.1.7)
5
+ paintbrush (~> 0.1.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ base64 (0.1.1)
12
+ concurrent-ruby (1.2.2)
13
+ diff-lcs (1.5.0)
14
+ htmlbeautifier (1.4.2)
15
+ i18n (1.14.1)
16
+ concurrent-ruby (~> 1.0)
17
+ json (2.6.3)
18
+ kramdown (2.4.0)
19
+ rexml
20
+ kramdown-parser-gfm (1.1.0)
21
+ kramdown (~> 2.0)
22
+ language_server-protocol (3.17.0.3)
23
+ nokogiri (1.15.4-x86_64-linux)
24
+ racc (~> 1.4)
25
+ paint (2.3.0)
26
+ paintbrush (0.1.3)
27
+ parallel (1.23.0)
28
+ parser (3.2.2.4)
29
+ ast (~> 2.4.1)
30
+ racc
31
+ racc (1.7.1)
32
+ rainbow (3.1.1)
33
+ rake (13.0.6)
34
+ regexp_parser (2.8.2)
35
+ rexml (3.2.6)
36
+ rouge (4.2.0)
37
+ rspec (3.12.0)
38
+ rspec-core (~> 3.12.0)
39
+ rspec-expectations (~> 3.12.0)
40
+ rspec-mocks (~> 3.12.0)
41
+ rspec-core (3.12.2)
42
+ rspec-support (~> 3.12.0)
43
+ rspec-documentation (0.0.11)
44
+ htmlbeautifier (~> 1.4)
45
+ kramdown (~> 2.4)
46
+ kramdown-parser-gfm (~> 1.1)
47
+ nokogiri (~> 1.15)
48
+ paintbrush (~> 0.1.3)
49
+ rouge (~> 4.1)
50
+ rspec (~> 3.12)
51
+ rspec-expectations (3.12.3)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.12.0)
54
+ rspec-its (1.3.0)
55
+ rspec-core (>= 3.0.0)
56
+ rspec-expectations (>= 3.0.0)
57
+ rspec-mocks (3.12.6)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.12.0)
60
+ rspec-support (3.12.1)
61
+ rubocop (1.57.1)
62
+ base64 (~> 0.1.1)
63
+ json (~> 2.3)
64
+ language_server-protocol (>= 3.17.0)
65
+ parallel (~> 1.10)
66
+ parser (>= 3.2.2.4)
67
+ rainbow (>= 2.2.2, < 4.0)
68
+ regexp_parser (>= 1.8, < 3.0)
69
+ rexml (>= 3.2.5, < 4.0)
70
+ rubocop-ast (>= 1.28.1, < 2.0)
71
+ ruby-progressbar (~> 1.7)
72
+ unicode-display_width (>= 2.4.0, < 3.0)
73
+ rubocop-ast (1.29.0)
74
+ parser (>= 3.2.1.0)
75
+ rubocop-capybara (2.19.0)
76
+ rubocop (~> 1.41)
77
+ rubocop-factory_bot (2.24.0)
78
+ rubocop (~> 1.33)
79
+ rubocop-rake (0.6.0)
80
+ rubocop (~> 1.0)
81
+ rubocop-rspec (2.24.1)
82
+ rubocop (~> 1.33)
83
+ rubocop-capybara (~> 2.17)
84
+ rubocop-factory_bot (~> 2.22)
85
+ ruby-progressbar (1.13.0)
86
+ strong_versions (0.4.5)
87
+ i18n (>= 0.5)
88
+ paint (~> 2.0)
89
+ unicode-display_width (2.5.0)
90
+
91
+ PLATFORMS
92
+ x86_64-linux
93
+
94
+ DEPENDENCIES
95
+ betterp!
96
+ rake (~> 13.0)
97
+ rspec (~> 3.12)
98
+ rspec-documentation (~> 0.0.11)
99
+ rspec-its (~> 1.3)
100
+ rubocop (~> 1.57)
101
+ rubocop-rake (~> 0.6.0)
102
+ rubocop-rspec (~> 2.24)
103
+ strong_versions (~> 0.4.5)
104
+
105
+ BUNDLED WITH
106
+ 2.4.14
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2018 Robert Farrell
1
+ Copyright 2018-2023 Robert Farrell
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/Makefile CHANGED
@@ -3,3 +3,4 @@ test:
3
3
  bin/rspec
4
4
  bin/rubocop
5
5
  bin/strong_versions
6
+ bundle exec rspec-documentation
data/betterp.gemspec CHANGED
@@ -9,13 +9,15 @@ Gem::Specification.new do |spec|
9
9
  spec.licenses = ['MIT']
10
10
  spec.version = Betterp::VERSION
11
11
  spec.authors = ['Bob Farrell']
12
- spec.email = ['bob@homeflow.co.uk']
12
+ spec.email = ['git@bob.frl']
13
13
 
14
- spec.summary = 'Enhanced debug output'
15
- spec.description = 'Replaces Kernel#p with a fancier version'
14
+ spec.summary = 'Enhanced colorized debug output'
15
+ spec.description = 'Overwrites Kernel#p to provide output with file path, line numbers, and profiling. '
16
16
  spec.homepage = 'https://github.com/bobf/betterp'
17
17
 
18
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ spec.required_ruby_version = '>= 3.2'
19
+
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
21
  `git ls-files -z`.split("\x0").reject do |f|
20
22
  f.match(%r{^(test|spec|features)/})
21
23
  end
@@ -24,12 +26,7 @@ Gem::Specification.new do |spec|
24
26
  spec.executables = []
25
27
  spec.require_paths = ['lib']
26
28
 
27
- spec.add_runtime_dependency 'paint', '~> 2.0'
29
+ spec.add_runtime_dependency 'paintbrush', '~> 0.1.3'
28
30
 
29
- spec.add_development_dependency 'bundler', '~> 1.16'
30
- spec.add_development_dependency 'rake', '~> 10.0'
31
- spec.add_development_dependency 'rspec', '~> 3.0'
32
- spec.add_development_dependency 'rspec-its', '~> 1.2'
33
- spec.add_development_dependency 'rubocop', '~> 0.77.0'
34
- spec.add_development_dependency 'strong_versions', '~> 0.3.2'
31
+ spec.metadata['rubygems_mfa_required'] = 'true'
35
32
  end
data/doc/testp.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'betterp'
4
4
 
5
- class MyCustomClass
5
+ class MyCustomClass # rubocop:disable Lint/EmptyClass
6
6
  end
7
7
 
8
8
  p 'hello'
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Betterp
4
+ # Misc. configuration options for Betterp library.
5
+ class Configuration
6
+ attr_accessor :test_mode
7
+ attr_writer :profiling_thresholds
8
+
9
+ # Configures colors to use for different profiling durations, defines low, medium, and high
10
+ # colors.
11
+ class ProfilingThreshold
12
+ attr_writer :low, :high
13
+
14
+ def color(duration)
15
+ return :green if low?(duration)
16
+ return :yellow if medium?(duration)
17
+
18
+ :red if high?(duration)
19
+ end
20
+
21
+ private
22
+
23
+ def low?(duration)
24
+ duration <= low
25
+ end
26
+
27
+ def medium?(duration)
28
+ duration.between?(low, high)
29
+ end
30
+
31
+ def high?(duration)
32
+ duration >= high
33
+ end
34
+
35
+ def low
36
+ @low || 10
37
+ end
38
+
39
+ def high
40
+ @high || 100
41
+ end
42
+ end
43
+
44
+ def profiling_threshold
45
+ @profiling_threshold ||= ProfilingThreshold.new
46
+ end
47
+ end
48
+ end
@@ -1,27 +1,42 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Betterp
4
+ # Transforms default output from `Kernel.p` into enhanced, colorized output with source
5
+ # filename, line number, method name, and duration when used with a block.
4
6
  class Output
5
- COLORS = %i[red green yellow blue magenta cyan].freeze
6
- EFFECTS = [:bright, nil].freeze
7
+ COLORS = %i[red green yellow blue purple cyan red_b green_b yellow_b blue_b purple_b cyan_b].freeze
7
8
 
8
- def initialize(raw, source, options = {})
9
+ def initialize(raw, source, duration, options = {})
9
10
  @raw = raw
10
11
  @source = source
12
+ @duration = duration
11
13
  @color = color
12
- @effect = effect
13
14
  @pretty = options.fetch(:pretty, false)
14
15
  end
15
16
 
16
- def format(args)
17
+ def formatted(args)
17
18
  (@pretty ? args : args.map(&:inspect)).map do |arg|
18
- style = %i[yellow]
19
- header + colorize(prefix) + caller_code + Paint[pretty(arg), *style]
19
+ output = [
20
+ header, colorized_prefix, colorized_duration, caller_code, colorized_pretty(arg)
21
+ ].compact.join(' ').chomp
22
+ "#{output}\n"
20
23
  end
21
24
  end
22
25
 
23
26
  private
24
27
 
28
+ def colorized_duration
29
+ return nil if @duration.nil?
30
+
31
+ duration = @duration * 1000
32
+ color = Betterp.configuration.profiling_threshold.color(duration)
33
+ Paintbrush.paintbrush { "[#{send color, "#{Float(format('%.2g', duration))}ms"}]" }
34
+ end
35
+
36
+ def colorized_pretty(arg)
37
+ Paintbrush.paintbrush { cyan pretty(arg) }
38
+ end
39
+
25
40
  def pretty(arg)
26
41
  return arg unless @pretty
27
42
 
@@ -29,22 +44,18 @@ module Betterp
29
44
  PP.pp(arg, io)
30
45
  return io.string unless io.string.include?("\n")
31
46
 
32
- "\n" + io.string.split("\n").map { |line| " #{line}" }.join("\n")
47
+ "\n#{io.string.split("\n").map { |line| " #{line}" }.join("\n")}"
33
48
  end
34
49
 
35
50
  def caller_code
36
- return '' unless @raw.include?(':')
51
+ return nil unless @raw.include?(':')
37
52
 
38
53
  path, line, *_rest = @raw.split(':')
39
- return '' unless Pathname.new(path).readable? && line.to_i.positive?
40
-
41
- Paint % [
42
- +'%{open}%{code}%{close}',
43
- :default,
44
- open: ['{ ', :white, :default],
45
- code: [find_caller(line.to_i, path).to_s.strip, :cyan],
46
- close: [' } ', :white, :default]
47
- ]
54
+ return nil unless Pathname.new(path).readable? && line.to_i.positive?
55
+
56
+ Paintbrush.paintbrush do
57
+ white "{ #{blue find_caller(line.to_i, path).to_s.strip} }"
58
+ end
48
59
  end
49
60
 
50
61
  def find_caller(line_number, path)
@@ -54,49 +65,19 @@ module Betterp
54
65
  end
55
66
 
56
67
  def header
57
- Paint % [
58
- +"%{standard}%{relevant}",
59
- :default,
60
- standard: [' ', :default],
61
- relevant: ['•••• ', @color, @effect]
62
- ]
68
+ Paintbrush.paintbrush { send @color, '####' }
63
69
  end
64
70
 
65
- def prefix
66
- [
67
- '%{path}',
68
- '%{separator}',
69
- '%{line_no}',
70
- '%{method_pointer}',
71
- '%{method_name}',
72
- '%{terminator}'
73
- ].join
74
- end
75
-
76
- def colorize(string)
77
- Paint % [string, :default, mapping]
78
- end
79
-
80
- def mapping
81
- {
82
- path: [@source.path],
83
- line_no: [@source.line_no],
84
- method_name: [@source.method_name],
85
-
86
- method_pointer: [' => ', :reset, :bright],
87
- separator: [':', :reset],
88
- terminator: [' :: ', :reset]
89
- }
71
+ def colorized_prefix
72
+ Paintbrush.paintbrush do
73
+ "#{blue_b @source.path}:#{cyan_b @source.line_no} => [#{green "##{@source.method_name}"}]"
74
+ end
90
75
  end
91
76
 
92
77
  def color
93
78
  COLORS[hash(@raw).hex % COLORS.size]
94
79
  end
95
80
 
96
- def effect
97
- EFFECTS[hash(hash(@raw)).hex % EFFECTS.size]
98
- end
99
-
100
81
  def hash(input)
101
82
  Digest::MD5.hexdigest(input)
102
83
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Betterp
4
+ # Parses a line from a stack trace to generate file path, line number, and method name.
4
5
  class Source
5
6
  def initialize(source, base_path)
6
7
  @source = source
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Betterp
4
+ # Executes a block and returns the block result and duration.
5
+ class TimedBlock
6
+ def initialize(block:)
7
+ @block = block
8
+ end
9
+
10
+ def result
11
+ start = Time.now.utc
12
+ block_result = block.call
13
+ [block_result, Time.now.utc - start]
14
+ end
15
+
16
+ private
17
+
18
+ attr_reader :block
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Betterp
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
5
5
  end
data/lib/betterp.rb CHANGED
@@ -2,18 +2,31 @@
2
2
 
3
3
  require 'digest'
4
4
  require 'pathname'
5
- require 'pp'
5
+ require 'pp' # rubocop:disable Lint/RedundantRequireStatement
6
6
  require 'stringio'
7
+ require 'time'
7
8
 
8
- require 'paint'
9
+ require 'paintbrush'
9
10
 
10
11
  require 'kernel'
12
+ require 'betterp/configuration'
11
13
  require 'betterp/output'
12
14
  require 'betterp/source'
15
+ require 'betterp/timed_block'
13
16
  require 'betterp/version'
14
17
 
18
+ # Enhanced debug output library.
15
19
  module Betterp
16
20
  def self.root
17
21
  Pathname.new(File.dirname(__dir__))
18
22
  end
23
+
24
+ def self.configuration
25
+ @configuration || Configuration.new
26
+ end
27
+
28
+ def self.configure
29
+ @configuration = Configuration.new
30
+ yield @configuration
31
+ end
19
32
  end
data/lib/kernel.rb CHANGED
@@ -1,23 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Overrides for `p` and `pp` Kernel methods.
3
4
  module Kernel
4
- def p(*args)
5
+ def p(*args, &block)
5
6
  raw = caller(1..1).first
6
- _betterp(raw, args)
7
+ _betterp(raw, args, block)
7
8
  end
8
9
 
9
- def pp(*args)
10
+ def pp(*args, &block)
10
11
  raw = caller(1..1).first
11
- _betterp(raw, args, pretty: true)
12
+ _betterp(raw, args, block, pretty: true)
12
13
  end
13
14
 
14
- def _betterp(raw, args, options = {})
15
+ def _betterp(raw, args, block, options = {}) # rubocop:disable Metrics/AbcSize
15
16
  source = Betterp::Source.new(raw, Dir.pwd)
16
17
  pretty = options.fetch(:pretty, false)
17
18
 
18
- Betterp::Output.new(raw, source, pretty: pretty).format(args).each do |str|
19
- STDOUT.write(str + "\n")
20
- end
19
+ block_result, duration = Betterp::TimedBlock.new(block:).result unless block.nil?
20
+
21
+ output = Betterp::Output.new(raw, source, duration, pretty:)
22
+ formatted_output = output.formatted(block.nil? ? args : [block_result]).join("\n")
23
+
24
+ return formatted_output if Betterp.configuration.test_mode
25
+
26
+ $stdout.write(formatted_output)
27
+
28
+ return block_result unless block.nil?
21
29
 
22
30
  args.size > 1 ? args : args.first
23
31
  end
@@ -0,0 +1,16 @@
1
+ # Introduction
2
+
3
+ _Betterp_ overwrites the default `p` and `pp` _Kernel_ methods to provide enhanced debug output including:
4
+
5
+ * Source file and line number of invocation.
6
+ * Colorized tags to help track debug output in noisy server logs.
7
+ * Profiling information (pass a block to `p` or `pp` to output call duration).
8
+
9
+
10
+ ```rspec:ansi
11
+ require 'betterp'
12
+
13
+ subject { p 'hello' }
14
+
15
+ it { is_expected.to include 'hello' }
16
+ ```
@@ -0,0 +1,43 @@
1
+ # Usage
2
+
3
+ Typical usage of _Betterp_ is identical to usage of `Kernel.p` and `Kernel.pp`, simply require `betterp` somewhere in your project and call `#p` or `#pp` as normal.
4
+
5
+ ```rspec:ansi
6
+ subject { p 'hi' }
7
+
8
+ it { is_expected.to include 'hi' }
9
+ ```
10
+
11
+ ```rspec:ansi
12
+ subject { pp({ foo: 'bar', baz: 'qux' }) }
13
+
14
+ it { is_expected.to include 'qux' }
15
+ ```
16
+
17
+ ## Profiling
18
+
19
+ Both `#p` and `#pp` can receive a block. If a block is received, the block will be timed and the execution time will be included in the output. The result of the block is returned to the caller.
20
+
21
+ ```rspec:ansi
22
+ subject do
23
+ p { sleep(0.1); 'some return value' }
24
+ end
25
+
26
+ it { is_expected.to match /\dms/ }
27
+ ```
28
+
29
+ The execution time is highlighted in `green`, `yellow`, or `red` depending on execution time.
30
+
31
+ The default thresholds are:
32
+
33
+ * `low`: `< 10ms`.
34
+ * `high`: `> 100ms`.
35
+
36
+ The thresholds can be modified:
37
+
38
+ ```ruby
39
+ Betterp.configure do |config|
40
+ config.profiling_threshold.low = 100
41
+ config.profiling_threshold.high = 1000
42
+ end
43
+ ```
@@ -0,0 +1,11 @@
1
+ # License
2
+
3
+ ## MIT
4
+
5
+ Copyright 2018-2023 Robert Farrell
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'betterp'
4
+
5
+ Betterp.configure do |config|
6
+ config.test_mode = true
7
+ end
8
+
9
+ RSpec::Documentation.configure do |config|
10
+ # Force example tabs to have a consistent height to prevent content jumping.
11
+ # config.consistent_height = false
12
+
13
+ # Set a maximum height for example tabs. Tabs will scroll if content exceeds this value.
14
+ # config.max_height = "30rem"
15
+
16
+ # Enable or disable the table of contents for each page. This renders a list of all headings in
17
+ # the page, except the main heading.
18
+ # config.table_of_contents = true
19
+
20
+ # Enable or disable the index search above the navigation tree.
21
+ # config.index_search = true
22
+
23
+ config.context do
24
+ # Define global context here, e.g. add some `let` blocks to make them available in every example.
25
+ #
26
+ # let(:foo) { 'bar' }
27
+ end
28
+ end
29
+
30
+ RSpec.configure do |config|
31
+ # Define RSpec configuration here.
32
+ # Note that your main `spec/spec_helper.rb` is not loaded unless you require it in this file.
33
+ end
metadata CHANGED
@@ -1,116 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betterp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-23 00:00:00.000000000 Z
11
+ date: 2023-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: paint
14
+ name: paintbrush
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: 0.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: '2.0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.16'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.16'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '10.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec-its
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.2'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.2'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.77.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.77.0
97
- - !ruby/object:Gem::Dependency
98
- name: strong_versions
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 0.3.2
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 0.3.2
111
- description: Replaces Kernel#p with a fancier version
26
+ version: 0.1.3
27
+ description: 'Overwrites Kernel#p to provide output with file path, line numbers,
28
+ and profiling. '
112
29
  email:
113
- - bob@homeflow.co.uk
30
+ - git@bob.frl
114
31
  executables: []
115
32
  extensions: []
116
33
  extra_rdoc_files: []
@@ -119,6 +36,7 @@ files:
119
36
  - ".rspec"
120
37
  - ".rubocop.yml"
121
38
  - Gemfile
39
+ - Gemfile.lock
122
40
  - LICENSE
123
41
  - Makefile
124
42
  - README.md
@@ -132,15 +50,22 @@ files:
132
50
  - doc/images/screenshot.png
133
51
  - doc/testp.rb
134
52
  - lib/betterp.rb
53
+ - lib/betterp/configuration.rb
135
54
  - lib/betterp/output.rb
136
55
  - lib/betterp/source.rb
56
+ - lib/betterp/timed_block.rb
137
57
  - lib/betterp/version.rb
138
58
  - lib/kernel.rb
59
+ - rspec-documentation/pages/000-Introduction.md
60
+ - rspec-documentation/pages/010-Usage.md
61
+ - rspec-documentation/pages/500-License.md
62
+ - rspec-documentation/spec_helper.rb
139
63
  homepage: https://github.com/bobf/betterp
140
64
  licenses:
141
65
  - MIT
142
- metadata: {}
143
- post_install_message:
66
+ metadata:
67
+ rubygems_mfa_required: 'true'
68
+ post_install_message:
144
69
  rdoc_options: []
145
70
  require_paths:
146
71
  - lib
@@ -148,15 +73,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
73
  requirements:
149
74
  - - ">="
150
75
  - !ruby/object:Gem::Version
151
- version: '0'
76
+ version: '3.2'
152
77
  required_rubygems_version: !ruby/object:Gem::Requirement
153
78
  requirements:
154
79
  - - ">="
155
80
  - !ruby/object:Gem::Version
156
81
  version: '0'
157
82
  requirements: []
158
- rubygems_version: 3.0.3
159
- signing_key:
83
+ rubygems_version: 3.4.10
84
+ signing_key:
160
85
  specification_version: 4
161
- summary: Enhanced debug output
86
+ summary: Enhanced colorized debug output
162
87
  test_files: []