semverify 0.3.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: 9fcbd22e660e49a8687593008433ffbfd859760a9ecb7a2f61c1277786d34a25
4
+ data.tar.gz: d4973af279ee22a2ed02874972908c47ddb4c3db604166c577d00c29885114c6
5
+ SHA512:
6
+ metadata.gz: d92b11f52be46b8d19b434b1a219a603785ad3cd7570bd64c313e37b78b8c066f8e15d0a491e6834db98206de967359e93c8cb08b03863f97dce0c6c5d6a3477
7
+ data.tar.gz: 9b88892ebc937cf4f18a64b16d0a0fe5eb1a706a7564ee1a23e5b5d35089d7d9e1fc5f74c4cf42ffcad32413085ca015166a12703432f1701e551c973b51b451
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,26 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ # Output extra information for each offense to make it easier to diagnose:
4
+ DisplayCopNames: true
5
+ DisplayStyleGuide: true
6
+ ExtraDetails: true
7
+ SuggestExtensions: false
8
+ # RuboCop enforces rules depending on the oldest version of Ruby which
9
+ # your project supports:
10
+ TargetRubyVersion: 3.0
11
+
12
+ # The default max line length is 80 characters
13
+ Layout/LineLength:
14
+ Max: 120
15
+
16
+ # The DSL for RSpec and the gemspec file make it very hard to limit block length:
17
+ Metrics/BlockLength:
18
+ Exclude:
19
+ - "spec/spec_helper.rb"
20
+ - "spec/**/*_spec.rb"
21
+ - "*.gemspec"
22
+
23
+ # When writing minitest tests, it is very hard to limit test class length:
24
+ Metrics/ClassLength:
25
+ Exclude:
26
+ - "test/**/*_test.rb"
data/.yardopts ADDED
@@ -0,0 +1,6 @@
1
+ --no-private
2
+ --hide-void-return
3
+ --markup-provider=redcarpet
4
+ --markup markdown
5
+ - CHANGELOG.md
6
+ - LICENSE.txt
data/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ ## v0.3.0 (2023-03-19)
2
+
3
+ [Full Changelog](https://github.com/main-branch/semverify/compare/v0.2.0..v0.3.0)
4
+
5
+ Changes since v0.2.0:
6
+
7
+ * 83cf403 Update CodeClimate badges after project rename (#13)
8
+ * 7079244 Rename gem from 'semversion' to 'semverify' (#11)
9
+
10
+ ## v0.2.0 (2023-03-18)
11
+
12
+ [Full Changelog](https://github.com/main-branch/semverify/compare/v0.1.0..v0.2.0)
13
+
14
+ Changes since v0.1.0:
15
+
16
+ * 7a8069c Integrate the create_github_release gem (#9)
17
+ * 96cdae4 Add Library Usage documentation to README.md (#8)
18
+ * 8196c2e Add JRuby Linux and Windows builds to CI builds (#7)
19
+ * e6b0739 Add windows build to CI builds (#6)
20
+ * 59e310f Fix reported CodeClimate complexity issues (#3)
21
+ * 2d28b30 Integrate CodeClimate maintainability and test coverage tracking (#1)
22
+ * 2bda849 Add CODEOWNERS file to indicate who can review PRs
23
+ * 4599554 Add the CommandLine class and semverify script
24
+ * 6204835 Add the #next_release method to IncrementableSemver
25
+ * 4219c88 Add the #next_pre method to IncrementableSemver
26
+ * 6f3bd22 Add the #next_major, #next_minor, #next_patch methods to IncrementableSemver
27
+ * 76782ac Add the IncrementableSemver class
28
+ * 98d12cc Add the VersionFile and the VersionFileFactory classes
29
+ * 713fddd Add the Semver class
30
+ * e5c9864 Update README.md
31
+
32
+ ## [Unreleased]
33
+
34
+ ## [0.1.0] - 2023-03-10
35
+
36
+ - Initial release
@@ -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 jcouball@yahoo.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/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in semverify.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 James Couball
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,116 @@
1
+ # Semverify
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/semverify.svg)](https://badge.fury.io/rb/semverify)
4
+ [![Documentation](https://img.shields.io/badge/Documentation-Latest-green)](https://rubydoc.info/gems/semverify/)
5
+ [![Change Log](https://img.shields.io/badge/CHANGELOG-Latest-green)](https://rubydoc.info/gems/semverify/file/CHANGELOG.md)
6
+ [![Build Status](https://github.com/main-branch/semverify/workflows/CI%20Build/badge.svg?branch=main)](https://github.com/main-branch/semverify/actions?query=workflow%3ACI%20Build)
7
+ [![Maintainability](https://api.codeclimate.com/v1/badges/44a42ed085fe162e5dff/maintainability)](https://codeclimate.com/github/main-branch/semverify/maintainability)
8
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/44a42ed085fe162e5dff/test_coverage)](https://codeclimate.com/github/main-branch/semverify/test_coverage)
9
+
10
+ A Gem to parse, compare, and increment versions for RubyGems.
11
+
12
+ Can be used as an alternative to the [bump RubyGem](https://rubygems.org/gems/bump/).
13
+
14
+ * [Semverify](#semverify)
15
+ * [Installation](#installation)
16
+ * [Command Line Usage](#command-line-usage)
17
+ * [Library Usage](#library-usage)
18
+ * [Development](#development)
19
+ * [Contributing](#contributing)
20
+ * [License](#license)
21
+
22
+ ## Installation
23
+
24
+ Install the gem and add to the application's Gemfile by executing:
25
+
26
+ ```shell
27
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
28
+ ```
29
+
30
+ If bundler is not being used to manage dependencies, install the gem by executing:
31
+
32
+ ```shell
33
+ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
34
+ ```
35
+
36
+ ## Command Line Usage
37
+
38
+ The `semverify` command line has built in help for all its commands. List the
39
+ commands by invoking `semverify` with no arguments or `semverify help` as
40
+ follows:
41
+
42
+ ```shell
43
+ semverify help
44
+ ```
45
+
46
+ The output is the following:
47
+
48
+ ```shell
49
+ Commands:
50
+ semverify current [-q] # Show the current gem version
51
+ semverify file [-q] # Show the path to the file containing the g...
52
+ semverify help [COMMAND] # Describe available commands or one specifi...
53
+ semverify next-major [VERSION] [-p [-t TYPE]] [-b BUILD] [-n] [-q] # Increment the version's major part
54
+ semverify next-minor [VERSION] [-p [-t TYPE]] [-b BUILD] [-n] [-q] # Increment the version's minor part
55
+ semverify next-patch [VERSION] [-p [-t TYPE]] [-b BUILD] [-n] [-q] # Increment the version's patch part
56
+ semverify next-pre [VERSION] [-t TYPE] [-b BUILD] [-n] [-q] # Increment the version's pre-release part
57
+ semverify next-release [VERSION] [-b BUILD] [-n] [-q] # Increment a pre-release version to the rel...
58
+ semverify validate VERSION [-q] # Validate the given version
59
+ $
60
+ ```
61
+
62
+ The `semverify help COMMAND` command will give further help for a specific command:
63
+
64
+ ```shell
65
+ semverify help current
66
+ ```
67
+
68
+ The output is the following:
69
+
70
+ ```shell
71
+ Usage:
72
+ semverify current [-q]
73
+
74
+ Options:
75
+ -q, [--quiet], [--no-quiet] # Do not print the current version to stdout
76
+
77
+ Description:
78
+ Output the current gem version from the file that stores the gem version.
79
+
80
+ The command fails if the gem version could not be found or is invalid.
81
+
82
+ Use `--quiet` to ensure that a gem version could be found and is valid without producing any output.
83
+ $
84
+ ```
85
+
86
+ ## Library Usage
87
+
88
+ [Detailed API documenation](https://rubydoc.info/gems/semverify/) is hosted on rubygems.org.
89
+
90
+ The main classes are:
91
+
92
+ * **Semverify::Semver**: Parse and compare generic semver version strings. See
93
+ [semver.org](https://semver.org) for details on what makes a valid semver string.
94
+
95
+ * **Semverify::IncrementableSemver**: Extends the Semverify::Semver class that knows
96
+ how to increment (aka bump) parts of the version string (major, minor, patch,
97
+ pre-release). Some additional restrictions are put onto the pre-release part
98
+ so that the pre-release part of the version can be incremented.
99
+
100
+ * **Semverify::VersionFileFactory**: find the gem's version file and returns a
101
+ **Semverify::VersionFile** that knows it's path, the contained version, and how to update
102
+ the version file with a new version.
103
+
104
+ ## Development
105
+
106
+ 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.
107
+
108
+ 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).
109
+
110
+ ## Contributing
111
+
112
+ Bug reports and pull requests are welcome on GitHub at https://github.com/main-branch/semverify.
113
+
114
+ ## License
115
+
116
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Run the same tasks that the CI build will run'
4
+ if RUBY_PLATFORM == 'java'
5
+ task default: %w[spec rubocop bundle:audit build]
6
+ else
7
+ task default: %w[spec rubocop yard yard:audit yard:coverage bundle:audit build]
8
+ end
9
+
10
+ # Bundler Audit
11
+
12
+ require 'bundler/audit/task'
13
+ Bundler::Audit::Task.new
14
+
15
+ # Bundler Gem Build
16
+
17
+ require 'bundler'
18
+ require 'bundler/gem_tasks'
19
+
20
+ begin
21
+ Bundler.setup(:default, :development)
22
+ rescue Bundler::BundlerError => e
23
+ warn e.message
24
+ warn 'Run `bundle install` to install missing gems'
25
+ exit e.status_code
26
+ end
27
+
28
+ CLEAN << 'pkg'
29
+ CLEAN << 'Gemfile.lock'
30
+
31
+ # RSpec
32
+
33
+ require 'rspec/core/rake_task'
34
+
35
+ RSpec::Core::RakeTask.new do
36
+ if RUBY_PLATFORM == 'java'
37
+ ENV['JAVA_OPTS'] = '-Djdk.io.File.enableADS=true'
38
+ ENV['JRUBY_OPTS'] = '--debug'
39
+ ENV['NOCOV'] = 'TRUE'
40
+ end
41
+ end
42
+
43
+ CLEAN << 'coverage'
44
+ CLEAN << '.rspec_status'
45
+ CLEAN << 'rspec-report.xml'
46
+
47
+ # Rubocop
48
+
49
+ require 'rubocop/rake_task'
50
+
51
+ RuboCop::RakeTask.new do |t|
52
+ t.options = %w[
53
+ --format progress
54
+ --format json --out rubocop-report.json
55
+ ]
56
+ end
57
+
58
+ CLEAN << 'rubocop-report.json'
59
+
60
+ unless RUBY_PLATFORM == 'java'
61
+ # YARD
62
+
63
+ require 'yard'
64
+ YARD::Rake::YardocTask.new do |t|
65
+ t.files = %w[lib/**/*.rb examples/**/*]
66
+ end
67
+
68
+ CLEAN << '.yardoc'
69
+ CLEAN << 'doc'
70
+
71
+ # Yardstick
72
+
73
+ desc 'Run yardstick to show missing YARD doc elements'
74
+ task :'yard:audit' do
75
+ sh "yardstick 'lib/**/*.rb'"
76
+ end
77
+
78
+ # Yardstick coverage
79
+
80
+ require 'yardstick/rake/verify'
81
+
82
+ Yardstick::Rake::Verify.new(:'yard:coverage') do |verify|
83
+ verify.threshold = 100
84
+ end
85
+ end
data/exe/semverify ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'semverify'
5
+
6
+ Semverify::CommandLine.start(ARGV)