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 (13)
Showing with 336 additions and 78 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
# 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: 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 RuboCop
run: bundle exec rubocop -DESP
- name: Run tests
run: bundle exec rake test
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: [false]
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 RuboCop
run: bundle exec rubocop -DESP
- 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"
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 RuboCop
run: bundle exec rubocop -DESP
- 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
......@@ -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.
......
ruby 2.6.10
ruby 3.1.2
# 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,9 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
## [1.0.0] - 2022-06-09
s## [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/not-a-SHA...v1.0.0
[Unreleased]: https://github.com/pboling/version_gem/compare/v1.0.0...HEAD
[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,5 @@
source 'https://rubygems.org'
# Specify your gem's dependencies in gem_ver.gemspec
# Specify your gem's dependencies in version_gem.gemspec
gemspec
PATH
remote: .
specs:
gem_ver (1.0.0)
version_gem (1.0.0)
GEM
remote: https://rubygems.org/
......@@ -54,9 +54,9 @@ GEM
PLATFORMS
arm64-darwin-21
x86_64-linux
DEPENDENCIES
gem_ver!
pry
rake
rspec
......@@ -64,6 +64,7 @@ DEPENDENCIES
rubocop-performance
rubocop-rake
rubocop-rspec
version_gem!
BUNDLED WITH
2.3.15
2.3.16
# GemVer
# VersionGem
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gem_ver`. To experiment with that code, run `bin/console` for an interactive prompt.
Give your next library an introspectable `Version` module.
TODO: Delete this and the text above, and describe your gem
```ruby
MyLib::Version.to_s # => "1.2.3.rc3"
MyLib::Version.major # => 1
MyLib::Version.minor # => 2
MyLib::Version.patch # => 3
MyLib::Version.pre # => "rc3"
MyLib::Version.to_a # => [1, 2, 3, "rc3"]
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).
## 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
......@@ -24,27 +34,41 @@ module MyLib
end
```
Change it to:
Add a Version namespace (the one implied by the path => namespace convention):
```ruby
module MyLib
module Version
VERSION = "0.1.0"
extend GemVer::Basic
end
end
```
Now add the following near the top of the file the manages requiring external libraries.
Using the same example of `bundle gem my_lib`, this would be `lib/my_lib.rb`.
```ruby
require "version_gem"
```
Then, add the following wherever you want in the same file (recommend the bottom).
```ruby
MyLib::Version.class_eval do
extend VersionGem::Basic
end
```
And now you have some version introspection methods available:
```ruby
MyLib::Version.to_s # => "0.1.0"
MyLib::Version.major # => 1
MyLib::Version.minor # => 0
MyLib::Version.major # => 0
MyLib::Version.minor # => 1
MyLib::Version.patch # => 0
MyLib::Version.pre # => ""
MyLib::Version.to_a # => [1, 0, 0]
MyLib::Version.to_h # => { major: 1, minor: 0, patch: 0, pre: "" }
MyLib::Version.to_a # => [0, 1, 0]
MyLib::Version.to_h # => { major: 0, minor: 1, patch: 0, pre: "" }
```
### Side benefit
......@@ -59,7 +83,7 @@ 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).
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).
## License
......@@ -67,4 +91,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
## 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).
# Security Policy
## Supported Versions
| Version | Supported |
|--------------|-----------|
| 1.0.<latest> | ✅ |
## Reporting a Vulnerability
Peter Boling is the primary maintainer of this gem. Please find a way
to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
possible.
......@@ -71,13 +71,13 @@ m = Module.new do
def bundler_requirement_for(version)
return "#{Gem::Requirement.default}.a" unless version
bundler_gem_version = Gem::Version.new(version)
bundler_version_gemsion = Gem::Version.new(version)
requirement = bundler_gem_version.approximate_recommendation
requirement = bundler_version_gemsion.approximate_recommendation
return requirement unless Gem.rubygems_version < Gem::Version.new('2.7.0')
requirement += '.a' if bundler_gem_version.prerelease?
requirement += '.a' if bundler_version_gemsion.prerelease?
requirement
end
......
......@@ -2,7 +2,7 @@
# frozen_string_literal: true
require 'bundler/setup'
require 'gem_ver'
require 'version_gem'
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
......
# frozen_string_literal: true
require_relative 'gem_ver/version'
module GemVer
end
# frozen_string_literal: true
require_relative 'basic'
module GemVer
module Version
VERSION = '1.0.0'.freeze
# Dogfood is yummy!
extend GemVer::Basic
end
end
# frozen_string_literal: true
require_relative 'version_gem/version'
module VersionGem
end
VersionGem::Version.class_eval do
extend VersionGem::Basic
end