require_bench 1.0.3 → 1.0.4.pre.alpha.2

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: 29b5e12e1b01d5ae6d8533aa3e0242232be4f034e2f2358d701fcdd1509a1414
4
- data.tar.gz: 34c075de69195c9ec4100921b1fb1378091898d878ba3794eb5de0f83c1c22ac
3
+ metadata.gz: 8ad6c348ba3e2af8f3031d0311a47f5f8e9bab4edace929cec17b95fc0ba6b69
4
+ data.tar.gz: 929d2e6271277681bc182ac8107c77f7e3ddf84156dc375a45b9b829ef2fb468
5
5
  SHA512:
6
- metadata.gz: 531b1fecc4c691ed4b23c8fdcec9864710c2671a9ad5dd8a9db36de4618acb1331b1e7c09e771959725cef9d52812bf6b140f97b735e1683b2d6b62b07d376ad
7
- data.tar.gz: 4514de7127ec5e7294e0825f6a572abb4ad364be96f35ca623127e6dec0314e31ca4030e08ddf191f952468659ab997e9b58d7afea7188a5c82d0d020b8e1e44
6
+ metadata.gz: ae182b869291e087254d3386ab2e379e6e26adf6d15da8e1f5027a3bd7f4b35704c0af6b10981fd5f5a28d31bb897873c4476e63a48fe9f9063cd281cc1bb497
7
+ data.tar.gz: 36e08a41d98fef5a804543b301f5754da4e4a07cbb89c577ff66b8309cd3b94bcc25ac7566928efa98a99420ddcff66e785ca128ab8e250bb9a1b84157a8d2f4
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2018 Peter Boling of railsbling.com
1
+ Copyright 2018-2020, 2023 Peter Boling of railsbling.com
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/README.md CHANGED
@@ -10,20 +10,20 @@ This is an extraction of a debugging tool that I have copy/pasted into many proj
10
10
 
11
11
  *Caveat*: This gem has no effects unless a particular environment variable is set. It does nothing at all unless it is 'invoked' by detection of the environment variable (`ENV['REQUIRE_BENCH'] == 'true'`). The *Warning* above is mitigated by the gem not having any of its code activated under normal circumstances.
12
12
 
