cronex 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5326f654a688b504da9a79818cc3ae5c9e5b36797246ef53d8311946543c5432
4
- data.tar.gz: 5609b37b9e49f3a850937df6c912236e737def16c397a556fa549e173867aab3
3
+ metadata.gz: 27e7637c0b490441441238824af2bd3a54c6f263e88acc9490ee20190c852258
4
+ data.tar.gz: bc2e41a12f8a15f21d50cffa2fef998647b8cc7e3429e2b4b5b7297d83d02c02
5
5
  SHA512:
6
- metadata.gz: c2a0b1c000223a3c63c6b74c3f479a6be6e21534db10c7abaac4c329d11b5c06d425173c82f527ffef0f333e1a632974bceaf520f5fbe21f82c63a490a46c3cd
7
- data.tar.gz: d80c695bbac875c1fc77ab5681e56261aa5161327baa6c45110b050156448f8a8bf7fa89762a59fec7809b2ef113483137629cddedf88b979105d239c26dd420
6
+ metadata.gz: a73574bad6da9bfa391897a9a34f86ec3353718406da131faaa2af8f7b63a5f6f7694a45f67f47b24ff352179798c9342e21966f9104ed423c00dae41e144539
7
+ data.tar.gz: '081dbbc263ed70ab9f6f514f3359f17df56c270ff1eea91a72b197426c31b6403bd10d4020e7289b6b9f7cc64069714d3decd1e43481e6a6384ec0601472169f'
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Test
3
+
4
+ on: [push, pull_request]
5
+
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ ruby-version: [2.5, 2.6, 2.7]
12
+ name: Ruby ${{ matrix.ruby-version }}
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Setup Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ - run: bundle install
20
+ - run: bundle exec rake
data/.travis.yml CHANGED
@@ -3,7 +3,6 @@ language: ruby
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 2.3
7
- - 2.4
8
6
  - 2.5
9
7
  - 2.6
8
+ - 2.7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### [0.12.0] - 2023-04-16
2
+ * Add "strict_quartz" option for Java Quartz implementation (quartz-scheduler)
3
+
1
4
  ### [0.11.1] - 2020-10-21
2
5
  * Fix two consecutive commas in interval expressions
3
6
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Cronex
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/cronex.svg)](https://badge.fury.io/rb/cronex)
4
- [![Build Status](https://travis-ci.org/alpinweis/cronex.svg?branch=master)](https://travis-ci.org/alpinweis/cronex)
4
+ [![Build Status](https://github.com/alpinweis/cronex/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/alpinweis/cronex/actions/workflows/test.yml?query=branch%3Amaster)
5
5
 
6
6
  A Ruby library that converts cron expressions into human readable strings.
7
7
  Translated to Ruby from [cron-expression-descriptor](https://github.com/bradyholt/cron-expression-descriptor) (C#) via
@@ -70,6 +70,11 @@ Or install it yourself as:
70
70
  => Every minute between 4:00 AM and 4:10 AM # PDT or
71
71
  => Every minute between 3:00 AM and 3:10 AM # PST
72
72
 
73
+ ### Strict quartz-scheduler implementation support
74
+
75
+ Cronex::ExpressionDescriptor.new('* * * * *', strict_quartz: true).description
76
+ => Cronex::ExpressionError (Error: Expression only has 5 parts. For 'strict_quartz' option, at least 6 parts are required)
77
+
73
78
  See spec tests for more examples.
74
79
 
75
80
  ### Contributing
@@ -13,6 +13,7 @@ module Cronex
13
13
  zero_based_dow: true,
14
14
  use_24_hour_time_format: false,
15
15
  throw_exception_on_parse_error: true,
16
+ strict_quartz: false,
16
17
  locale: nil,
17
18
  timezone: nil
18
19
  }
data/lib/cronex/parser.rb CHANGED
@@ -27,6 +27,7 @@ module Cronex
27
27
  if len < 5
28
28
  fail ExpressionError, "Error: Expression only has #{len} parts. At least 5 parts are required"
29
29
  elsif len == 5
30
+ fail ExpressionError, "Error: Expression only has 5 parts. For 'strict_quartz' option, at least 6 parts are required" if options[:strict_quartz]
30
31
  # 5 part CRON so shift array past seconds element
31
32
  parsed_parts.insert(1, *parts)
32
33
  elsif len == 6
@@ -1,3 +1,3 @@
1
1
  module Cronex
2
- VERSION = '0.11.1'
2
+ VERSION = '0.12.0'
3
3
  end
@@ -390,6 +390,12 @@ module Cronex
390
390
  end
391
391
  end
392
392
 
393
+ context 'strict_quartz' do
394
+ it '5 part cron fails' do
395
+ expect { desc('* * * * *', strict_quartz: true) }.to raise_error(Cronex::ExpressionError)
396
+ end
397
+ end
398
+
393
399
  context 'timezone' do
394
400
  it 'minute span' do
395
401
  tz = TZInfo::Timezone.get('America/Los_Angeles')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cronex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Kazaku
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-21 00:00:00.000000000 Z
11
+ date: 2023-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -87,6 +87,7 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".github/workflows/test.yml"
90
91
  - ".gitignore"
91
92
  - ".rspec"
92
93
  - ".rubocop.yml"
@@ -148,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
149
  - !ruby/object:Gem::Version
149
150
  version: '0'
150
151
  requirements: []
151
- rubygems_version: 3.0.8
152
+ rubygems_version: 3.1.4
152
153
  signing_key:
153
154
  specification_version: 4
154
155
  summary: Ruby library that converts cron expressions into human readable strings