README.md in gem_bench-2.0.1 vs README.md in gem_bench-2.0.2
- old
+ new
@@ -6,28 +6,34 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Version](https://img.shields.io/gem/v/gem_bench.svg)](https://rubygems.org/gems/gem_bench)
[![Downloads Today](https://img.shields.io/gem/rd/gem_bench.svg)](https://github.com/pboling/gem_bench)
[![Depfu](https://badges.depfu.com/badges/865e7bb1d0d3eb3ba807fca7344e22d1/overview.svg)](https://depfu.com/github/pboling/gem_bench?project_id=2688)
+[![CodeCov][🖇codecov-img♻️]][🖇codecov]
[![Test Coverage](https://api.codeclimate.com/v1/badges/80787f126e7a486b19af/test_coverage)](https://codeclimate.com/github/pboling/gem_bench/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/80787f126e7a486b19af/maintainability)](https://codeclimate.com/github/pboling/gem_bench/maintainability)
[![CI Supported Build][🚎s-wfi]][🚎s-wf]
[![CI Unsupported Build][🚎us-wfi]][🚎us-wf]
[![CI Style Build][🚎st-wfi]][🚎st-wf]
[![CI Coverage Build][🚎cov-wfi]][🚎cov-wf]
[![CI Heads Build][🚎hd-wfi]][🚎hd-wf]
+[![CI Ancient Build][🚎an-wfi]][🚎an-wf]
+[🖇codecov-img♻️]: https://codecov.io/gh/pboling/gem_bench/graph/badge.svg?token=selEoMrZzA
+[🖇codecov]: https://codecov.io/gh/pboling/gem_bench
[🚎s-wf]: https://github.com/pboling/gem_bench/actions/workflows/supported.yml
[🚎s-wfi]: https://github.com/pboling/gem_bench/actions/workflows/supported.yml/badge.svg
[🚎us-wf]: https://github.com/pboling/gem_bench/actions/workflows/unsupported.yml
[🚎us-wfi]: https://github.com/pboling/gem_bench/actions/workflows/unsupported.yml/badge.svg
[🚎st-wf]: https://github.com/pboling/gem_bench/actions/workflows/style.yml
[🚎st-wfi]: https://github.com/pboling/gem_bench/actions/workflows/style.yml/badge.svg
[🚎cov-wf]: https://github.com/pboling/gem_bench/actions/workflows/coverage.yml
[🚎cov-wfi]: https://github.com/pboling/gem_bench/actions/workflows/coverage.yml/badge.svg
[🚎hd-wf]: https://github.com/pboling/gem_bench/actions/workflows/heads.yml
[🚎hd-wfi]: https://github.com/pboling/gem_bench/actions/workflows/heads.yml/badge.svg
+[🚎an-wf]: https://github.com/pboling/gem_bench/actions/workflows/ancient.yml
+[🚎an-wfi]: https://github.com/pboling/gem_bench/actions/workflows/ancient.yml/badge.svg
</div>
-----
@@ -55,50 +61,76 @@
</span>
</div>
</div>
-Scene: You are a spectator at a game of Ruby Sports Gem Ball.
+## What's it do?
-Gem wearing jersey namespace **#23**:
+🏁 Copy & Re-namespace any gem to benchmark side-by-side with `benchmarks-ips`!
+👯 For example, many of the ~dozen Memoization gems use the same namespaces (`Memoist`, `Memery`, etc).
+In order to compare them side-by-side one of them must be re-namespaced.
+
+<details>
+ <summary>Scene: Spectator at a game of Ruby Sports Gem Ball</summary>
+
+Gem wearing jersey **#23**:
+
> "Put me in coach!"
-Other Gem, also wearing jersey namespace **#23**:
+Other Gem, also wearing jersey **#23**:
> "Put me in coach!"
Coach:
> ❨╯°□°❩╯︵┻━┻ fine, but one of you change your jersey first!
-## What's it do?
+</details>
-`gem_bench` is for static Gemfile and installed gem library source code analysis.
+🤩 Benchmark trunk against released version of a library!
-`gem_bench` can be used to re-namespace a gem at run-time so that you can run simultaneously:
+🧐 A `git clone` build can now be run against the latest public release build, side-by-side, by re-namespacing one of them.
-- two versions of the same library, or
-- two different things that happen to have a namespace collision,
+🕵️♀️ Static Gemfile and installed gem library source code analysis.
+Regex search through all of a project's source code, including installed Bundler dependencies.
-for benchmarking or other purposes.
+🛟 Trim down app load times, such as on Heroku, by finding and keeping your worst players on the bench.
-`gem_bench` can also be used to trim down app load times by keeping your worst players on the bench.
+| Project | GemBench |
+|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| gem name | [gem_bench](https://rubygems.org/gems/gem_bench) |
+| code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/gem_bench/badges/users.svg)](https://www.codetriage.com/pboling/gem_bench) |
+| homepage | [on Github.com][homepage] |
+| documentation | [on Rdoc.info][documentation] |
+| live chat | [![Join the chat][🏘chati]][🏘chat] |
+| expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) |
+| `...` 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Follow Me on LinkedIn][🖇linkedin-img]][🖇linkedin] [![Find Me on WellFound:][✌️wellfound-img]][✌️wellfound] [![Find Me on CrunchBase][💲crunchbase-img]][💲crunchbase] [![My LinkTree][🌳linktree-img]][🌳linktree] [![Follow Me on Ruby.Social][🐘ruby-mast-img]][🐘ruby-mast] [![Tweet @ Peter][🐦tweet-img]][🐦tweet] [💻][coderme] [🌏][aboutme] |
-| Project | GemBench |
-|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| gem name | [gem_bench](https://rubygems.org/gems/gem_bench) |
-| code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/gem_bench/badges/users.svg)](https://www.codetriage.com/pboling/gem_bench) |
-| homepage | [on Github.com][homepage] |
-| documentation | [on Rdoc.info][documentation] |
-| live chat | [![Join the chat][🏘chati]][🏘chat] |
-| expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) |
-| Spread ~♡ⓛⓞⓥⓔ♡~ | [🌏](https://about.me/peter.boling) [👼](https://angel.co/peter-boling) [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo) |
-
[🏘chat]: https://matrix.to/#/%23pboling_gem_bench:gitter.im
[🏘chati]: https://badges.gitter.im/Join%20Chat.svg
+<!-- 7️⃣ spread 💖 -->
+[🐦tweet-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow%20%40galtzo
+[🐦tweet]: http://twitter.com/galtzo
+[🚎blog]: http://www.railsbling.com/tags/gem_bench/
+[🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
+[🖇linkedin]: http://www.linkedin.com/in/peterboling
+[🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-blue?style=plastic&logo=linkedin
+[✌️wellfound]: https://angel.co/u/peter-boling
+[✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=plastic&logo=wellfound
+[💲crunchbase]: https://www.crunchbase.com/person/peter-boling
+[💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=plastic&logo=crunchbase
+[🐘ruby-mast]: https://ruby.social/@galtzo
+[🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https%3A%2F%2Fruby.social&style=plastic&logo=mastodon&label=Ruby%20%40galtzo
+[🌳linktree]: https://linktr.ee/galtzo
+[🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=plastic&logo=linktree
+
+<!-- Maintainer Contact Links -->
+[aboutme]: https://about.me/peter.boling
+[coderme]: https://coderwall.com/Peter%20Boling
+
### New for 2.0.1 - `GemBench::Jersey`
Allows you to re-namespace any gem.
You can, for example, benchmark a gem against another version of itself.
@@ -175,15 +207,18 @@
### New for 1.0.0 - Find WAT Dragons in 3rd party source code
Search the Ruby source code of all the gems loaded by your Gemfile for a specified regex, to find out which gems have wat DRAGONS.
+<details>
+ <summary>Scene: Rubiana Jones is searching for WAT Dragon relics in dusty bins of source code</summary>
+
Gem:
> "I have no wat DRAGONS!"`
-You:
+Rubiana Jones:
> ❨╯°□°❩╯︵┻━┻ Yes you do!
```
>> puts GemBench.find(look_for_regex: /wat/).starters.map {|gem| "#{gem.name} has wat DRAGONS at #{gem.stats}" }.join("\n")
@@ -194,25 +229,38 @@
```
NOTE: The number (954, above) is not a line number. The file which contains the text `wat` was the 954th file evaluated, i.e. the number doesn't matter.
NOTE: This is a contrived example. The occurrence of `wat` in byebug is meaningless: `byebug/commands/frame.rb:34` has ` if there is a front end also watching over things.`. This is just an example! You can find anything you want, perhaps even something important!
+</details>
+
It is a fact of RubyGems that many of them do not need to be loaded by your app at boot time.
It is a fact of Bundler that you don't know which ones need to be 'required' while staring at the Gemfile.
It is a fact of Heroku that you only have 60, 75, or 120 ([by special request](https://devcenter.heroku.com/articles/error-codes#h20-app-boot-timeout)) precious seconds to get your app loaded before ❨╯°□°❩╯︵┻━┻
This gem helps by telling you which gems don't need to be loaded during boot time.
You can even use it to evaluate your project's actual Gemfile for easy peasy boot time savings. (see Advanced Usage)
## Installation
-You *may not* need to add this gem to your project. You have three options, 1, 2 or BEST:
+You *may not* need to add this gem to your project.
+Install the gem and add to the application's Gemfile by executing:
+
+ $ bundle add active_security
+
+If bundler is not being used to manage dependencies, install the gem by executing:
+
+ $ gem install active_security
+
+<details>
+ <summary>Installation Options</summary>
+
### Option 1
-Just install it, and require it in your`irb`/`console` session when you want to use it. However, if you load your console with `bundle exec` then you only have access to gems in the gemfile, so either load without `bundle exec` or add it to the `Gemfile`.
+Just install it, and require it in your `irb` or `console` session when you want to use it. However, if you load your console with `bundle exec` then you only have access to gems in the gemfile, so either load without `bundle exec` or add it to the `Gemfile`.
$ gem install gem_bench
### Option 2
@@ -234,17 +282,20 @@
If you are going to use the gem in your specs, you will need to add it to the test group.
gem 'gem_bench', :group => :test
+</details>
+
## Usage
Works with Ruby >= 2.3.
-### Example!
+### Examples
-Getting tired of seeing this `irb` warning, perhaps?
+<details>
+ <summary>Getting tired of seeing this `irb` warning, perhaps?</summary>
```
$ bundle exec rails console
Loading staging environment (Rails M.m.p)
irb: warn: can't alias context from irb_context.
@@ -266,12 +317,15 @@
```
>> bad_context_maybes.map { |bcm| bcm.stats.map(&:first) }
=> [["/Users/pboling/.rvm/gems/ruby-2.4.0@foss/gems/byebug-9.0.6/lib/byebug/command.rb"], ["/Users/pboling/.rvm/gems/ruby-2.4.0@foss/gems/diff-lcs-1.3/lib/diff/lcs/hunk.rb"]]
```
-### Find what gems have `RAILS_ENV` specific code!
+</details>
+<details>
+ <summary>Find what gems have `RAILS_ENV` specific code!</summary>
+
Let's try to find what libraries might be using a conditional guard to alter their behavior in a specific Rails environment.
```
# Not a perfect regex, but pretty good: https://rubular.com/r/b7tdIoYOVQM2RR
# RAILS_ENV == "development"
@@ -294,12 +348,15 @@
rubocop-ruby2_7 has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/rubocop-ruby2_7-2.0.5/lib/rubocop/ruby2_7/railtie.rb", 131]]
sass has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/sass-rails-5.1.0/lib/sass/rails/railtie.rb", 3349]]
sass-rails has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/sass-rails-5.1.0/lib/sass/rails/railtie.rb", 3349]]
```
-### More Different Example!
+</details>
+<details>
+ <summary> Basic Gemfile Analysis</summary>
+
Fire up an `irb` session or a `rails console` and then:
>> require 'gem_bench'
=> true
>> team = GemBench.check({verbose: true}) # verbose: true => print output, verbose: false => just returns a GemBench::Team object you can inspect.
@@ -350,12 +407,15 @@
However, in order to prevent loading them we would have to make them primary dependencies, listed in the Gemfile, which isn't really the best idea. Moving on...
If you run the check against a real app's Gemfile it will find numerous primary dependencies that don't need to be required at app boot. See Advanced Usage :)
In a random directory, in an irb session, where there is no Gemfile in sight it will give a lot more information.
-### Advanced Usage
+</details>
+<details>
+ <summary>Advanced Gemfile Analysis</summary>
+
In order to *also* see list gems may *not* be required at boot time you need to:
1. Make sure you are in the root of a project with a Gemfile
2. Make sure the gem is actually a dependency in the Gemfile
@@ -510,55 +570,106 @@
How much faster will my app boot loading 45 fewer gems? A bit.
**Note:** Some of the gems in the list above should have been excluded. They are now excluded as of `gem_bench` version 0.0.4.
+</details>
+
## Future
This gem determines which gems need to be loaded at Rails' boot time by looking for Railties and Engines.
A future version will also look for initializers, because gems which have code that runs (e.g. configuration) in an initializer also need to be loaded at boot time.
-## Contributors
+## 🤝 Contributing
+See [CONTRIBUTING.md][🤝contributing]
+
+[🤝contributing]: CONTRIBUTING.md
+
+### Code Coverage
+
+If you need some ideas of where to help, you could work on adding more code coverage.
+
+[![Coverage Graph][🔑codecov-g]][🖇codecov]
+
+[🔑codecov-g]: https://codecov.io/gh/pboling/gem_bench/graphs/tree.svg?token=selEoMrZzA
+
+## 🌈 Contributors
+
[![Contributors][🖐contributors-img]][🖐contributors]
Made with [contributors-img][🖐contrib-rocks].
[🖐contrib-rocks]: https://contrib.rocks
[🖐contributors]: https://github.com/pboling/gem_bench/graphs/contributors
[🖐contributors-img]: https://contrib.rocks/image?repo=pboling/gem_bench
-## Contributing
+## Star History
-See [CONTRIBUTING.md](CONTRIBUTING.md)
+<a href="https://star-history.com/#pboling/gem_bench&Date">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=pboling/gem_bench&type=Date&theme=dark" />
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=pboling/gem_bench&type=Date" />
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=pboling/gem_bench&type=Date" />
+ </picture>
+</a>
-## Versioning
+## 🪇 Code of Conduct
-This library aims to adhere to [Semantic Versioning 2.0.0][semver].
-Violations of this scheme should be reported as bugs. Specifically,
-if a minor or patch version is released that breaks backward
-compatibility, a new version should be immediately released that
-restores compatibility. Breaking changes to the public API will
-only be introduced with new major versions.
+Everyone interacting in this project's codebases, issue trackers,
+chat rooms and mailing lists is expected to follow the [code of conduct][🪇conduct].
-As a result of this policy, you can (and should) specify a
-dependency on this gem using the [Pessimistic Version Constraint][pvc] with two digits of precision.
+[🪇conduct]: CODE_OF_CONDUCT.md
+## 📌 Versioning
+
+This Library adheres to [Semantic Versioning 2.0.0][📌semver].
+Violations of this scheme should be reported as bugs.
+Specifically, if a minor or patch version is released that breaks backward compatibility,
+a new version should be immediately released that restores compatibility.
+Breaking changes to the public API will only be introduced with new major versions.
+
+To get a better understanding of how SemVer is intended to work over a project's lifetime,
+read this article from the creator of SemVer:
+
+- ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
+
+As a result of this policy, you can (and should) specify a dependency on these libraries using
+the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
+
For example:
- spec.add_dependency 'gem_bench', '~> 2.0'
+```ruby
+spec.add_dependency("gem_bench", "~> 2.0")
+```
-See [CHANGELOG.md](CHANGELOG.md) for list of releases.
+See [CHANGELOG.md][📌changelog] for list of releases.
-## Legal
+[comment]: <> ( 📌 VERSIONING LINKS )
-* [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
-* Copyright (c) 2013 - 2014, 2016 - 2020, 2023 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
+[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
+[📌semver]: http://semver.org/
+[📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
+[📌changelog]: CHANGELOG.md
-[semver]: http://semver.org/
-[pvc]: http://docs.rubygems.org/read/chapter/16#page74
-[bundle-group-pattern]: https://gist.github.com/pboling/4564780
+## 📄 License
+
+The gem is available as open source under the terms of
+the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref].
+See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
+
+[comment]: <> ( 📄 LEGAL LINKS )
+
+[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
+[📄license]: LICENSE.txt
+[📄license-ref]: https://opensource.org/licenses/MIT
+[📄license-img]: https://img.shields.io/badge/License-MIT-green.svg
+
+### © Copyright
+
+* Copyright (c) 2013 - 2014, 2016 - 2020, 2023 - 2024 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
+
[railsbling]: http://www.railsbling.com
[peterboling]: http://www.peterboling.com
-[coderwall]: http://coderwall.com/pboling
+[bundle-group-pattern]: https://gist.github.com/pboling/4564780
[documentation]: http://rdoc.info/github/pboling/gem_bench/frames
[homepage]: https://github.com/pboling/gem_bench