Skip to content

Commit e7e2489

Browse files
authored
Merge branch 'master' into master
2 parents 87e0e87 + ee21ea6 commit e7e2489

47 files changed

Lines changed: 299 additions & 123 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3+
{
4+
"name": "IceCube",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/ruby:1-3.3-bookworm",
7+
8+
// Features to add to the dev container. More info: https://containers.dev/features.
9+
// "features": {},
10+
11+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
12+
// "forwardPorts": [],
13+
14+
// Use 'postCreateCommand' to run commands after the container is created.
15+
// "postCreateCommand": "ruby --version",
16+
17+
// Configure tool-specific properties.
18+
"customizations" : {
19+
"jetbrains" : {
20+
"backend" : "RubyMine"
21+
}
22+
},
23+
24+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
25+
// "remoteUser": "root"
26+
}

.github/workflows/tests.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ jobs:
1919
changelog:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
- id: read-version
2424
run: |
2525
echo "::set-output name=VERSION::`cat lib/ice_cube/version.rb | grep -i version | awk '{ print $3 }' | sed -e 's/\"//g'`"
26-
- uses: dangoslen/changelog-enforcer@v2.3.1
26+
- uses: dangoslen/changelog-enforcer@v3
2727
with:
2828
skipLabels: 'skip-changelog'
2929
expectedLatestVersion: ${{ steps.read-version.outputs.VERSION }}
3030
lint:
3131
runs-on: ubuntu-latest
3232
steps:
33-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v4
3434
- uses: ruby/setup-ruby@v1
3535
with:
36-
ruby-version: '2.6'
36+
ruby-version: '3.1'
3737
bundler-cache: true
3838
- run: bundle exec standardrb
3939
test:
@@ -42,16 +42,13 @@ jobs:
4242
- lint
4343
strategy:
4444
matrix:
45-
rails: ['5.2', '6.0.4', '6.1']
46-
ruby: ['2.6', '2.7', '3.0']
47-
exclude:
48-
- rails: '5.2'
49-
ruby: '3.0'
45+
rails: ['6.1', '7.0', '7.1']
46+
ruby: ['3.1', '3.2', '3.3']
5047
runs-on: ubuntu-latest
5148
env:
5249
RAILS_VERSION: ${{ matrix.rails }}
5350
steps:
54-
- uses: actions/checkout@v2
51+
- uses: actions/checkout@v4
5552
- uses: ruby/setup-ruby@v1
5653
with:
5754
ruby-version: ${{ matrix.ruby }}

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [Unreleased]
7+
## [0.17.0] - 2024-07-18
88
### Added
99
- Indonesian translations. ([#505](https://github.com/seejohnrun/ice_cube/pull/505)) by [@achmiral](https://github.com/achmiral)
1010

11+
### Changed
12+
- Removed use of `delegate` method added in [66f1d797](https://github.com/ice-cube-ruby/ice_cube/commit/66f1d797092734563bfabd2132c024c7d087f683) , reverting to previous implementation. ([#522](https://github.com/ice-cube-ruby/ice_cube/pull/522)) by [@pacso](https://github.com/pacso)
13+
- Updated supported versions of Ruby and Rails and fixed standardrb lint issues. ([#552](https://github.com/ice-cube-ruby/ice_cube/pull/552)) by [@pacso](https://github.com/pacso)
14+
- Fixed `I18n.load_path` injection ([#546](https://github.com/ice-cube-ruby/ice_cube/pull/546)) by [@glaszig](https://github.com/glaszig)
15+
- Use `exepect` in specs ([#530](https://github.com/ice-cube-ruby/ice_cube/pull/530) by [@artofhuman](https://github.com/artofhuman))
16+
1117
### Fixed
1218
- Fix for weekly interval results when requesting `occurrences_between` on a narrow range ([#487](https://github.com/seejohnrun/ice_cube/pull/487)) by [@jakebrady5](https://github.com/jakebrady5)
1319
- When using a rule with hour_of_day validations, and asking for occurrences on the day that DST skips forward, valid occurrences would be missed. ([#464](https://github.com/seejohnrun/ice_cube/pull/464)) by [@jakebrady5](https://github.com/jakebrady5)
20+
- Include `exrules` when exporting a schedule to YAML, JSON or a Hash. ([#519](https://github.com/ice-cube-ruby/ice_cube/pull/519)) by [@pacso](https://github.com/pacso)
21+
- Documentation links updated to point to the new repository location. ([#553](https://github.com/ice-cube-ruby/ice_cube/pull/553)) by [@pacso](https://github.com/pacso)
22+
- Input validation added for day_of_week validator. Fixes infinite loops when invalid day_of_week occurrences are provided. ([#554](https://github.com/ice-cube-ruby/ice_cube/pull/554)) by [@pacso](https://github.com/pacso)
23+
- Documentation links in README.md updated to new repository location. ([#527](https://github.com/ice-cube-ruby/ice_cube/pull/527) by [@dalpo](https://github.com/dalpo))
1424

1525
## [0.16.4] - 2021-10-21
1626
### Added

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ https://github.com/GetJobber/recurring_select
298298

299299
## Contributors
300300

301-
https://github.com/seejohnrun/ice_cube/graphs/contributors
301+
https://github.com/ice-cube-ruby/ice_cube/graphs/contributors
302302

303303
---
304304

@@ -316,10 +316,7 @@ Use the GitHub [issue tracker][ice_cube-issues]
316316

317317

318318
[ical-3.6.1]: https://tools.ietf.org/html/rfc5545#section-3.6.1
319-
[github-avit]: https://github.com/avit/
320-
[travis-ice_cube]: http://travis-ci.org/seejohnrun/ice_cube
321-
[travis-ice_cube-badge_image]: https://secure.travis-ci.org/seejohnrun/ice_cube.svg
322-
[ice_cube-lone_star_pdf]: http://seejohnrun.github.com/ice_cube/static/lsrc_ice_cube.pdf
323-
[ice_cube-ruby_nyc_pdf]: http://seejohnrun.github.com/ice_cube/static/ice_cube_ruby_nyc.pdf
324-
[ice_cube-docs]: http://seejohnrun.github.io/ice_cube/
325-
[ice_cube-issues]: https://github.com/seejohnrun/ice_cube/issues
319+
[ice_cube-lone_star_pdf]: https://ice-cube-ruby.github.io/ice_cube/static/lsrc_ice_cube.pdf
320+
[ice_cube-ruby_nyc_pdf]: https://ice-cube-ruby.github.io/ice_cube/static/ice_cube_ruby_nyc.pdf
321+
[ice_cube-docs]: https://ice-cube-ruby.github.io/ice_cube/
322+
[ice_cube-issues]: https://github.com/ice-cube-ruby/ice_cube/issues

ice_cube.gemspec

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ Gem::Specification.new do |s|
88
s.description = "ice_cube is a recurring date library for Ruby. It allows for quick, programatic expansion of recurring date rules."
99
s.author = "John Crepezzi"
1010
s.email = "john@crepezzi.com"
11-
s.homepage = "https://seejohnrun.github.io/ice_cube/"
11+
s.homepage = "https://ice-cube-ruby.github.io/ice_cube/"
1212
s.license = "MIT"
1313

14-
s.metadata["changelog_uri"] = "https://github.com/seejohnrun/ice_cube/blob/master/CHANGELOG.md"
15-
s.metadata["wiki_uri"] = "https://github.com/seejohnrun/ice_cube/wiki"
14+
s.metadata["changelog_uri"] = "https://github.com/ice-cube-ruby/ice_cube/blob/master/CHANGELOG.md"
15+
s.metadata["wiki_uri"] = "https://github.com/ice-cube-ruby/ice_cube/wiki"
1616

1717
s.version = IceCube::VERSION
1818
s.platform = Gem::Platform::RUBY
1919
s.files = Dir["lib/**/*.rb", "config/**/*.yml"]
20-
s.test_files = Dir.glob("spec/*.rb")
2120
s.require_paths = ["lib"]
2221

2322
s.add_development_dependency("rake")

lib/ice_cube.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module IceCube
66

77
autoload :TimeUtil, "ice_cube/time_util"
88
autoload :FlexibleHash, "ice_cube/flexible_hash"
9-
autoload :I18n, "ice_cube/i18n"
9+
10+
require "ice_cube/i18n"
1011

1112
autoload :Rule, "ice_cube/rule"
1213
autoload :Schedule, "ice_cube/schedule"

lib/ice_cube/builders/string_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def ordinal(number)
6161
ord = IceCube::I18n.t("ice_cube.integer.ordinals")[number] ||
6262
IceCube::I18n.t("ice_cube.integer.ordinals")[number % 10] ||
6363
IceCube::I18n.t("ice_cube.integer.ordinals")[:default]
64-
number >= 0 ? ord : IceCube::I18n.t("ice_cube.integer.negative", ordinal: ord)
64+
(number >= 0) ? ord : IceCube::I18n.t("ice_cube.integer.negative", ordinal: ord)
6565
end
6666
end
6767

lib/ice_cube/flexible_hash.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def delete(key)
2525

2626
def _match_key(key)
2727
return key if __getobj__.has_key? key
28-
if Symbol == key.class
28+
if key.instance_of?(Symbol)
2929
__getobj__.keys.detect { |k| return k if k == key.to_s }
30-
elsif String == key.class
30+
elsif key.instance_of?(String)
3131
__getobj__.keys.detect { |k| return k if k.to_s == key }
3232
end
3333
key

lib/ice_cube/i18n.rb

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
require "ice_cube/null_i18n"
22

33
module IceCube
4-
module I18n
5-
LOCALES_PATH = File.expand_path(File.join("..", "..", "..", "config", "locales"), __FILE__)
6-
7-
class << self
8-
delegate :t, :l, to: :backend
9-
end
10-
11-
def self.backend
12-
@backend ||= detect_backend!
13-
end
14-
15-
def self.detect_backend!
16-
::I18n.load_path += Dir[File.join(LOCALES_PATH, "*.yml")]
17-
::I18n
18-
rescue NameError
19-
NullI18n
20-
end
4+
LOCALES_PATH = File.expand_path(File.join("..", "..", "config", "locales"), __dir__)
5+
6+
# rubocop:disable Naming/ConstantName
7+
I18n = begin
8+
require "i18n"
9+
::I18n.load_path += Dir[File.join(LOCALES_PATH, "*.yml")]
10+
::I18n
11+
rescue LoadError
12+
NullI18n
2113
end
14+
# rubocop:enable Naming/ConstantName
2215
end

lib/ice_cube/input_alignment.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ def initialize(rule, value, rule_part)
88

99
attr_reader :rule, :value, :rule_part
1010

11-
def verify(freq, options = {}, &block)
11+
def verify(freq, options = {}, &)
1212
@rule.validations[:interval] or return
1313

1414
case @rule
1515
when DailyRule
16-
verify_wday_alignment(freq, &block)
16+
verify_wday_alignment(freq, &)
1717
when MonthlyRule
18-
verify_month_alignment(freq, &block)
18+
verify_month_alignment(freq, &)
1919
else
20-
verify_freq_alignment(freq, &block)
20+
verify_freq_alignment(freq, &)
2121
end
2222
end
2323

@@ -28,12 +28,12 @@ def interval_validation
2828
end
2929

3030
def interval_value
31-
@interval_value ||= rule_part == :interval ? value : interval_validation.interval
31+
@interval_value ||= (rule_part == :interval) ? value : interval_validation.interval
3232
end
3333

3434
def fixed_validations
3535
@fixed_validations ||= @rule.validations.values.flatten.select { |v|
36-
interval_type = (v.type == :wday ? :day : v.type)
36+
interval_type = ((v.type == :wday) ? :day : v.type)
3737
v.class < Validations::FixedValue &&
3838
interval_type == rule.base_interval_validation.type
3939
}

0 commit comments

Comments
 (0)