gem_bench 2.0.2 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +47 -23
- data/CODE_OF_CONDUCT.md +74 -25
- data/CONTRIBUTING.md +1 -3
- data/README.md +49 -17
- data/lib/gem_bench/gemfile_line_tokenizer.rb +132 -40
- data/lib/gem_bench/jersey.rb +100 -66
- data/lib/gem_bench/player.rb +2 -0
- data/lib/gem_bench/scout.rb +6 -4
- data/lib/gem_bench/strict_version_gem.rb +3 -1
- data/lib/gem_bench/strict_version_requirement.rb +2 -1
- data/lib/gem_bench/team.rb +16 -6
- data/lib/gem_bench/version.rb +2 -1
- data/lib/gem_bench.rb +34 -21
- data.tar.gz.sig +0 -0
- metadata +52 -60
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47591b1b5f1880cbb2c40be1199aa7fa65a25d2c32ca52131ba54e0e89d8b6b7
|
4
|
+
data.tar.gz: 93aad6d4e020398b93ffdaa2e8fddfce5b5e5cc4fa08854f22850dcccee9f0ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47827b59b13ee527cecfc8db349437c0fc416aa53fa83b4138a6c1884652d857ce9be708ec534e099b8a41f47914b831d8f73e09e430134f4deb050714a1925a
|
7
|
+
data.tar.gz: 9ae3067637e3293209bde40127e55ad42882b075ca71fc65e7b025ec5dd4e160f5669767e6990a8a0db915ff6031f1555e432cc6a110e32b09346a710fd304bf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -11,10 +11,34 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
|
|
11
11
|
### Fixed
|
12
12
|
### Removed
|
13
13
|
|
14
|
-
[2.0.
|
15
|
-
COVERAGE:
|
16
|
-
BRANCH COVERAGE:
|
17
|
-
|
14
|
+
## [2.0.4] SEP.20.2024
|
15
|
+
- COVERAGE: 98.19% -- 488/497 lines in 9 files
|
16
|
+
- BRANCH COVERAGE: 88.95% -- 161/181 branches in 9 files
|
17
|
+
- 58.06% documented
|
18
|
+
### Added
|
19
|
+
- More Documentation
|
20
|
+
- Almost 100% test coverage
|
21
|
+
- Thread Safety (removed `GemBench.roster`, which was effectively never used internally)
|
22
|
+
- Performance improvements
|
23
|
+
### Fixed
|
24
|
+
- Can now handle more variations of Ruby syntax in the Gemfile analyzer
|
25
|
+
- `require_relative` > `require` for internal files (except for `spec` => `lib`)
|
26
|
+
- Updated logic for version specified via git with branch, tag, ref (to match fixes to Bundler's behavior)
|
27
|
+
- Ambiguous naming of `GemBench::Jersey#primary_namespace` is split to:
|
28
|
+
- `#doffed_primary_namespace`
|
29
|
+
- `#donned_primary_namespace`
|
30
|
+
|
31
|
+
## [2.0.3] SEP.18.2024
|
32
|
+
### Added
|
33
|
+
- More documentation
|
34
|
+
### Fixed
|
35
|
+
- Typos in documentation
|
36
|
+
- Copyright years
|
37
|
+
|
38
|
+
## [2.0.2] SEP.17.2024
|
39
|
+
- COVERAGE: 82.15% -- 382/465 lines in 9 files
|
40
|
+
- BRANCH COVERAGE: 58.79% -- 97/165 branches in 9 files
|
41
|
+
- 51.72% documented
|
18
42
|
### Added
|
19
43
|
- CI for Ancient Rubies
|
20
44
|
- Ruby 2.3
|
@@ -26,10 +50,10 @@ BRANCH COVERAGE: 58.79% -- 97/165 branches in 9 branches
|
|
26
50
|
- Typo in URL in documentation
|
27
51
|
- Gemspec description & Summary
|
28
52
|
|
29
|
-
[2.0.1] SEP.17.2024
|
30
|
-
COVERAGE: 82.15% -- 382/465 lines in 9 files
|
31
|
-
BRANCH COVERAGE: 58.08% -- 97/167 branches in 9 files
|
32
|
-
51.72% documented
|
53
|
+
## [2.0.1] SEP.17.2024
|
54
|
+
- COVERAGE: 82.15% -- 382/465 lines in 9 files
|
55
|
+
- BRANCH COVERAGE: 58.08% -- 97/167 branches in 9 files
|
56
|
+
- 51.72% documented
|
33
57
|
### Added
|
34
58
|
- Ability to re-namespace and load copy of a gem alongside vanilla version for benchmarking via `GemBench::Jersey`
|
35
59
|
- See: https://github.com/panorama-ed/memo_wise/pull/339
|
@@ -42,7 +66,7 @@ BRANCH COVERAGE: 58.08% -- 97/167 branches in 9 files
|
|
42
66
|
### Fixed
|
43
67
|
- Stopped swallowing `ArgumentError` in certain exceptional cases
|
44
68
|
|
45
|
-
[2.0.0] SEP.25.2023
|
69
|
+
## [2.0.0] SEP.25.2023
|
46
70
|
### Added
|
47
71
|
- Compatible with Bundler 2+
|
48
72
|
- Checksums for release
|
@@ -60,18 +84,18 @@ BRANCH COVERAGE: 58.08% -- 97/167 branches in 9 files
|
|
60
84
|
- Removed Appraisals
|
61
85
|
- Removed Travis-CI
|
62
86
|
|
63
|
-
[1.0.6] SEP.09.2018
|
87
|
+
## [1.0.6] SEP.09.2018
|
64
88
|
- Documentation improvements
|
65
89
|
- Add Ruby 2.5 to build matrix
|
66
90
|
|
67
|
-
[1.0.5] JUN.05.2017
|
91
|
+
## [1.0.5] JUN.05.2017
|
68
92
|
- Allow github macro as an alternative to git within Gemfile for strict version constraint analysis
|
69
93
|
|
70
|
-
[1.0.3] JUN.02.2017
|
94
|
+
## [1.0.3] JUN.02.2017
|
71
95
|
- fixed accidental removal of loaded_gems in 1.0.2
|
72
96
|
- better documentation
|
73
97
|
|
74
|
-
[1.0.2] JUN.02.2017
|
98
|
+
## [1.0.2] JUN.02.2017
|
75
99
|
- version constraint checking, useful to add a spec enforcing Gemfile version constraints, by Peter Boling
|
76
100
|
- Console use:
|
77
101
|
- GemBench::StrictVersionRequirement.new({verbose: true})
|
@@ -85,42 +109,42 @@ Rspec.describe("Gemfile") do
|
|
85
109
|
end
|
86
110
|
```
|
87
111
|
|
88
|
-
[1.0.1] MAR.25.2017
|
112
|
+
## [1.0.1] MAR.25.2017
|
89
113
|
- fixed a typo that prevented Gemfile comparison by mobilutz
|
90
114
|
|
91
|
-
[1.0.0] FEB.26.2017
|
115
|
+
## [1.0.0] FEB.26.2017
|
92
116
|
- New feature: scan all code (except for test/spec/feature code) in all loaded gems for a given regex:
|
93
117
|
- puts GemBench.find(look_for_regex: /HERE BE DRAGONS/).starters.map {|gem| "#{gem.name} has DRAGONS at #{gem.stats}" }.join("\n")
|
94
118
|
- Added basic specs
|
95
119
|
- More Documentation
|
96
120
|
- added back git dependency to gemspec (pulled in latest Gem scaffolding from Bundler :/)
|
97
121
|
|
98
|
-
[0.0.8] JAN.16.2014
|
122
|
+
## [0.0.8] JAN.16.2014
|
99
123
|
- Corrected issues with 0.0.7 release.
|
100
124
|
- More Documentation
|
101
125
|
- removed git dependency from gemspec
|
102
126
|
|
103
|
-
[0.0.7] DEC.23.2013 (Yanked immediately)
|
127
|
+
## [0.0.7] DEC.23.2013 (Yanked immediately)
|
104
128
|
- Attempt to fix failure on encoding problem, with a rescue fallback (Issue #1) by Peter Boling
|
105
129
|
- Readme / Documentation improvements by John Bachir
|
106
130
|
- Runtime output improvements by John Bachir
|
107
131
|
|
108
|
-
[0.0.6] AUG.29.2013
|
132
|
+
## [0.0.6] AUG.29.2013
|
109
133
|
- Added license to gemspec by Peter Boling
|
110
134
|
- No longer altering Ruby load path - Let the gem manager do that by Peter Boling
|
111
135
|
|
112
|
-
[0.0.5] AUG.28.2013
|
136
|
+
## [0.0.5] AUG.28.2013
|
113
137
|
- Encode as UTF-8 prior to comparison by Peter Boling
|
114
138
|
|
115
|
-
[0.0.4] APR.06.2013
|
139
|
+
## [0.0.4] APR.06.2013
|
116
140
|
- Expanded exclusion list by Peter Boling
|
117
141
|
|
118
|
-
[0.0.3] APR.06.2013
|
142
|
+
## [0.0.3] APR.06.2013
|
119
143
|
- Late night coding needs more coffee by Peter Boling
|
120
144
|
|
121
|
-
[0.0.2] APR.06.2013
|
145
|
+
## [0.0.2] APR.06.2013
|
122
146
|
- Works against 265 dependency Gemfile by Peter Boling
|
123
147
|
- Added ability to evaluate a Gemfile by Peter Boling
|
124
148
|
|
125
|
-
[0.0.1] APR.05.2013
|
149
|
+
## [0.0.1] APR.05.2013
|
126
150
|
- Initial release by Peter Boling
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,20 +1,30 @@
|
|
1
|
+
|
1
2
|
# Contributor Covenant Code of Conduct
|
2
3
|
|
3
4
|
## Our Pledge
|
4
5
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our
|
7
|
+
community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
9
|
+
identity and expression, level of experience, education, socio-economic status,
|
10
|
+
nationality, personal appearance, race, religion, or sexual identity
|
11
|
+
and orientation.
|
6
12
|
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
14
|
+
diverse, inclusive, and healthy community.
|
8
15
|
|
9
16
|
## Our Standards
|
10
17
|
|
11
|
-
Examples of behavior that contributes to a positive environment for our
|
18
|
+
Examples of behavior that contributes to a positive environment for our
|
19
|
+
community include:
|
12
20
|
|
13
21
|
* Demonstrating empathy and kindness toward other people
|
14
22
|
* Being respectful of differing opinions, viewpoints, and experiences
|
15
23
|
* Giving and gracefully accepting constructive feedback
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes,
|
17
|
-
|
24
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
25
|
+
and learning from the experience
|
26
|
+
* Focusing on what is best not just for us as individuals, but for the
|
27
|
+
overall community
|
18
28
|
|
19
29
|
Examples of unacceptable behavior include:
|
20
30
|
|
@@ -29,56 +39,95 @@ Examples of unacceptable behavior include:
|
|
29
39
|
|
30
40
|
## Enforcement Responsibilities
|
31
41
|
|
32
|
-
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
43
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
44
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
45
|
+
or harmful.
|
33
46
|
|
34
|
-
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
48
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
49
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
50
|
+
decisions when appropriate.
|
35
51
|
|
36
52
|
## Scope
|
37
53
|
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
55
|
+
an individual is officially representing the community in public spaces.
|
56
|
+
Examples of representing our community include using an official e-mail address,
|
57
|
+
posting via an official social media account, or acting as an appointed
|
58
|
+
representative at an online or offline event.
|
39
59
|
|
40
60
|
## Enforcement
|
41
61
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
63
|
+
reported to the community leaders responsible for enforcement at
|
64
|
+
[INSERT CONTACT METHOD].
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
43
66
|
|
44
|
-
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
68
|
+
reporter of any incident.
|
45
69
|
|
46
70
|
## Enforcement Guidelines
|
47
71
|
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
49
74
|
|
50
75
|
### 1. Correction
|
51
76
|
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
78
|
+
unprofessional or unwelcome in the community.
|
53
79
|
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
55
83
|
|
56
84
|
### 2. Warning
|
57
85
|
|
58
|
-
**Community Impact**: A violation through a single incident or series
|
86
|
+
**Community Impact**: A violation through a single incident or series
|
87
|
+
of actions.
|
59
88
|
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
93
|
+
like social media. Violating these terms may lead to a temporary or
|
94
|
+
permanent ban.
|
61
95
|
|
62
96
|
### 3. Temporary Ban
|
63
97
|
|
64
|
-
**Community Impact**: A serious violation of community standards, including
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
99
|
+
sustained inappropriate behavior.
|
65
100
|
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
102
|
+
communication with the community for a specified period of time. No public or
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
105
|
+
Violating these terms may lead to a permanent ban.
|
67
106
|
|
68
107
|
### 4. Permanent Ban
|
69
108
|
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
71
112
|
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
114
|
+
the community.
|
73
115
|
|
74
116
|
## Attribution
|
75
117
|
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
77
|
-
available at
|
78
|
-
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
119
|
+
version 2.0, available at
|
120
|
+
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
80
121
|
|
81
|
-
|
122
|
+
Community Impact Guidelines were inspired by
|
123
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
82
124
|
|
83
125
|
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available
|
126
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
|
127
|
+
at [https://www.contributor-covenant.org/translations][translations].
|
128
|
+
|
129
|
+
[homepage]: https://www.contributor-covenant.org
|
130
|
+
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
131
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
132
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
133
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/CONTRIBUTING.md
CHANGED
@@ -4,8 +4,7 @@ Bug reports and pull requests are welcome on GitHub at [https://github.com/pboli
|
|
4
4
|
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
|
5
5
|
the [code of conduct][🤝conduct].
|
6
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].
|
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.
|
9
8
|
|
10
9
|
## Development
|
11
10
|
|
@@ -59,4 +58,3 @@ Made with [contributors-img][🖐contrib-rocks].
|
|
59
58
|
[🔒️rubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
|
60
59
|
[🔒️rubygems-checksums-pr]: https://github.com/rubygems/guides/pull/325
|
61
60
|
[🚎src-main]: https://github.com/pboling/gem_bench
|
62
|
-
[🏘chat]: https://matrix.to/#/%23pboling_gem_bench:gitter.im
|
data/README.md
CHANGED
@@ -63,12 +63,14 @@
|
|
63
63
|
</div>
|
64
64
|
</div>
|
65
65
|
|
66
|
+
[benchmarking-example]: https://github.com/panorama-ed/memo_wise/pull/339
|
67
|
+
|
66
68
|
## What's it do?
|
67
69
|
|
68
70
|
🏁 Copy & Re-namespace any gem to benchmark side-by-side with `benchmarks-ips`!
|
69
71
|
|
70
72
|
👯 For example, many of the ~dozen Memoization gems use the same namespaces (`Memoist`, `Memery`, etc).
|
71
|
-
In order to compare them side-by-side one of them must be re-namespaced.
|
73
|
+
In order to compare them side-by-side one of them must be re-namespaced. ([working example][benchmarking-example])
|
72
74
|
|
73
75
|
<details>
|
74
76
|
<summary>Scene: Spectator at a game of Ruby Sports Gem Ball</summary>
|
@@ -87,27 +89,22 @@ Coach:
|
|
87
89
|
|
88
90
|
</details>
|
89
91
|
|
90
|
-
🤩 Benchmark trunk against released version of a library!
|
92
|
+
🤩 Benchmark trunk against released version of a library! ([working example][benchmarking-example])
|
91
93
|
|
92
|
-
🧐 A `git clone` build can now be run against the latest public release build, side-by-side, by re-namespacing one of them.
|
94
|
+
🧐 A `git clone` build can now be run against the latest public release build, side-by-side, by re-namespacing one of them. ([working example][benchmarking-example])
|
93
95
|
|
94
96
|
🕵️♀️ Static Gemfile and installed gem library source code analysis.
|
95
97
|
Regex search through all of a project's source code, including installed Bundler dependencies.
|
96
98
|
|
97
99
|
🛟 Trim down app load times, such as on Heroku, by finding and keeping your worst players on the bench.
|
98
100
|
|
99
|
-
|
|
100
|
-
|
101
|
-
| gem name
|
102
|
-
| code triage
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
| 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) |
|
107
|
-
| `...` 💖 | [![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] |
|
108
|
-
|
109
|
-
[🏘chat]: https://matrix.to/#/%23pboling_gem_bench:gitter.im
|
110
|
-
[🏘chati]: https://badges.gitter.im/Join%20Chat.svg
|
101
|
+
| Primary Namespace | `GemBench` |
|
102
|
+
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
103
|
+
| gem name | [gem_bench](https://rubygems.org/gems/gem_bench) |
|
104
|
+
| code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/gem_bench/badges/users.svg)](https://www.codetriage.com/pboling/gem_bench) |
|
105
|
+
| documentation | [on Github.com][homepage], [on Rdoc.info][documentation] |
|
106
|
+
| 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) |
|
107
|
+
| `...` 💖 | [![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] |
|
111
108
|
|
112
109
|
<!-- 7️⃣ spread 💖 -->
|
113
110
|
[🐦tweet-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow%20%40galtzo
|
@@ -165,8 +162,43 @@ NOTE: It is not required by default, so you do need to require the Jersey if you
|
|
165
162
|
require "gem_bench/jersey"
|
166
163
|
```
|
167
164
|
|
165
|
+
#### Usage
|
166
|
+
|
167
|
+
If the original gem defines multiple top-level namespaces,
|
168
|
+
they can all be renamed by providing more key value pairs in `trades`.
|
169
|
+
If the original gem monkey patches other libraries,
|
170
|
+
that behavior can't be isolated, so YMMV.
|
171
|
+
|
172
|
+
NOTE: Non-top-level namespaces do not need to be renamed,
|
173
|
+
as they are isolated within their parent namespace.
|
174
|
+
|
175
|
+
#### Example
|
176
|
+
|
168
177
|
For a real example, see: https://github.com/panorama-ed/memo_wise/pull/339
|
169
178
|
|
179
|
+
#### Naming: Why `doff_and_don`?
|
180
|
+
|
181
|
+
> Wouldn't "copy_gem" make sense?
|
182
|
+
|
183
|
+
Actually copy is an overloaded term, which creates confusion in this use case.
|
184
|
+
This method Generates a temp directory, and creates a copy of a gem within it.
|
185
|
+
Re-namespaces the copy according to the `trades` configuration.
|
186
|
+
Then requires each file of the "copied gem", resulting
|
187
|
+
in a loaded gem that will not have namespace
|
188
|
+
collisions when loaded alongside the original-namespaced gem.
|
189
|
+
Note that "copied gem" in the previous sentence is ambiguous without the supporting context.
|
190
|
+
The "copied gem" can mean either the original, or the "copy", which is why this gem refers to
|
191
|
+
a "doffed gem" (the original) and a "donned gem" (the copy).
|
192
|
+
|
193
|
+
Also because `Jersey`. Duh...
|
194
|
+
|
195
|
+
#### Advanced Usage
|
196
|
+
|
197
|
+
If a block is provided the contents of each file will be yielded to the block,
|
198
|
+
after all namespace substitutions from `trades` are complete, but before the contents
|
199
|
+
are written to the donned (re-namespaced) gem. The return value of the block will be
|
200
|
+
written to the file in this scenario.
|
201
|
+
|
170
202
|
### New for 2.0.0 - Dropped Support for Ruby 2.0, 2.1, 2.2
|
171
203
|
|
172
204
|
- Required Ruby is now 2.3+
|
@@ -247,11 +279,11 @@ You *may not* need to add this gem to your project.
|
|
247
279
|
|
248
280
|
Install the gem and add to the application's Gemfile by executing:
|
249
281
|
|
250
|
-
$ bundle add
|
282
|
+
$ bundle add gem_bench
|
251
283
|
|
252
284
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
253
285
|
|
254
|
-
$ gem install
|
286
|
+
$ gem install gem_bench
|
255
287
|
|
256
288
|
<details>
|
257
289
|
<summary>Installation Options</summary>
|