-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b656f1
commit af50308
Showing
9 changed files
with
205 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
## | ||
# Load development gems | ||
# | ||
require 'debug' | ||
|
||
load File.expand_path('ruby_version.rb', Dir.pwd) | ||
# require 'debug' | ||
|
||
|
||
## | ||
# Load all the gem files in /lib | ||
# | ||
Dir['./lib/*.rb'].each { |f| load f } | ||
Dir['./lib/**/*.rb'].each { |f| load f } | ||
|
||
Dir[Dir.pwd + '/lib/*.rb'].each { |f| load f } | ||
Dir[Dir.pwd + '/lib/**/*.rb'].each { |f| load f } | ||
|
||
puts "LOADED" | ||
## | ||
# Reload all the gem files in /lib | ||
# | ||
def reload! | ||
Dir['./lib/*.rb'].each { |f| load f } | ||
Dir['./lib/**/*.rb'].each { |f| load f } | ||
load File.expand_path('ruby_version.rb', Dir.pwd) | ||
Dir[Dir.pwd + '/lib/*.rb'].each { |f| load f } | ||
Dir[Dir.pwd + '/lib/**/*.rb'].each { |f| load f } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby 3.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in result_vault.gemspec | ||
# gemspec | ||
|
||
gem 'rake' | ||
|
||
gem 'rspec' | ||
|
||
gem 'debug' | ||
|
||
gem 'amazing_print' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
amazing_print (1.6.0) | ||
date (3.4.1) | ||
debug (1.10.0) | ||
irb (~> 1.10) | ||
reline (>= 0.3.8) | ||
diff-lcs (1.5.1) | ||
io-console (0.8.0) | ||
irb (1.14.3) | ||
rdoc (>= 4.0.0) | ||
reline (>= 0.4.2) | ||
psych (5.2.2) | ||
date | ||
stringio | ||
rake (13.2.1) | ||
rdoc (6.10.0) | ||
psych (>= 4.0.0) | ||
reline (0.6.0) | ||
io-console (~> 0.5) | ||
rspec (3.13.0) | ||
rspec-core (~> 3.13.0) | ||
rspec-expectations (~> 3.13.0) | ||
rspec-mocks (~> 3.13.0) | ||
rspec-core (3.13.2) | ||
rspec-support (~> 3.13.0) | ||
rspec-expectations (3.13.3) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.13.0) | ||
rspec-mocks (3.13.2) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.13.0) | ||
rspec-support (3.13.2) | ||
stringio (3.1.2) | ||
|
||
PLATFORMS | ||
arm64-darwin-23 | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
amazing_print | ||
debug | ||
rake | ||
rspec | ||
|
||
BUNDLED WITH | ||
2.4.22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
## | ||
# Methods to work with the current ruby version at the MAJOR.MINOR level | ||
# | ||
module RubyVersion | ||
class << self | ||
|
||
# Returns the latest known version of Ruby | ||
def latest_version | ||
Gem::Version.new('3.4') | ||
end | ||
|
||
|
||
|
||
# Returns true if the current verion of Ruby is as defined | ||
def latest? | ||
is?(latest_version) | ||
end | ||
|
||
|
||
# Returns tru if the current version of Ruby matches the expected version | ||
# | ||
# expected: anything that can be stringified with String(xxx) | ||
# | ||
def is?(expected = nil) | ||
expected = refined(expected) | ||
expected == current | ||
end | ||
|
||
|
||
# Return a Gem::Version of the current Ruby version twith only MJOR.MINOR segments | ||
def current | ||
@current_version ||= refined RUBY_VERSION | ||
end | ||
|
||
|
||
|
||
def ==(other) | ||
current == refined(other) | ||
end | ||
|
||
|
||
|
||
def >(other) | ||
current > refined(other) | ||
end | ||
|
||
|
||
|
||
def >=(other) | ||
current >= refined(other) | ||
end | ||
|
||
|
||
|
||
def <(other) | ||
current < refined(other) | ||
end | ||
|
||
|
||
|
||
def <=(other) | ||
current <= refined(other) | ||
end | ||
|
||
|
||
|
||
# Returns the string filename for the current ruby version gemfile | ||
def gemfile | ||
if current == refined("2.7") | ||
"gemfiles/ruby-#{current.to_s.gsub('.','-')}/Gemfile" | ||
else | ||
"gemfiles/ruby-3/Gemfile" | ||
end | ||
end | ||
|
||
|
||
# ====================================================================== | ||
# = Private | ||
# ====================================================================== | ||
|
||
# Return a Gem::Version from the given version refined down to MAJOR.MINOR segments | ||
# | ||
# version: anything that can be stringified with String(xxx) | ||
# | ||
def refined(version) | ||
version = String(version) | ||
refined_version = Gem::Version.new(version).release.segments[0..1].join('.') | ||
Gem::Version.new(refined_version) | ||
end | ||
end | ||
end |