cronex 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +3 -0
- data/CHANGELOG.md +6 -2
- data/README.md +13 -2
- data/lib/cronex/errors.rb +1 -1
- data/lib/cronex/version.rb +1 -1
- data/resources/resources_en.yml +19 -19
- data/resources/resources_fr.yml +24 -24
- data/resources/resources_pt_BR.yml +19 -19
- data/resources/resources_ro.yml +75 -0
- data/resources/resources_ru.yml +75 -0
- data/spec/exp_descriptor_en_spec.rb +5 -0
- data/spec/exp_descriptor_fr_spec.rb +87 -83
- data/spec/exp_descriptor_pt_BR_spec.rb +87 -83
- data/spec/exp_descriptor_ro_spec.rb +382 -0
- data/spec/exp_descriptor_ru_spec.rb +382 -0
- data/spec/spec_helper.rb +0 -8
- metadata +23 -16
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
M2Y5NThhMDZhYWE5NGU0ODYxM2FiMDBhNjc1MjVhNDg5YjkzNGJmMg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 081c0fa8d2bf218663e3b48a43a6b4ac8287cf6d
|
4
|
+
data.tar.gz: 8311c133c8a3cda5dcac7db0145afd825db70694
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MDNkMDEwYmMwMzBiODYyODQ1ZmI3ZWE5Mzg1MDMwZjkwMzdiMTIyNzQ0Yzlm
|
11
|
-
MTM1MWRmZjNlNzQ2NDcxZTM3YmI1MDY0ODAzZTU0N2Q4MGNkZjk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MmNkZjljNDUwYTYxYzdkMzliZjg4ZGIzZWNhZGUyNjNmZWM1MjZhMzE4ZWVi
|
14
|
-
ZGNjZmRhOWYzMmRlNDVmMjliYWEzZjFiOGIwYjE0ODU3Y2NmNDYwMGUzOWY2
|
15
|
-
NjQwOTVjYmE5YmViYWVhOGUyODBmYjg5MWYwMjNhYTUzM2NlMzE=
|
6
|
+
metadata.gz: 869366f189713aa55aa0dcbe66fa8723cee93350378236fe22243c8400e051d24346b2a31fed9b4f7de08f5af7f89a83e6a25157315dea0392b833376e68a2a2
|
7
|
+
data.tar.gz: c8d5408aa713911a1f2a643255933ce4752cd57126aa79181145bbdfb2d1e6fbc0ee03d77e15c5ff31eabb86dbef258d649ca19e5bb23e2d9dc77f92c9a2a8ac
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
### [0.6.0] - 2017-02-17
|
2
|
+
* Add romanian and russian locales
|
3
|
+
* Minor fixes to the french locale
|
4
|
+
|
1
5
|
### [0.5.0] - 2017-02-15
|
2
|
-
* Add french
|
6
|
+
* Add french locale
|
3
7
|
|
4
8
|
### [0.4.0] - 2016-11-28
|
5
9
|
* Fix handling leading zeros in numbers
|
6
10
|
|
7
11
|
### [0.3.0] - 2016-03-02
|
8
|
-
* Add pt_BR
|
12
|
+
* Add pt_BR locale
|
9
13
|
|
10
14
|
### [0.2.0] - 2015-10-25
|
11
15
|
* Initial public version
|
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#Cronex
|
1
|
+
# Cronex
|
2
|
+
|
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)
|
2
5
|
|
3
6
|
A Ruby library that converts cron expressions into human readable strings.
|
4
7
|
Translated to Ruby from [cron-expression-descriptor](https://github.com/bradyholt/cron-expression-descriptor) (C#) via
|
@@ -16,6 +19,14 @@ Original Author & Credit: Brady Holt (http://www.geekytidbits.com).
|
|
16
19
|
|
17
20
|
For a quick intro to cron see Quartz [Cron Tutorial](http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger).
|
18
21
|
|
22
|
+
## Available Locales
|
23
|
+
|
24
|
+
* English
|
25
|
+
* Brazilian
|
26
|
+
* French
|
27
|
+
* Romanian
|
28
|
+
* Russian
|
29
|
+
|
19
30
|
## Installation
|
20
31
|
|
21
32
|
Add this line to your application's Gemfile:
|
@@ -44,7 +55,7 @@ Or install it yourself as:
|
|
44
55
|
|
45
56
|
Cronex::ExpressionDescriptor.new('*/5 15 * * 1-5', zero_based_dow: false).description
|
46
57
|
=> Every 5 minutes, at 3:00 PM, Sunday through Thursday
|
47
|
-
|
58
|
+
|
48
59
|
#### Localization
|
49
60
|
|
50
61
|
Cronex::ExpressionDescriptor.new('30 2 * 2 1-5', {}, 'fr').description
|
data/lib/cronex/errors.rb
CHANGED
data/lib/cronex/version.rb
CHANGED
data/resources/resources_en.yml
CHANGED
@@ -35,25 +35,25 @@ every_x: 'every %s'
|
|
35
35
|
at_x: 'at %s'
|
36
36
|
on_x: 'on %s'
|
37
37
|
in_x: 'in %s'
|
38
|
-
first:
|
39
|
-
second:
|
40
|
-
third:
|
41
|
-
fourth:
|
42
|
-
fifth:
|
43
|
-
time_pm:
|
44
|
-
time_am:
|
45
|
-
and:
|
46
|
-
at:
|
47
|
-
day:
|
48
|
-
days:
|
49
|
-
hour:
|
50
|
-
hours:
|
51
|
-
minute:
|
52
|
-
minutes:
|
53
|
-
month:
|
54
|
-
months:
|
55
|
-
year:
|
56
|
-
years:
|
38
|
+
first: first
|
39
|
+
second: second
|
40
|
+
third: third
|
41
|
+
fourth: fourth
|
42
|
+
fifth: fifth
|
43
|
+
time_pm: PM
|
44
|
+
time_am: AM
|
45
|
+
and: and
|
46
|
+
at: At
|
47
|
+
day: day
|
48
|
+
days: days
|
49
|
+
hour: hour
|
50
|
+
hours: hours
|
51
|
+
minute: minute
|
52
|
+
minutes: minutes
|
53
|
+
month: month
|
54
|
+
months: months
|
55
|
+
year: year
|
56
|
+
years: years
|
57
57
|
monday: Monday
|
58
58
|
tuesday: Tuesday
|
59
59
|
wednesday: Wednesday
|
data/resources/resources_fr.yml
CHANGED
@@ -17,13 +17,13 @@ at_x_seconds_past_the_minute: 'à %s secondes après la minute'
|
|
17
17
|
minutes_through_past_the_hour: "minutes %s à %s après l'heure"
|
18
18
|
on_day_of_the_month: 'le %s de chaque mois'
|
19
19
|
first_weekday: 'premier jour de la semaine'
|
20
|
-
weekday_nearest_day: '
|
21
|
-
starting: 'commence'
|
22
|
-
only_on: 'seulement le %s'
|
20
|
+
weekday_nearest_day: 'jour de semaine le plus proche du %s'
|
21
|
+
starting: 'commence' # départ
|
22
|
+
only_on: 'seulement le %s' # uniquement le
|
23
23
|
only_in: 'seulement en %s'
|
24
24
|
every_x_seconds: 'toutes les %s secondes'
|
25
|
-
every_minute_between: '
|
26
|
-
every_second: '
|
25
|
+
every_minute_between: 'chaque minute entre %s et %s'
|
26
|
+
every_second: 'chaque seconde'
|
27
27
|
every_minute: 'chaque minute'
|
28
28
|
every_1_minute: 'toutes les 1 minutes'
|
29
29
|
every_hour: 'chaque heure'
|
@@ -35,25 +35,25 @@ every_x: 'tous les %s'
|
|
35
35
|
at_x: 'à %s'
|
36
36
|
on_x: 'le %s'
|
37
37
|
in_x: 'en %s'
|
38
|
-
first:
|
39
|
-
second:
|
40
|
-
third:
|
41
|
-
fourth:
|
42
|
-
fifth:
|
43
|
-
time_pm:
|
44
|
-
time_am:
|
45
|
-
and:
|
46
|
-
at:
|
47
|
-
day:
|
48
|
-
days:
|
49
|
-
hour:
|
50
|
-
hours:
|
51
|
-
minute:
|
52
|
-
minutes:
|
53
|
-
month:
|
54
|
-
months:
|
55
|
-
year:
|
56
|
-
years:
|
38
|
+
first: premier
|
39
|
+
second: second
|
40
|
+
third: troisième
|
41
|
+
fourth: quatrième
|
42
|
+
fifth: cinquième
|
43
|
+
time_pm: PM
|
44
|
+
time_am: AM
|
45
|
+
and: et
|
46
|
+
at: À
|
47
|
+
day: jour
|
48
|
+
days: jours
|
49
|
+
hour: heure
|
50
|
+
hours: heures
|
51
|
+
minute: minute
|
52
|
+
minutes: minutes
|
53
|
+
month: mois
|
54
|
+
months: mois
|
55
|
+
year: an
|
56
|
+
years: ans
|
57
57
|
monday: lundi
|
58
58
|
tuesday: mardi
|
59
59
|
wednesday: mercredi
|
@@ -35,25 +35,25 @@ every_x: 'a cada %s'
|
|
35
35
|
at_x: '%s'
|
36
36
|
on_x: '%s'
|
37
37
|
in_x: 'em %s'
|
38
|
-
first:
|
39
|
-
second:
|
40
|
-
third:
|
41
|
-
fourth:
|
42
|
-
fifth:
|
43
|
-
time_pm:
|
44
|
-
time_am:
|
45
|
-
and:
|
46
|
-
at:
|
47
|
-
day:
|
48
|
-
days:
|
49
|
-
hour:
|
50
|
-
hours:
|
51
|
-
minute:
|
52
|
-
minutes:
|
53
|
-
month:
|
54
|
-
months:
|
55
|
-
year:
|
56
|
-
years:
|
38
|
+
first: primeiro(a)
|
39
|
+
second: segundo(a)
|
40
|
+
third: terceiro(a)
|
41
|
+
fourth: quarto(a)
|
42
|
+
fifth: quinto(a)
|
43
|
+
time_pm: após meio-dia
|
44
|
+
time_am: antes do meio-dia
|
45
|
+
and: e
|
46
|
+
at: às
|
47
|
+
day: dia
|
48
|
+
days: dias
|
49
|
+
hour: hora
|
50
|
+
hours: horas
|
51
|
+
minute: minuto
|
52
|
+
minutes: minutos
|
53
|
+
month: mês
|
54
|
+
months: mêses
|
55
|
+
year: ano
|
56
|
+
years: anos
|
57
57
|
monday: segunda-feira
|
58
58
|
tuesday: terça-feira
|
59
59
|
wednesday: quarta-feira
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# resources_ro.yml
|
2
|
+
---
|
3
|
+
expression_empty_exception: 'Expresia nu poate fi vidă sau nulă'
|
4
|
+
interval_description_format: 'în fiecare %s zile din săptămână'
|
5
|
+
between_description_format: 'din %s până în %s'
|
6
|
+
between_weekday_description_format: 'de %s până %s'
|
7
|
+
on_the_day_of_the_month: 'în {{nth}} %s a lunii'
|
8
|
+
on_the_of_the_month: 'în %s ale lunii'
|
9
|
+
on_the_last_of_the_month: 'în ultima %s din lună'
|
10
|
+
on_the_last_day_of_the_month: 'în ultima zi a lunii'
|
11
|
+
on_the_last_weekday_of_the_month: 'în ultima zi din săptămână a lunii'
|
12
|
+
between_days_of_the_month: 'între a %s-a și a %s-a zi a lunii'
|
13
|
+
seconds_through_past_the_minute: 'între secundele %s și %s'
|
14
|
+
between_x_and_y: 'între %s și %s'
|
15
|
+
past_the_hour: 'în fiecare oră'
|
16
|
+
at_x_seconds_past_the_minute: 'la secunda %s'
|
17
|
+
minutes_through_past_the_hour: 'între minutele %s și %s'
|
18
|
+
on_day_of_the_month: 'în a %s-a zi a lunii'
|
19
|
+
first_weekday: 'prima zi din săptămână'
|
20
|
+
weekday_nearest_day: 'cea mai apropiată %s din săptămână'
|
21
|
+
starting: pornire
|
22
|
+
only_on: 'numai %s'
|
23
|
+
only_in: 'numai în %s'
|
24
|
+
every_x_seconds: 'la fiecare %s secunde'
|
25
|
+
every_minute_between: 'în fiecare minut între %s și %s'
|
26
|
+
every_second: 'în fiecare secundă'
|
27
|
+
every_minute: 'în fiecare minut'
|
28
|
+
every_1_minute: 'din minut în minut'
|
29
|
+
every_hour: 'în fiecare oră'
|
30
|
+
every_1_hour: 'din oră în oră'
|
31
|
+
every_day: 'în fiecare zi'
|
32
|
+
every_1_day: 'în fiecare zi'
|
33
|
+
every_year: 'în fiecare an'
|
34
|
+
every_x: 'la fiecare %s'
|
35
|
+
at_x: 'la %s'
|
36
|
+
on_x: 'de %s'
|
37
|
+
in_x: 'în %s'
|
38
|
+
first: prima
|
39
|
+
second: 'a doua'
|
40
|
+
third: 'a treia'
|
41
|
+
fourth: 'a patra'
|
42
|
+
fifth: 'a cincea'
|
43
|
+
time_pm: PM
|
44
|
+
time_am: AM
|
45
|
+
and: și
|
46
|
+
at: la
|
47
|
+
day: zi
|
48
|
+
days: zile
|
49
|
+
hour: oră
|
50
|
+
hours: ore
|
51
|
+
minute: minut
|
52
|
+
minutes: minute
|
53
|
+
month: lună
|
54
|
+
months: luni
|
55
|
+
year: an
|
56
|
+
years: ani
|
57
|
+
monday: luni
|
58
|
+
tuesday: marți
|
59
|
+
wednesday: miercuri
|
60
|
+
thursday: joi
|
61
|
+
friday: vineri
|
62
|
+
saturday: sâmbătă
|
63
|
+
sunday: duminică
|
64
|
+
january: ianuarie
|
65
|
+
february: februarie
|
66
|
+
march: martie
|
67
|
+
april: aprilie
|
68
|
+
may: mai
|
69
|
+
june: iunie
|
70
|
+
july: iulie
|
71
|
+
august: august
|
72
|
+
september: septembrie
|
73
|
+
october: octombrie
|
74
|
+
november: noiembrie
|
75
|
+
december: decembrie
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# resources_ru.yml
|
2
|
+
---
|
3
|
+
expression_empty_exception: 'Выражение не может быть нулевым или пустым'
|
4
|
+
interval_description_format: 'каждые %s дня(ей) недели'
|
5
|
+
between_description_format: '%s - %s'
|
6
|
+
between_weekday_description_format: '%s - %s'
|
7
|
+
on_the_day_of_the_month: 'в {{nth}} %s месяца'
|
8
|
+
on_the_of_the_month: 'в %s месяца'
|
9
|
+
on_the_last_of_the_month: 'в последний %s месяца'
|
10
|
+
on_the_last_day_of_the_month: 'в последний день месяца'
|
11
|
+
on_the_last_weekday_of_the_month: 'в последний будний день месяца'
|
12
|
+
between_days_of_the_month: 'с %s по %s число месяца'
|
13
|
+
seconds_through_past_the_minute: 'секунды с %s по %s'
|
14
|
+
between_x_and_y: 'с %s по %s'
|
15
|
+
past_the_hour: 'часа'
|
16
|
+
at_x_seconds_past_the_minute: 'в %s секунд'
|
17
|
+
minutes_through_past_the_hour: 'минуты с %s по %s'
|
18
|
+
on_day_of_the_month: '%s число месяца'
|
19
|
+
first_weekday: 'первый будний день'
|
20
|
+
weekday_nearest_day: 'ближайший будний день к %s'
|
21
|
+
starting: начало
|
22
|
+
only_on: 'только %s'
|
23
|
+
only_in: 'только %s'
|
24
|
+
every_x_seconds: 'каждые %s секунд'
|
25
|
+
every_minute_between: 'каждую минуту с %s по %s'
|
26
|
+
every_second: 'каждую секунду'
|
27
|
+
every_minute: 'каждую минуту'
|
28
|
+
every_1_minute: 'каждую минуту'
|
29
|
+
every_hour: 'каждый час'
|
30
|
+
every_1_hour: 'каждый час'
|
31
|
+
every_day: 'каждый день'
|
32
|
+
every_1_day: 'каждый день'
|
33
|
+
every_year: 'каждый год'
|
34
|
+
every_x: 'каждые %s'
|
35
|
+
at_x: 'в %s'
|
36
|
+
on_x: 'в %s'
|
37
|
+
in_x: 'в %s'
|
38
|
+
first: первый
|
39
|
+
second: второй
|
40
|
+
third: третий
|
41
|
+
fourth: четвертый
|
42
|
+
fifth: пятый
|
43
|
+
time_pm: PM
|
44
|
+
time_am: AM
|
45
|
+
and: и
|
46
|
+
at: В
|
47
|
+
day: день
|
48
|
+
days: дня(ей)
|
49
|
+
hour: час
|
50
|
+
hours: часов
|
51
|
+
minute: минута
|
52
|
+
minutes: минут
|
53
|
+
month: месяц
|
54
|
+
months: месяцев
|
55
|
+
year: год
|
56
|
+
years: лет
|
57
|
+
monday: понедельник
|
58
|
+
tuesday: вторник
|
59
|
+
wednesday: среда
|
60
|
+
thursday: четверг
|
61
|
+
friday: пятница
|
62
|
+
saturday: суббота
|
63
|
+
sunday: воскресенье
|
64
|
+
january: январь
|
65
|
+
february: февраль
|
66
|
+
march: март
|
67
|
+
april: апрель
|
68
|
+
may: май
|
69
|
+
june: июнь
|
70
|
+
july: июль
|
71
|
+
august: август
|
72
|
+
september: сентябрь
|
73
|
+
october: октябрь
|
74
|
+
november: ноябрь
|
75
|
+
december: декабрь
|
@@ -1,8 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'cronex'
|
2
3
|
|
3
4
|
module Cronex
|
4
5
|
describe ExpressionDescriptor do
|
5
6
|
|
7
|
+
def desc(expression, opts = {})
|
8
|
+
Cronex::ExpressionDescriptor.new(expression, opts, 'en').description
|
9
|
+
end
|
10
|
+
|
6
11
|
let(:opts) { { zero_based_dow: false } }
|
7
12
|
|
8
13
|
it 'every second' do
|
@@ -4,374 +4,378 @@ require 'cronex'
|
|
4
4
|
module Cronex
|
5
5
|
describe ExpressionDescriptor do
|
6
6
|
|
7
|
+
def desc(expression, opts = {})
|
8
|
+
Cronex::ExpressionDescriptor.new(expression, opts, 'fr').description
|
9
|
+
end
|
10
|
+
|
7
11
|
let(:opts) { { zero_based_dow: false } }
|
8
12
|
|
9
13
|
it 'every second' do
|
10
|
-
expect(
|
14
|
+
expect(desc('* * * * * *')).to eq('Chaque seconde')
|
11
15
|
end
|
12
16
|
|
13
17
|
it 'every 45 seconds' do
|
14
|
-
expect(
|
18
|
+
expect(desc('*/45 * * * * *')).to eq('Toutes les 45 secondes')
|
15
19
|
end
|
16
20
|
|
17
21
|
it 'minute span' do
|
18
|
-
expect(
|
22
|
+
expect(desc('0-10 11 * * *')).to eq('Chaque minute entre 11:00 AM et 11:10 AM')
|
19
23
|
end
|
20
24
|
|
21
25
|
context 'every minute' do
|
22
26
|
it 'every minute' do
|
23
|
-
expect(
|
27
|
+
expect(desc('* * * * *')).to eq('Chaque minute')
|
24
28
|
end
|
25
29
|
|
26
30
|
it 'every minute */1' do
|
27
|
-
expect(
|
31
|
+
expect(desc('*/1 * * * *')).to eq('Chaque minute')
|
28
32
|
end
|
29
33
|
|
30
34
|
it 'every minute 0 0/1' do
|
31
|
-
expect(
|
35
|
+
expect(desc('0 0/1 * * * ?')).to eq('Chaque minute')
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
35
39
|
context 'every X minutes:' do
|
36
40
|
it 'every 5 minutes' do
|
37
|
-
expect(
|
41
|
+
expect(desc('*/5 * * * *')).to eq('Tous les 5 minutes')
|
38
42
|
end
|
39
43
|
|
40
44
|
it 'every 5 minute 0 */5' do
|
41
|
-
expect(
|
45
|
+
expect(desc('0 */5 * * * *')).to eq('Tous les 5 minutes')
|
42
46
|
end
|
43
47
|
|
44
48
|
it 'every 10 minutes 0 0/10' do
|
45
|
-
expect(
|
49
|
+
expect(desc('0 0/10 * * * ?')).to eq('Tous les 10 minutes')
|
46
50
|
end
|
47
51
|
end
|
48
52
|
|
49
53
|
context 'every hour:' do
|
50
54
|
it 'every hour 0 0' do
|
51
|
-
expect(
|
55
|
+
expect(desc('0 0 * * * ?')).to eq('Chaque heure')
|
52
56
|
end
|
53
57
|
|
54
58
|
it 'every hour 0 0 0/1' do
|
55
|
-
expect(
|
59
|
+
expect(desc('0 0 0/1 * * ?')).to eq('Chaque heure')
|
56
60
|
end
|
57
61
|
end
|
58
62
|
|
59
63
|
context 'daily:' do
|
60
64
|
it 'daily at /\d\d/:/\d\d/' do
|
61
|
-
expect(
|
65
|
+
expect(desc('30 11 * * *')).to eq('À 11:30 AM')
|
62
66
|
end
|
63
67
|
|
64
68
|
it 'daily at /\d/:/\d/' do
|
65
|
-
expect(
|
69
|
+
expect(desc('9 8 * * *')).to eq('À 8:09 AM')
|
66
70
|
end
|
67
71
|
|
68
72
|
it 'daily at /0[89]/:/0[89]/' do
|
69
|
-
expect(
|
73
|
+
expect(desc('09 08 * * *')).to eq('À 8:09 AM')
|
70
74
|
end
|
71
75
|
|
72
76
|
it 'daily at /0[1-7]/ /0[1-7/' do
|
73
|
-
expect(
|
77
|
+
expect(desc('02 01 * * *')).to eq('À 1:02 AM')
|
74
78
|
end
|
75
79
|
end
|
76
80
|
|
77
81
|
context 'time of day certain days of week:' do
|
78
82
|
it 'time of day on MON-FRI' do
|
79
|
-
expect(
|
83
|
+
expect(desc('0 23 ? * MON-FRI')).to eq('À 11:00 PM, lundi à vendredi')
|
80
84
|
end
|
81
85
|
|
82
86
|
it 'time of day on 1-5' do
|
83
|
-
expect(
|
87
|
+
expect(desc('30 11 * * 1-5')).to eq('À 11:30 AM, lundi à vendredi')
|
84
88
|
end
|
85
89
|
end
|
86
90
|
|
87
91
|
it 'one month only' do
|
88
|
-
expect(
|
92
|
+
expect(desc('* * * 3 *')).to eq('Chaque minute, seulement en mars')
|
89
93
|
end
|
90
94
|
|
91
95
|
it 'two months only' do
|
92
|
-
expect(
|
96
|
+
expect(desc('* * * 3,6 *')).to eq("Chaque minute, seulement en mars et juin")
|
93
97
|
end
|
94
98
|
|
95
99
|
it 'two times each afternoon' do
|
96
|
-
expect(
|
100
|
+
expect(desc('30 14,16 * * *')).to eq("À 2:30 PM et 4:30 PM")
|
97
101
|
end
|
98
102
|
|
99
103
|
it 'three times daily' do
|
100
|
-
expect(
|
104
|
+
expect(desc('30 6,14,16 * * *')).to eq('À 6:30 AM, 2:30 PM et 4:30 PM')
|
101
105
|
end
|
102
106
|
|
103
107
|
context 'once a week:' do
|
104
108
|
it 'once a week 0' do
|
105
|
-
expect(
|
109
|
+
expect(desc('46 9 * * 0')).to eq('À 9:46 AM, seulement le dimanche')
|
106
110
|
end
|
107
111
|
|
108
112
|
it 'once a week SUN' do
|
109
|
-
expect(
|
113
|
+
expect(desc('46 9 * * SUN')).to eq('À 9:46 AM, seulement le dimanche')
|
110
114
|
end
|
111
115
|
|
112
116
|
it 'once a week 7' do
|
113
|
-
expect(
|
117
|
+
expect(desc('46 9 * * 7')).to eq('À 9:46 AM, seulement le dimanche')
|
114
118
|
end
|
115
119
|
|
116
120
|
it 'once a week 1' do
|
117
|
-
expect(
|
121
|
+
expect(desc('46 9 * * 1')).to eq('À 9:46 AM, seulement le lundi')
|
118
122
|
end
|
119
123
|
|
120
124
|
it 'once a week 6' do
|
121
|
-
expect(
|
125
|
+
expect(desc('46 9 * * 6')).to eq('À 9:46 AM, seulement le samedi')
|
122
126
|
end
|
123
127
|
end
|
124
128
|
|
125
129
|
context 'once a week non zero based:' do
|
126
130
|
it 'once a week 1' do
|
127
|
-
expect(
|
131
|
+
expect(desc('46 9 * * 1', opts)).to eq('À 9:46 AM, seulement le dimanche')
|
128
132
|
end
|
129
133
|
|
130
134
|
it 'once a week SUN' do
|
131
|
-
expect(
|
135
|
+
expect(desc('46 9 * * SUN', opts)).to eq('À 9:46 AM, seulement le dimanche')
|
132
136
|
end
|
133
137
|
|
134
138
|
it 'once a week 2' do
|
135
|
-
expect(
|
139
|
+
expect(desc('46 9 * * 2', opts)).to eq('À 9:46 AM, seulement le lundi')
|
136
140
|
end
|
137
141
|
|
138
142
|
it 'once a week 7' do
|
139
|
-
expect(
|
143
|
+
expect(desc('46 9 * * 7', opts)).to eq('À 9:46 AM, seulement le samedi')
|
140
144
|
end
|
141
145
|
end
|
142
146
|
|
143
147
|
context 'twice a week:' do
|
144
148
|
it 'twice a week 1,2' do
|
145
|
-
expect(
|
149
|
+
expect(desc('46 9 * * 1,2')).to eq('À 9:46 AM, seulement le lundi et mardi')
|
146
150
|
end
|
147
151
|
|
148
152
|
it 'twice a week MON,TUE' do
|
149
|
-
expect(
|
153
|
+
expect(desc('46 9 * * MON,TUE')).to eq('À 9:46 AM, seulement le lundi et mardi')
|
150
154
|
end
|
151
155
|
|
152
156
|
it 'twice a week 0,6' do
|
153
|
-
expect(
|
157
|
+
expect(desc('46 9 * * 0,6')).to eq('À 9:46 AM, seulement le dimanche et samedi')
|
154
158
|
end
|
155
159
|
|
156
160
|
it 'twice a week 6,7' do
|
157
|
-
expect(
|
161
|
+
expect(desc('46 9 * * 6,7')).to eq('À 9:46 AM, seulement le samedi et dimanche')
|
158
162
|
end
|
159
163
|
end
|
160
164
|
|
161
165
|
context 'twice a week non zero based:' do
|
162
166
|
it 'twice a week 1,2' do
|
163
|
-
expect(
|
167
|
+
expect(desc('46 9 * * 1,2', opts)).to eq('À 9:46 AM, seulement le dimanche et lundi')
|
164
168
|
end
|
165
169
|
|
166
170
|
it 'twice a week SUN,MON' do
|
167
|
-
expect(
|
171
|
+
expect(desc('46 9 * * SUN,MON', opts)).to eq('À 9:46 AM, seulement le dimanche et lundi')
|
168
172
|
end
|
169
173
|
|
170
174
|
it 'twice a week 6,7' do
|
171
|
-
expect(
|
175
|
+
expect(desc('46 9 * * 6,7', opts)).to eq('À 9:46 AM, seulement le vendredi et samedi')
|
172
176
|
end
|
173
177
|
end
|
174
178
|
|
175
179
|
it 'day of month' do
|
176
|
-
expect(
|
180
|
+
expect(desc('23 12 15 * *')).to eq('À 12:23 PM, le 15 de chaque mois')
|
177
181
|
end
|
178
182
|
|
179
183
|
it 'day of month ignores day of week' do
|
180
|
-
expect(
|
184
|
+
expect(desc('23 12 15 * SUN')).to eq('À 12:23 PM, le 15 de chaque mois')
|
181
185
|
end
|
182
186
|
|
183
187
|
it 'month name' do
|
184
|
-
expect(
|
188
|
+
expect(desc('23 12 * JAN *')).to eq('À 12:23 PM, seulement en janvier')
|
185
189
|
end
|
186
190
|
|
187
191
|
it 'day of month with question mark' do
|
188
|
-
expect(
|
192
|
+
expect(desc('23 12 ? JAN *')).to eq('À 12:23 PM, seulement en janvier')
|
189
193
|
end
|
190
194
|
|
191
195
|
it 'month name range 2' do
|
192
|
-
expect(
|
196
|
+
expect(desc('23 12 * JAN-FEB *')).to eq('À 12:23 PM, janvier à février')
|
193
197
|
end
|
194
198
|
|
195
199
|
it 'month name range 3' do
|
196
|
-
expect(
|
200
|
+
expect(desc('23 12 * JAN-MAR *')).to eq('À 12:23 PM, janvier à mars')
|
197
201
|
end
|
198
202
|
|
199
203
|
it 'day of week name' do
|
200
|
-
expect(
|
204
|
+
expect(desc('23 12 * * SUN')).to eq('À 12:23 PM, seulement le dimanche')
|
201
205
|
end
|
202
206
|
|
203
207
|
context 'day of week range:' do
|
204
208
|
it 'day of week range MON-FRI' do
|
205
|
-
expect(
|
209
|
+
expect(desc('*/5 15 * * MON-FRI')).to eq('Tous les 5 minutes, à 3:00 PM, lundi à vendredi')
|
206
210
|
end
|
207
211
|
|
208
212
|
it 'day of week range 0-6' do
|
209
|
-
expect(
|
213
|
+
expect(desc('*/5 15 * * 0-6')).to eq('Tous les 5 minutes, à 3:00 PM, dimanche à samedi')
|
210
214
|
end
|
211
215
|
|
212
216
|
it 'day of week range 6-7' do
|
213
|
-
expect(
|
217
|
+
expect(desc('*/5 15 * * 6-7')).to eq('Tous les 5 minutes, à 3:00 PM, samedi à dimanche')
|
214
218
|
end
|
215
219
|
end
|
216
220
|
|
217
221
|
context 'day of week once in month:' do
|
218
222
|
it 'day of week once MON#3' do
|
219
|
-
expect(
|
223
|
+
expect(desc('* * * * MON#3')).to eq('Chaque minute, le troisième lundi du mois')
|
220
224
|
end
|
221
225
|
|
222
226
|
it 'day of week once 0#3' do
|
223
|
-
expect(
|
227
|
+
expect(desc('* * * * 0#3')).to eq('Chaque minute, le troisième dimanche du mois')
|
224
228
|
end
|
225
229
|
end
|
226
230
|
|
227
231
|
context 'last day of week of the month:' do
|
228
232
|
it 'last day of week 4L' do
|
229
|
-
expect(
|
233
|
+
expect(desc('* * * * 4L')).to eq('Chaque minute, le dernier jeudi du mois')
|
230
234
|
end
|
231
235
|
|
232
236
|
it 'last day of week 0L' do
|
233
|
-
expect(
|
237
|
+
expect(desc('* * * * 0L')).to eq('Chaque minute, le dernier dimanche du mois')
|
234
238
|
end
|
235
239
|
end
|
236
240
|
|
237
241
|
it 'last day of the month' do
|
238
|
-
expect(
|
242
|
+
expect(desc('*/5 * L JAN *')).to eq('Tous les 5 minutes, le dernier jour du mois, seulement en janvier')
|
239
243
|
end
|
240
244
|
|
241
245
|
it 'time of day with seconds' do
|
242
|
-
expect(
|
246
|
+
expect(desc('30 02 14 * * *')).to eq('À 2:02:30 PM')
|
243
247
|
end
|
244
248
|
|
245
249
|
it 'second intervals' do
|
246
|
-
expect(
|
250
|
+
expect(desc('5-10 * * * * *')).to eq('Secondes 5 à 10 après la minute')
|
247
251
|
end
|
248
252
|
|
249
253
|
it 'second minutes hours intervals' do
|
250
|
-
expect(
|
254
|
+
expect(desc('5-10 30-35 10-12 * * *')).to eq(
|
251
255
|
"Secondes 5 à 10 après la minute, minutes 30 à 35 après l'heure, entre 10:00 AM et 12:59 PM")
|
252
256
|
end
|
253
257
|
|
254
258
|
it 'every 5 minutes at 30 seconds' do
|
255
|
-
expect(
|
259
|
+
expect(desc('30 */5 * * * *')).to eq('À 30 secondes après la minute, tous les 5 minutes')
|
256
260
|
end
|
257
261
|
|
258
262
|
it 'minutes past the hour range' do
|
259
|
-
expect(
|
263
|
+
expect(desc('0 30 10-13 ? * WED,FRI')).to eq(
|
260
264
|
"À 30 minutes après l'heure, entre 10:00 AM et 1:59 PM, seulement le mercredi et vendredi")
|
261
265
|
end
|
262
266
|
|
263
267
|
it 'seconds past the minute interval' do
|
264
|
-
expect(
|
268
|
+
expect(desc('10 0/5 * * * ?')).to eq('À 10 secondes après la minute, tous les 5 minutes')
|
265
269
|
end
|
266
270
|
|
267
271
|
it 'between with interval' do
|
268
|
-
expect(
|
272
|
+
expect(desc('2-59/3 1,9,22 11-26 1-6 ?')).to eq(
|
269
273
|
"Tous les 3 minutes, minutes 02 à 59 après l'heure, à 1:00 AM, 9:00 AM et 10:00 PM, entre le 11 et le 26 du mois, janvier à juin")
|
270
274
|
end
|
271
275
|
|
272
276
|
it 'recurring first of month' do
|
273
|
-
expect(
|
277
|
+
expect(desc('0 0 6 1/1 * ?')).to eq('À 6:00 AM')
|
274
278
|
end
|
275
279
|
|
276
280
|
it 'minutes past the hour' do
|
277
|
-
expect(
|
281
|
+
expect(desc('0 5 0/1 * * ?')).to eq("À 05 minutes après l'heure")
|
278
282
|
end
|
279
283
|
|
280
284
|
it 'every past the hour' do
|
281
|
-
expect(
|
285
|
+
expect(desc('0 0,5,10,15,20,25,30,35,40,45,50,55 * ? * *')).to eq(
|
282
286
|
"À 00, 05, 10, 15, 20, 25, 30, 35, 40, 45, 50 et 55 minutes après l'heure")
|
283
287
|
end
|
284
288
|
|
285
289
|
it 'every x minute past the hour with interval' do
|
286
|
-
expect(
|
290
|
+
expect(desc('0 0-30/2 17 ? * MON-FRI')).to eq(
|
287
291
|
"Tous les 2 minutes, minutes 00 à 30 après l'heure, à 5:00 PM, lundi à vendredi")
|
288
292
|
end
|
289
293
|
|
290
294
|
it 'one year only with seconds' do
|
291
|
-
expect(
|
295
|
+
expect(desc('* * * * * * 2013')).to eq('Chaque seconde, seulement en 2013')
|
292
296
|
end
|
293
297
|
|
294
298
|
it 'one year only without seconds' do
|
295
|
-
expect(
|
299
|
+
expect(desc('* * * * * 2013')).to eq('Chaque minute, seulement en 2013')
|
296
300
|
end
|
297
301
|
|
298
302
|
it 'two years only' do
|
299
|
-
expect(
|
303
|
+
expect(desc('* * * * * 2013,2014')).to eq('Chaque minute, seulement en 2013 et 2014')
|
300
304
|
end
|
301
305
|
|
302
306
|
it 'year range 2' do
|
303
|
-
expect(
|
307
|
+
expect(desc('23 12 * JAN-FEB * 2013-2014')).to eq('À 12:23 PM, janvier à février, 2013 à 2014')
|
304
308
|
end
|
305
309
|
|
306
310
|
it 'year range 3' do
|
307
|
-
expect(
|
311
|
+
expect(desc('23 12 * JAN-MAR * 2013-2015')).to eq('À 12:23 PM, janvier à mars, 2013 à 2015')
|
308
312
|
end
|
309
313
|
|
310
314
|
context 'multi part range seconds:' do
|
311
315
|
it 'multi part range seconds 2,4-5' do
|
312
|
-
expect(
|
316
|
+
expect(desc('2,4-5 1 * * *')).to eq("Minutes 02,04 à 05 après l'heure, à 1:00 AM")
|
313
317
|
end
|
314
318
|
|
315
319
|
it 'multi part range seconds 2,26-28' do
|
316
|
-
expect(
|
320
|
+
expect(desc('2,26-28 18 * * *')).to eq("Minutes 02,26 à 28 après l'heure, à 6:00 PM")
|
317
321
|
end
|
318
322
|
end
|
319
323
|
|
320
324
|
context 'minutes past the hour:' do
|
321
325
|
it 'minutes past the hour 5,10' do
|
322
|
-
expect(
|
326
|
+
expect(desc('5,10 0 * * *')).to eq("À 05 et 10 minutes après l'heure")
|
323
327
|
end
|
324
328
|
|
325
329
|
it 'minutes past the hour 5,10 day 2' do
|
326
|
-
expect(
|
330
|
+
expect(desc('5,10 0 2 * *')).to eq("À 05 et 10 minutes après l'heure, le 2 de chaque mois")
|
327
331
|
end
|
328
332
|
|
329
333
|
it 'minutes past the hour 5/10 day 2' do
|
330
|
-
expect(
|
334
|
+
expect(desc('5/10 0 2 * *')).to eq("Tous les 10 minutes, commence à 05 minutes après l'heure, le 2 de chaque mois")
|
331
335
|
end
|
332
336
|
end
|
333
337
|
|
334
338
|
context 'seconds past the minute:' do
|
335
339
|
it 'seconds past the minute 5,6' do
|
336
|
-
expect(
|
340
|
+
expect(desc('5,6 0 0 * * *')).to eq('À 5 et 6 secondes après la minute')
|
337
341
|
end
|
338
342
|
|
339
343
|
it 'seconds past the minute 5,6 at 1' do
|
340
|
-
expect(
|
344
|
+
expect(desc('5,6 0 1 * * *')).to eq('À 5 et 6 secondes après la minute, à 1:00 AM')
|
341
345
|
end
|
342
346
|
|
343
347
|
it 'seconds past the minute 5,6 day 2' do
|
344
|
-
expect(
|
348
|
+
expect(desc('5,6 0 0 2 * *')).to eq('À 5 et 6 secondes après la minute, le 2 de chaque mois')
|
345
349
|
end
|
346
350
|
end
|
347
351
|
|
348
352
|
context 'increments starting at X > 1:' do
|
349
353
|
it 'second increments' do
|
350
|
-
expect(
|
354
|
+
expect(desc('5/15 0 * * * *')).to eq("Toutes les 15 secondes, commence à 5 secondes après la minute")
|
351
355
|
end
|
352
356
|
|
353
357
|
it 'minute increments' do
|
354
|
-
expect(
|
358
|
+
expect(desc('30/10 * * * *')).to eq("Tous les 10 minutes, commence à 30 minutes après l'heure")
|
355
359
|
end
|
356
360
|
|
357
361
|
it 'hour increments' do
|
358
|
-
expect(
|
362
|
+
expect(desc('0 30 2/6 * * ?')).to eq("À 30 minutes après l'heure, tous les 6 heures, commence à 2:00 AM")
|
359
363
|
end
|
360
364
|
|
361
365
|
it 'day of month increments' do
|
362
|
-
expect(
|
366
|
+
expect(desc('0 30 8 2/7 * *')).to eq('À 8:30 AM, tous les 7 jours, commence le 2 de chaque mois')
|
363
367
|
end
|
364
368
|
|
365
369
|
it 'day of week increments' do
|
366
|
-
expect(
|
370
|
+
expect(desc('0 30 11 * * 2/2')).to eq('À 11:30 AM, tous les 2 jours de la semaine, commence le mardi')
|
367
371
|
end
|
368
372
|
|
369
373
|
it 'month increments' do
|
370
|
-
expect(
|
374
|
+
expect(desc('0 20 10 * 2/3 THU')).to eq('À 10:20 AM, seulement le jeudi, tous les 3 mois, commence en février')
|
371
375
|
end
|
372
376
|
|
373
377
|
it 'year increments' do
|
374
|
-
expect(
|
378
|
+
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('À 0:00 AM, le 1 de chaque mois, seulement en mars, tous les 5 ans, commence en 2010')
|
375
379
|
end
|
376
380
|
end
|
377
381
|
end
|