version_gem 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d64ccd004d84d985193814b22b94eb0131e7d3de5d4414a775a82343ac3b88bb
4
+ data.tar.gz: b99052895d88af63e8d5e217ca18d0161b8edca03ee4cd17e3a07cd2a8e8e3a5
5
+ SHA512:
6
+ metadata.gz: d5ef0dac07a5548b9e6fd0f21eacfd16443acb196ad9c8f3fce45f851f74129fd2a30de5674bcebcb97ed73efc0d0cc0c71fd8b42a71d5d18a50282e33604d38
7
+ data.tar.gz: c96480d2fcd3d8b0b0c3566a967a8f7dd197558301eb4075e6ad525eb179871f7f97256e65785b06ef5587f0229adcd8339ca9bee048908a2c6ed4d593439c5b
data/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+ ### Added
9
+
10
+ ### Changed
11
+
12
+ ### Fixed
13
+
14
+ ### Removed
15
+
16
+ s## [1.0.0] - 2022-06-21
17
+ ### Added
18
+ - Initial release, with basic version parsing API
19
+
20
+ [Unreleased]: https://github.com/pboling/version_gem/compare/v1.0.0...HEAD
21
+ [1.0.0]: https://github.com/pboling/version_gem/compare/a3055964517c159bf214712940982034b75264be...v1.0.0
@@ -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,25 @@
1
+ ## Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/version_gem][source]
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
+
9
+ ## Contributors
10
+
11
+ [![Contributors](https://contrib.rocks/image?repo=pboling/version_gem)][contributors]
12
+
13
+ Made with [contributors-img][contrib-rocks].
14
+
15
+ [comment]: <> (Following links are used by README, CONTRIBUTING)
16
+
17
+ [conduct]: https://github.com/pboling/version_gem/blob/main/CODE_OF_CONDUCT.md
18
+
19
+ [contrib-rocks]: https://contrib.rocks
20
+
21
+ [contributors]: https://github.com/pboling/version_gem/graphs/contributors
22
+
23
+ [comment]: <> (Following links are used by README, CONTRIBUTING, Homepage)
24
+
25
+ [source]: https://github.com/pboling/version_gem
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Peter Boling
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # VersionGem
2
+
3
+ Give your next library an introspectable `Version` module.
4
+
5
+ ```ruby
6
+ MyLib::Version.to_s # => "1.2.3.rc3"
7
+ MyLib::Version.major # => 1
8
+ MyLib::Version.minor # => 2
9
+ MyLib::Version.patch # => 3
10
+ MyLib::Version.pre # => "rc3"
11
+ MyLib::Version.to_a # => [1, 2, 3, "rc3"]
12
+ MyLib::Version.to_h # => { major: 1, minor: 2, patch: 3, pre: "rc3" }
13
+ ```
14
+
15
+ This library was extracted from the gem [`oauth2`](https://github.com/oauth-xx/oauth2).
16
+
17
+ ## Installation
18
+
19
+ Install the gem and add to the application's Gemfile by executing:
20
+
21
+ $ bundle add version_gem
22
+
23
+ If bundler is not being used to manage dependencies, install the gem by executing:
24
+
25
+ $ gem install version_gem
26
+
27
+ ## Usage
28
+
29
+ In the standard `bundle gem my_lib` code you get the following in `lib/my_lib/version.rb:
30
+
31
+ ```ruby
32
+ module MyLib
33
+ VERSION = "0.1.0"
34
+ end
35
+ ```
36
+
37
+ Add a Version namespace (the one implied by the path => namespace convention):
38
+
39
+ ```ruby
40
+ module MyLib
41
+ module Version
42
+ VERSION = "0.1.0"
43
+ end
44
+ end
45
+ ```
46
+
47
+ Now add the following near the top of the file the manages requiring external libraries.
48
+ Using the same example of `bundle gem my_lib`, this would be `lib/my_lib.rb`.
49
+
50
+ ```ruby
51
+ require "version_gem"
52
+ ```
53
+
54
+ Then, add the following wherever you want in the same file (recommend the bottom).
55
+
56
+ ```ruby
57
+ MyLib::Version.class_eval do
58
+ extend VersionGem::Basic
59
+ end
60
+ ```
61
+
62
+ And now you have some version introspection methods available:
63
+
64
+ ```ruby
65
+ MyLib::Version.to_s # => "0.1.0"
66
+ MyLib::Version.major # => 0
67
+ MyLib::Version.minor # => 1
68
+ MyLib::Version.patch # => 0
69
+ MyLib::Version.pre # => ""
70
+ MyLib::Version.to_a # => [0, 1, 0]
71
+ MyLib::Version.to_h # => { major: 0, minor: 1, patch: 0, pre: "" }
72
+ ```
73
+
74
+ ### Side benefit
75
+
76
+ Your `version.rb` file now abides the Ruby convention of directory / path matching the namespace / class!
77
+
78
+ ## Development
79
+
80
+ 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.
81
+
82
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
83
+
84
+ ## Contributing
85
+
86
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/version_gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/pboling/version_gem/blob/main/CODE_OF_CONDUCT.md).
87
+
88
+ ## License
89
+
90
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
91
+
92
+ ## Code of Conduct
93
+
94
+ Everyone interacting in the VersionGem project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pboling/version_gem/blob/main/CODE_OF_CONDUCT.md).
data/SECURITY.md ADDED
@@ -0,0 +1,13 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |--------------|-----------|
7
+ | 1.0.<latest> | ✅ |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ Peter Boling is the primary maintainer of this gem. Please find a way
12
+ to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
13
+ possible.
@@ -0,0 +1,57 @@
1
+ module VersionGem
2
+ module Api
3
+ # The version number as a string
4
+ #
5
+ # @return [String]
6
+ def to_s
7
+ self::VERSION
8
+ end
9
+
10
+ # The major version
11
+ #
12
+ # @return [Integer]
13
+ def major
14
+ to_a[0].to_i
15
+ end
16
+
17
+ # The minor version
18
+ #
19
+ # @return [Integer]
20
+ def minor
21
+ to_a[1].to_i
22
+ end
23
+
24
+ # The patch version
25
+ #
26
+ # @return [Integer]
27
+ def patch
28
+ to_a[2].to_i
29
+ end
30
+
31
+ # The pre-release version, if any
32
+ #
33
+ # @return [String, NilClass]
34
+ def pre
35
+ to_a[3]
36
+ end
37
+
38
+ # The version number as a hash
39
+ #
40
+ # @return [Hash]
41
+ def to_h
42
+ {
43
+ major: major,
44
+ minor: minor,
45
+ patch: patch,
46
+ pre: pre
47
+ }
48
+ end
49
+
50
+ # The version number as an array
51
+ #
52
+ # @return [Array]
53
+ def to_a
54
+ self::VERSION.split('.')
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'error'
4
+ require_relative 'api'
5
+
6
+ module VersionGem
7
+ # This is a very *basic* version parser. Others could be built based on this pattern!
8
+ module Basic
9
+ def self.extended(base)
10
+ raise Error, "VERSION must be defined before 'extend #{name}'" unless defined?(base::VERSION)
11
+
12
+ base.extend Api
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module VersionGem
2
+ class Error < RuntimeError; end
3
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'basic'
4
+
5
+ module VersionGem
6
+ module Version
7
+ VERSION = '1.0.0'.freeze
8
+ # This would work in this gem, but not in external libraries,
9
+ # because version files are loaded in Gemspecs before bundler
10
+ # has a chance to load dependencies.
11
+ # Instead, see lib/version_gem.rb for a solution that will work everywhere
12
+ # extend VersionGem::Basic
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'version_gem/version'
4
+
5
+ module VersionGem
6
+ end
7
+
8
+ VersionGem::Version.class_eval do
9
+ extend VersionGem::Basic
10
+ end
@@ -0,0 +1,4 @@
1
+ module VersionGem
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: version_gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Peter Boling
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-06-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-lts
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '8.0'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 8.0.2
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '8.0'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 8.0.2
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop-rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop-rake
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rubocop-performance
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ description: Versions are good. Versions are cool. Versions will win.
118
+ email:
119
+ - peter.boling@gmail.com
120
+ executables: []
121
+ extensions: []
122
+ extra_rdoc_files: []
123
+ files:
124
+ - CHANGELOG.md
125
+ - CODE_OF_CONDUCT.md
126
+ - CONTRIBUTING.md
127
+ - LICENSE.txt
128
+ - README.md
129
+ - SECURITY.md
130
+ - lib/version_gem.rb
131
+ - lib/version_gem/api.rb
132
+ - lib/version_gem/basic.rb
133
+ - lib/version_gem/error.rb
134
+ - lib/version_gem/version.rb
135
+ - sig/version_gem.rbs
136
+ homepage: https://github.com/pboling/version_gem
137
+ licenses:
138
+ - MIT
139
+ metadata:
140
+ homepage_uri: https://github.com/pboling/version_gem
141
+ source_code_uri: https://github.com/pboling/version_gem/tree/v1.0.0
142
+ changelog_uri: https://github.com/pboling/version_gem/blob/v1.0.0/CHANGELOG.md
143
+ bug_tracker_uri: https://github.com/pboling/version_gem/issues
144
+ documentation_uri: https://www.rubydoc.info/gems/version_gem/1.0.0
145
+ wiki_uri: https://github.com/pboling/version_gem/wiki
146
+ rubygems_mfa_required: 'true'
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '2.2'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubygems_version: 3.3.16
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: Enhance your VERSION! Sugar for Version modules.
166
+ test_files: []