gem_bench 1.0.5 → 2.0.1

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: d0150f098c58edf7279abc13c963078e6e2a200c8191c9c123e2c4fd01dfc082
4
- data.tar.gz: e9ce289e93f6949152cdc2440d0124b5b84c11c124678adcdf9d247fe89f5a4d
3
+ metadata.gz: b054d58ceb273738cbb17694960de3fb3a5c8646eeed7f41c77e9b4177e3a52c
4
+ data.tar.gz: a5565712bc1ae7423890b8b7615a048850962e6a403f6ed76828804f60fa8840
5
5
  SHA512:
6
- metadata.gz: 9e5f931b2ebc0df56cbf9a5e2b99dfa408d14aebaadb6b7897077f10be7d809f89b65dff0061f22b33e925330f88501a54e77ab0473020c1914c426650f39449
7
- data.tar.gz: f5c3e302abf1b337081e06d4f77ce8eb2e1f49d2faf735d2336e4660df0f99a09cf5ebc8c3297b423bca7502a2db385010d72c4685bf5a69a6c1c36606d534ff
6
+ metadata.gz: 9ba5c0b8243072eec99db4ccd0d7efd6aab41d6d592bfddecf359259777a9be5c578f7ef8c3cf02b01117369c0f777db594cbf22ec5663d6dbaf06c700e87d96
7
+ data.tar.gz: 25e0360cd1200ecdc0d7a65de318c02270492c255dc66f9bf46cd4359a5fe37ff6b67307c351b20657ada7a3ec04584221bbe8bafce5f29e8d2373671042a941
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,111 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog v1](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+ ### Added
10
+ ### Changed
11
+ ### Fixed
12
+ ### Removed
13
+
14
+ [2.0.1] SEP.17.2024
15
+ COVERAGE: 82.15% -- 382/465 lines in 9 files
16
+ BRANCH COVERAGE: 58.08% -- 97/167 branches in 9 files
17
+ 51.72% documented
18
+ ### Added
19
+ * Ability to re-namespace and load copy of a gem alongside vanilla version for benchmarking via `GemBench::Jersey`
20
+ * See: https://github.com/panorama-ed/memo_wise/pull/339
21
+ * Many more tests
22
+ * `kettle-soup-cover` for test coverage enforcement
23
+ * Better documentation
24
+ * Improved instructions for contributing
25
+ ### Changed
26
+ * Improved `bin/checksums`
27
+ ### Fixed
28
+ * Stopped swallowing `ArgumentError` in certain exceptional cases
29
+
30
+ [2.0.0] SEP.25.2023
31
+ ### Added
32
+ * Compatible with Bundler 2+
33
+ * Checksums for release
34
+ * SHA-256
35
+ * SHA-512
36
+ * Signed releases
37
+ * Add CODE_OF_CONDUCT.md
38
+ * Add SECURITY.md (Security policy)
39
+ * Github Actions
40
+ ### Changed
41
+ * Dropped support for Ruby 2.0, 2.1, and 2.2
42
+ * `VERSION` constant now lives at `GemBench::Version::VERSION`, enhanced by `version_gem`
43
+ * Changelog updated to Keep-a-changelog format (going forward)
44
+ ### Removed
45
+ * Removed Appraisals
46
+ * Removed Travis-CI
47
+
48
+ [1.0.6] SEP.09.2018
49
+ * Documentation improvements
50
+ * Add Ruby 2.5 to build matrix
51
+
52
+ [1.0.5] JUN.05.2017
53
+ * Allow github macro as an alternative to git within Gemfile for strict version constraint analysis
54
+
55
+ [1.0.3] JUN.02.2017
56
+ * fixed accidental removal of loaded_gems in 1.0.2
57
+ * better documentation
58
+
59
+ [1.0.2] JUN.02.2017
60
+ * version constraint checking, useful to add a spec enforcing Gemfile version constraints, by Peter Boling
61
+ - Console use:
62
+ - GemBench::StrictVersionRequirement.new({verbose: true})
63
+ - Spec use:
64
+ ```ruby
65
+ Rspec.describe("Gemfile") do
66
+ it("has version constraint on every gem") do
67
+ requirements = GemBench::StrictVersionRequirement.new({verbose: true})
68
+ expect(requirements.list_missing_version_constraints).to(eq([]))
69
+ end
70
+ end
71
+ ```
72
+
73
+ [1.0.1] MAR.25.2017
74
+ * fixed a typo that prevented Gemfile comparison by mobilutz
75
+
76
+ [1.0.0] FEB.26.2017
77
+ * New feature: scan all code (except for test/spec/feature code) in all loaded gems for a given regex:
78
+ - puts GemBench.find(look_for_regex: /HERE BE DRAGONS/).starters.map {|gem| "#{gem.name} has DRAGONS at #{gem.stats}" }.join("\n")
79
+ * Added basic specs
80
+ * More Documentation
81
+ * added back git dependency to gemspec (pulled in latest Gem scaffolding from Bundler :/)
82
+
83
+ [0.0.8] JAN.16.2014
84
+ * Corrected issues with 0.0.7 release.
85
+ * More Documentation
86
+ * removed git dependency from gemspec
87
+
88
+ [0.0.7] DEC.23.2013 (Yanked immediately)
89
+ * Attempt to fix failure on encoding problem, with a rescue fallback (Issue #1) by Peter Boling
90
+ * Readme / Documentation improvements by John Bachir
91
+ * Runtime output improvements by John Bachir
92
+
93
+ [0.0.6] AUG.29.2013
94
+ * Added license to gemspec by Peter Boling
95
+ * No longer altering Ruby load path - Let the gem manager do that by Peter Boling
96
+
97
+ [0.0.5] AUG.28.2013
98
+ * Encode as UTF-8 prior to comparison by Peter Boling
99
+
100
+ [0.0.4] APR.06.2013
101
+ * Expanded exclusion list by Peter Boling
102
+
103
+ [0.0.3] APR.06.2013
104
+ * Late night coding needs more coffee by Peter Boling
105
+
106
+ [0.0.2] APR.06.2013
107
+ * Works against 265 dependency Gemfile by Peter Boling
108
+ * Added ability to evaluate a Gemfile by Peter Boling
109
+
110
+ [0.0.1] APR.05.2013
111
+ * Initial release by Peter Boling
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at peter.boling@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,62 @@
1
+ ## Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/gem_bench][🚎src-main].
4
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
5
+ the [code of conduct][🤝conduct].
6
+
7
+ To submit a patch, please fork the project and create a patch with tests. Once you're happy with it send a pull request
8
+ and you might also post a message to the [gitter chat][🏘chat].
9
+
10
+ ## Development
11
+
12
+ After checking out the repo, run `bin/setup` to install dependencies.
13
+ Then, run `bin/rake` to run the default rake tasks, which include specs.
14
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
15
+
16
+ ## Release
17
+
18
+ ### One-time, Per-developer, Setup
19
+
20
+ **IMPORTANT**: Your public key for signing gems will need to be picked up by the line in the
21
+ `gemspec` defining the `spec.cert_chain` (check the relevant ENV variables there),
22
+ in order to sign the new release.
23
+ See: [RubyGems Security Guide][🔒️rubygems-security-guide]
24
+
25
+ ### To release a new version:
26
+
27
+ 1. Run `bin/setup && bin/rake` as a tests, coverage, & linting sanity check
28
+ 2. Update the version number in `version.rb`
29
+ 3. Run `bin/setup && bin/rake` again as a secondary check, and to update `Gemfile.lock`
30
+ 4. Run `git commit -am "🔖 Prepare release v<VERSION>"` to commit the changes
31
+ 5. Run `git push` to trigger the final CI pipeline before release, & merge PRs
32
+ - NOTE: Remember to [check the build][🧪build]!
33
+ 6. Run `export GIT_TRUNK_BRANCH_NAME="$(git remote show origin | grep 'HEAD branch' | cut -d ' ' -f5)" && echo $GIT_TRUNK_BRANCH_NAME`
34
+ 7. Run `git checkout $GIT_TRUNK_BRANCH_NAME`
35
+ 8. Run `git pull origin $GIT_TRUNK_BRANCH_NAME` to ensure you will release the latest trunk code
36
+ 9. Set `SOURCE_DATE_EPOCH` so `rake build` and `rake release` use same timestamp, and generate same checksums
37
+ - Run `export SOURCE_DATE_EPOCH=$EPOCHSECONDS && echo $SOURCE_DATE_EPOCH`
38
+ - If the echo above has no output, then it didn't work.
39
+ - Note that you'll need the `zsh/datetime` module, if running `zsh`.
40
+ - In `bash` you can use `date +%s` instead, i.e. `export SOURCE_DATE_EPOCH=$(date +%s) && echo $SOURCE_DATE_EPOCH`
41
+ 10. Run `bundle exec rake build`
42
+ 11. Run `bin/checksums` (more [context][🔒️rubygems-checksums-pr]) to create SHA-256 and SHA-512 checksums
43
+ - Checksums will be committed automatically by the script, but not pushed
44
+ 12. Run `bundle exec rake release` which will create a git tag for the version,
45
+ push git commits and tags, and push the `.gem` file to [rubygems.org][💎rubygems]
46
+
47
+ ## Contributors
48
+
49
+ [![Contributors][🖐contributors-img]][🖐contributors]
50
+
51
+ Made with [contributors-img][🖐contrib-rocks].
52
+
53
+ [🧪build]: https://github.com/pboling/gem_bench/actions
54
+ [🤝conduct]: https://github.com/pboling/gem_bench/blob/main/CODE_OF_CONDUCT.md
55
+ [🖐contrib-rocks]: https://contrib.rocks
56
+ [🖐contributors]: https://github.com/pboling/gem_bench/graphs/contributors
57
+ [🖐contributors-img]: https://contrib.rocks/image?repo=pboling/gem_bench
58
+ [💎rubygems]: https://rubygems.org
59
+ [🔒️rubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
60
+ [🔒️rubygems-checksums-pr]: https://github.com/rubygems/guides/pull/325
61
+ [🚎src-main]: https://github.com/pboling/gem_bench
62
+ [🏘chat]: https://matrix.to/#/%23pboling_gem_bench:gitter.im
data/README.md CHANGED
@@ -1,40 +1,156 @@
1
1
  # GemBench
2
2
 
3
+ <div id="badges">
4
+
5
+ <div align="center">
6
+
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
8
+ [![Version](https://img.shields.io/gem/v/gem_bench.svg)](https://rubygems.org/gems/gem_bench)
9
+ [![Downloads Today](https://img.shields.io/gem/rd/gem_bench.svg)](https://github.com/pboling/gem_bench)
10
+ [![Depfu](https://badges.depfu.com/badges/865e7bb1d0d3eb3ba807fca7344e22d1/overview.svg)](https://depfu.com/github/pboling/gem_bench?project_id=2688)
11
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/80787f126e7a486b19af/test_coverage)](https://codeclimate.com/github/pboling/gem_bench/test_coverage)
12
+ [![Maintainability](https://api.codeclimate.com/v1/badges/80787f126e7a486b19af/maintainability)](https://codeclimate.com/github/pboling/gem_bench/maintainability)
13
+ [![CI Supported Build][🚎s-wfi]][🚎s-wf]
14
+ [![CI Unsupported Build][🚎us-wfi]][🚎us-wf]
15
+ [![CI Style Build][🚎st-wfi]][🚎st-wf]
16
+ [![CI Coverage Build][🚎cov-wfi]][🚎cov-wf]
17
+ [![CI Heads Build][🚎hd-wfi]][🚎hd-wf]
18
+
19
+ [🚎s-wf]: https://github.com/pboling/gem_bench/actions/workflows/supported.yml
20
+ [🚎s-wfi]: https://github.com/pboling/gem_bench/actions/workflows/supported.yml/badge.svg
21
+ [🚎us-wf]: https://github.com/pboling/gem_bench/actions/workflows/unsupported.yml
22
+ [🚎us-wfi]: https://github.com/pboling/gem_bench/actions/workflows/unsupported.yml/badge.svg
23
+ [🚎st-wf]: https://github.com/pboling/gem_bench/actions/workflows/style.yml
24
+ [🚎st-wfi]: https://github.com/pboling/gem_bench/actions/workflows/style.yml/badge.svg
25
+ [🚎cov-wf]: https://github.com/pboling/gem_bench/actions/workflows/coverage.yml
26
+ [🚎cov-wfi]: https://github.com/pboling/gem_bench/actions/workflows/coverage.yml/badge.svg
27
+ [🚎hd-wf]: https://github.com/pboling/gem_bench/actions/workflows/heads.yml
28
+ [🚎hd-wfi]: https://github.com/pboling/gem_bench/actions/workflows/heads.yml/badge.svg
29
+
30
+ </div>
31
+
32
+ -----
33
+
34
+ <div align="center">
35
+
36
+ [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay]
37
+ [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor]
38
+ [![Polar Shield][🖇polar-img]][🖇polar]
39
+ [![Donate to my FLOSS or refugee efforts at ko-fi.com][🖇kofi-img]][🖇kofi]
40
+ [![Donate to my FLOSS or refugee efforts using Patreon][🖇patreon-img]][🖇patreon]
41
+
42
+ [⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
43
+ [⛳liberapay]: https://liberapay.com/pboling/donate
44
+ [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
45
+ [🖇sponsor]: https://github.com/sponsors/pboling
46
+ [🖇polar-img]: https://polar.sh/embed/seeks-funding-shield.svg?org=pboling
47
+ [🖇polar]: https://polar.sh/pboling
48
+ [🖇kofi-img]: https://img.shields.io/badge/buy%20me%20coffee-donate-yellow.svg
49
+ [🖇kofi]: https://ko-fi.com/O5O86SNP4
50
+ [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-yellow.svg
51
+ [🖇patreon]: https://patreon.com/galtzo
52
+
53
+ <span class="badge-buymealatte">
54
+ <a href="https://www.buymeacoffee.com/pboling"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff" /></a>
55
+ </span>
56
+
57
+ </div>
58
+ </div>
59
+
60
+ Scene: You are a spectator at a game of Ruby Sports Gem Ball.
61
+
62
+ Gem wearing jersey namespace **#23**:
63
+
64
+ > "Put me in coach!"
65
+
66
+ Other Gem, also wearing jersey namespace **#23**:
67
+
68
+ > "Put me in coach!"
69
+
70
+ Coach:
71
+
72
+ > ❨╯°□°❩╯︵┻━┻ fine, but one of you change your jersey first!
73
+
74
+ ## What's it do?
75
+
3
76
  `gem_bench` is for static Gemfile and installed gem library source code analysis.
4
77
 
78
+ `gem_bench` can be used to re-namespace a gem at run-time so that you can run simultaneously:
79
+
80
+ - two versions of the same library, or
81
+ - two different things that happen to have a namespace collision,
82
+
83
+ for benchmarking or other purposes.
84
+
5
85
  `gem_bench` can also be used to trim down app load times by keeping your worst players on the bench.
6
86
 
7
- Gem: "Put me in coach!"
8
- You: ❨╯°□°❩╯︵┻━┻
9
-
10
- | Project | GemBench |
11
- |------------------------ | ----------------------- |
12
- | gem name | [gem_bench](https://rubygems.org/gems/gem_bench) |
13
- | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
14
- | download rank | [![Downloads Today](https://img.shields.io/gem/rd/gem_bench.svg)](https://github.com/pboling/gem_bench) |
15
- | version | [![Version](https://img.shields.io/gem/v/gem_bench.svg)](https://rubygems.org/gems/gem_bench) |
16
- | dependencies | [![Depfu](https://badges.depfu.com/badges/a34c123a78a86496bbc2163b801089dd/count.svg)](https://depfu.com/github/pboling/activerecord-tablefree?project_id=5613) |
17
- | continuous integration | [![Build Status](https://travis-ci.org/pboling/gem_bench.svg?branch=master)](https://travis-ci.org/pboling/gem_bench) |
18
- | test coverage | [![Test Coverage](https://api.codeclimate.com/v1/badges/fe504d4ab2fb77cecf7d/test_coverage)](https://codeclimate.com/github/pboling/gem_bench/test_coverage) |
19
- | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/fe504d4ab2fb77cecf7d/maintainability)](https://codeclimate.com/github/pboling/gem_bench/maintainability) |
20
- | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/gem_bench/badges/users.svg)](https://www.codetriage.com/pboling/gem_bench) |
21
- | homepage | [on Github.com][homepage] |
22
- | documentation | [on Rdoc.info][documentation] |
23
- | inline documenation | [![Inline docs](http://inch-ci.org/github/pboling/gem_bench.png)](http://inch-ci.org/github/pboling/gem_bench) |
24
- | live chat | [![Join the chat at https://gitter.im/pboling/gem_bench](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pboling/gem_bench?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
25
- | 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) |
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:][coderwall], [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo) |
87
+ | Project | GemBench |
88
+ |------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
89
+ | gem name | [gem_bench](https://rubygems.org/gems/gem_bench) |
90
+ | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/gem_bench/badges/users.svg)](https://www.codetriage.com/pboling/gem_bench) |
91
+ | homepage | [on Github.com][homepage] |
92
+ | documentation | [on Rdoc.info][documentation] |
93
+ | live chat | [![Join the chat][🏘chati]][🏘chat] |
94
+ | 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) |
95
+ | 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) |
96
+
97
+ [🏘chat]: https://matrix.to/#/%23pboling_gem_bench:gitter.im
98
+ [🏘chati]: https://badges.gitter.im/Join%20Chat.svg
99
+
100
+ ### New for 2.0.1 - `GemBench::Jersey`
101
+
102
+ Allows you to re-namespace any gem.
103
+ You can, for example, benchmark a gem against another version of itself.
104
+
105
+ The gem `alt_memery` uses a namespace, `Memery`, that does not match the gem name.
106
+
107
+ ```ruby
108
+ require "gem_bench/jersey"
109
+
110
+ jersey = GemBench::Jersey.new(
111
+ gem_name: "alt_memery",
112
+ trades: {"Memery" => "AltMemery"},
113
+ metadata: { # optional, mostly used for benchmarking report output
114
+ something: "a value here",
115
+ something_else: :obviously,
116
+ },
117
+ )
118
+ jersey.doff_and_don
119
+ # The re-namespaced constant is now available!
120
+ AltMemery # => AltMemery
121
+ jersey.as_klass # => AltMemery
122
+
123
+ # The original, unmodified, gem is still there!
124
+ require "alt_memery"
125
+
126
+ Memery # => Memery
127
+ # So you can use both!
128
+ ```
129
+
130
+ NOTE: It is not required by default, so you do need to require the Jersey if you want to use it!
131
+
132
+ ```ruby
133
+ require "gem_bench/jersey"
134
+ ```
135
+
136
+ For a real example, see: https://github.com/panorama-ed/memo_wise/pull/339
137
+
138
+ ### New for 2.0.0 - Dropped Support for Ruby 2.0, 2.1, 2.2
139
+
140
+ - Required Ruby is now 2.3+
141
+ - `VERSION` is now namespaced at `GemBench::Version::VERSION` and is enhanced by `version_gem`.
27
142
 
28
143
  ### New for 1.0.2 - Gemfile specs
29
144
 
30
145
  Version constraints are important. Give the Gemfile some love in your CI build
31
146
 
32
147
  Create a `spec/gemfile_spec.rb` like:
148
+
33
149
  ```ruby
34
- Rspec.describe "Gemfile" do
150
+ Rspec.describe("Gemfile") do
35
151
  it("has version constraint on every gem") do
36
152
  requirements = GemBench::StrictVersionRequirement.new({verbose: false})
37
- expect(requirements.list_missing_version_constraints).to eq([])
153
+ expect(requirements.list_missing_version_constraints).to(eq([]))
38
154
  end
39
155
  end
40
156
  ```
@@ -61,8 +177,13 @@ For string version constraints anything is allowed (e.g. `'~> 1.0'`), as it assu
61
177
 
62
178
  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.
63
179
 
64
- Gem: "I have no wat DRAGONS!"
65
- You: ❨╯°□°❩╯︵┻━┻
180
+ Gem:
181
+
182
+ > "I have no wat DRAGONS!"`
183
+
184
+ You:
185
+
186
+ > ❨╯°□°❩╯︵┻━┻ Yes you do!
66
187
 
67
188
  ```
68
189
  >> puts GemBench.find(look_for_regex: /wat/).starters.map {|gem| "#{gem.name} has wat DRAGONS at #{gem.stats}" }.join("\n")
@@ -117,7 +238,7 @@ If you are going to use the gem in your specs, you will need to add it to the te
117
238
 
118
239
  ## Usage
119
240
 
120
- Works with Ruby >= 2.0 due to use of named parameters.
241
+ Works with Ruby >= 2.3.
121
242
 
122
243
  ### Example!
123
244
 
@@ -130,6 +251,7 @@ irb: warn: can't alias context from irb_context.
130
251
  ```
131
252
 
132
253
  Find out what gems may be causing it by defining `context`!
254
+
133
255
  ```
134
256
  >> require 'gem_bench'
135
257
  => true
@@ -138,12 +260,42 @@ Find out what gems may be causing it by defining `context`!
138
260
  [GemBench] Detected 11 loaded gems + 2 loaded gems which GemBench is configured to ignore.
139
261
  => [byebug, diff-lcs]
140
262
  ```
263
+
141
264
  Then find the file with the first occurrence of the regex in each:
265
+
142
266
  ```
143
267
  >> bad_context_maybes.map { |bcm| bcm.stats.map(&:first) }
144
268
  => [["/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"]]
145
269
  ```
146
270
 
271
+ ### Find what gems have `RAILS_ENV` specific code!
272
+
273
+ Let's try to find what libraries might be using a conditional guard to alter their behavior in a specific Rails environment.
274
+
275
+ ```
276
+ # Not a perfect regex, but pretty good: https://rubular.com/r/b7tdIoYOVQM2RR
277
+ # RAILS_ENV == "development"
278
+ # Rails.env.development?
279
+ # Rails.env == "development"
280
+ # ENV["RAILS_ENV"] == "development"
281
+ # ENV.fetch("RAILS_ENV") == "development"
282
+ >> require "gem_bench"
283
+ => true
284
+ >> conditional_rails_behavior_regex = /(ENV(\["|\.fetch\("))?rails(_|\.)env("\]|"\))?( == "|\.)development/i
285
+ >> conditional_rails_behavior = GemBench.find(look_for_regex: conditional_rails_behavior_regex).starters
286
+ => [rack, actionpack, actioncable, actionmailer, rubocop, railties, rubocop-ruby2_7, sass, sass-rails]
287
+ >> print conditional_rails_behavior.map {|gem| "#{gem.name} has Rails.env condition in #{gem.stats}" }.join("\n")
288
+ rack has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/rack-mini-profiler-3.1.0/lib/mini_profiler_rails/railtie.rb", 1154]]
289
+ actionpack has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/actionpack-3.2.22.5/lib/action_controller/metal/force_ssl.rb", 1377]]
290
+ actioncable has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/actioncable-5.2.8.1/lib/action_cable/engine.rb", 886]]
291
+ actionmailer has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/actionmailer-7.0.5/lib/action_mailer/railtie.rb", 807]]
292
+ rubocop has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/rubocop-ruby2_2-2.0.5/lib/rubocop/ruby2_2/railtie.rb", 131]]
293
+ railties has Rails.env condition in [["/Users/pboling/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/railties-3.2.22.5/lib/rails.rb", 2478]]
294
+ 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]]
295
+ 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]]
296
+ 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]]
297
+ ```
298
+
147
299
  ### More Different Example!
148
300
 
149
301
  Fire up an `irb` session or a `rails console` and then:
@@ -207,7 +359,7 @@ In order to *also* see list gems may *not* be required at boot time you need to:
207
359
  1. Make sure you are in the root of a project with a Gemfile
208
360
  2. Make sure the gem is actually a dependency in the Gemfile
209
361
 
210
- So here's a [*fat* Gemfile][bundle-group-pattern] weighing in at 265 gem dependencies. We'll use it for this example:
362
+ So here's a [fat Gemfile][bundle-group-pattern] weighing in at 265 gem dependencies. We'll use it for this example:
211
363
 
212
364
  ∴ bundle exec rails console
213
365
  Welcome to RAILS. You are using ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.1]. Have fun ;)
@@ -365,25 +517,19 @@ How much faster will my app boot loading 45 fewer gems? A bit.
365
517
  This gem determines which gems need to be loaded at Rails' boot time by looking for Railties and Engines.
366
518
  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.
367
519
 
368
- ## Development
369
-
370
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
520
+ ## Contributors
371
521
 
372
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
522
+ [![Contributors][🖐contributors-img]][🖐contributors]
373
523
 
374
- ## Contributing
524
+ Made with [contributors-img][🖐contrib-rocks].
375
525
 
376
- Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/gem_bench.
526
+ [🖐contrib-rocks]: https://contrib.rocks
527
+ [🖐contributors]: https://github.com/pboling/gem_bench/graphs/contributors
528
+ [🖐contributors-img]: https://contrib.rocks/image?repo=pboling/gem_bench
377
529
 
378
- If you see: `is feeling very lost right now` then I'd like to know.
379
- Create an issue and tell me about it, or fix it yo'sef.
530
+ ## Contributing
380
531
 
381
- 1. Fork it
382
- 2. Create your feature branch (`git checkout -b my-new-feature`)
383
- 3. Commit your changes (`git commit -am 'Added some feature'`)
384
- 4. Push to the branch (`git push origin my-new-feature`)
385
- 5. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
386
- 6. Create new Pull Request
532
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
387
533
 
388
534
  ## Versioning
389
535
 
@@ -399,12 +545,14 @@ dependency on this gem using the [Pessimistic Version Constraint][pvc] with two
399
545
 
400
546
  For example:
401
547
 
402
- spec.add_dependency 'gem_bench', '~> 0.0'
548
+ spec.add_dependency 'gem_bench', '~> 2.0'
549
+
550
+ See [CHANGELOG.md](CHANGELOG.md) for list of releases.
403
551
 
404
552
  ## Legal
405
553
 
406
554
  * [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
407
- * Copyright (c) 2013 - 2018 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
555
+ * Copyright (c) 2013 - 2014, 2016 - 2020, 2023 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
408
556
 
409
557
  [semver]: http://semver.org/
410
558
  [pvc]: http://docs.rubygems.org/read/chapter/16#page74
data/SECURITY.md ADDED
@@ -0,0 +1,14 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|-----------|
7
+ | 2.x | ✅ |
8
+ | 1.x | ❌ |
9
+
10
+ ## Reporting a Vulnerability
11
+
12
+ Peter Boling is the primary maintainer of this gem. Please find a way
13
+ to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
14
+ possible.