gem_bench 1.0.5 → 2.0.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: d0150f098c58edf7279abc13c963078e6e2a200c8191c9c123e2c4fd01dfc082
4
- data.tar.gz: e9ce289e93f6949152cdc2440d0124b5b84c11c124678adcdf9d247fe89f5a4d
3
+ metadata.gz: bb28fac08232d2a64f31d1c3ac4dd0172ae1898460cc24b6770d84bb6fb8f478
4
+ data.tar.gz: abe5ec2c0d44d28e70dd89141da8d56e3c440f80b21b5ff8d197aaa01031e10e
5
5
  SHA512:
6
- metadata.gz: 9e5f931b2ebc0df56cbf9a5e2b99dfa408d14aebaadb6b7897077f10be7d809f89b65dff0061f22b33e925330f88501a54e77ab0473020c1914c426650f39449
7
- data.tar.gz: f5c3e302abf1b337081e06d4f77ce8eb2e1f49d2faf735d2336e4660df0f99a09cf5ebc8c3297b423bca7502a2db385010d72c4685bf5a69a6c1c36606d534ff
6
+ metadata.gz: 8a56aa10d455dbf1b745af1d83b80db1c5501ae78edf3ddd3fcb8047e4230512249249215240765a540a963eff6551149406d534ba5fa209a10bce8e358884a9
7
+ data.tar.gz: 58e77a2c83629a736e203c8918f8258f04f0e83357a403b53669f1a439d5996f34f429701d7be5bc154842dcf941fa27c0884afba976b6d8e1a031d44f83dc19
checksums.yaml.gz.sig ADDED
Binary file
@@ -1,64 +1,95 @@
1
- Version 1.0.6 - SEP.09.2018
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.0] SEP.25.2023
15
+ ### Added
16
+ * Compatible with Bundler 2+
17
+ * Checksums for release
18
+ * SHA-256
19
+ * SHA-512
20
+ * Signed releases
21
+ * Add CODE_OF_CONDUCT.md
22
+ * Add SECURITY.md (Security policy)
23
+ * Github Actions
24
+ ### Changed
25
+ * Dropped support for Ruby 2.0, 2.1, and 2.2
26
+ * `VERSION` constant now lives at `GemBench::Version::VERSION`, enhanced by `version_gem`
27
+ * Changelog updated to Keep-a-changelog format (going forward)
28
+ ### Removed
29
+ * Removed Appraisals
30
+ * Removed Travis-CI
31
+
32
+ [1.0.6] SEP.09.2018
2
33
  * Documentation improvements
3
34
  * Add Ruby 2.5 to build matrix
4
35
 
5
- Version 1.0.5 - JUN.05.2017
36
+ [1.0.5] JUN.05.2017
6
37
  * Allow github macro as an alternative to git within Gemfile for strict version constraint analysis
7
38
 
8
- Version 1.0.3 - JUN.02.2017
39
+ [1.0.3] JUN.02.2017
9
40
  * fixed accidental removal of loaded_gems in 1.0.2
10
41
  * better documentation
11
42
 
12
- Version 1.0.2 - JUN.02.2017
43
+ [1.0.2] JUN.02.2017
13
44
  * version constraint checking, useful to add a spec enforcing Gemfile version constraints, by Peter Boling
14
45
  - Console use:
15
46
  - GemBench::StrictVersionRequirement.new({verbose: true})
16
47
  - Spec use:
17
48
  ```ruby
18
- Rspec.describe "Gemfile" do
49
+ Rspec.describe("Gemfile") do
19
50
  it("has version constraint on every gem") do
20
51
  requirements = GemBench::StrictVersionRequirement.new({verbose: true})
21
- expect(requirements.list_missing_version_constraints).to eq([])
52
+ expect(requirements.list_missing_version_constraints).to(eq([]))
22
53
  end
23
54
  end
24
55
  ```
25
56
 
26
- Version 1.0.1 - MAR.25.2017
57
+ [1.0.1] MAR.25.2017
27
58
  * fixed a typo that prevented Gemfile comparison by mobilutz
28
59
 
29
- Version 1.0.0 - FEB.26.2017
60
+ [1.0.0] FEB.26.2017
30
61
  * New feature: scan all code (except for test/spec/feature code) in all loaded gems for a given regex:
31
62
  - puts GemBench.find(look_for_regex: /HERE BE DRAGONS/).starters.map {|gem| "#{gem.name} has DRAGONS at #{gem.stats}" }.join("\n")
32
63
  * Added basic specs
33
64
  * More Documentation
34
65
  * added back git dependency to gemspec (pulled in latest Gem scaffolding from Bundler :/)
