bumbler 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c89d49c4a06405dfb85e410e301dc1c38b963b8fb3d01516a74c0653262c5ab4
4
- data.tar.gz: 5166819a1081467131e185a596c0d3f2d3ed6110cf97bcf24d3c79f9389297e6
3
+ metadata.gz: 7ad7fe2ebf27b55813bffb1ba59a966c14f9c3eda4b9df33d568754072549e1e
4
+ data.tar.gz: e64f75c85c1b996dd5cdfc2ddc1fc2d318e3809464788758578a2799864e6f7f
5
5
  SHA512:
6
- metadata.gz: 924cde7931d93dedc918501e2a151da50157983e8c9cc7fed393884c7af99ffe811d44274aba939dbc439e3b463ef21cd3b25170ceaf703d31121c529f0c9791
7
- data.tar.gz: 2ea0410b258aa50a912979c061735ed08a8f83b800e2ed2eee061d2f488740049b9f8a8126e763e8ce8125c72674291703b67cbc6d2342bdb2560fc92fb1f89a
6
+ metadata.gz: 75412e45f8d0764be03b8a7c657d477cc51be29b25ff74b614dfacac3440b2e3d0d2ed8442af3de0da0288cc7cb982a883889e2571edb284a281ced58408c9dd
7
+ data.tar.gz: d1c438a7d9f168ab285c16c53a10ffbe505a6b312d6667b2a201d8e6d4049a25576809cc781991593656380bfa6df75aaa305343c1cd3ca1d9b7c5e92d7b2cf3
data/README.md CHANGED
@@ -6,7 +6,7 @@ Find slow loading gems in your [Bundler](http://gembundler.com/)-based projects!
6
6
  Bumbler tracks how long the main require of each gem takes,
7
7
  for example with `gem 'bar'` it tracks `require 'bar'`. If the gem name and the require name are different,
8
8
  add `require:` manually for correct time tracking, for example `gem 'bar-foo', require: 'bar_foo'`.
9
- This reuquire tracking can sometimes lead to false positives, because of dependencies,
9
+ This require tracking can sometimes lead to false positives, because of dependencies,
10
10
  for example `foo` requires `rails` which leads to `foo` being marked as slow.
11
11
 
12
12
  For rails projects it loads `config/environment.rb`, for all others it runs `Bundler.require *Bundler.groups`.
data/bin/bumbler CHANGED
@@ -21,7 +21,9 @@ OptionParser.new do |parser|
21
21
 
22
22
  Options:
23
23
  BANNER
24
- parser.on("-t", "--threshold MILLISECONDS", Integer, "Threshold in ms to be listed as slow") { |t| options[:threshold] = t }
24
+ parser.on("-t", "--threshold MILLISECONDS", Integer, "Threshold in ms to be listed as slow") do |t|
25
+ options[:threshold] = t
26
+ end
25
27
  parser.on("--initializers", "Show load time of initializers") { options[:initializers] = true }
26
28
  parser.on("--all", "Show all load times") { options[:all] = true }
27
29
  parser.on("-h", "--help", "Show this.") { puts parser; exit }
data/lib/bumbler/hooks.rb CHANGED
@@ -27,7 +27,7 @@ module Bumbler
27
27
  orig_instance_require.bind(self).call(path, *args)
28
28
  end
29
29
  end
30
- private :require # rubocop:disable Style/AccessModifierDeclarations
30
+ private :require
31
31
  end
32
32
 
33
33
  @hooking_instance_require = nil
@@ -54,13 +54,13 @@ module Bumbler
54
54
  def watch_require!
55
55
  ::Kernel.module_eval do
56
56
  # It isn't previously defined in Kernel. This could be a bit dangerous, though.
57
- def self.method_added(method_name, *_args)
57
+ def self.method_added(method_name, *_args) # rubocop:disable Lint/MissingSuper
58
58
  if method_name == :require && !Bumbler::Hooks.hooking_instance_require?
59
59
  ::Bumbler::Hooks.hook_instance_require!
60
60
  end
61
61
  end
62
62
 
63
- def self.singleton_method_added(method_name, *_args)
63
+ def self.singleton_method_added(method_name, *_args) # rubocop:disable Lint/MissingSuper
64
64
  if method_name == :require && !Bumbler::Hooks.hooking_singleton_require?
65
65
  ::Bumbler::Hooks.hook_singleton_require!
66
66
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # TODO: replace with ruby-progressbar dependency
3
+ require 'io/console'
4
+
3
5
  module Bumbler
4
6
  module Progress
5
7
  @item_count = 0
@@ -36,7 +38,8 @@ module Bumbler
36
38
  end
37
39
 
38
40
  def tty_width
39
- `tput cols`.to_i || 80
41
+ # console_winsize: https://github.com/ruby/ruby/blob/f27eb8148f5a72bbacfebfecc7de9305471bb5c9/ext/io/console/console.c#L796
42
+ IO.console.winsize[1]
40
43
  end
41
44
 
42
45
  def bar(width)
@@ -1,14 +1,18 @@
1
1
  # frozen_string_literal: true
2
- Rails::Engine.prepend(Module.new do
3
- def load(file, *)
4
- initializer = file.sub(Rails.root.to_s, ".")
5
- Bumbler::Hooks.benchmark(initializer) { super }.last
2
+ Rails::Engine.prepend(
3
+ Module.new do
4
+ def load(file, *)
5
+ initializer = file.sub(Rails.root.to_s, ".")
6
+ Bumbler::Hooks.benchmark(initializer) { super }.last
7
+ end
6
8
  end
7
- end)
9
+ )
8
10
 
9
- Rails::Initializable::Initializer.prepend(Module.new do
10
- def run(*)
11
- name = (@name.is_a?(Symbol) ? @name.inspect : @name)
12
- Bumbler::Hooks.benchmark(name) { super }.last
11
+ Rails::Initializable::Initializer.prepend(
12
+ Module.new do
13
+ def run(*)
14
+ name = (@name.is_a?(Symbol) ? @name.inspect : @name)
15
+ Bumbler::Hooks.benchmark(name) { super }.last
16
+ end
13
17
  end
14
- end)
18
+ )
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Bumbler
3
- VERSION = '0.8.0'
3
+ VERSION = '0.9.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian MacLeod
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-24 00:00:00.000000000 Z
11
+ date: 2022-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump
@@ -97,14 +97,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: 2.3.0
100
+ version: 2.7.0
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubygems_version: 3.1.3
107
+ rubygems_version: 3.1.6
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Find slowly loading gems for your Bundler-based projects