cronex 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +24 -15
- data/CHANGELOG.md +3 -0
- data/README.md +1 -0
- data/cronex.gemspec +1 -1
- data/lib/cronex/version.rb +1 -1
- data/resources/resources_it.yml +75 -0
- data/spec/exp_descriptor_it_spec.rb +402 -0
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e6f8daf70eaa89830eec06d7c7368292dcf846d
|
4
|
+
data.tar.gz: a0c6845cfa574085f21e8dc5ecb1e73fcc210918
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31b31f7c5933aa622962e5c321c94205bbc968c8c56682955175dae4e2e8e9e375c3577cef6a6c42067506236ea0e0f433a8f4eb48b5c3117ddaa915069da4ff
|
7
|
+
data.tar.gz: c88a9490b5b66c82cbad4498373aafbfa4822ff2debbe1f7466044a07d9b8cb6e3f477cd53a735db97df1ebefe15f53d538be818e2b4f80fe6db8ba75bf28c2a
|
data/.rubocop.yml
CHANGED
@@ -1,47 +1,56 @@
|
|
1
|
-
Encoding:
|
1
|
+
Style/Encoding:
|
2
2
|
Enabled: false
|
3
3
|
|
4
|
-
AmbiguousOperator:
|
4
|
+
Lint/AmbiguousOperator:
|
5
5
|
Enabled: false
|
6
6
|
|
7
|
-
CaseIndentation:
|
7
|
+
Layout/CaseIndentation:
|
8
8
|
Enabled: false
|
9
9
|
|
10
|
-
CyclomaticComplexity:
|
10
|
+
Metrics/CyclomaticComplexity:
|
11
11
|
Enabled: false
|
12
12
|
Max: 10
|
13
13
|
|
14
|
-
PerceivedComplexity:
|
14
|
+
Metrics/PerceivedComplexity:
|
15
15
|
Enabled: false
|
16
16
|
Max: 10
|
17
17
|
|
18
|
-
Documentation:
|
18
|
+
Style/Documentation:
|
19
19
|
Enabled: false
|
20
20
|
|
21
|
-
|
21
|
+
Layout/EmptyLinesAroundBlockBody:
|
22
22
|
Enabled: false
|
23
23
|
|
24
|
-
|
24
|
+
Layout/EmptyLinesAroundClassBody:
|
25
25
|
Enabled: false
|
26
26
|
|
27
|
-
|
27
|
+
Layout/EmptyLinesAroundModuleBody:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Metrics/ClassLength:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/FrozenStringLiteralComment:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Layout/LineLength:
|
28
37
|
Enabled: true
|
29
38
|
Max: 160
|
30
39
|
|
31
|
-
MethodLength:
|
40
|
+
Metrics/MethodLength:
|
32
41
|
Enabled: false
|
33
42
|
|
34
|
-
ModuleFunction:
|
43
|
+
Style/ModuleFunction:
|
35
44
|
Enabled: false
|
36
45
|
|
37
|
-
NestedTernaryOperator:
|
46
|
+
Style/NestedTernaryOperator:
|
38
47
|
Enabled: false
|
39
48
|
|
40
|
-
RaiseArgs:
|
49
|
+
Style/RaiseArgs:
|
41
50
|
Enabled: false
|
42
51
|
|
43
|
-
RescueModifier:
|
52
|
+
Style/RescueModifier:
|
44
53
|
Enabled: false
|
45
54
|
|
46
|
-
UnusedMethodArgument:
|
55
|
+
Lint/UnusedMethodArgument:
|
47
56
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/cronex.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency 'tzinfo'
|
24
24
|
spec.add_runtime_dependency 'unicode'
|
25
25
|
spec.add_development_dependency 'pry', '~> 0.10'
|
26
|
-
spec.add_development_dependency 'rake', '
|
26
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
28
28
|
end
|
data/lib/cronex/version.rb
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
# resources_it.yml
|
2
|
+
---
|
3
|
+
expression_empty_exception: "L'espressione non puó essere null o vuota"
|
4
|
+
interval_description_format: '%s giorni alla settimana'
|
5
|
+
between_description_format: 'da %s a %s'
|
6
|
+
between_weekday_description_format: 'da %s a %s'
|
7
|
+
on_the_day_of_the_month: 'il(la) {{nth}}(a) %s del mese'
|
8
|
+
on_the_of_the_month: 'il %s del mese'
|
9
|
+
on_the_last_of_the_month: "l'ultimo(a) %s del mese"
|
10
|
+
on_the_last_day_of_the_month: "l'ultimo giorno del mese"
|
11
|
+
on_the_last_weekday_of_the_month: "l'ultimo giorno lavorativo del mese"
|
12
|
+
between_days_of_the_month: 'tra il giorno %s e il giorno %s del mese'
|
13
|
+
seconds_through_past_the_minute: 'dal secondo %s al %s dopo il minuto'
|
14
|
+
between_x_and_y: 'tra le %s e le %s'
|
15
|
+
past_the_hour: "dopo l'ora"
|
16
|
+
at_x_seconds_past_the_minute: 'a %s secondi dopo il minuto'
|
17
|
+
minutes_through_past_the_hour: "dal minuto %s al %s dopo l'ora"
|
18
|
+
on_day_of_the_month: 'il giorno %s del mese'
|
19
|
+
first_weekday: 'il primo giorno della settimana lavorativa'
|
20
|
+
weekday_nearest_day: 'il prossimo giorno %s della settimana lavorativa'
|
21
|
+
starting: 'a partire da'
|
22
|
+
only_on: 'solo di %s'
|
23
|
+
only_in: 'solo a(nel) %s'
|
24
|
+
every_x_seconds: 'ogni %s secondi'
|
25
|
+
every_minute_between: 'ogni minuto tra le %s e le %s'
|
26
|
+
every_second: 'ogni secondo'
|
27
|
+
every_minute: 'ogni minuto'
|
28
|
+
every_1_minute: 'ogni minuto'
|
29
|
+
every_hour: 'ogni ora'
|
30
|
+
every_1_hour: 'ogni ora'
|
31
|
+
every_day: 'ogni giorno'
|
32
|
+
every_1_day: 'ogni giorno'
|
33
|
+
every_year: 'ogni anno'
|
34
|
+
every_x: 'ogni %s'
|
35
|
+
at_x: 'alle(ai) %s'
|
36
|
+
on_x: 'il %s'
|
37
|
+
in_x: '%s'
|
38
|
+
first: primo
|
39
|
+
second: secondo
|
40
|
+
third: terzo
|
41
|
+
fourth: quarto
|
42
|
+
fifth: quinto
|
43
|
+
time_pm: pomeriggio
|
44
|
+
time_am: mattino
|
45
|
+
and: e
|
46
|
+
at: alle(ai)
|
47
|
+
day: giorno
|
48
|
+
days: giorni
|
49
|
+
hour: ora
|
50
|
+
hours: ore
|
51
|
+
minute: minuto
|
52
|
+
minutes: minuti
|
53
|
+
month: mese
|
54
|
+
months: mesi
|
55
|
+
year: anno
|
56
|
+
years: anni
|
57
|
+
monday: lunedì
|
58
|
+
tuesday: martedì
|
59
|
+
wednesday: mercoledì
|
60
|
+
thursday: giovedì
|
61
|
+
friday: venerdì
|
62
|
+
saturday: sabato
|
63
|
+
sunday: domenica
|
64
|
+
january: gennaio
|
65
|
+
february: febbraio
|
66
|
+
march: marzo
|
67
|
+
april: aprile
|
68
|
+
may: maggio
|
69
|
+
june: giugno
|
70
|
+
july: luglio
|
71
|
+
august: agosto
|
72
|
+
september: settembre
|
73
|
+
october: ottobre
|
74
|
+
november: novembre
|
75
|
+
december: dicembre
|
@@ -0,0 +1,402 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'cronex'
|
3
|
+
|
4
|
+
module Cronex
|
5
|
+
describe ExpressionDescriptor do
|
6
|
+
|
7
|
+
def desc(expression, opts = {}, timezone = 'UTC')
|
8
|
+
Cronex::ExpressionDescriptor.new(expression, opts, 'it', timezone).description
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:opts) { { zero_based_dow: false } }
|
12
|
+
|
13
|
+
it 'every second' do
|
14
|
+
expect(desc('* * * * * *')).to eq('Ogni secondo')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'every 45 seconds' do
|
18
|
+
expect(desc('*/45 * * * * *')).to eq('Ogni 45 secondi')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'minute span' do
|
22
|
+
expect(desc('0-10 11 * * *')).to eq('Ogni minuto tra le 11:00 AM e le 11:10 AM')
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'every minute' do
|
26
|
+
it 'every minute' do
|
27
|
+
expect(desc('* * * * *')).to eq('Ogni minuto')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'every minute */1' do
|
31
|
+
expect(desc('*/1 * * * *')).to eq('Ogni minuto')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'every minute 0 0/1' do
|
35
|
+
expect(desc('0 0/1 * * * ?')).to eq('Ogni minuto')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'every X minutes:' do
|
40
|
+
it 'every 5 minuti' do
|
41
|
+
expect(desc('*/5 * * * *')).to eq('Ogni 5 minuti')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'every 5 minute 0 */5' do
|
45
|
+
expect(desc('0 */5 * * * *')).to eq('Ogni 5 minuti')
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'every 10 minutes 0 0/10' do
|
49
|
+
expect(desc('0 0/10 * * * ?')).to eq('Ogni 10 minuti')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'every hour:' do
|
54
|
+
it 'every hour 0 0' do
|
55
|
+
expect(desc('0 0 * * * ?')).to eq('Ogni ora')
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'every hour 0 0 0/1' do
|
59
|
+
expect(desc('0 0 0/1 * * ?')).to eq('Ogni ora')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'daily:' do
|
64
|
+
it 'daily at /\d\d/:/\d\d/' do
|
65
|
+
expect(desc('30 11 * * *')).to eq('Alle(ai) 11:30 AM')
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'daily at /\d/:/\d/' do
|
69
|
+
expect(desc('9 8 * * *')).to eq('Alle(ai) 8:09 AM')
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'daily at /0[89]/:/0[89]/' do
|
73
|
+
expect(desc('09 08 * * *')).to eq('Alle(ai) 8:09 AM')
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'daily at /0[1-7]/ /0[1-7/' do
|
77
|
+
expect(desc('02 01 * * *')).to eq('Alle(ai) 1:02 AM')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'time of day certain days of week:' do
|
82
|
+
it 'time of day on MON-FRI' do
|
83
|
+
expect(desc('0 23 ? * MON-FRI')).to eq('Alle(ai) 11:00 PM, da lunedì a venerdì')
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'time of day on 1-5' do
|
87
|
+
expect(desc('30 11 * * 1-5')).to eq('Alle(ai) 11:30 AM, da lunedì a venerdì')
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'one month only' do
|
92
|
+
expect(desc('* * * 3 *')).to eq('Ogni minuto, solo a(nel) marzo')
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'two months only' do
|
96
|
+
expect(desc('* * * 3,6 *')).to eq('Ogni minuto, solo a(nel) marzo e giugno')
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'two times each afternoon' do
|
100
|
+
expect(desc('30 14,16 * * *')).to eq('Alle(ai) 2:30 PM e 4:30 PM')
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'three times daily' do
|
104
|
+
expect(desc('30 6,14,16 * * *')).to eq('Alle(ai) 6:30 AM, 2:30 PM e 4:30 PM')
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'once a week:' do
|
108
|
+
it 'once a week 0' do
|
109
|
+
expect(desc('46 9 * * 0')).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'once a week SUN' do
|
113
|
+
expect(desc('46 9 * * SUN')).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'once a week 7' do
|
117
|
+
expect(desc('46 9 * * 7')).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'once a week 1' do
|
121
|
+
expect(desc('46 9 * * 1')).to eq('Alle(ai) 9:46 AM, solo di lunedì')
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'once a week 6' do
|
125
|
+
expect(desc('46 9 * * 6')).to eq('Alle(ai) 9:46 AM, solo di sabato')
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'once a week non zero based:' do
|
130
|
+
it 'once a week 1' do
|
131
|
+
expect(desc('46 9 * * 1', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'once a week SUN' do
|
135
|
+
expect(desc('46 9 * * SUN', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'once a week 2' do
|
139
|
+
expect(desc('46 9 * * 2', opts)).to eq('Alle(ai) 9:46 AM, solo di lunedì')
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'once a week 7' do
|
143
|
+
expect(desc('46 9 * * 7', opts)).to eq('Alle(ai) 9:46 AM, solo di sabato')
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'twice a week:' do
|
148
|
+
it 'twice a week 1,2' do
|
149
|
+
expect(desc('46 9 * * 1,2')).to eq('Alle(ai) 9:46 AM, solo di lunedì e martedì')
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'twice a week MON,TUE' do
|
153
|
+
expect(desc('46 9 * * MON,TUE')).to eq('Alle(ai) 9:46 AM, solo di lunedì e martedì')
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'twice a week 0,6' do
|
157
|
+
expect(desc('46 9 * * 0,6')).to eq('Alle(ai) 9:46 AM, solo di domenica e sabato')
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'twice a week 6,7' do
|
161
|
+
expect(desc('46 9 * * 6,7')).to eq('Alle(ai) 9:46 AM, solo di sabato e domenica')
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
context 'twice a week non zero based:' do
|
166
|
+
it 'twice a week 1,2' do
|
167
|
+
expect(desc('46 9 * * 1,2', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica e lunedì')
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'twice a week SUN,MON' do
|
171
|
+
expect(desc('46 9 * * SUN,MON', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica e lunedì')
|
172
|
+
end
|
173
|
+
|
174
|
+
it 'twice a week 6,7' do
|
175
|
+
expect(desc('46 9 * * 6,7', opts)).to eq('Alle(ai) 9:46 AM, solo di venerdì e sabato')
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'day of month' do
|
180
|
+
expect(desc('23 12 15 * *')).to eq('Alle(ai) 12:23 PM, il giorno 15 del mese')
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'day of month with day of week' do
|
184
|
+
expect(desc('23 12 15 * SUN')).to eq('Alle(ai) 12:23 PM, il giorno 15 del mese, solo di domenica')
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'month name' do
|
188
|
+
expect(desc('23 12 * JAN *')).to eq('Alle(ai) 12:23 PM, solo a(nel) gennaio')
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'day of month with question mark' do
|
192
|
+
expect(desc('23 12 ? JAN *')).to eq('Alle(ai) 12:23 PM, solo a(nel) gennaio')
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'month name range 2' do
|
196
|
+
expect(desc('23 12 * JAN-FEB *')).to eq('Alle(ai) 12:23 PM, da gennaio a febbraio')
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'month name range 3' do
|
200
|
+
expect(desc('23 12 * JAN-MAR *')).to eq('Alle(ai) 12:23 PM, da gennaio a marzo')
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'day of week name' do
|
204
|
+
expect(desc('23 12 * * SUN')).to eq('Alle(ai) 12:23 PM, solo di domenica')
|
205
|
+
end
|
206
|
+
|
207
|
+
context 'day of week range:' do
|
208
|
+
it 'day of week range MON-FRI' do
|
209
|
+
expect(desc('*/5 15 * * MON-FRI')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da lunedì a venerdì')
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'day of week range 0-6' do
|
213
|
+
expect(desc('*/5 15 * * 0-6')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da domenica a sabato')
|
214
|
+
end
|
215
|
+
|
216
|
+
it 'day of week range 6-7' do
|
217
|
+
expect(desc('*/5 15 * * 6-7')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da sabato a domenica')
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
context 'day of week once in month:' do
|
222
|
+
it 'day of week once MON#3' do
|
223
|
+
expect(desc('* * * * MON#3')).to eq('Ogni minuto, il(la) terzo(a) lunedì del mese')
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'day of week once 0#3' do
|
227
|
+
expect(desc('* * * * 0#3')).to eq('Ogni minuto, il(la) terzo(a) domenica del mese')
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
context 'last day of week del mese:' do
|
232
|
+
it 'last day of week 4L' do
|
233
|
+
expect(desc('* * * * 4L')).to eq('Ogni minuto, l\'ultimo(a) giovedì del mese')
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'last day of week 0L' do
|
237
|
+
expect(desc('* * * * 0L')).to eq('Ogni minuto, l\'ultimo(a) domenica del mese')
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
it 'last day of the month' do
|
242
|
+
expect(desc('*/5 * L JAN *')).to eq('Ogni 5 minuti, l\'ultimo giorno del mese, solo a(nel) gennaio')
|
243
|
+
end
|
244
|
+
|
245
|
+
it 'time of day with seconds' do
|
246
|
+
expect(desc('30 02 14 * * *')).to eq('Alle(ai) 2:02:30 PM')
|
247
|
+
end
|
248
|
+
|
249
|
+
it 'second intervals' do
|
250
|
+
expect(desc('5-10 * * * * *')).to eq('Dal secondo 5 al 10 dopo il minuto')
|
251
|
+
end
|
252
|
+
|
253
|
+
it 'second minutes hours intervals' do
|
254
|
+
expect(desc('5-10 30-35 10-12 * * *')).to eq(
|
255
|
+
'Dal secondo 5 al 10 dopo il minuto, dal minuto 30 al 35 dopo l\'ora, tra le 10:00 AM e le 12:59 PM')
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'every 5 minutes at 30 seconds' do
|
259
|
+
expect(desc('30 */5 * * * *')).to eq('A 30 secondi dopo il minuto, ogni 5 minuti')
|
260
|
+
end
|
261
|
+
|
262
|
+
it 'minutes past the hour range' do
|
263
|
+
expect(desc('0 30 10-13 ? * WED,FRI')).to eq(
|
264
|
+
'Alle(ai) 30 minuti dopo l\'ora, tra le 10:00 AM e le 1:59 PM, solo di mercoledì e venerdì')
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'seconds past the minute interval' do
|
268
|
+
expect(desc('10 0/5 * * * ?')).to eq('A 10 secondi dopo il minuto, ogni 5 minuti')
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'between with interval' do
|
272
|
+
expect(desc('2-59/3 1,9,22 11-26 1-6 ?')).to eq(
|
273
|
+
'Ogni 3 minuti, dal minuto 02 al 59 dopo l\'ora, alle(ai) 1:00 AM, 9:00 AM e 10:00 PM, tra il giorno 11 e il giorno 26 del mese, da gennaio a giugno')
|
274
|
+
end
|
275
|
+
|
276
|
+
it 'recurring first of month' do
|
277
|
+
expect(desc('0 0 6 1/1 * ?')).to eq('Alle(ai) 6:00 AM')
|
278
|
+
end
|
279
|
+
|
280
|
+
it 'minutes past the hour' do
|
281
|
+
expect(desc('0 5 0/1 * * ?')).to eq('Alle(ai) 05 minuti dopo l\'ora')
|
282
|
+
end
|
283
|
+
|
284
|
+
it 'every past the hour' do
|
285
|
+
expect(desc('0 0,5,10,15,20,25,30,35,40,45,50,55 * ? * *')).to eq(
|
286
|
+
'Alle(ai) 00, 05, 10, 15, 20, 25, 30, 35, 40, 45, 50 e 55 minuti dopo l\'ora')
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'every x minute past the hour with interval' do
|
290
|
+
expect(desc('0 0-30/2 17 ? * MON-FRI')).to eq(
|
291
|
+
'Ogni 2 minuti, dal minuto 00 al 30 dopo l\'ora, alle(ai) 5:00 PM, da lunedì a venerdì')
|
292
|
+
end
|
293
|
+
|
294
|
+
it 'one year only with seconds' do
|
295
|
+
expect(desc('* * * * * * 2013')).to eq('Ogni secondo, solo a(nel) 2013')
|
296
|
+
end
|
297
|
+
|
298
|
+
it 'one year only without seconds' do
|
299
|
+
expect(desc('* * * * * 2013')).to eq('Ogni minuto, solo a(nel) 2013')
|
300
|
+
end
|
301
|
+
|
302
|
+
it 'two years only' do
|
303
|
+
expect(desc('* * * * * 2013,2014')).to eq('Ogni minuto, solo a(nel) 2013 e 2014')
|
304
|
+
end
|
305
|
+
|
306
|
+
it 'year range 2' do
|
307
|
+
expect(desc('23 12 * JAN-FEB * 2013-2014')).to eq('Alle(ai) 12:23 PM, da gennaio a febbraio, da 2013 a 2014')
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'year range 3' do
|
311
|
+
expect(desc('23 12 * JAN-MAR * 2013-2015')).to eq('Alle(ai) 12:23 PM, da gennaio a marzo, da 2013 a 2015')
|
312
|
+
end
|
313
|
+
|
314
|
+
context 'multi part range seconds:' do
|
315
|
+
it 'multi part range seconds 2,4-5' do
|
316
|
+
expect(desc('2,4-5 1 * * *')).to eq('Dal minuto 02,04 al 05 dopo l\'ora, alle(ai) 1:00 AM')
|
317
|
+
end
|
318
|
+
|
319
|
+
it 'multi part range seconds 2,26-28' do
|
320
|
+
expect(desc('2,26-28 18 * * *')).to eq('Dal minuto 02,26 al 28 dopo l\'ora, alle(ai) 6:00 PM')
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
context 'minutes past the hour:' do
|
325
|
+
it 'minutes past the hour 5,10' do
|
326
|
+
expect(desc('5,10 0 * * *')).to eq('Alle(ai) 05 e 10 minuti dopo l\'ora')
|
327
|
+
end
|
328
|
+
|
329
|
+
it 'minutes past the hour 5,10 day 2' do
|
330
|
+
expect(desc('5,10 0 2 * *')).to eq('Alle(ai) 05 e 10 minuti dopo l\'ora, il giorno 2 del mese')
|
331
|
+
end
|
332
|
+
|
333
|
+
it 'minutes past the hour 5/10 day 2' do
|
334
|
+
expect(desc('5/10 0 2 * *')).to eq('Ogni 10 minuti, a partire da alle(ai) 05 minuti dopo l\'ora, il giorno 2 del mese')
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
context 'seconds past the minute:' do
|
339
|
+
it 'seconds past the minute 5,6' do
|
340
|
+
expect(desc('5,6 0 0 * * *')).to eq('A 5 e 6 secondi dopo il minuto')
|
341
|
+
end
|
342
|
+
|
343
|
+
it 'seconds past the minute 5,6 at 1' do
|
344
|
+
expect(desc('5,6 0 1 * * *')).to eq('A 5 e 6 secondi dopo il minuto, alle(ai) 1:00 AM')
|
345
|
+
end
|
346
|
+
|
347
|
+
it 'seconds past the minute 5,6 day 2' do
|
348
|
+
expect(desc('5,6 0 0 2 * *')).to eq('A 5 e 6 secondi dopo il minuto, il giorno 2 del mese')
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
context 'increments starting at X > 1:' do
|
353
|
+
it 'second increments' do
|
354
|
+
expect(desc('5/15 0 * * * *')).to eq('Ogni 15 secondi, a partire da a 5 secondi dopo il minuto')
|
355
|
+
end
|
356
|
+
|
357
|
+
it 'minute increments' do
|
358
|
+
expect(desc('30/10 * * * *')).to eq('Ogni 10 minuti, a partire da alle(ai) 30 minuti dopo l\'ora')
|
359
|
+
end
|
360
|
+
|
361
|
+
it 'hour increments' do
|
362
|
+
expect(desc('0 30 2/6 * * ?')).to eq('Alle(ai) 30 minuti dopo l\'ora, ogni 6 ore, a partire da alle(ai) 2:00 AM')
|
363
|
+
end
|
364
|
+
|
365
|
+
it 'day of month increments' do
|
366
|
+
expect(desc('0 30 8 2/7 * *')).to eq('Alle(ai) 8:30 AM, ogni 7 giorni, a partire da il giorno 2 del mese')
|
367
|
+
end
|
368
|
+
|
369
|
+
it 'day of week increments' do
|
370
|
+
expect(desc('0 30 11 * * 2/2')).to eq('Alle(ai) 11:30 AM, 2 giorni alla settimana, a partire da il martedì')
|
371
|
+
end
|
372
|
+
|
373
|
+
it 'month increments' do
|
374
|
+
expect(desc('0 20 10 * 2/3 THU')).to eq('Alle(ai) 10:20 AM, solo di giovedì, ogni 3 mesi, a partire da febbraio')
|
375
|
+
end
|
376
|
+
|
377
|
+
it 'year increments' do
|
378
|
+
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('Alle(ai) 12:00 AM, il giorno 1 del mese, solo a(nel) marzo, ogni 5 anni, a partire da 2010')
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
context 'timezone' do
|
383
|
+
it 'minute span' do
|
384
|
+
tz = TZInfo::Timezone.get('America/Los_Angeles')
|
385
|
+
hour = tz.period_for_local(Time.now).zone_identifier.to_s == 'PDT' ? 4 : 3
|
386
|
+
expect(desc('0-10 11 * * *', {}, 'America/Los_Angeles')).to eq("Ogni minuto tra le #{hour}:00 AM e le #{hour}:10 AM")
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'twice a day' do
|
390
|
+
tz = TZInfo::Timezone.get('America/Los_Angeles')
|
391
|
+
hour = tz.period_for_local(Time.now).zone_identifier.to_s == 'PDT' ? 5 : 4
|
392
|
+
expect(desc('0 0,12 * * *', {}, 'America/Los_Angeles')).to eq("Alle(ai) #{hour}:00 PM e #{hour}:00 AM")
|
393
|
+
end
|
394
|
+
|
395
|
+
it 'ahead of GMT' do
|
396
|
+
tz = TZInfo::Timezone.get('Europe/Vienna')
|
397
|
+
hour = tz.period_for_local(Time.now).zone_identifier.to_s == 'CEST' ? 1 : 12
|
398
|
+
expect(desc('0-10 11 * * *', {}, 'Europe/Vienna')).to eq("Ogni minuto tra le #{hour}:00 PM e le #{hour}:10 PM")
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
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.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Kazaku
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 12.3.3
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 12.3.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- resources/resources_de.yml
|
117
117
|
- resources/resources_en.yml
|
118
118
|
- resources/resources_fr.yml
|
119
|
+
- resources/resources_it.yml
|
119
120
|
- resources/resources_pt_BR.yml
|
120
121
|
- resources/resources_ro.yml
|
121
122
|
- resources/resources_ru.yml
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- spec/exp_descriptor_de_spec.rb
|
124
125
|
- spec/exp_descriptor_en_spec.rb
|
125
126
|
- spec/exp_descriptor_fr_spec.rb
|
127
|
+
- spec/exp_descriptor_it_spec.rb
|
126
128
|
- spec/exp_descriptor_pt_BR_spec.rb
|
127
129
|
- spec/exp_descriptor_ro_spec.rb
|
128
130
|
- spec/exp_descriptor_ru_spec.rb
|
@@ -156,6 +158,7 @@ test_files:
|
|
156
158
|
- spec/exp_descriptor_de_spec.rb
|
157
159
|
- spec/exp_descriptor_en_spec.rb
|
158
160
|
- spec/exp_descriptor_fr_spec.rb
|
161
|
+
- spec/exp_descriptor_it_spec.rb
|
159
162
|
- spec/exp_descriptor_pt_BR_spec.rb
|
160
163
|
- spec/exp_descriptor_ro_spec.rb
|
161
164
|
- spec/exp_descriptor_ru_spec.rb
|