Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • oauth-xx/version_gem
  • Fryguy/version_gem
2 results
Show changes
Commits on Source (34)
Showing
with 836 additions and 124 deletions
# These are supported funding model platforms
github: [pboling] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: galtzo # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: pboling # Replace with a single Ko-fi username
tidelift: rubygems/version_gem # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: pboling # Replace with a single Liberapay username
issuehunt: pboling # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
time: "04:36"
open-pull-requests-limit: 10
ignore:
- dependency-name: "rubocop-lts"
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main, "*-stable" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, "*-stable" ]
schedule:
- cron: '35 1 * * 5'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'ruby' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
name: Code Coverage
env:
CI_CODECOV: true
COVER_ALL: true
on:
push:
branches:
- 'main'
- '*-maintenance'
- '*-dev'
- '*-stable'
tags:
- '!*' # Do not execute on tags
pull_request:
branches:
- '*'
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Specs with Coverage - Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
experimental: [false]
rubygems:
- latest
bundler:
- latest
ruby:
- "2.7"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
steps:
- uses: amancevice/setup-code-climate@v0
name: CodeClimate Install
if: matrix.ruby == '2.7' && github.event_name != 'pull_request' && always()
with:
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby & Bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}
bundler-cache: true
- name: CodeClimate Pre-build Notification
run: cc-test-reporter before-build
if: matrix.ruby == '2.7' && github.event_name != 'pull_request' && always()
continue-on-error: ${{ matrix.experimental != 'false' }}
- name: Run tests
run: bundle exec rake test
- name: CodeClimate Post-build Notification
run: cc-test-reporter after-build
if: matrix.ruby == '2.7' && github.event_name != 'pull_request' && always()
continue-on-error: ${{ matrix.experimental != 'false' }}
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.2.0
with:
filename: ./coverage/coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: true
hide_complexity: true
indicators: true
output: both
thresholds: '86 88'
continue-on-error: ${{ matrix.experimental != 'false' }}
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: matrix.ruby == '2.7' && always()
with:
recreate: true
path: code-coverage-results.md
continue-on-error: ${{ matrix.experimental != 'false' }}
- name: Coveralls
uses: coverallsapp/github-action@master
if: matrix.ruby == '2.7' && github.event_name != 'pull_request' && always()
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: ${{ matrix.experimental != 'false' }}
# Using the codecov gem instead.
# - name: CodeCov
# uses: codecov/codecov-action@v2
# if: matrix.ruby == '2.7' && github.event_name != 'pull_request' && always()
# with:
# files: ./coverage/coverage.xml
# flags: unittests
# name: codecov-upload
# fail_ci_if_error: true
# continue-on-error: ${{ matrix.experimental != 'false' }}
name: Ruby HEAD Support
on:
push:
branches:
- 'main'
- '*-dev'
- '*-stable'
tags:
- '!*' # Do not execute on tags
pull_request:
branches:
- '*'
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
experimental: [true]
rubygems:
- latest
bundler:
- latest
ruby:
# rubocop supports JRuby, but I can't get it to work on jruby-head (and the problem might be in JRuby!)
- "ruby-head"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby & Bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}
bundler-cache: true
- name: Run tests
run: bundle exec rake test
name: Legacy Ruby Support
on:
push:
branches:
- 'main'
- '*-maintenance'
- '*-dev'
- '*-stable'
tags:
- '!*' # Do not execute on tags
pull_request:
branches:
- '*'
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
experimental: [false]
rubygems:
- "2.7.11"
bundler:
- none
ruby:
- "2.6"
- "2.5"
- "2.4"
- "2.3"
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby & Bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}
bundler-cache: true
- name: Run tests
run: bundle exec rake test
name: Ruby
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '3.1.2'
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the default task
run: bundle exec rake
name: Code Style Checks
on:
push:
branches:
- 'main'
- '*-maintenance'
- '*-dev'
- '*-stable'
tags:
- '!*' # Do not execute on tags
pull_request:
branches:
- '*'
jobs:
rubocop:
name: Rubocop
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
experimental: [false]
ruby:
- "2.2"
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby & Bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}
bundler-cache: true
- name: Run Rubocop
run: bundle exec rubocop -DES
name: Current Ruby Support
on:
push:
branches:
- 'main'
- '*-maintenance'
- '*-dev'
- '*-stable'
tags:
- '!*' # Do not execute on tags
pull_request:
branches:
- '*'
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
experimental: [false]
rubygems:
- latest
bundler:
- latest
ruby:
- "2.7"
- "3.0"
- "3.1"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby & Bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}
bundler-cache: true
- name: Run tests
run: bundle exec rake test
name: Unofficial Support
on:
push:
branches:
- 'main'
- '*-maintenance'
- '*-dev'
- '*-stable'
tags:
- '!*' # Do not execute on tags
pull_request:
branches:
- '*'
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Specs - Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
experimental: [false]
ruby:
- "2.2"
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby & Bundle
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake test
......@@ -10,3 +10,9 @@
# rspec failure tracking
.rspec_status
/.idea/
# Gemfile Lock files
Gemfile.lock
.ruby-version
.tool-versions
......@@ -2,3 +2,14 @@ inherit_from: .rubocop_todo.yml
inherit_gem:
rubocop-lts: rubocop-lts.yml
Metrics/BlockLength:
ExcludedMethods:
- context
- describe
- it
- shared_context
- shared_examples
- shared_examples_for
- namespace
- draw
......@@ -34,9 +34,9 @@ Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/gem_ver.rb'
- 'lib/gem_ver/api.rb'
- 'lib/gem_ver/version.rb'
- 'lib/version_gem.rb'
- 'lib/version_gem/api.rb'
- 'lib/version_gem/version.rb'
# Offense count: 18
# Cop supports --auto-correct.
......
# frozen_string_literal: true
# To get coverage
# On Local, default (HTML) output, it just works, coverage is turned on:
# bundle exec rspec spec
# On Local, all output formats:
# COVER_ALL=true bundle exec rspec spec
#
# On CI, all output formats, the ENV variables CI is always set,
# and COVER_ALL, and CI_CODECOV, are set in the coverage.yml workflow only,
# so coverage only runs in that workflow, and outputs all formats.
#
if RUN_COVERAGE
SimpleCov.start do
enable_coverage :branch
primary_coverage :branch
add_filter "spec"
track_files "lib/**/*.rb"
if ALL_FORMATTERS
command_name "#{ENV["GITHUB_WORKFLOW"]} Job #{ENV["GITHUB_RUN_ID"]}:#{ENV["GITHUB_RUN_NUMBER"]}"
else
formatter SimpleCov::Formatter::HTMLFormatter
end
minimum_coverage(85)
end
else
puts "Not running coverage on #{RUBY_ENGINE} #{RUBY_VERSION}"
end
ruby 2.6.10
# Changelog
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
......@@ -13,17 +13,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
## [1.0.2] - 2022-06-20
## [1.1.0] - 2022-06-24
### Fixed
- to_a uses same type casting as major, minor, patch, and pre
### Added
- RSpec Matchers and Shared Example
## [1.0.2] - 2022-06-23
### Added
- Better documentation
- Delay loading of library code until after code coverage tool is loaded
## [1.0.1] - 2022-06-20
## [1.0.1] - 2022-06-23
### Added
- SECURITY.md
- CI Build improvements
- Code coverage reporting
- Documentation improvements
- Badges!
## [1.0.0] - 2022-06-20
## [1.0.0] - 2022-06-21
### Added
- Initial release, with basic version parsing API
[Unreleased]: https://github.com/pboling/gem_ver/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/pboling/gem_ver/compare/a3055964517c159bf214712940982034b75264be...v1.0.0
[Unreleased]: https://github.com/pboling/version_gem/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/pboling/version_gem/compare/v1.0.2...v1.1.0
[1.0.2]: https://github.com/pboling/version_gem/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/pboling/version_gem/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/pboling/version_gem/compare/a3055964517c159bf214712940982034b75264be...v1.0.0
## Contributing
Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/gem_ver][source]
Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/version_gem][source]
. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
the [code of conduct][conduct].
......@@ -8,18 +8,18 @@ To submit a patch, please fork the project and create a patch with tests. Once y
## Contributors
[![Contributors](https://contrib.rocks/image?repo=pboling/gem_ver)][contributors]
[![Contributors](https://contrib.rocks/image?repo=pboling/version_gem)][contributors]
Made with [contributors-img][contrib-rocks].
[comment]: <> (Following links are used by README, CONTRIBUTING)
[conduct]: https://github.com/pboling/gem_ver/blob/main/CODE_OF_CONDUCT.md
[conduct]: https://github.com/pboling/version_gem/blob/main/CODE_OF_CONDUCT.md
[contrib-rocks]: https://contrib.rocks
[contributors]: https://github.com/pboling/gem_ver/graphs/contributors
[contributors]: https://github.com/pboling/version_gem/graphs/contributors
[comment]: <> (Following links are used by README, CONTRIBUTING, Homepage)
[source]: https://github.com/pboling/gem_ver
[source]: https://github.com/pboling/version_gem
......@@ -2,5 +2,36 @@
source 'https://rubygems.org'
# Specify your gem's dependencies in gem_ver.gemspec
# Specify your gem's dependencies in gitmoji-regex.gemspec
gemspec
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.0'
ruby_version = Gem::Version.new(RUBY_VERSION)
minimum_version = ->(version, engine = 'ruby') { ruby_version >= Gem::Version.new(version) && RUBY_ENGINE == engine }
coverage = minimum_version.call('2.6')
debugging = minimum_version.call('2.7')
platforms :mri do
if coverage
gem 'codecov', '~> 0.6' # For CodeCov
gem 'simplecov', '~> 0.21', require: false
gem 'simplecov-cobertura' # XML for Jenkins
gem 'simplecov-json' # For CodeClimate
gem 'simplecov-lcov', '~> 0.8', require: false
end
if debugging
# Add `byebug` to your code where you want to drop to REPL
gem 'byebug'
gem 'pry-byebug'
end
end
platforms :jruby do
# Add `binding.pry` to your code where you want to drop to REPL
gem 'pry-debugger-jruby'
end
PATH
remote: .
specs:
gem_ver (1.0.1)
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
coderay (1.1.3)
diff-lcs (1.5.0)
jaro_winkler (1.5.4)
method_source (1.0.0)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rainbow (3.1.1)
rake (13.0.6)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (0.68.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.6)
rubocop-lts (8.0.2)
rubocop-ruby2_2 (~> 1.0.4)
rubocop-performance (1.3.0)
rubocop (>= 0.68.0)
rubocop-rake (0.5.1)
rubocop
rubocop-rspec (1.41.0)
rubocop (>= 0.68.1)
rubocop-ruby2_2 (1.0.4)
rubocop (= 0.68.1)
ruby-progressbar (1.11.0)
unicode-display_width (1.5.0)
PLATFORMS
arm64-darwin-21
DEPENDENCIES
gem_ver!
pry
rake
rspec
rubocop-lts (~> 8.0, >= 8.0.2)
rubocop-performance
rubocop-rake
rubocop-rspec
BUNDLED WITH
2.3.15
# GemVer
# VersionGem
Give your next library an introspectable `Version` module.
......@@ -14,19 +14,157 @@ MyLib::Version.to_h # => { major: 1, minor: 2, patch: 3, pre: "rc3" }
This library was extracted from the gem [`oauth2`](https://github.com/oauth-xx/oauth2).
This gem has no runtime dependencies.
<!--
Numbering rows and badges in each row as a visual "database" lookup,
as the table is extremely dense, and it can be very difficult to find anything
Putting one on each row here, to document the emoji that should be used, and for ease of copy/paste.
row #s:
1️⃣
2️⃣
3️⃣
4️⃣
5️⃣
6️⃣
7️⃣
badge #s:
⛳️
🖇
🏘
🚎
🖐
🧮
📗
appended indicators:
♻️ - URL needs to be updated from SASS integration. Find / Replace is insufficient.
-->
| | Project | bundle add version_gem |
|:----|--------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1️⃣ | name, license, docs, standards | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![RubyDoc.info][🚎yard-img]][🚎yard] [![SemVer 2.0.0][🧮semver-img]][semver] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] |
| 2️⃣ | version & activity | [![Gem Version][⛳️version-img]][⛳️gem] [![Total Downloads][🖇DL-total-img]][⛳️gem] [![Download Rank][🏘DL-rank-img]][⛳️gem] [![Source Code][🚎src-home-img]][🚎src-home] [![Open PRs][🖐prs-o-img]][🖐prs-o] [![Closed PRs][🧮prs-c-img]][🧮prs-c] <!--[![Next Version][📗next-img]][📗next]--> |
| 3️⃣ | maintanence & linting | [![Maintainability][⛳cclim-maint-img♻️]][⛳cclim-maint] [![Helpers][🖇triage-help-img]][🖇triage-help] [![Depfu][🏘depfu-img♻️]][🏘depfu♻️] [![Contributors][🚎contributors-img]][🚎contributors] [![Style][🖐style-wf-img]][🖐style-wf] [![Kloc Roll][🧮kloc-img]][🧮kloc] |
| 4️⃣ | testing | [![Open Issues][⛳iss-o-img]][⛳iss-o] [![Closed Issues][🖇iss-c-img]][🖇iss-c] [![Supported][🏘sup-wf-img]][🏘sup-wf] [![Heads][🚎heads-wf-img]][🚎heads-wf] [![Unofficial Support][🖐uns-wf-img]][🖐uns-wf] <!--[![MacOS][🧮mac-wf-img]][🧮mac-wf] [![Windows][📗win-wf-img]][📗win-wf]--> |
| 5️⃣ | coverage & security | [![CodeClimate][⛳cclim-cov-img♻️]][⛳cclim-cov] [![CodeCov][🖇codecov-img♻️]][🖇codecov] [![Coveralls][🏘coveralls-img]][🏘coveralls] [![Security Policy][🚎sec-pol-img]][🚎sec-pol] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Code Coverage][🧮cov-wf-img]][🧮cov-wf] |
| 6️⃣ | resources | [![Discussion][⛳gh-discussions-img]][⛳gh-discussions] [![Get help on Codementor][🖇codementor-img]][🖇codementor] [![Chat][🏘chat-img]][🏘chat] [![Blog][🚎blog-img]][🚎blog] [![Wiki][🖐wiki-img]][🖐wiki] |
| 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] |
<!--
The link tokens in the following sections should be kept ordered by the row and badge numbering scheme
-->
<!-- 1️⃣ name, license, docs -->
[⛳️gem]: https://rubygems.org/gems/version_gem
[⛳️name-img]: https://img.shields.io/badge/name-version_gem-brightgreen.svg?style=flat
[🖇src-license]: https://opensource.org/licenses/MIT
[🖇src-license-img]: https://img.shields.io/badge/License-MIT-green.svg
[🚎yard]: https://www.rubydoc.info/github/pboling/version_gem
[🚎yard-img]: https://img.shields.io/badge/documentation-rubydoc-brightgreen.svg?style=flat
[🧮semver-img]: https://img.shields.io/badge/semver-2.0.0-FFDD67.svg?style=flat
[📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
[📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-FFDD67.svg?style=flat
<!-- 2️⃣ version & activity -->
[⛳️version-img]: http://img.shields.io/gem/v/version_gem.svg
[🖇DL-total-img]: https://img.shields.io/gem/dt/version_gem.svg
[🏘DL-rank-img]: https://img.shields.io/gem/rt/version_gem.svg
[🚎src-home]: https://github.com/pboling/version_gem
[🚎src-home-img]: https://img.shields.io/badge/source-github-brightgreen.svg?style=flat
[🖐prs-o]: https://github.com/pboling/version_gem/pulls
[🖐prs-o-img]: https://img.shields.io/github/issues-pr/pboling/version_gem
[🧮prs-c]: https://github.com/pboling/version_gem/pulls?q=is%3Apr+is%3Aclosed
[🧮prs-c-img]: https://img.shields.io/github/issues-pr-closed/pboling/version_gem
[📗next]: https://github.com/pboling/version_gem/milestone/1
[📗next-img]: https://img.shields.io/github/milestones/progress/pboling/version_gem/1?label=Next%20Version
<!-- 3️⃣ maintanence & linting -->
[⛳cclim-maint]: https://codeclimate.com/github/pboling/version_gem/maintainability
[⛳cclim-maint-img♻️]: https://api.codeclimate.com/v1/badges/b504d61c4ed1d46aec02/maintainability
[🖇triage-help]: https://www.codetriage.com/pboling/version_gem
[🖇triage-help-img]: https://www.codetriage.com/pboling/version_gem/badges/users.svg
[🏘depfu♻️]: https://depfu.com/github/pboling/version_gem?project_id=35803
[🏘depfu-img♻️]: https://badges.depfu.com/badges/5d8943de6cfdf1ee048ad6d907f3e35b/count.svg
[🚎contributors]: https://github.com/pboling/version_gem/graphs/contributors
[🚎contributors-img]: https://img.shields.io/github/contributors-anon/pboling/version_gem
[🖐style-wf]: https://github.com/pboling/version_gem/actions/workflows/style.yml
[🖐style-wf-img]: https://github.com/pboling/version_gem/actions/workflows/style.yml/badge.svg
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
[🧮kloc-img]: https://img.shields.io/tokei/lines/github.com/pboling/version_gem
<!-- 4️⃣ testing -->
[⛳iss-o]: https://github.com/pboling/version_gem/issues
[⛳iss-o-img]: https://img.shields.io/github/issues-raw/pboling/version_gem
[🖇iss-c]: https://github.com/pboling/version_gem/issues?q=is%3Aissue+is%3Aclosed
[🖇iss-c-img]: https://img.shields.io/github/issues-closed-raw/pboling/version_gem
[🏘sup-wf]: https://github.com/pboling/version_gem/actions/workflows/supported.yml
[🏘sup-wf-img]: https://github.com/pboling/version_gem/actions/workflows/supported.yml/badge.svg
[🚎heads-wf]: https://github.com/pboling/version_gem/actions/workflows/heads.yml
[🚎heads-wf-img]: https://github.com/pboling/version_gem/actions/workflows/heads.yml/badge.svg
[🖐uns-wf]: https://github.com/pboling/version_gem/actions/workflows/unsupported.yml
[🖐uns-wf-img]: https://github.com/pboling/version_gem/actions/workflows/unsupported.yml/badge.svg
[🧮mac-wf]: https://github.com/pboling/version_gem/actions/workflows/macos.yml
[🧮mac-wf-img]: https://github.com/pboling/version_gem/actions/workflows/macos.yml/badge.svg
[📗win-wf]: https://github.com/pboling/version_gem/actions/workflows/windows.yml
[📗win-wf-img]: https://github.com/pboling/version_gem/actions/workflows/windows.yml/badge.svg
<!-- 5️⃣ coverage & security -->
[⛳cclim-cov]: https://codeclimate.com/github/pboling/version_gem/test_coverage
[⛳cclim-cov-img♻️]: https://api.codeclimate.com/v1/badges/b504d61c4ed1d46aec02/test_coverage
[🖇codecov-img♻️]: https://codecov.io/gh/pboling/version_gem/branch/main/graph/badge.svg?token=79c3X4vtfO
[🖇codecov]: https://codecov.io/gh/pboling/version_gem
[🏘coveralls]: https://coveralls.io/github/pboling/version_gem?branch=main
[🏘coveralls-img]: https://coveralls.io/repos/github/pboling/version_gem/badge.svg?branch=main
[🚎sec-pol]: https://github.com/pboling/version_gem/blob/main/SECURITY.md
[🚎sec-pol-img]: https://img.shields.io/badge/security-policy-brightgreen.svg?style=flat
[🖐codeQL]: https://github.com/pboling/version_gem/security/code-scanning
[🖐codeQL-img]: https://github.com/pboling/version_gem/actions/workflows/codeql-analysis.yml/badge.svg
[🧮cov-wf]: https://github.com/pboling/version_gem/actions/workflows/coverage.yml
[🧮cov-wf-img]: https://github.com/pboling/version_gem/actions/workflows/coverage.yml/badge.svg
<!-- 6️⃣ resources -->
[⛳gh-discussions]: https://github.com/pboling/version_gem/discussions
[⛳gh-discussions-img]: https://img.shields.io/github/discussions/pboling/version_gem
[🖇codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
[🖇codementor-img]: https://cdn.codementor.io/badges/get_help_github.svg
[🏘chat]: https://gitter.im/pboling/version_gem
[🏘chat-img]: https://img.shields.io/gitter/room/pboling/version_gem.svg
[🚎blog]: http://www.railsbling.com/tags/version_gem/
[🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
[🖐wiki]: https://github.com/pboling/version_gem/wiki
[🖐wiki-img]: https://img.shields.io/badge/wiki-examples-brightgreen.svg?style=flat
<!-- 7️⃣ spread 💖 -->
[⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
[⛳liberapay]: https://liberapay.com/pboling/donate
[🖇sponsor-img]: https://img.shields.io/badge/sponsor-pboling.svg?style=social&logo=github
[🖇sponsor]: https://github.com/sponsors/pboling
[🏘tweet-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
[🏘tweet]: http://twitter.com/galtzo
<!-- Maintainer Contact Links -->
[railsbling]: http://www.railsbling.com
[peterboling]: http://www.peterboling.com
[aboutme]: https://about.me/peter.boling
[angelme]: https://angel.co/peter-boling
[coderme]:http://coderwall.com/pboling
## Installation
Install the gem and add to the application's Gemfile by executing:
$ bundle add gem_ver
$ bundle add version_gem
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install gem_ver
$ gem install version_gem
## Usage
In the standard `bundle gem my_lib` code you get the following in `lib/my_lib/version.rb:
In the standard `bundle gem my_lib` code you get the following in `lib/my_lib/version.rb`:
```ruby
module MyLib
......@@ -34,7 +172,7 @@ module MyLib
end
```
Add a Version namespace (the one implied by the path => namespace convention):
Change it to a nested `Version` namespace (the one implied by the path => namespace convention):
```ruby
module MyLib
......@@ -48,14 +186,14 @@ Now add the following near the top of the file the manages requiring external li
Using the same example of `bundle gem my_lib`, this would be `lib/my_lib.rb`.
```ruby
require "gem_ver"
require "version_gem"
```
Then, add the following wherever you want in the same file (recommend the bottom).
```ruby
MyLib::Version.class_eval do
extend GemVer::Basic
extend VersionGem::Basic
end
```
......@@ -75,6 +213,43 @@ MyLib::Version.to_h # => { major: 0, minor: 1, patch: 0, pre: "" }
Your `version.rb` file now abides the Ruby convention of directory / path matching the namespace / class!
### Caveat
This design keeps your `version.rb` file compatible with the way `gemspec` files use them.
This means that the introspection is _not_ available within the gemspec.
The enhancement from this gem is only available at runtime.
### RSpec Matchers
In `spec_helper.rb`:
```ruby
require 'version_gem/rspec'
```
Then you can write a test like:
```ruby
RSpec.describe MyLib::Version do
it_behaves_like 'a Version module', described_class
end
# Or, if you want to write your own, here is the a la carte menu:
RSpec.describe MyLib::Version do
it "is a Version module" do
expect(described_class).is_a?(Module)
expect(described_class).to have_version_constant
expect(described_class).to have_version_as_string
expect(described_class.to_s).to be_a(String)
expect(described_class).to have_major_as_integer
expect(described_class).to have_minor_as_integer
expect(described_class).to have_patch_as_integer
expect(described_class).to have_pre_as_nil_or_string
expect(described_class.to_h.keys).to match_array(%i[major minor patch pre])
expect(described_class.to_a).to be_a(Array)
end
end
```
## Development
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.
......@@ -83,12 +258,104 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/gem_ver. 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/gem_ver/blob/main/CODE_OF_CONDUCT.md).
See [CONTRIBUTING.md][contributing]
## Contributors
[![Contributors](https://contrib.rocks/image?repo=pboling/version_gem)]("https://github.com/pboling/version_gem/graphs/contributors")
Made with [contributors-img](https://contrib.rocks).
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
The gem is available as open source under the terms of
the [MIT License][license] [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)][license-ref].
See [LICENSE][license] for the official [Copyright Notice][copyright-notice-explainer].
* Copyright (c) 2022 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
## Code of Conduct
Everyone interacting in the GemVer project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pboling/gem_ver/blob/main/CODE_OF_CONDUCT.md).
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).
## Versioning
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations of this scheme should be reported as
bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be
immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new
major versions.
As a result of this policy, you can (and should) specify a dependency on this gem using
the [Pessimistic Version Constraint][pvc] with two digits of precision.
For example:
```ruby
spec.add_dependency "version_gem", "~> 1.1"
```
## Security
See [SECURITY.md](https://github.com/pboling/version_gem/blob/main/SECURITY.md).
[copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
[gh_discussions]: https://github.com/pboling/version_gem/discussions
[conduct]: https://github.com/pboling/version_gem/blob/main/CODE_OF_CONDUCT.md
[contributing]: https://github.com/pboling/version_gem/blob/main/CONTRIBUTING.md
[security]: https://github.com/pboling/version_gem/blob/main/SECURITY.md
[license]: https://github.com/pboling/version_gem/blob/main/LICENSE.txt
[license-ref]: https://opensource.org/licenses/MIT
[semver]: http://semver.org/
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
[railsbling]: http://www.railsbling.com
[peterboling]: http://www.peterboling.com
[aboutme]: https://about.me/peter.boling
[angelme]: https://angel.co/peter-boling
[coderme]:http://coderwall.com/pboling
[followme-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
[tweetme]: http://twitter.com/galtzo
[politicme]: https://nationalprogressiveparty.org
[documentation]: https://rubydoc.info/github/pboling/version_gem/main
[source]: https://github.com/pboling/version_gem/
[actions]: https://github.com/pboling/version_gem/actions
[issues]: https://github.com/pboling/version_gem/issues
[climate_maintainability]: https://codeclimate.com/github/pboling/version_gem/maintainability
[climate_coverage]: https://codeclimate.com/github/pboling/version_gem/test_coverage
[codecov_coverage]: https://codecov.io/gh/pboling/version_gem
[code_triage]: https://www.codetriage.com/pboling/version_gem
[blogpage]: http://www.railsbling.com/tags/version_gem/
[rubygems]: https://rubygems.org/gems/version_gem
[chat]: https://gitter.im/pboling/version_gem?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[maintenancee_policy]: https://guides.rubyonrails.org/maintenance_policy.html#security-issues
[liberapay_donate]: https://liberapay.com/pboling/donate
[gh_sponsors]: https://github.com/sponsors/pboling