require_bench 1.0.3 → 1.0.4.pre.alpha.4

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: 026d8a38aa26e66261868831f961e0b6f9fcc11b155d662b72a74a34eb29fa33
4
+ data.tar.gz: b61edbde73769d00fd2c48f48852712803a935475b67aefbb640a615b828b625
5
5
  SHA512:
6
- metadata.gz: 531b1fecc4c691ed4b23c8fdcec9864710c2671a9ad5dd8a9db36de4618acb1331b1e7c09e771959725cef9d52812bf6b140f97b735e1683b2d6b62b07d376ad
7
- data.tar.gz: 4514de7127ec5e7294e0825f6a572abb4ad364be96f35ca623127e6dec0314e31ca4030e08ddf191f952468659ab997e9b58d7afea7188a5c82d0d020b8e1e44
6
+ metadata.gz: d9e1d511651debe3a12d6542b1546f407d30e919dbc331de463f62775a6a155ea9bca4e749bd4b7e3da945d7247e7d3ee8e7a59685ae3ae16130c962b6537607
7
+ data.tar.gz: 7a06355f673765e18f116f01b7fd59199ab5c850d7cfaaccfc237ff1bdfe5f48ae8cf7fdac22cf9c2b6a9fd0a12cc4bb3815c5382819862614c68d1f9915700d
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.4'
5
5
  end
data/lib/require_bench.rb CHANGED
@@ -1,61 +1,182 @@
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
+
43
+ if rescued_classes.any?
44
+ rescued_classes.map! do |klass|
45
+ Kernel.const_get(klass)
46
+ end
47
+ end
48
+ if skips && !skips.empty?
49
+ skip_pattern = case skips
50
+ when /,/
51
+ Regexp.union(*skips.split(','))
52
+ when /\|/
53
+ Regexp.union(*skips.split('|'))
54
+ else
55
+ Regexp.new(skips)
56
+ end
57
+ puts "[RequireBench] Using skip pattern: #{skip_pattern}"
58
+ end
59
+ if includes && !includes.empty?
60
+ include_tokens = case includes
61
+ when /,/
62
+ includes.split(',')
63
+ when /\|/
64
+ includes.split('|')
65
+ else
66
+ Array(includes)
67
+ end
68
+ include_pattern = Regexp.union(*include_tokens)
69
+ include_tokens.reject! { |a| a.match?(%r{/}) } if prefer_not_path
70
+ puts "[RequireBench] Using include pattern: #{include_pattern}"
71
+ end
72
+ if no_group && !no_group.empty?
73
+ no_group_pattern = case no_group
74
+ when /,/
75
+ Regexp.union(*no_group.split(','))
76
+ when /\|/
77
+ Regexp.union(*no_group.split('|'))
78
+ else
79
+ Regexp.new(no_group)
80
+ end
81
+ puts "[RequireBench] Using no group pattern: #{no_group_pattern}"
82
+ end
83
+ INCLUDE_PATTERN = include_pattern
84
+ INCLUDE_TOKENS = include_tokens
85
+ LOG_START = log_start
86
+ NO_GROUP_PATTERN = no_group_pattern
87
+ PREFER_NOT_PATH = prefer_not_path
88
+ RESCUED_CLASSES = rescued_classes
89
+ SKIP_PATTERN = skip_pattern
90
+ TIMEOUT = timeout
91
+ TRACKED_METHODS = tracked_methods
22
92
 
23
- if ENV['REQUIRE_BENCH'] == 'true'
24
- def require_with_timing(file)
93
+ def consume_with_timing(type, file)
25
94
  $require_bench_semaphore = true
95
+ short_type = type[0]
26
96
  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
97
+ # Not sure if this is actually a useful abstraction...
98
+ prefix = INCLUDE_TOKENS.detect { |t| File.basename(file).match?(t) } if PREFER_NOT_PATH
99
+
100
+ seconds = Benchmark.realtime do
101
+ ret = if RequireBench::TIMEOUT.zero?
102
+ Kernel.send("#{type}_without_timing", file)
103
+ else
104
+ # Raise Timeout::Error if more than RequireBench::TIMEOUT seconds are spent in the block
105
+ # This is a giant hammer, and should probably only be used to figure out where an infinite loop might be hiding.
106
+ Timeout.timeout(RequireBench::TIMEOUT) do
107
+ Kernel.send("#{type}_without_timing", file)
108
+ end
109
+ end
110
+ end
111
+ PRINTER.p(seconds, file, short_type)
112
+ if prefix.nil? && (NO_GROUP_PATTERN.nil? || !NO_GROUP_PATTERN.match?(file))
113
+ # This results in grouping all files with the same leading path part (e.g. "models", or "lib")
114
+ # into the same timing bucket.
115
+ # requires that were fully qualified paths probably need to be identified
116
+ # by the full path
117
+ prefix = if (match = INCLUDE_PATTERN&.match(file))
118
+ match[0]
119
+ else
120
+ # Generally this will target a library name, e.g. "rspec"
121
+ # which sums all require timings from a single library together
122
+ file.partition('/').first
123
+ end
124
+ end
33
125
  prefix = file if prefix.nil? || prefix.empty?
34
126
  RequireBench::TIMINGS[prefix] += seconds
35
127
  ret
36
128
  ensure
37
129
  $require_bench_semaphore = nil
38
130
  end
39
- module_function :require_with_timing
131
+ module_function :consume_with_timing
40
132
  end
41
133
  end
42
134
 
43
- if ENV['REQUIRE_BENCH'] == 'true'
135
+ if REQUIRE_BENCH_ENABLED
44
136
  # A Kernel hack that adds require timing to find require problems in app.
45
137
  module Kernel
46
138
  alias require_without_timing require
139
+ alias load_without_timing load
47
140
 
48
141
  def require(file)
142
+ _require_bench_consume_file('require', file)
143
+ end
144
+
145
+ def load(file)
146
+ _require_bench_consume_file('load', file)
147
+ end
148
+
149
+ def _require_bench_consume_file(type, file)
49
150
  file_path = file.to_s
151
+ # byebug if file_path.match?(/no_group_fox/)
50
152
 
51
153
  # Global $ variable, which is always truthy while inside the hack, is to
52
154
  # 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)
155
+ return send("#{type}_without_timing", file_path) if $require_bench_semaphore
156
+
157
+ short_type = type[0]
158
+ measure = RequireBench::INCLUDE_PATTERN && file_path.match?(RequireBench::INCLUDE_PATTERN)
159
+ skippy = RequireBench::SKIP_PATTERN && file_path.match?(RequireBench::SKIP_PATTERN)
160
+ RequireBench::PRINTER.p(file, short_type) if RequireBench::LOG_START
161
+ if RequireBench::RESCUED_CLASSES.any?
162
+ begin
163
+ _require_bench_file(type, measure, skippy, file_path)
164
+ rescue *RequireBench::RESCUED_CLASSES => e
165
+ RequireBench::PRINTER.e(e, file, short_type)
166
+ end
167
+ else
168
+ _require_bench_file(type, measure, skippy, file_path)
56
169
  end
170
+ end
57
171
 
58
- RequireBench.require_with_timing(file_path)
172
+ def _require_bench_file(type, measure, skippy, file_path)
173
+ if !measure && skippy
174
+ send("#{type}_without_timing", file_path)
175
+ elsif RequireBench::INCLUDE_PATTERN.nil? || measure
176
+ RequireBench.send('consume_with_timing', type, file_path)
177
+ else
178
+ send("#{type}_without_timing", file_path)
179
+ end
59
180
  end
60
181
  end
61
182
  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.4
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