35
66
 
36
- Version 0.0.8 - JAN.16.2014
67
+ [0.0.8] JAN.16.2014
37
68
  * Corrected issues with 0.0.7 release.
38
69
  * More Documentation
39
70
  * removed git dependency from gemspec
40
71
 
41
- Version 0.0.7 - DEC.23.2013 (Yanked immediately)
72
+ [0.0.7] DEC.23.2013 (Yanked immediately)
42
73
  * Attempt to fix failure on encoding problem, with a rescue fallback (Issue #1) by Peter Boling
43
74
  * Readme / Documentation improvements by John Bachir
44
75
  * Runtime output improvements by John Bachir
45
76
 
46
- Version 0.0.6 - AUG.29.2013
77
+ [0.0.6] AUG.29.2013
47
78
  * Added license to gemspec by Peter Boling
48
79
  * No longer altering Ruby load path - Let the gem manager do that by Peter Boling
49
80
 
50
- Version 0.0.5 - AUG.28.2013
81
+ [0.0.5] AUG.28.2013
51
82
  * Encode as UTF-8 prior to comparison by Peter Boling
52
83
 
53
- Version 0.0.4 - APR.06.2013
84
+ [0.0.4] APR.06.2013
54
85
  * Expanded exclusion list by Peter Boling
55
86
 
56
- Version 0.0.3 - APR.06.2013
87
+ [0.0.3] APR.06.2013
57
88
  * Late night coding needs more coffee by Peter Boling
58
89
 
59
- Version 0.0.2 - APR.06.2013
90
+ [0.0.2] APR.06.2013
60
91
  * Works against 265 dependency Gemfile by Peter Boling
61
92
  * Added ability to evaluate a Gemfile by Peter Boling
62
93
 
63
- Version 0.0.1 - APR.05.2013
94
+ [0.0.1] APR.05.2013
64
95
  * 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,46 @@
1
+ ## Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitLab at [https://gitlab.com/rubocop-lts/standard-rubocop-lts][🚎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 post a message to the [gitter chat][🏘chat].
9
+
10
+ ## Development
11
+
12
+ 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.
13
+
14
+ ## Release
15
+
16
+ To release a new version:
17
+
18
+ 1. Run `bin/setup && bin/rake` as a tests, coverage, & linting sanity check
19
+ 2. update the version number in `version.rb`
20
+ 3. Run `bin/setup && bin/rake` again as a secondary check, and to update `Gemfile.lock`
21
+ 4. Double check the `CHANGELOG.md`, make sure changes are documented
22
+ 5. run `git commit -am "🔖 Prepare release v<VERSION>"` to commit the changes
23
+ 6. Run `git push` to trigger the final CI pipeline before release, & merge PRs
24
+ 7. Run `git checkout main` (Or whichever branch is considered `trunk`, e.g. `master`)
25
+ 8. Run `git pull origin main` to ensure you will release the latest trunk code.
26
+ 9. Run `bundle exec rake build`
27
+ 10. Run `bin/checksum` to create and commit the SHA256 & SHA512 checksums
28
+ 11. Run `bundle exec rake release`
29
+
30
+ NOTE: You will need to have a public key in `certs/`, and list your cert in the
31
+ `gemspec`, in order to sign the new release.
32
+ See: [RubyGems Security Guide][rubygems-security-guide]
33
+
34
+ ## Contributors
35
+
36
+ [![Contributors](https://contrib.rocks/image?repo=pboling/gitmoji-regex)][🖐contributors]
37
+
38
+ Made with [contributors-img][contrib-rocks].
39
+
40
+ [🖐contributors]: https://github.com/pboling/gem_bench/graphs/contributors
41
+ [contrib-rocks]: https://contrib.rocks
42
+ [conduct]: https://github.com/pboling/gem_bench/blob/main/CODE_OF_CONDUCT.md
43
+ [🚎src-main]: https://github.com/pboling/gem_bench/tree/main
44
+ [🏘chat]: https://matrix.to/#/%23pboling_gem_bench:gitter.im
45
+ [rubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
46
+ [rubygems]: https://rubygems.org
data/README.md CHANGED
@@ -7,23 +7,38 @@
7
7
  Gem: "Put me in coach!"
8
8
  You: ❨╯°□°❩╯︵┻━┻
9
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) |
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/865e7bb1d0d3eb3ba807fca7344e22d1/overview.svg)](https://depfu.com/github/pboling/gem_bench?project_id=5613) |
17
+ | continuous integration | [![Current][🚎cwfi]][🚎cwf] [![Heads][🖐hwfi]][🖐hwf] [![Style][🧮swfi]][🧮swf] [![Coverage][📗cov-wfi]][📗cov-wf] |
18
+ | test coverage | [![Test Coverage](https://api.codeclimate.com/v1/badges/80787f126e7a486b19af/test_coverage)](https://codeclimate.com/github/pboling/gem_bench/test_coverage) |
19
+ | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/80787f126e7a486b19af/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
+ | live chat | [![Join the chat][🏘chati]][🏘chat] |
24
+ | 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) |
25
+ | 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) |
26
+
27
+ [🚎cwf]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/current.yml
28
+ [🚎cwfi]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/current.yml/badge.svg
29
+ [🖐hwf]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/heads.yml
30
+ [🖐hwfi]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/heads.yml/badge.svg
31
+ [🧮swf]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/style.yml
32
+ [🧮swfi]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/style.yml/badge.svg
33
+ [📗cov-wf]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/coverage.yml
34
+ [📗cov-wfi]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/coverage.yml/badge.svg
35
+ [🏘chat]: https://matrix.to/#/%23pboling_gem_bench:gitter.im
36
+ [🏘chati]: https://badges.gitter.im/Join%20Chat.svg
37
+
38
+ ### New for 2.0.0 - Dropped Support for Ruby 2.0, 2.1, 2.2
39
+
40
+ -- Required Ruby is now 2.3+
41
+ - `VERSION` is now namespaced at `GemBench::Version::VERSION` and is enhanced by `version_gem`.
27
42
 
28
43
  ### New for 1.0.2 - Gemfile specs
29
44
 
@@ -31,10 +46,10 @@ Version constraints are important. Give the Gemfile some love in your CI build
31
46
 
32
47
  Create a `spec/gemfile_spec.rb` like:
33
48
  ```ruby
34
- Rspec.describe "Gemfile" do
49
+ Rspec.describe("Gemfile") do
35
50
  it("has version constraint on every gem") do
36
51
  requirements = GemBench::StrictVersionRequirement.new({verbose: false})
37
- expect(requirements.list_missing_version_constraints).to eq([])
52
+ expect(requirements.list_missing_version_constraints).to(eq([]))
38
53
  end
39
54
  end
40
55
  ```
@@ -117,7 +132,7 @@ If you are going to use the gem in your specs, you will need to add it to the te
117
132
 
118
133
  ## Usage
119
134
 
120
- Works with Ruby >= 2.0 due to use of named parameters.
135
+ Works with Ruby >= 2.3.
121
136
 
122
137
  ### Example!
123
138
 
@@ -365,25 +380,18 @@ How much faster will my app boot loading 45 fewer gems? A bit.
365
380
  This gem determines which gems need to be loaded at Rails' boot time by looking for Railties and Engines.
366
381
  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
382
 
368
- ## Development
383
+ ## Contributors
369
384
 
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.
385
+ [![Contributors](https://contrib.rocks/image?repo=pboling/gitmoji-regex)][🖐contributors]
371
386
 
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).
387
+ Made with [contributors-img][contrib-rocks].
373
388
 
374
- ## Contributing
375
-
376
- Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/gem_bench.
389
+ [🖐contributors]: https://github.com/pboling/gem_bench/graphs/contributors
390
+ [contrib-rocks]: https://contrib.rocks
377
391
 
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.
392
+ ## Contributing
380
393
 
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
394
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
387
395
 
388
396
  ## Versioning
389
397
 
@@ -399,12 +407,14 @@ dependency on this gem using the [Pessimistic Version Constraint][pvc] with two
399
407
 
400
408
  For example:
401
409
 
402
- spec.add_dependency 'gem_bench', '~> 0.0'
410
+ spec.add_dependency 'gem_bench', '~> 2.0'
411
+
412
+ See [CHANGELOG.md](CHANGELOG.md) for list of releases.
403
413
 
404
414
  ## Legal
405
415
 
406
416
  * [![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]
417
+ * Copyright (c) 2013 - 2014, 2016 - 2020, 2023 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
408
418
 
409
419
  [semver]: http://semver.org/
410
420
  [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.
@@ -3,46 +3,41 @@ module GemBench
3
3
  GEM_REGEX = /\A\s*gem\s+([^#]*).*\Z/.freeze # run against gem lines like: "gem 'aftership', # Ruby SDK of AfterShip API."
4
4
  GEM_NAME_REGEX = /\A\s*gem\s+['"]{1}(?<name>[^'"]*)['"].*\Z/.freeze # run against gem lines like: "gem 'aftership', # Ruby SDK of AfterShip API."
5
5
  VERSION_CONSTRAINT = /['"]{1}([^'"]*)['"]/.freeze
6
- GEMFILE_HASH_CONFIG_KEY_REGEX_PROC = ->(key) { /\A\s*[^#]*(?<key1>#{key}: *)['"]{1}(?<value1>[^'"]*)['"]|(?<key2>['"]#{key}['"] *=> *)['"]{1}(?<value2>[^'"]*)['"]|(?<key3>:#{key} *=> *)['"]{1}(?<value3>[^'"]*)['"]/ }
7
- VERSION_PATH = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call('path').freeze
8
- VERSION_GIT = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call('git').freeze
9
- VERSION_GITHUB = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call('github').freeze
10
- VERSION_GIT_REF = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call('ref').freeze
11
- VERSION_GIT_TAG = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call('tag').freeze
12
- VERSION_GIT_BRANCH = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call('branch').freeze
13
- VALID_VERSION_TYPES = %i(
6
+ GEMFILE_HASH_CONFIG_KEY_REGEX_PROC = lambda { |key|
7
+ /\A\s*[^#]*(?<key1>#{key}: *)['"]{1}(?<value1>[^'"]*)['"]|(?<key2>['"]#{key}['"] *=> *)['"]{1}(?<value2>[^'"]*)['"]|(?<key3>:#{key} *=> *)['"]{1}(?<value3>[^'"]*)['"]/
8
+ }
9
+ VERSION_PATH = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call("path").freeze
10
+ VERSION_GIT = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call("git").freeze
11
+ VERSION_GITHUB = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call("github").freeze
12
+ VERSION_GIT_REF = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call("ref").freeze
13
+ VERSION_GIT_TAG = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call("tag").freeze
14
+ VERSION_GIT_BRANCH = GEMFILE_HASH_CONFIG_KEY_REGEX_PROC.call("branch").freeze
15
+ VALID_VERSION_TYPES = %i[
14
16
  constraint
15
17
  git_ref
16
18
  git_tag
17
- )
19
+ ]
18
20
  # branch is only valid if the branch is not master
19
21
  attr_reader :line
20
- attr_reader :relevant_lines
21
- attr_reader :is_gem
22
- attr_reader :all_lines
23
- attr_reader :index
24
- attr_reader :tokens
22
+ attr_reader :relevant_lines, :is_gem, :all_lines, :index, :tokens, :version_type, :name, :parse_success, :valid
25
23
  # version will be a string if it is a normal constraint like '~> 1.2.3'
26
24
  # version will be a hash if it is an alternative constraint like:
27
25
  # git: "blah/blah", ref: "shasha"
28
26
  attr_reader :version
29
- attr_reader :version_type
30
- attr_reader :name
31
- attr_reader :parse_success
32
- attr_reader :valid
27
+
33
28
  def initialize(all_lines, line, index)
34
29
  @line = line.strip
35
30
  @is_gem = self.line.match(GEM_REGEX)
36
- if self.is_gem
31
+ if is_gem
37
32
  @all_lines = all_lines
38
33
  @index = index
39
- @tokens = self.line.split(',')
34
+ @tokens = self.line.split(",")
40
35
  determine_name
41
- if self.name
36
+ if name
42
37
  determine_relevant_lines
43
38
  determine_version
44
39
  @parse_success = true
45
- @valid = VALID_VERSION_TYPES.include?(self.version_type)
40
+ @valid = VALID_VERSION_TYPES.include?(version_type)
46
41
  else
47
42
  noop
48
43
  end
@@ -87,6 +82,7 @@ module GemBench
87
82
  # index 1 of the comma-split tokens will usually be the version constraint, if there is one
88
83
  possible_constraint = @tokens[1]
89
84
  return false unless possible_constraint
85
+
90
86
  match_data = possible_constraint.strip.match(VERSION_CONSTRAINT)
91
87
  # the version constraint is in a regex capture group
92
88
  if match_data && (@version = match_data[1].strip)
@@ -99,92 +95,100 @@ module GemBench
99
95
 
100
96
  def version_path
101
97
  @version = {}
102
- line = relevant_lines.detect { |next_line| (next_line.match(VERSION_PATH)) }
98
+ line = relevant_lines.detect { |next_line| next_line.match(VERSION_PATH) }
103
99
  return false unless line
100
+
104
101
  enhance_version(
105
- line.match(VERSION_PATH),
106
- :path,
107
- :path
102
+ line.match(VERSION_PATH),
103
+ :path,
104
+ :path,
108
105
  )
109
106
  end
110
107
 
111
108
  def version_git
112
109
  @version = {}
113
- line = relevant_lines.detect { |next_line| (next_line.match(VERSION_GIT)) }
110
+ line = relevant_lines.detect { |next_line| next_line.match(VERSION_GIT) }
114
111
  return false unless line
112
+
115
113
  enhance_version(
116
- line.match(VERSION_GIT),
117
- :git,
118
- :git
114
+ line.match(VERSION_GIT),
115
+ :git,
116
+ :git,
119
117
  )
120
118
  end
121
119
 
122
120
  def version_github
123
121
  @version = {}
124
- line = relevant_lines.detect { |next_line| (next_line.match(VERSION_GITHUB)) }
122
+ line = relevant_lines.detect { |next_line| next_line.match(VERSION_GITHUB) }
125
123
  return false unless line
124
+
126
125
  enhance_version(
127
- line.match(VERSION_GITHUB),
128
- :github,
129
- :github
126
+ line.match(VERSION_GITHUB),
127
+ :github,
128
+ :github,
130
129
  )
131
130
  end
132
131
 
133
132
  def check_for_version_of_type_git_ref
134
- line = relevant_lines.detect { |next_line| (next_line.match(VERSION_GIT_REF)) }
133
+ line = relevant_lines.detect { |next_line| next_line.match(VERSION_GIT_REF) }
135
134
  return false unless line
135
+
136
136
  enhance_version(
137
- line.match(VERSION_GIT_REF),
138
- :ref,
139
- :git_ref
137
+ line.match(VERSION_GIT_REF),
138
+ :ref,
139
+ :git_ref,
140
140
  )
141
141
  end
142
142
 
143
143
  def check_for_version_of_type_git_tag
144
- line = relevant_lines.detect { |next_line| (next_line.match(VERSION_GIT_TAG)) }
144
+ line = relevant_lines.detect { |next_line| next_line.match(VERSION_GIT_TAG) }
145
145
  return false unless line
146
+
146
147
  enhance_version(
147
- line.match(VERSION_GIT_TAG),
148
- :tag,
149
- :git_tag
148
+ line.match(VERSION_GIT_TAG),
149
+ :tag,
150
+ :git_tag,
150
151
  )
151
152
  end
152
153
 
153
154
  def check_for_version_of_type_git_branch
154
- line = relevant_lines.detect { |next_line| (next_line.match(VERSION_GIT_BRANCH)) }
155
+ line = relevant_lines.detect { |next_line| next_line.match(VERSION_GIT_BRANCH) }
155
156
  return false unless line
157
+
156
158
  enhance_version(
157
- line.match(VERSION_GIT_BRANCH),
158
- :branch,
159
- :git_branch
159
+ line.match(VERSION_GIT_BRANCH),
160
+ :branch,
161
+ :git_branch,
160
162
  )
161
163
  end
162
164
 
163
165
  # returns an array with each line following the current line, which is not a gem line
164
166
  def following_non_gem_lines
165
- all_lines[(index+1)..(-1)].
166
- reject {|x| x.strip.empty? || x.match(GemBench::TRASH_REGEX) }.
167
- map(&:strip).
168
- inject([]) do |following_lines, next_line|
169
- break following_lines if next_line.match(GEM_REGEX)
170
- following_lines << next_line
167
+ all_lines[(index + 1)..-1]
168
+ .reject { |x| x.strip.empty? || x.match(GemBench::TRASH_REGEX) }
169
+ .map(&:strip)
170
+ .inject([]) do |following_lines, next_line|
171
+ break following_lines if next_line.match(GEM_REGEX)
172
+
173
+ following_lines << next_line
171
174
  end
172
175
  end
173
176
 
174
177
  # returns a hash like:
175
178
  # {"key" => ":git => ", "value" => "https://github.com/cte/aftership-sdk-ruby.git"}
176
179
  def normalize_match_data_captures(match_data)
177
- match_data.names.inject({}) do |mem, capture|
178
- mem[capture.gsub(/\d/,'')] = match_data[capture]
180
+ match_data.names.each_with_object({}) do |capture, mem|
181
+ mem[capture.gsub(/\d/, "")] = match_data[capture]
179
182
  break mem if mem.keys.length >= 2
180
- mem
181
183
  end
182
184
  end
183
185
 
184
186
  def enhance_version(match_data, version_key, type)
185
187
  return false unless match_data
188
+
186
189
  normalized_capture = normalize_match_data_captures(match_data) if match_data
187
190
  return false unless normalized_capture
191
+
188
192
  @version.merge!({version_key => normalized_capture["value"]})
189
193
  @version_type = type
190
194
  true