13
- | Project | RequireBench |
14
- |------------------------ | ----------------------- |
15
- | gem name | [require_bench](https://rubygems.org/gems/require_bench) |
16
- | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
17
- | download rank | [![Downloads Today](https://img.shields.io/gem/rd/require_bench.svg)](https://github.com/pboling/require_bench) |
18
- | version | [![Version](https://img.shields.io/gem/v/require_bench.svg)](https://rubygems.org/gems/require_bench) |
19
- | dependencies | [![Depfu](https://badges.depfu.com/badges/247bffc753b0cd49d3c08ce03b5c251c/count.svg)](https://depfu.com/github/pboling/require_bench?project_id=5824) |
20
- | continuous integration | [![Build Status](https://travis-ci.org/pboling/require_bench.svg?branch=master)](https://travis-ci.org/pboling/require_bench) |
21
- | test coverage | [![Test Coverage](https://api.codeclimate.com/v1/badges/18523205c207a2b53045/test_coverage)](https://codeclimate.com/github/pboling/require_bench/test_coverage) |
22
- | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/18523205c207a2b53045/maintainability)](https://codeclimate.com/github/pboling/require_bench/maintainability) |
23
- | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/require_bench/badges/users.svg)](https://www.codetriage.com/pboling/require_bench) |
24
- | homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
25
- | documentation | [on RDoc.info][documentation] |
26
- | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌍 🌎 🌏](https://about.me/peter.boling), [🍚](https://www.crowdrise.com/helprefugeeswithhopefortomorrowliberia/fundraiser/peterboling), [➕](https://plus.google.com/+PeterBoling/posts), [👼](https://angel.co/peter-boling), [🐛](https://www.topcoder.com/members/pboling/), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo) |
13
+ | Project | RequireBench |
14
+ |------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15
+ | gem name | [require_bench](https://rubygems.org/gems/require_bench) |
16
+ | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
17
+ | download rank | [![Downloads Today](https://img.shields.io/gem/rd/require_bench.svg)](https://github.com/pboling/require_bench) |
18
+ | version | [![Version](https://img.shields.io/gem/v/require_bench.svg)](https://rubygems.org/gems/require_bench) |
19
+ | dependencies | [![Depfu](https://badges.depfu.com/badges/247bffc753b0cd49d3c08ce03b5c251c/count.svg)](https://depfu.com/github/pboling/require_bench?project_id=5824) |
20
+ | continuous integration | [![Build Status](https://travis-ci.org/pboling/require_bench.svg?branch=master)](https://travis-ci.org/pboling/require_bench) |
21
+ | test coverage | [![Test Coverage](https://api.codeclimate.com/v1/badges/18523205c207a2b53045/test_coverage)](https://codeclimate.com/github/pboling/require_bench/test_coverage) |
22
+ | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/18523205c207a2b53045/maintainability)](https://codeclimate.com/github/pboling/require_bench/maintainability) |
23
+ | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/require_bench/badges/users.svg)](https://www.codetriage.com/pboling/require_bench) |
24
+ | homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
25
+ | documentation | [on RDoc.info][documentation] |
26
+ | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌏](https://about.me/peter.boling), [👼](https://angel.co/peter-boling), [:shipit:](https://coderwall.com/Peter%20Boling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](https://twitter.com/galtzo) |
27
27
 
28
28
  ## Installation
29
29
 
@@ -61,20 +61,31 @@ ENV['REQUIRE_BENCH'] == 'true'
61
61
 
62
62
  Any value other than `'true'` means RequireBench is still turned off.
63
63
 
64
- ### Handy Rake Task for Rails:
64
+ ### Handy Rake Task
65
65
 
66
- Require in Rakefile, as follows:
66
+ #### For a Gem Library
67
+
68
+ Require in Rakefile:
67
69
 
68
70
  ```ruby
69
71
  require 'bundler/setup'
70
72
  require 'require_bench/tasks' # Near the top, just below require 'bundler/setup'!
71
73
  ```
72
74
 
73
- This will ensure it will load before other stuff.
75
+ #### For Rails
76
+
77
+ Require in Rakefile:
78
+
79
+ ```ruby
80
+ require_relative 'config/application'
81
+ require 'require_bench/tasks' # Near the top, just below require_relative 'config/application'!
82
+ ```
83
+
84
+ #### Output
74
85
 
75
86
  When running from command line, you will see output as the Rails app boots.
76
87
  ```bash
77
- REQUIRE_BENCH=true bundle exec rake require_bench:hello
88
+ $ REQUIRE_BENCH=true bundle exec rake require_bench:hello
78
89
  [RequireBench] 12.179703 /path/to/my_app/config/application
79
90
  [RequireBench] 0.001726 resque/tasks
80
91
  [RequireBench] 0.000917 resque/scheduler/tasks
@@ -121,8 +132,8 @@ export REQUIRE_BENCH_SKIP_PATTERN=activesupport,rspec
121
132
  ```
122
133
 
123
134
  `ENV['REQUIRE_BENCH_SKIP_PATTERN']` must be one of:
124
- * a string, to be split by comma (`,`), each Regexp escaped, then joined by pipe (`|`) with `Regexp.union`
125
- * a string, to be split by pipe (`|`), each Regexp escaped, then joined by pipe (`|`) with `Regexp.union`
135
+ * a string, to be split by comma (`,`), then joined by pipe (`|`) with `Regexp.union`
136
+ * a string, to be split by pipe (`|`), then joined by pipe (`|`) with `Regexp.union`
126
137
 
127
138
  ```ruby
128
139
  ENV['REQUIRE_BENCH_SKIP_PATTERN'] = 'activesupport,rspec'
@@ -170,7 +181,7 @@ spec.add_dependency 'require_bench', '~> 0.0'
170
181
 
171
182
  ## License
172
183
 
173
- * Copyright (c) 2018 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
184
+ * Copyright (c) 2018-2020, 2023 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
174
185
 
175
186
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
176
187
 
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # std libs
4
+ require 'forwardable'
5
+
6
+ # third party libs
7
+ # You will need to have gem "colorize" installed!
8
+ # NOTE: You will need to require "colorized_string" in your own code,
9
+ # in order for this alternate Printer class to load
10
+
11
+ class Printer
12
+ attr_accessor :colors, :color
13
+
14
+ extend Forwardable
15
+ def_delegators :@colors, :rotate!, :first
16
+ def initialize
17
+ @colors = ColorizedString.colors.dup.reject { |x| x.match?(/black|white/) }
18
+ end
19
+
20
+ # Log statement when a file starts loading
21
+ def s(file, type)
22
+ printf "🚥 #{ColorizedString["[RequireBench-#{type}]"].colorize(first)} 📖 %s 🚥\n", file
23
+ rotate!
24
+ end
25
+
26
+ # Log statement when a file completed loading
27
+ def p(seconds, file, type)
28
+ printf "🚥 #{ColorizedString["[RequireBench-#{type}]"].colorize(first)} ☑️ %10f %s 🚥\n", seconds, file
29
+ rotate!
30
+ end
31
+
32
+ # Log statement when a file raises an error while loading
33
+ def e(error, file, type)
34
+ printf "🚥 #{ColorizedString["[RequireBench-#{type}]"].colorize(first)} ❌ '#{error.class}: #{error.message}' loading %s 🚥\n#{error.backtrace.join("\n")}",
35
+ file
36
+ end
37
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Printer
4
+ # Log statement when a file starts loading
5
+ def s(file, type)
6
+ printf "🚥 [RequireBench-#{type}] 📖 %s 🚥\n", file
7
+ rotate!
8
+ end
9
+
10
+ # Log statement when a file completed loading
11
+ def p(seconds, file, type)
12
+ printf "🚥 [RequireBench-#{type}] ☑️ %10f %s 🚥\n", seconds, file
13
+ end
14
+
15
+ # Log statement when a file raises an error while loading
16
+ def e(error, file, type)
17
+ printf "🚥 [RequireBench-#{type}] ❌ '#{error.class}: #{error.message}' loading %s 🚥\n#{error.backtrace.join("\n")}",
18
+ file
19
+ end
20
+ end
@@ -23,10 +23,15 @@ namespace :require_bench do
23
23
  printf("%10f %s\n", tot, 'TOTAL')
24
24
  else
25
25
  puts %(
26
- require_bench did not track any requires, because it was required too late.
26
+ require_bench did not track any requires, because it was required too late, of the configuration excluded everything.
27
27
  Require in Rakefile, as follows
28
- require 'bundler/setup'
28
+ require 'bundler/setup' # or for Rails - require_relative 'config/application'
29
29
  require 'require_bench/tasks'
30
+ Check ENV variable values for:
31
+ REQUIRE_BENCH_SKIP_PATTERN
32
+ REQUIRE_BENCH_INCLUDE_PATTERN
33
+ REQUIRE_BENCH_NO_GROUP_PATTERN
34
+ Then run rake require_bench:hello again!
30
35
  )
31
36
  end
32
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RequireBench
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4-alpha.2'
5
5
  end
data/lib/require_bench.rb CHANGED
@@ -1,61 +1,176 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ REQUIRE_BENCH_ENABLED = ENV.fetch('REQUIRE_BENCH', 'false').casecmp?('true')
4
+
3
5
  # STD Libs
4
- require 'benchmark'
6
+ if REQUIRE_BENCH_ENABLED
7
+ require 'benchmark'
8
+ require 'timeout'
9
+ end
5
10
 
6
11
  # This Gem
7
12
  require 'require_bench/version'
8
13
 
14
+ # Namespace for this gem
9
15
  module RequireBench
10
- TIMINGS = Hash.new { |h, k| h[k] = 0.0 }
11
- skips = ENV['REQUIRE_BENCH_SKIP_PATTERN']
12
- if skips
13
- skip_pattern = case skips
14
- when /,/ then
15
- Regexp.union(*skips.split(','))
16
- when /\|/ then
17
- Regexp.union(*skips.split('|'))
18
- end
19
- puts "[RequireBench] Using skip pattern: #{skip_pattern}"
20
- end
21
- SKIP_PATTERN = skip_pattern
16
+ if REQUIRE_BENCH_ENABLED
17
+ TIMINGS = Hash.new { |h, k| h[k] = 0.0 }
18
+ skips = ENV['REQUIRE_BENCH_SKIP_PATTERN']
19
+ log_start = ENV['REQUIRE_BENCH_LOG_START']
20
+ timeout = ENV.fetch('REQUIRE_BENCH_TIMEOUT', '0').to_i # zero == no timeout, any other number == seconds to wait.
21
+ tracked_methods = ENV.fetch('REQUIRE_BENCH_TRACKED_METHODS', 'require,load').split(',')
22
+ raise ArgumentError, "ENV['REQUIRE_BENCH_TRACKED_METHODS'] is invalid." unless (tracked_methods - %w[load
23
+ require]).empty?
24
+
25
+ includes = ENV['REQUIRE_BENCH_INCLUDE_PATTERN']
26
+ no_group = ENV['REQUIRE_BENCH_NO_GROUP_PATTERN']
27
+ group_precedence = ENV.fetch('REQUIRE_BENCH_GROUP_PRECEDENCE', 'path,basename')
28
+ precedence = group_precedence.split(',')
29
+ raise ArgumentError, "ENV['REQUIRE_BENCH_GROUP_PRECEDENCE'] is invalid." unless precedence.sort == %w[basename path]
30
+
31
+ rescued_classes = ENV.fetch('REQUIRE_BENCH_RESCUED_CLASSES', '').split(',')
32
+
33
+ preferred_grouping = precedence.first
34
+ prefer_not_path = preferred_grouping != 'path' # path correlates to default behavior of regexp matching
35
+
36
+ if defined?(ColorizedString)
37
+ require 'require_bench/color_printer'
38
+ else
39
+ require 'require_bench/printer'
40
+ end
41
+ PRINTER = Printer.new
42
+ if skips && !skips.empty?
43
+ skip_pattern = case skips
44
+ when /,/
45
+ Regexp.union(*skips.split(','))
46
+ when /\|/
47
+ Regexp.union(*skips.split('|'))
48
+ else
49
+ Regexp.new(skips)
50
+ end
51
+ puts "[RequireBench] Using skip pattern: #{skip_pattern}"
52
+ end
53
+ if includes && !includes.empty?
54
+ include_tokens = case includes
55
+ when /,/
56
+ includes.split(',')
57
+ when /\|/
58
+ includes.split('|')
59
+ else
60
+ Array(includes)
61
+ end
62
+ include_pattern = Regexp.union(*include_tokens)
63
+ include_tokens.reject! { |a| a.match?(%r{/}) } if prefer_not_path
64
+ puts "[RequireBench] Using include pattern: #{include_pattern}"
65
+ end
66
+ if no_group && !no_group.empty?
67
+ no_group_pattern = case no_group
68
+ when /,/
69
+ Regexp.union(*no_group.split(','))
70
+ when /\|/
71
+ Regexp.union(*no_group.split('|'))
72
+ else
73
+ Regexp.new(no_group)
74
+ end
75
+ puts "[RequireBench] Using no group pattern: #{no_group_pattern}"
76
+ end
77
+ INCLUDE_PATTERN = include_pattern
78
+ INCLUDE_TOKENS = include_tokens
79
+ LOG_START = log_start
80
+ NO_GROUP_PATTERN = no_group_pattern
81
+ PREFER_NOT_PATH = prefer_not_path
82
+ RESCUED_CLASSES = rescued_classes
83
+ SKIP_PATTERN = skip_pattern
84
+ TIMEOUT = timeout
85
+ TRACKED_METHODS = tracked_methods
22
86
 
23
- if ENV['REQUIRE_BENCH'] == 'true'
24
- def require_with_timing(file)
87
+ def consume_with_timing(type, file)
25
88
  $require_bench_semaphore = true
89
+ short_type = type[0]
26
90
  ret = nil
27
- seconds = Benchmark.realtime { ret = Kernel.send(:require_without_timing, file) }
28
- printf("[RequireBench] %10f %s\n", seconds, file)
29
- path_parts = file.split('/')
30
- prefix = path_parts.first
31
- # requires that were fully qualified paths probably need to be identified
32
- # by the full path
91
+ # Not sure if this is actually a useful abstraction...
92
+ prefix = INCLUDE_TOKENS.detect { |t| File.basename(file).match?(t) } if PREFER_NOT_PATH
93
+
94
+ seconds = Benchmark.realtime do
95
+ ret = if RequireBench::TIMEOUT.zero?
96
+ Kernel.send("#{type}_without_timing", file)
97
+ else
98
+ # Raise Timeout::Error if more than RequireBench::TIMEOUT seconds are spent in the block
99
+ # This is a giant hammer, and should probably only be used to figure out where an infinite loop might be hiding.
100
+ Timeout.timeout(RequireBench::TIMEOUT) do
101
+ Kernel.send("#{type}_without_timing", file)
102
+ end
103
+ end
104
+ end
105
+ PRINTER.p(seconds, file, short_type)
106
+ if prefix.nil? && (NO_GROUP_PATTERN.nil? || !NO_GROUP_PATTERN.match?(file))
107
+ # This results in grouping all files with the same leading path part (e.g. "models", or "lib")
108
+ # into the same timing bucket.
109
+ # requires that were fully qualified paths probably need to be identified
110
+ # by the full path
111
+ prefix = if (match = INCLUDE_PATTERN&.match(file))
112
+ match[0]
113
+ else
114
+ # Generally this will target a library name, e.g. "rspec"
115
+ # which sums all require timings from a single library together
116
+ file.partition('/').first
117
+ end
118
+ end
33
119
  prefix = file if prefix.nil? || prefix.empty?
34
120
  RequireBench::TIMINGS[prefix] += seconds
35
121
  ret
36
122
  ensure
37
123
  $require_bench_semaphore = nil
38
124
  end
39
- module_function :require_with_timing
125
+ module_function :consume_with_timing
40
126
  end
41
127
  end
42
128
 
43
- if ENV['REQUIRE_BENCH'] == 'true'
129
+ if REQUIRE_BENCH_ENABLED
44
130
  # A Kernel hack that adds require timing to find require problems in app.
45
131
  module Kernel
46
132
  alias require_without_timing require
133
+ alias load_without_timing load
47
134
 
48
135
  def require(file)
136
+ _require_bench_consume_file('require', file)
137
+ end
138
+
139
+ def load(file)
140
+ _require_bench_consume_file('load', file)
141
+ end
142
+
143
+ def _require_bench_consume_file(type, file)
49
144
  file_path = file.to_s
145
+ # byebug if file_path.match?(/no_group_fox/)
50
146
 
51
147
  # Global $ variable, which is always truthy while inside the hack, is to
52
148
  # prevent a scenario that might result in infinite recursion.
53
- return require_without_timing(file_path) if $require_bench_semaphore
54
- if RequireBench::SKIP_PATTERN && file_path =~ RequireBench::SKIP_PATTERN
55
- return require_without_timing(file_path)
149
+ return send("#{type}_without_timing", file_path) if $require_bench_semaphore
150
+
151
+ short_type = type[0]
152
+ measure = RequireBench::INCLUDE_PATTERN && file_path.match?(RequireBench::INCLUDE_PATTERN)
153
+ skippy = RequireBench::SKIP_PATTERN && file_path.match?(RequireBench::SKIP_PATTERN)
154
+ PRINTER.p(file, short_type) if RequireBench::LOG_START
155
+ if RequireBench::RESCUED_CLASSES.any?
156
+ begin
157
+ _require_bench_file(type, measure, skippy, file_path)
158
+ rescue *RequireBench::RESCUED_CLASSES => e
159
+ PRINTER.e(e, file, short_type)
160
+ end
161
+ else
162
+ _require_bench_file(type, measure, skippy, file_path)
56
163
  end
164
+ end
57
165
 
58
- RequireBench.require_with_timing(file_path)
166
+ def _require_bench_file(type, measure, skippy, file_path)
167
+ if !measure && skippy
168
+ send("#{type}_without_timing", file_path)
169
+ elsif RequireBench::INCLUDE_PATTERN.nil? || measure
170
+ RequireBench.send('consume_with_timing', type, file_path)
171
+ else
172
+ send("#{type}_without_timing", file_path)
173
+ end
59
174
  end
60
175
  end
61
176
  end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: require_bench
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-08 00:00:00.000000000 Z
11
+ date: 2023-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: byebug
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '11'
20
20
  type: :development
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'
26
+ version: '11'
27
27
  - !ruby/object:Gem::Dependency
28
- name: byebug
28
+ name: colorize
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '11'
33
+ version: '1.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '11'
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lucky_case
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.1'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +72,108 @@ dependencies:
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '3.9'
75
+ version: '3.12'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.12'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-block_is_expected
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
94
  - - "~>"
67
95
  - !ruby/object:Gem::Version
68
- version: '3.9'
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-stubbed_env
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 1.0.1
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '1.0'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 1.0.1
117
+ - !ruby/object:Gem::Dependency
118
+ name: rubocop-lts
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '2.1'
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 2.1.1
127
+ type: :development
128
+ prerelease: false
129
+ version_requirements: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '2.1'
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: 2.1.1
137
+ - !ruby/object:Gem::Dependency
138
+ name: rubocop-packaging
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '0.5'
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: 0.5.2
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '0.5'
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: 0.5.2
69
157
  - !ruby/object:Gem::Dependency
70
158
  name: silent_stream
71
159
  requirement: !ruby/object:Gem::Requirement
72
160
  requirements:
73
161
  - - "~>"
74
162
  - !ruby/object:Gem::Version
75
- version: '1'
163
+ version: '1.0'
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: 1.0.3
76
167
  type: :development
77
168
  prerelease: false
78
169
  version_requirements: !ruby/object:Gem::Requirement
79
170
  requirements:
80
171
  - - "~>"
81
172
  - !ruby/object:Gem::Version
82
- version: '1'
173
+ version: '1.0'
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: 1.0.3
83
177
  description: Ruby app loading slowly, or never? Discover bootstrapping issues in Ruby
84
178
  by benchmarking "Kernel.require"
85
179
  email:
@@ -88,29 +182,19 @@ executables: []
88
182
  extensions: []
89
183
  extra_rdoc_files: []
90
184
  files:
91
- - ".gitignore"
92
- - ".pryrc"
93
- - ".rspec"
94
- - ".rubocop.yml"
95
- - ".ruby-version"
96
- - ".tool-versions"
97
- - ".travis.yml"
98
185
  - CODE_OF_CONDUCT.md
99
- - Gemfile
100
186
  - LICENSE
101
187
  - README.md
102
- - Rakefile
103
- - bin/console
104
- - bin/setup
105
188
  - lib/require_bench.rb
189
+ - lib/require_bench/color_printer.rb
190
+ - lib/require_bench/printer.rb
106
191
  - lib/require_bench/tasks.rb
107
192
  - lib/require_bench/version.rb
108
- - require_bench.gemspec
109
193
  homepage: https://github.com/pboling/require_bench
110
194
  licenses:
111
195
  - MIT
112
196
  metadata: {}
113
- post_install_message:
197
+ post_install_message:
114
198
  rdoc_options: []
115
199
  require_paths:
116
200
  - lib
@@ -121,12 +205,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
205
  version: '0'
122
206
  required_rubygems_version: !ruby/object:Gem::Requirement
123
207
  requirements:
124
- - - ">="
208
+ - - ">"
125
209
  - !ruby/object:Gem::Version
126
- version: '0'
210
+ version: 1.3.1
127
211
  requirements: []
128
- rubygems_version: 3.1.2
129
- signing_key:
212
+ rubygems_version: 3.4.20
213
+ signing_key:
130
214
  specification_version: 4
131
215
  summary: Discover bootstrapping issues in Ruby by benchmarking "Kernel.require"
132
216
  test_files: []
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
13
- .byebug_history
14
-
15
- # iCloud Drive
16
- .nosync
17
-
18
- *.gem
19
- /Gemfile.lock
data/.pryrc DELETED
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if defined?(PryByebug)
4
- Pry.commands.alias_command 'c', 'continue'
5
- Pry.commands.alias_command 's', 'step'
6
- Pry.commands.alias_command 'n', 'next'
7
- Pry.commands.alias_command 'trace', 'backtrace'
8
- end
9
-
10
- # Hit Enter to repeat last command
11
- Pry::Commands.command /^$/, 'repeat last command' do
12
- _pry_.run_command Pry.history.to_a.last
13
- end
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,2 +0,0 @@
1
- Layout/DotPosition:
2
- EnforcedStyle: trailing
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- ruby-2.3.4
data/.tool-versions DELETED
@@ -1 +0,0 @@
1
- ruby 2.5.7
data/.travis.yml DELETED
@@ -1,32 +0,0 @@
1
- ---
2
- env:
3
- global:
4
- - JRUBY_OPTS="-Xcli.debug=true --debug"
5
- - CC_TEST_REPORTER_ID=5a499d33adfcdac3088a2c917f4b374987d69bf18c1124542cb77ce2db85d8f9
6
-
7
- before_script:
8
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
9
- - chmod +x ./cc-test-reporter
10
- - ./cc-test-reporter before-build
11
-
12
- script:
13
- - bundle exec rspec
14
-
15
- after_script:
16
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
17
-
18
- before_install:
19
- - gem update --system
20
- - gem install bundler
21
-
22
- install:
23
- - bundle install
24
-
25
- bundler_args: --no-deployment --jobs 3 --retry 3
26
-
27
- cache: bundler
28
-
29
- language: ruby
30
- sudo: false
31
- rvm:
32
- - 2.5.8
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
-
7
- # Specify your gem's dependencies in require_bench.gemspec
8
- gemspec
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'require_bench'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'require_bench/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'require_bench'
9
- spec.version = RequireBench::VERSION
10
- spec.authors = ['Peter Boling']
11
- spec.email = ['peter.boling@gmail.com']
12
-
13
- spec.summary = 'Discover bootstrapping issues in Ruby by benchmarking "Kernel.require"'
14
- spec.description = 'Ruby app loading slowly, or never? Discover bootstrapping issues in Ruby by benchmarking "Kernel.require"'
15
- spec.homepage = 'https://github.com/pboling/require_bench'
16
-
17
- # Specify which files should be added to the gem when it is released.
18
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- end
22
- spec.bindir = 'exe'
23
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
- spec.require_paths = ['lib']
25
- spec.license = 'MIT'
26
-
27
- spec.add_development_dependency 'bundler', '~> 2.0'
28
- spec.add_development_dependency 'byebug', '~> 11'
29
- spec.add_development_dependency 'rake', '~> 13.0'
30
- spec.add_development_dependency 'rspec', '~> 3.9'
31
- spec.add_development_dependency 'silent_stream', '~> 1'
32
- end