Skip to content

Commit

Permalink
Add support for Ruby 3.3 and drop 2.7 (#23)
Browse files Browse the repository at this point in the history
* Test on Ruby 3.3

* Update deps

* Fixes

* Lock with newer bundler

* Drop Ruby 2.7

* Update target version in Rubocop

* Fix

* Fix

* Fix

* Update action version
  • Loading branch information
raymondjavaxx authored Jul 13, 2024
1 parent 5127586 commit e909868
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 68 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:
strategy:
matrix:
ruby-version:
- "2.7"
- "3.0"
- "3.1"
- "3.2"
- "3.3"

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Lint
run: bundle exec rake rubocop
- name: Run tests
run: bundle exec rake
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Lint
run: bundle exec rake rubocop
- name: Run tests
run: bundle exec rake
30 changes: 15 additions & 15 deletions .github/workflows/install-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ jobs:
strategy:
matrix:
ruby-version:
- "2.7"
- "3.0"
- "3.1"
- "3.2"
- "3.3"

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: 'Install'
run: bundle exec rake install
- name: 'Command: Version'
run: bundle exec stylegen version
- name: 'Command: Init'
run: bundle exec stylegen init
- name: 'Command: Build'
run: bundle exec stylegen build
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: "Install"
run: bundle exec rake install
- name: "Command: Version"
run: bundle exec stylegen version
- name: "Command: Init"
run: bundle exec stylegen init
- name: "Command: Build"
run: bundle exec stylegen build
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require:
- rubocop-minitest

AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0
NewCops: enable

Metrics/MethodLength:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source 'https://rubygems.org'
gemspec

gem 'bundler'
gem 'minitest', '~> 5.14'
gem 'minitest', '~> 5.24'
gem 'rake'
gem 'rubocop'
gem 'rubocop-minitest'
Expand Down
57 changes: 29 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,69 @@ PATH
specs:
stylegen (0.7.0)
dry-cli (~> 1.0.0)
dry-inflector (~> 1.0.0)
json_schemer (~> 1.0.3)
dry-inflector (~> 1.1.0)
json_schemer (~> 2.3.0)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
bigdecimal (3.1.8)
dry-cli (1.0.0)
dry-inflector (1.0.0)
dry-inflector (1.1.0)
hana (1.3.7)
json (2.6.3)
json_schemer (1.0.3)
json (2.7.2)
json_schemer (2.3.0)
bigdecimal
hana (~> 1.3)
regexp_parser (~> 2.0)
simpleidn (~> 0.2)
language_server-protocol (3.17.0.3)
minitest (5.18.1)
parallel (1.23.0)
parser (3.2.2.3)
minitest (5.24.1)
parallel (1.25.1)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
racc (1.7.1)
racc (1.8.0)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.1)
rexml (3.2.5)
rubocop (1.54.2)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.3.1)
strscan
rubocop (1.65.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-minitest (0.31.0)
rubocop (>= 1.39, < 2.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-minitest (0.35.1)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
simpleidn (0.2.1)
unf (~> 0.1.4)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.4.2)
simpleidn (0.2.3)
strscan (3.1.0)
unicode-display_width (2.5.0)

PLATFORMS
ruby

DEPENDENCIES
bundler
minitest (~> 5.14)
minitest (~> 5.24)
rake
rubocop
rubocop-minitest
rubocop-rake
stylegen!

BUNDLED WITH
2.1.4
2.5.15
4 changes: 2 additions & 2 deletions lib/stylegen/colors/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Stylegen
class Color
attr_reader :red, :green, :blue, :alpha

SIX_DIGIT_HEX_REGEX = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/.freeze
THREE_DIGIT_HEX_REGEX = /^#?([a-f\d])([a-f\d])([a-f\d])$/.freeze
SIX_DIGIT_HEX_REGEX = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/
THREE_DIGIT_HEX_REGEX = /^#?([a-f\d])([a-f\d])([a-f\d])$/
MAX_PRECISION = 16

def initialize(red, green, blue, alpha)
Expand Down
8 changes: 4 additions & 4 deletions stylegen.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']
s.license = 'MIT'

s.add_runtime_dependency 'dry-cli', '~> 1.0.0'
s.add_runtime_dependency 'dry-inflector', '~> 1.0.0'
s.add_runtime_dependency 'json_schemer', '~> 1.0.3'
s.add_dependency 'dry-cli', '~> 1.0.0'
s.add_dependency 'dry-inflector', '~> 1.1.0'
s.add_dependency 'json_schemer', '~> 2.3.0'

s.required_ruby_version = '>= 2.7.0'
s.required_ruby_version = '>= 3.0.0'
s.metadata['rubygems_mfa_required'] = 'true'
end
2 changes: 1 addition & 1 deletion test/test_base_elevated_color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_relative 'helper'

class TestBaseElevatedColor < MiniTest::Test
class TestBaseElevatedColor < Minitest::Test
def test_to_string
color = Stylegen::BaseElevatedColor.new(
Stylegen::Color.from_hex('#000000'),
Expand Down
2 changes: 1 addition & 1 deletion test/test_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'open3'
require_relative 'helper'

class TestCLI < MiniTest::Test
class TestCLI < Minitest::Test
def test_version
stdout, _stderr, status = Open3.capture3('bin/stylegen version')

Expand Down
4 changes: 2 additions & 2 deletions test/test_color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_relative 'helper'

class TestColor < MiniTest::Test
class TestColor < Minitest::Test
def test_parsing
color = Stylegen::Color.from_hex('#FF8000')

Expand Down Expand Up @@ -49,7 +49,7 @@ def test_grayscale

color = Stylegen::Color.new(1, 1, 0.9, 1)

refute_predicate color, :grayscale?
refute_predicate(color, :grayscale?) # skipcq: RB-RL1045
end

def test_to_string
Expand Down
2 changes: 1 addition & 1 deletion test/test_light_dark_color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_relative 'helper'

class TestLightDarkColor < MiniTest::Test
class TestLightDarkColor < Minitest::Test
def test_to_string
color = Stylegen::LightDarkColor.new(
Stylegen::Color.from_hex('#FFFFFF'),
Expand Down
2 changes: 1 addition & 1 deletion test/test_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'yaml'
require_relative 'helper'

class TestTemplate < MiniTest::Test
class TestTemplate < Minitest::Test
def test_render_appkit
yaml_path = File.join(__dir__, 'fixtures', 'appkit.yaml')
swift_path = File.join(__dir__, 'fixtures', 'appkit.swift')
Expand Down

0 comments on commit e909868

Please sign in to comment.