cronex 0.9.0 → 0.11.1

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
- SHA1:
3
- metadata.gz: f040a0dcd99a71f33ee446cc79a335d3d8fc52b1
4
- data.tar.gz: 81f0db030c4c4ac38bc3175e6899a0f8499758c7
2
+ SHA256:
3
+ metadata.gz: 5326f654a688b504da9a79818cc3ae5c9e5b36797246ef53d8311946543c5432
4
+ data.tar.gz: 5609b37b9e49f3a850937df6c912236e737def16c397a556fa549e173867aab3
5
5
  SHA512:
6
- metadata.gz: c21b947a64e2de555953c55c6419ad0b1a10c15c71ac96356ff0aea45f41bcf4ea6c78f6ef46e7b7102cc189b48fc7a1db3db9a6f160da88e6567371de1094aa
7
- data.tar.gz: 24c933580f5903618810c9940aae4880800e7167dc6191f86e3b2de11937a3ad484f2a7b1702b49f35102aca3b424d156efb4ed172164fa9592cbee7ed7e9787
6
+ metadata.gz: c2a0b1c000223a3c63c6b74c3f479a6be6e21534db10c7abaac4c329d11b5c06d425173c82f527ffef0f333e1a632974bceaf520f5fbe21f82c63a490a46c3cd
7
+ data.tar.gz: d80c695bbac875c1fc77ab5681e56261aa5161327baa6c45110b050156448f8a8bf7fa89762a59fec7809b2ef113483137629cddedf88b979105d239c26dd420
@@ -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
- EmptyLinesAroundBody:
21
+ Layout/EmptyLinesAroundBlockBody:
22
22
  Enabled: false
23
23
 
24
- ClassLength:
24
+ Layout/EmptyLinesAroundClassBody:
25
25
  Enabled: false
26
26
 
27
- LineLength:
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
@@ -1,3 +1,18 @@
1
+ ### [0.11.1] - 2020-10-21
2
+ * Fix two consecutive commas in interval expressions
3
+
4
+ ### [0.11.0] - 2020-10-05
5
+ * Fix handling L in day of month expressions
6
+
7
+ ### [0.10.0] - 2020-05-26
8
+ * Move locale and timezone arguments to options
9
+
10
+ ### [0.9.2] - 2020-04-24
11
+ * Add italian locale
12
+
13
+ ### [0.9.1] - 2019-11-26
14
+ * Update tzinfo dependency
15
+
1
16
  ### [0.9.0] - 2019-04-21
2
17
  * Add german locale
3
18
 
data/README.md CHANGED
@@ -18,7 +18,7 @@ Original Author & Credit: Brady Holt (http://www.geekytidbits.com).
18
18
  * Supports printing to locale specific human readable format
19
19
  * Supports displaying times in specific timezones
20
20
 
21
- For a quick intro to cron see Quartz [Cron Tutorial](http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger).
21
+ For a quick intro to cron see Quartz [Cron Tutorial](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html).
22
22
 
23
23
  ## Available Locales
24
24
 
@@ -26,6 +26,7 @@ For a quick intro to cron see Quartz [Cron Tutorial](http://www.quartz-scheduler
26
26
  * Brazilian
27
27
  * French
28
28
  * German
29
+ * Italian
29
30
  * Romanian
30
31
  * Russian
31
32
 
@@ -60,12 +61,12 @@ Or install it yourself as:
60
61
 
61
62
  #### Localization
62
63
 
63
- Cronex::ExpressionDescriptor.new('30 2 * 2 1-5', {}, 'fr').description
64
+ Cronex::ExpressionDescriptor.new('30 2 * 2 1-5', locale: 'fr').description
64
65
  => À 2:30 AM, lundi à vendredi, seulement en février
65
66
 
66
67
  #### Timezones
67
68
 
68
- Cronex::ExpressionDescriptor.new('0-10 11 * * *', {}, 'en', 'America/Los_Angeles').description
69
+ Cronex::ExpressionDescriptor.new('0-10 11 * * *', timezone: 'America/Los_Angeles').description
69
70
  => Every minute between 4:00 AM and 4:10 AM # PDT or
70
71
  => Every minute between 3:00 AM and 3:10 AM # PST
71
72
 
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = spec.files.grep(/^(test|spec|features)\//)
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_runtime_dependency 'tzinfo', '~> 1.2.5'
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', '~> 10.1'
26
+ spec.add_development_dependency 'rake', '>= 12.3.3'
27
27
  spec.add_development_dependency 'rspec', '~> 3.1'
28
28
  end
@@ -12,11 +12,11 @@ module Cronex
12
12
  ['/', '-', ',']
13
13
  end
14
14
 
15
- def segment_description(expression, all_description)
15
+ def segment_description(expression, all_values_description)
16
16
  if expression.empty? || expression == '0'
17
17
  desc = ''
18
18
  elsif expression == '*'
19
- desc = all_description
19
+ desc = all_values_description
20
20
  elsif !Cronex::Utils.include_any?(expression, special_chars)
21
21
  desc = format(description_format(expression), single_item_description(expression))
22
22
  elsif expression.include?('/')
@@ -26,10 +26,12 @@ module Cronex
26
26
  if segments[0].include?('-')
27
27
  between_segment_of_interval = segments[0]
28
28
  between_segments = between_segment_of_interval.split('-')
29
- desc += ', ' + format(
29
+ between = format(
30
30
  between_description_format(between_segment_of_interval),
31
31
  single_item_description(between_segments[0]),
32
32
  single_item_description(between_segments[1]).gsub(':00', ':59'))
33
+ desc += ', ' if !between.start_with?(', ')
34
+ desc += between
33
35
  elsif !Cronex::Utils.include_any?(segments[0], special_chars + ['*'])
34
36
  desc += ', ' + format(starting_description_format(segments[0]), single_item_description(segments[0]))
35
37
  end
@@ -1,7 +1,7 @@
1
1
  module Cronex
2
2
  class DayOfMonthDescription < Description
3
3
  def single_item_description(expression)
4
- expression
4
+ expression == 'L' ? resources.get('last_day') : expression
5
5
  end
6
6
 
7
7
  def interval_description_format(expression)
@@ -12,19 +12,21 @@ module Cronex
12
12
  verbose: false,
13
13
  zero_based_dow: true,
14
14
  use_24_hour_time_format: false,
15
- throw_exception_on_parse_error: true
15
+ throw_exception_on_parse_error: true,
16
+ locale: nil,
17
+ timezone: nil
16
18
  }
17
19
 
18
20
  class ExpressionDescriptor
19
21
  attr_accessor :expression, :expression_parts, :options, :parsed, :resources, :timezone
20
22
 
21
- def initialize(expression, options = {}, locale = nil, timezone = 'UTC')
23
+ def initialize(expression, options = {})
22
24
  @expression = expression
23
25
  @options = CRONEX_OPTS.merge(options)
24
26
  @expression_parts = []
25
27
  @parsed = false
26
- @resources = Cronex::Resource.new(locale)
27
- @timezone = timezone
28
+ @resources = Cronex::Resource.new(@options[:locale])
29
+ @timezone = @options[:timezone] || 'UTC'
28
30
  end
29
31
 
30
32
  def to_hash
@@ -1,3 +1,3 @@
1
1
  module Cronex
2
- VERSION = '0.9.0'
2
+ VERSION = '0.11.1'
3
3
  end
@@ -16,6 +16,7 @@ past_the_hour: 'vergangene Stunde'
16
16
  at_x_seconds_past_the_minute: 'am %s Sekunden nach der vergangenen Minute'
17
17
  minutes_through_past_the_hour: 'Minuten %s bis %s nach der vergangenen Stunde'
18
18
  on_day_of_the_month: 'am %s Tag des Monats'
19
+ last_day: 'der letzte Tag'
19
20
  first_weekday: 'Erster Wochentag'
20
21
  weekday_nearest_day: 'Wochentag zum nächsten Tag %s'
21
22
  starting: 'beginnend'
@@ -16,6 +16,7 @@ past_the_hour: 'past the hour'
16
16
  at_x_seconds_past_the_minute: 'at %s seconds past the minute'
17
17
  minutes_through_past_the_hour: 'minutes %s through %s past the hour'
18
18
  on_day_of_the_month: 'on day %s of the month'
19
+ last_day: 'the last day'
19
20
  first_weekday: 'first weekday'
20
21
  weekday_nearest_day: 'weekday nearest day %s'
21
22
  starting: 'starting'
@@ -9,13 +9,14 @@ on_the_of_the_month: 'le %s du mois'
9
9
  on_the_last_of_the_month: 'le dernier %s du mois'
10
10
  on_the_last_day_of_the_month: 'le dernier jour du mois'
11
11
  on_the_last_weekday_of_the_month: 'le dernier jour en semaine du mois'
12
- between_days_of_the_month: 'entre le %s et le %s du mois'
12
+ between_days_of_the_month: 'entre le jour %s et le %s du mois'
13
13
  seconds_through_past_the_minute: 'secondes %s à %s après la minute'
14
14
  between_x_and_y: 'entre %s et %s'
15
15
  past_the_hour: "après l'heure"
16
16
  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
+ last_day: 'dernier jour'
19
20
  first_weekday: 'premier jour de la semaine'
20
21
  weekday_nearest_day: 'jour de semaine le plus proche du %s'
21
22
  starting: 'commence' # départ
@@ -0,0 +1,76 @@
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 %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
+ last_day: 'ultimo giorno'
20
+ first_weekday: 'il primo giorno della settimana lavorativa'
21
+ weekday_nearest_day: 'il prossimo giorno %s della settimana lavorativa'
22
+ starting: 'a partire da'
23
+ only_on: 'solo di %s'
24
+ only_in: 'solo a(nel) %s'
25
+ every_x_seconds: 'ogni %s secondi'
26
+ every_minute_between: 'ogni minuto tra le %s e le %s'
27
+ every_second: 'ogni secondo'
28
+ every_minute: 'ogni minuto'
29
+ every_1_minute: 'ogni minuto'
30
+ every_hour: 'ogni ora'
31
+ every_1_hour: 'ogni ora'
32
+ every_day: 'ogni giorno'
33
+ every_1_day: 'ogni giorno'
34
+ every_year: 'ogni anno'
35
+ every_x: 'ogni %s'
36
+ at_x: 'alle(ai) %s'
37
+ on_x: 'il %s'
38
+ in_x: '%s'
39
+ first: primo
40
+ second: secondo
41
+ third: terzo
42
+ fourth: quarto
43
+ fifth: quinto
44
+ time_pm: pomeriggio
45
+ time_am: mattino
46
+ and: e
47
+ at: alle(ai)
48
+ day: giorno
49
+ days: giorni
50
+ hour: ora
51
+ hours: ore
52
+ minute: minuto
53
+ minutes: minuti
54
+ month: mese
55
+ months: mesi
56
+ year: anno
57
+ years: anni
58
+ monday: lunedì
59
+ tuesday: martedì
60
+ wednesday: mercoledì
61
+ thursday: giovedì
62
+ friday: venerdì
63
+ saturday: sabato
64
+ sunday: domenica
65
+ january: gennaio
66
+ february: febbraio
67
+ march: marzo
68
+ april: aprile
69
+ may: maggio
70
+ june: giugno
71
+ july: luglio
72
+ august: agosto
73
+ september: settembre
74
+ october: ottobre
75
+ november: novembre
76
+ december: dicembre
@@ -16,6 +16,7 @@ past_the_hour: 'após a hora'
16
16
  at_x_seconds_past_the_minute: '%s segundos após o minuto'
17
17
  minutes_through_past_the_hour: 'entre %s e %s minutos após a hora'
18
18
  on_day_of_the_month: 'no dia %s do mês'
19
+ last_day: 'último dia'
19
20
  first_weekday: 'primeiro dia útil'
20
21
  weekday_nearest_day: 'dia útil mais próximo a %s'
21
22
  starting: 'iniciando'
@@ -9,13 +9,14 @@ on_the_of_the_month: 'în %s ale lunii'
9
9
  on_the_last_of_the_month: 'în ultima %s din lună'
10
10
  on_the_last_day_of_the_month: 'în ultima zi a lunii'
11
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'
12
+ between_days_of_the_month: 'între zilele %s și %s a lunii'
13
13
  seconds_through_past_the_minute: 'între secundele %s și %s'
14
14
  between_x_and_y: 'între %s și %s'
15
15
  past_the_hour: 'în fiecare oră'
16
16
  at_x_seconds_past_the_minute: 'la secunda %s'
17
17
  minutes_through_past_the_hour: 'între minutele %s și %s'
18
18
  on_day_of_the_month: 'în a %s-a zi a lunii'
19
+ last_day: 'ultima zi'
19
20
  first_weekday: 'prima zi din săptămână'
20
21
  weekday_nearest_day: 'cea mai apropiată %s din săptămână'
21
22
  starting: pornire
@@ -9,13 +9,14 @@ on_the_of_the_month: 'в %s месяца'
9
9
  on_the_last_of_the_month: 'в последний %s месяца'
10
10
  on_the_last_day_of_the_month: 'в последний день месяца'
11
11
  on_the_last_weekday_of_the_month: 'в последний будний день месяца'
12
- between_days_of_the_month: 'с %s по %s число месяца'
12
+ between_days_of_the_month: 'между %s днем и %s днем месяца'
13
13
  seconds_through_past_the_minute: 'секунды с %s по %s'
14
- between_x_and_y: 'с %s по %s'
14
+ between_x_and_y: 'между %s и %s'
15
15
  past_the_hour: 'часа'
16
16
  at_x_seconds_past_the_minute: 'в %s секунд'
17
17
  minutes_through_past_the_hour: 'минуты с %s по %s'
18
- on_day_of_the_month: '%s число месяца'
18
+ on_day_of_the_month: '%s день месяца'
19
+ last_day: 'последним'
19
20
  first_weekday: 'первый будний день'
20
21
  weekday_nearest_day: 'ближайший будний день к %s'
21
22
  starting: начало
@@ -4,8 +4,9 @@ require 'cronex'
4
4
  module Cronex
5
5
  describe ExpressionDescriptor do
6
6
 
7
- def desc(expression, opts = {}, timezone = 'UTC')
8
- Cronex::ExpressionDescriptor.new(expression, opts, 'de', timezone).description
7
+ def desc(expression, opts = {})
8
+ opts[:locale] = 'de'
9
+ Cronex::ExpressionDescriptor.new(expression, opts).description
9
10
  end
10
11
 
11
12
  let(:opts) { { zero_based_dow: false } }
@@ -238,8 +239,14 @@ module Cronex
238
239
  end
239
240
  end
240
241
 
241
- it 'last day of the month' do
242
- expect(desc('*/5 * L JAN *')).to eq('Alle 5 Minuten, am letzten Tag des Monats, nur in Januar')
242
+ context 'last day of the month:' do
243
+ it 'on the last day of the month' do
244
+ expect(desc('*/5 * L JAN *')).to eq('Alle 5 Minuten, am letzten Tag des Monats, nur in Januar')
245
+ end
246
+
247
+ it 'between a day and last day of the month' do
248
+ expect(desc('*/5 * 23-L JAN *')).to eq('Alle 5 Minuten, zwischen Tag 23 und der letzte Tag des Monats, nur in Januar')
249
+ end
243
250
  end
244
251
 
245
252
  it 'time of day with seconds' do
@@ -291,6 +298,10 @@ module Cronex
291
298
  'Alle 2 Minuten, Minuten 00 bis 30 nach der vergangenen Stunde, um 5:00 PM, Montag bis Freitag')
292
299
  end
293
300
 
301
+ it 'every x days with interval' do
302
+ expect(desc('30 7 1-L/2 * *')).to eq('Um 7:30 AM, Alle 2 Tagen, zwischen Tag 1 und der letzte Tag des Monats')
303
+ end
304
+
294
305
  it 'one year only with seconds' do
295
306
  expect(desc('* * * * * * 2013')).to eq('Jede Sekunde, nur in 2013')
296
307
  end
@@ -4,8 +4,9 @@ require 'cronex'
4
4
  module Cronex
5
5
  describe ExpressionDescriptor do
6
6
 
7
- def desc(expression, opts = {}, timezone = 'UTC')
8
- Cronex::ExpressionDescriptor.new(expression, opts, 'en', timezone).description
7
+ def desc(expression, opts = {})
8
+ opts[:locale] = 'en'
9
+ Cronex::ExpressionDescriptor.new(expression, opts).description
9
10
  end
10
11
 
11
12
  let(:opts) { { zero_based_dow: false } }
@@ -238,8 +239,14 @@ module Cronex
238
239
  end
239
240
  end
240
241
 
241
- it 'last day of the month' do
242
- expect(desc('*/5 * L JAN *')).to eq('Every 5 minutes, on the last day of the month, only in January')
242
+ context 'last day of the month:' do
243
+ it 'on the last day of the month' do
244
+ expect(desc('*/5 * L JAN *')).to eq('Every 5 minutes, on the last day of the month, only in January')
245
+ end
246
+
247
+ it 'between a day and last day of the month' do
248
+ expect(desc('*/5 * 23-L JAN *')).to eq('Every 5 minutes, between day 23 and the last day of the month, only in January')
249
+ end
243
250
  end
244
251
 
245
252
  it 'time of day with seconds' do
@@ -291,6 +298,10 @@ module Cronex
291
298
  'Every 2 minutes, minutes 00 through 30 past the hour, at 5:00 PM, Monday through Friday')
292
299
  end
293
300
 
301
+ it 'every x days with interval' do
302
+ expect(desc('30 7 1-L/2 * *')).to eq('At 7:30 AM, every 2 days, between day 1 and the last day of the month')
303
+ end
304
+
294
305
  it 'one year only with seconds' do
295
306
  expect(desc('* * * * * * 2013')).to eq('Every second, only in 2013')
296
307
  end
@@ -383,19 +394,19 @@ module Cronex
383
394
  it 'minute span' do
384
395
  tz = TZInfo::Timezone.get('America/Los_Angeles')
385
396
  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("Every minute between #{hour}:00 AM and #{hour}:10 AM")
397
+ expect(desc('0-10 11 * * *', timezone: 'America/Los_Angeles')).to eq("Every minute between #{hour}:00 AM and #{hour}:10 AM")
387
398
  end
388
399
 
389
400
  it 'twice a day' do
390
401
  tz = TZInfo::Timezone.get('America/Los_Angeles')
391
402
  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("At #{hour}:00 PM and #{hour}:00 AM")
403
+ expect(desc('0 0,12 * * *', timezone: 'America/Los_Angeles')).to eq("At #{hour}:00 PM and #{hour}:00 AM")
393
404
  end
394
405
 
395
406
  it 'ahead of GMT' do
396
407
  tz = TZInfo::Timezone.get('Europe/Vienna')
397
408
  hour = tz.period_for_local(Time.now).zone_identifier.to_s == 'CEST' ? 1 : 12
398
- expect(desc('0-10 11 * * *', {}, 'Europe/Vienna')).to eq("Every minute between #{hour}:00 PM and #{hour}:10 PM")
409
+ expect(desc('0-10 11 * * *', timezone: 'Europe/Vienna')).to eq("Every minute between #{hour}:00 PM and #{hour}:10 PM")
399
410
  end
400
411
  end
401
412
  end
@@ -5,7 +5,8 @@ module Cronex
5
5
  describe ExpressionDescriptor do
6
6
 
7
7
  def desc(expression, opts = {})
8
- Cronex::ExpressionDescriptor.new(expression, opts, 'fr').description
8
+ opts[:locale] = 'fr'
9
+ Cronex::ExpressionDescriptor.new(expression, opts).description
9
10
  end
10
11
 
11
12
  let(:opts) { { zero_based_dow: false } }
@@ -238,8 +239,14 @@ module Cronex
238
239
  end
239
240
  end
240
241
 
241
- it 'last day of the month' do
242
- expect(desc('*/5 * L JAN *')).to eq('Tous les 5 minutes, le dernier jour du mois, seulement en janvier')
242
+ context 'last day of the month:' do
243
+ it 'on the last day of the month' do
244
+ expect(desc('*/5 * L JAN *')).to eq('Tous les 5 minutes, le dernier jour du mois, seulement en janvier')
245
+ end
246
+
247
+ it 'between a day and last day of the month' do
248
+ expect(desc('*/5 * 23-L JAN *')).to eq('Tous les 5 minutes, entre le jour 23 et le dernier jour du mois, seulement en janvier')
249
+ end
243
250
  end
244
251
 
245
252
  it 'time of day with seconds' do
@@ -270,7 +277,7 @@ module Cronex
270
277
 
271
278
  it 'between with interval' do
272
279
  expect(desc('2-59/3 1,9,22 11-26 1-6 ?')).to eq(
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")
280
+ "Tous les 3 minutes, minutes 02 à 59 après l'heure, à 1:00 AM, 9:00 AM et 10:00 PM, entre le jour 11 et le 26 du mois, janvier à juin")
274
281
  end
275
282
 
276
283
  it 'recurring first of month' do
@@ -291,6 +298,10 @@ module Cronex
291
298
  "Tous les 2 minutes, minutes 00 à 30 après l'heure, à 5:00 PM, lundi à vendredi")
292
299
  end
293
300
 
301
+ it 'every x days with interval' do
302
+ expect(desc('30 7 1-L/2 * *')).to eq('À 7:30 AM, tous les 2 jours, entre le jour 1 et le dernier jour du mois')
303
+ end
304
+
294
305
  it 'one year only with seconds' do
295
306
  expect(desc('* * * * * * 2013')).to eq('Chaque seconde, seulement en 2013')
296
307
  end
@@ -0,0 +1,393 @@
1
+ # encoding: utf-8
2
+ require 'cronex'
3
+
4
+ module Cronex
5
+ describe ExpressionDescriptor do
6
+
7
+ def desc(expression, opts = {})
8
+ opts[:locale] = 'it'
9
+ Cronex::ExpressionDescriptor.new(expression, opts).description
10
+ end
11
+
12
+ let(:opts) { { zero_based_dow: false } }
13
+
14
+ it 'every second' do
15
+ expect(desc('* * * * * *')).to eq('Ogni secondo')
16
+ end
17
+
18
+ it 'every 45 seconds' do
19
+ expect(desc('*/45 * * * * *')).to eq('Ogni 45 secondi')
20
+ end
21
+
22
+ it 'minute span' do
23
+ expect(desc('0-10 11 * * *')).to eq('Ogni minuto tra le 11:00 AM e le 11:10 AM')
24
+ end
25
+
26
+ context 'every minute' do
27
+ it 'every minute' do
28
+ expect(desc('* * * * *')).to eq('Ogni minuto')
29
+ end
30
+
31
+ it 'every minute */1' do
32
+ expect(desc('*/1 * * * *')).to eq('Ogni minuto')
33
+ end
34
+
35
+ it 'every minute 0 0/1' do
36
+ expect(desc('0 0/1 * * * ?')).to eq('Ogni minuto')
37
+ end
38
+ end
39
+
40
+ context 'every X minutes:' do
41
+ it 'every 5 minuti' do
42
+ expect(desc('*/5 * * * *')).to eq('Ogni 5 minuti')
43
+ end
44
+
45
+ it 'every 5 minute 0 */5' do
46
+ expect(desc('0 */5 * * * *')).to eq('Ogni 5 minuti')
47
+ end
48
+
49
+ it 'every 10 minutes 0 0/10' do
50
+ expect(desc('0 0/10 * * * ?')).to eq('Ogni 10 minuti')
51
+ end
52
+ end
53
+
54
+ context 'every hour:' do
55
+ it 'every hour 0 0' do
56
+ expect(desc('0 0 * * * ?')).to eq('Ogni ora')
57
+ end
58
+
59
+ it 'every hour 0 0 0/1' do
60
+ expect(desc('0 0 0/1 * * ?')).to eq('Ogni ora')
61
+ end
62
+ end
63
+
64
+ context 'daily:' do
65
+ it 'daily at /\d\d/:/\d\d/' do
66
+ expect(desc('30 11 * * *')).to eq('Alle(ai) 11:30 AM')
67
+ end
68
+
69
+ it 'daily at /\d/:/\d/' do
70
+ expect(desc('9 8 * * *')).to eq('Alle(ai) 8:09 AM')
71
+ end
72
+
73
+ it 'daily at /0[89]/:/0[89]/' do
74
+ expect(desc('09 08 * * *')).to eq('Alle(ai) 8:09 AM')
75
+ end
76
+
77
+ it 'daily at /0[1-7]/ /0[1-7/' do
78
+ expect(desc('02 01 * * *')).to eq('Alle(ai) 1:02 AM')
79
+ end
80
+ end
81
+
82
+ context 'time of day certain days of week:' do
83
+ it 'time of day on MON-FRI' do
84
+ expect(desc('0 23 ? * MON-FRI')).to eq('Alle(ai) 11:00 PM, da lunedì a venerdì')
85
+ end
86
+
87
+ it 'time of day on 1-5' do
88
+ expect(desc('30 11 * * 1-5')).to eq('Alle(ai) 11:30 AM, da lunedì a venerdì')
89
+ end
90
+ end
91
+
92
+ it 'one month only' do
93
+ expect(desc('* * * 3 *')).to eq('Ogni minuto, solo a(nel) marzo')
94
+ end
95
+
96
+ it 'two months only' do
97
+ expect(desc('* * * 3,6 *')).to eq('Ogni minuto, solo a(nel) marzo e giugno')
98
+ end
99
+
100
+ it 'two times each afternoon' do
101
+ expect(desc('30 14,16 * * *')).to eq('Alle(ai) 2:30 PM e 4:30 PM')
102
+ end
103
+
104
+ it 'three times daily' do
105
+ expect(desc('30 6,14,16 * * *')).to eq('Alle(ai) 6:30 AM, 2:30 PM e 4:30 PM')
106
+ end
107
+
108
+ context 'once a week:' do
109
+ it 'once a week 0' do
110
+ expect(desc('46 9 * * 0')).to eq('Alle(ai) 9:46 AM, solo di domenica')
111
+ end
112
+
113
+ it 'once a week SUN' do
114
+ expect(desc('46 9 * * SUN')).to eq('Alle(ai) 9:46 AM, solo di domenica')
115
+ end
116
+
117
+ it 'once a week 7' do
118
+ expect(desc('46 9 * * 7')).to eq('Alle(ai) 9:46 AM, solo di domenica')
119
+ end
120
+
121
+ it 'once a week 1' do
122
+ expect(desc('46 9 * * 1')).to eq('Alle(ai) 9:46 AM, solo di lunedì')
123
+ end
124
+
125
+ it 'once a week 6' do
126
+ expect(desc('46 9 * * 6')).to eq('Alle(ai) 9:46 AM, solo di sabato')
127
+ end
128
+ end
129
+
130
+ context 'once a week non zero based:' do
131
+ it 'once a week 1' do
132
+ expect(desc('46 9 * * 1', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica')
133
+ end
134
+
135
+ it 'once a week SUN' do
136
+ expect(desc('46 9 * * SUN', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica')
137
+ end
138
+
139
+ it 'once a week 2' do
140
+ expect(desc('46 9 * * 2', opts)).to eq('Alle(ai) 9:46 AM, solo di lunedì')
141
+ end
142
+
143
+ it 'once a week 7' do
144
+ expect(desc('46 9 * * 7', opts)).to eq('Alle(ai) 9:46 AM, solo di sabato')
145
+ end
146
+ end
147
+
148
+ context 'twice a week:' do
149
+ it 'twice a week 1,2' do
150
+ expect(desc('46 9 * * 1,2')).to eq('Alle(ai) 9:46 AM, solo di lunedì e martedì')
151
+ end
152
+
153
+ it 'twice a week MON,TUE' do
154
+ expect(desc('46 9 * * MON,TUE')).to eq('Alle(ai) 9:46 AM, solo di lunedì e martedì')
155
+ end
156
+
157
+ it 'twice a week 0,6' do
158
+ expect(desc('46 9 * * 0,6')).to eq('Alle(ai) 9:46 AM, solo di domenica e sabato')
159
+ end
160
+
161
+ it 'twice a week 6,7' do
162
+ expect(desc('46 9 * * 6,7')).to eq('Alle(ai) 9:46 AM, solo di sabato e domenica')
163
+ end
164
+ end
165
+
166
+ context 'twice a week non zero based:' do
167
+ it 'twice a week 1,2' do
168
+ expect(desc('46 9 * * 1,2', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica e lunedì')
169
+ end
170
+
171
+ it 'twice a week SUN,MON' do
172
+ expect(desc('46 9 * * SUN,MON', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica e lunedì')
173
+ end
174
+
175
+ it 'twice a week 6,7' do
176
+ expect(desc('46 9 * * 6,7', opts)).to eq('Alle(ai) 9:46 AM, solo di venerdì e sabato')
177
+ end
178
+ end
179
+
180
+ it 'day of month' do
181
+ expect(desc('23 12 15 * *')).to eq('Alle(ai) 12:23 PM, il giorno 15 del mese')
182
+ end
183
+
184
+ it 'day of month with day of week' do
185
+ expect(desc('23 12 15 * SUN')).to eq('Alle(ai) 12:23 PM, il giorno 15 del mese, solo di domenica')
186
+ end
187
+
188
+ it 'month name' do
189
+ expect(desc('23 12 * JAN *')).to eq('Alle(ai) 12:23 PM, solo a(nel) gennaio')
190
+ end
191
+
192
+ it 'day of month with question mark' do
193
+ expect(desc('23 12 ? JAN *')).to eq('Alle(ai) 12:23 PM, solo a(nel) gennaio')
194
+ end
195
+
196
+ it 'month name range 2' do
197
+ expect(desc('23 12 * JAN-FEB *')).to eq('Alle(ai) 12:23 PM, da gennaio a febbraio')
198
+ end
199
+
200
+ it 'month name range 3' do
201
+ expect(desc('23 12 * JAN-MAR *')).to eq('Alle(ai) 12:23 PM, da gennaio a marzo')
202
+ end
203
+
204
+ it 'day of week name' do
205
+ expect(desc('23 12 * * SUN')).to eq('Alle(ai) 12:23 PM, solo di domenica')
206
+ end
207
+
208
+ context 'day of week range:' do
209
+ it 'day of week range MON-FRI' do
210
+ expect(desc('*/5 15 * * MON-FRI')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da lunedì a venerdì')
211
+ end
212
+
213
+ it 'day of week range 0-6' do
214
+ expect(desc('*/5 15 * * 0-6')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da domenica a sabato')
215
+ end
216
+
217
+ it 'day of week range 6-7' do
218
+ expect(desc('*/5 15 * * 6-7')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da sabato a domenica')
219
+ end
220
+ end
221
+
222
+ context 'day of week once in month:' do
223
+ it 'day of week once MON#3' do
224
+ expect(desc('* * * * MON#3')).to eq('Ogni minuto, il(la) terzo(a) lunedì del mese')
225
+ end
226
+
227
+ it 'day of week once 0#3' do
228
+ expect(desc('* * * * 0#3')).to eq('Ogni minuto, il(la) terzo(a) domenica del mese')
229
+ end
230
+ end
231
+
232
+ context 'last day of week del mese:' do
233
+ it 'last day of week 4L' do
234
+ expect(desc('* * * * 4L')).to eq('Ogni minuto, l\'ultimo(a) giovedì del mese')
235
+ end
236
+
237
+ it 'last day of week 0L' do
238
+ expect(desc('* * * * 0L')).to eq('Ogni minuto, l\'ultimo(a) domenica del mese')
239
+ end
240
+ end
241
+
242
+ context 'last day of the month:' do
243
+ it 'on the last day of the month' do
244
+ expect(desc('*/5 * L JAN *')).to eq('Ogni 5 minuti, l\'ultimo giorno del mese, solo a(nel) gennaio')
245
+ end
246
+
247
+ it 'between a day and last day of the month' do
248
+ expect(desc('*/5 * 23-L JAN *')).to eq('Ogni 5 minuti, tra il giorno 23 e il ultimo giorno del mese, solo a(nel) gennaio')
249
+ end
250
+ end
251
+
252
+ it 'time of day with seconds' do
253
+ expect(desc('30 02 14 * * *')).to eq('Alle(ai) 2:02:30 PM')
254
+ end
255
+
256
+ it 'second intervals' do
257
+ expect(desc('5-10 * * * * *')).to eq('Dal secondo 5 al 10 dopo il minuto')
258
+ end
259
+
260
+ it 'second minutes hours intervals' do
261
+ expect(desc('5-10 30-35 10-12 * * *')).to eq(
262
+ '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')
263
+ end
264
+
265
+ it 'every 5 minutes at 30 seconds' do
266
+ expect(desc('30 */5 * * * *')).to eq('A 30 secondi dopo il minuto, ogni 5 minuti')
267
+ end
268
+
269
+ it 'minutes past the hour range' do
270
+ expect(desc('0 30 10-13 ? * WED,FRI')).to eq(
271
+ 'Alle(ai) 30 minuti dopo l\'ora, tra le 10:00 AM e le 1:59 PM, solo di mercoledì e venerdì')
272
+ end
273
+
274
+ it 'seconds past the minute interval' do
275
+ expect(desc('10 0/5 * * * ?')).to eq('A 10 secondi dopo il minuto, ogni 5 minuti')
276
+ end
277
+
278
+ it 'between with interval' do
279
+ expect(desc('2-59/3 1,9,22 11-26 1-6 ?')).to eq(
280
+ '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 26 del mese, da gennaio a giugno')
281
+ end
282
+
283
+ it 'recurring first of month' do
284
+ expect(desc('0 0 6 1/1 * ?')).to eq('Alle(ai) 6:00 AM')
285
+ end
286
+
287
+ it 'minutes past the hour' do
288
+ expect(desc('0 5 0/1 * * ?')).to eq('Alle(ai) 05 minuti dopo l\'ora')
289
+ end
290
+
291
+ it 'every past the hour' do
292
+ expect(desc('0 0,5,10,15,20,25,30,35,40,45,50,55 * ? * *')).to eq(
293
+ 'Alle(ai) 00, 05, 10, 15, 20, 25, 30, 35, 40, 45, 50 e 55 minuti dopo l\'ora')
294
+ end
295
+
296
+ it 'every x minute past the hour with interval' do
297
+ expect(desc('0 0-30/2 17 ? * MON-FRI')).to eq(
298
+ 'Ogni 2 minuti, dal minuto 00 al 30 dopo l\'ora, alle(ai) 5:00 PM, da lunedì a venerdì')
299
+ end
300
+
301
+ it 'every x days with interval' do
302
+ expect(desc('30 7 1-L/2 * *')).to eq('Alle(ai) 7:30 AM, ogni 2 giorni, tra il giorno 1 e il ultimo giorno del mese')
303
+ end
304
+
305
+ it 'one year only with seconds' do
306
+ expect(desc('* * * * * * 2013')).to eq('Ogni secondo, solo a(nel) 2013')
307
+ end
308
+
309
+ it 'one year only without seconds' do
310
+ expect(desc('* * * * * 2013')).to eq('Ogni minuto, solo a(nel) 2013')
311
+ end
312
+
313
+ it 'two years only' do
314
+ expect(desc('* * * * * 2013,2014')).to eq('Ogni minuto, solo a(nel) 2013 e 2014')
315
+ end
316
+
317
+ it 'year range 2' do
318
+ expect(desc('23 12 * JAN-FEB * 2013-2014')).to eq('Alle(ai) 12:23 PM, da gennaio a febbraio, da 2013 a 2014')
319
+ end
320
+
321
+ it 'year range 3' do
322
+ expect(desc('23 12 * JAN-MAR * 2013-2015')).to eq('Alle(ai) 12:23 PM, da gennaio a marzo, da 2013 a 2015')
323
+ end
324
+
325
+ context 'multi part range seconds:' do
326
+ it 'multi part range seconds 2,4-5' do
327
+ expect(desc('2,4-5 1 * * *')).to eq('Dal minuto 02,04 al 05 dopo l\'ora, alle(ai) 1:00 AM')
328
+ end
329
+
330
+ it 'multi part range seconds 2,26-28' do
331
+ expect(desc('2,26-28 18 * * *')).to eq('Dal minuto 02,26 al 28 dopo l\'ora, alle(ai) 6:00 PM')
332
+ end
333
+ end
334
+
335
+ context 'minutes past the hour:' do
336
+ it 'minutes past the hour 5,10' do
337
+ expect(desc('5,10 0 * * *')).to eq('Alle(ai) 05 e 10 minuti dopo l\'ora')
338
+ end
339
+
340
+ it 'minutes past the hour 5,10 day 2' do
341
+ expect(desc('5,10 0 2 * *')).to eq('Alle(ai) 05 e 10 minuti dopo l\'ora, il giorno 2 del mese')
342
+ end
343
+
344
+ it 'minutes past the hour 5/10 day 2' do
345
+ 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')
346
+ end
347
+ end
348
+
349
+ context 'seconds past the minute:' do
350
+ it 'seconds past the minute 5,6' do
351
+ expect(desc('5,6 0 0 * * *')).to eq('A 5 e 6 secondi dopo il minuto')
352
+ end
353
+
354
+ it 'seconds past the minute 5,6 at 1' do
355
+ expect(desc('5,6 0 1 * * *')).to eq('A 5 e 6 secondi dopo il minuto, alle(ai) 1:00 AM')
356
+ end
357
+
358
+ it 'seconds past the minute 5,6 day 2' do
359
+ expect(desc('5,6 0 0 2 * *')).to eq('A 5 e 6 secondi dopo il minuto, il giorno 2 del mese')
360
+ end
361
+ end
362
+
363
+ context 'increments starting at X > 1:' do
364
+ it 'second increments' do
365
+ expect(desc('5/15 0 * * * *')).to eq('Ogni 15 secondi, a partire da a 5 secondi dopo il minuto')
366
+ end
367
+
368
+ it 'minute increments' do
369
+ expect(desc('30/10 * * * *')).to eq('Ogni 10 minuti, a partire da alle(ai) 30 minuti dopo l\'ora')
370
+ end
371
+
372
+ it 'hour increments' do
373
+ 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')
374
+ end
375
+
376
+ it 'day of month increments' do
377
+ 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')
378
+ end
379
+
380
+ it 'day of week increments' do
381
+ expect(desc('0 30 11 * * 2/2')).to eq('Alle(ai) 11:30 AM, 2 giorni alla settimana, a partire da il martedì')
382
+ end
383
+
384
+ it 'month increments' do
385
+ 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')
386
+ end
387
+
388
+ it 'year increments' do
389
+ 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')
390
+ end
391
+ end
392
+ end
393
+ end
@@ -5,7 +5,8 @@ module Cronex
5
5
  describe ExpressionDescriptor do
6
6
 
7
7
  def desc(expression, opts = {})
8
- Cronex::ExpressionDescriptor.new(expression, opts, 'pt_BR').description
8
+ opts[:locale] = 'pt_BR'
9
+ Cronex::ExpressionDescriptor.new(expression, opts).description
9
10
  end
10
11
 
11
12
  let(:opts) { { zero_based_dow: false } }
@@ -238,8 +239,14 @@ module Cronex
238
239
  end
239
240
  end
240
241
 
241
- it 'last day of the month' do
242
- expect(desc('*/5 * L JAN *')).to eq('A cada 5 minutos, no último dia do mês, em janeiro')
242
+ context 'last day of the month:' do
243
+ it 'on the last day of the month' do
244
+ expect(desc('*/5 * L JAN *')).to eq('A cada 5 minutos, no último dia do mês, em janeiro')
245
+ end
246
+
247
+ it 'between a day and last day of the month' do
248
+ expect(desc('*/5 * 23-L JAN *')).to eq('A cada 5 minutos, entre os dias 23 e último dia do mês, em janeiro')
249
+ end
243
250
  end
244
251
 
245
252
  it 'time of day with seconds' do
@@ -291,6 +298,10 @@ module Cronex
291
298
  'A cada 2 minutos, entre 00 e 30 minutos após a hora, 5:00 PM, de segunda-feira a sexta-feira')
292
299
  end
293
300
 
301
+ it 'every x days with interval' do
302
+ expect(desc('30 7 1-L/2 * *')).to eq('Às 7:30 AM, a cada 2 dias, entre os dias 1 e último dia do mês')
303
+ end
304
+
294
305
  it 'one year only with seconds' do
295
306
  expect(desc('* * * * * * 2013')).to eq('A cada segundo, em 2013')
296
307
  end
@@ -5,7 +5,8 @@ module Cronex
5
5
  describe ExpressionDescriptor do
6
6
 
7
7
  def desc(expression, opts = {})
8
- Cronex::ExpressionDescriptor.new(expression, opts, 'ro').description
8
+ opts[:locale] = 'ro'
9
+ Cronex::ExpressionDescriptor.new(expression, opts).description
9
10
  end
10
11
 
11
12
  let(:opts) { { zero_based_dow: false } }
@@ -238,8 +239,14 @@ module Cronex
238
239
  end
239
240
  end
240
241
 
241
- it 'last day of the month' do
242
- expect(desc('*/5 * L JAN *')).to eq('La fiecare 5 minute, în ultima zi a lunii, numai în ianuarie')
242
+ context 'last day of the month:' do
243
+ it 'on the last day of the month' do
244
+ expect(desc('*/5 * L JAN *')).to eq('La fiecare 5 minute, în ultima zi a lunii, numai în ianuarie')
245
+ end
246
+
247
+ it 'between a day and last day of the month' do
248
+ expect(desc('*/5 * 23-L JAN *')).to eq('La fiecare 5 minute, între zilele 23 și ultima zi a lunii, numai în ianuarie')
249
+ end
243
250
  end
244
251
 
245
252
  it 'time of day with seconds' do
@@ -270,7 +277,7 @@ module Cronex
270
277
 
271
278
  it 'between with interval' do
272
279
  expect(desc('2-59/3 1,9,22 11-26 1-6 ?')).to eq(
273
- 'La fiecare 3 minute, între minutele 02 și 59, la 1:00 AM, 9:00 AM și 10:00 PM, între a 11-a și a 26-a zi a lunii, din ianuarie până în iunie')
280
+ 'La fiecare 3 minute, între minutele 02 și 59, la 1:00 AM, 9:00 AM și 10:00 PM, între zilele 11 și 26 a lunii, din ianuarie până în iunie')
274
281
  end
275
282
 
276
283
  it 'recurring first of month' do
@@ -291,6 +298,10 @@ module Cronex
291
298
  'La fiecare 2 minute, între minutele 00 și 30, la 5:00 PM, de luni până vineri')
292
299
  end
293
300
 
301
+ it 'every x days with interval' do
302
+ expect(desc('30 7 1-L/2 * *')).to eq('La 7:30 AM, la fiecare 2 zile, între zilele 1 și ultima zi a lunii')
303
+ end
304
+
294
305
  it 'one year only with seconds' do
295
306
  expect(desc('* * * * * * 2013')).to eq('În fiecare secundă, numai în 2013')
296
307
  end
@@ -5,7 +5,8 @@ module Cronex
5
5
  describe ExpressionDescriptor do
6
6
 
7
7
  def desc(expression, opts = {})
8
- Cronex::ExpressionDescriptor.new(expression, opts, 'ru').description
8
+ opts[:locale] = 'ru'
9
+ Cronex::ExpressionDescriptor.new(expression, opts).description
9
10
  end
10
11
 
11
12
  let(:opts) { { zero_based_dow: false } }
@@ -177,11 +178,11 @@ module Cronex
177
178
  end
178
179
 
179
180
  it 'day of month' do
180
- expect(desc('23 12 15 * *')).to eq('В 12:23 PM, 15 число месяца')
181
+ expect(desc('23 12 15 * *')).to eq('В 12:23 PM, 15 день месяца')
181
182
  end
182
183
 
183
184
  it 'day of month with day of week' do
184
- expect(desc('23 12 15 * SUN')).to eq('В 12:23 PM, 15 число месяца, только воскресенье')
185
+ expect(desc('23 12 15 * SUN')).to eq('В 12:23 PM, 15 день месяца, только воскресенье')
185
186
  end
186
187
 
187
188
  it 'month name' do
@@ -238,8 +239,14 @@ module Cronex
238
239
  end
239
240
  end
240
241
 
241
- it 'last day of the month' do
242
- expect(desc('*/5 * L JAN *')).to eq('Каждые 5 минут, в последний день месяца, только январь')
242
+ context 'last day of the month:' do
243
+ it 'on the last day of the month' do
244
+ expect(desc('*/5 * L JAN *')).to eq('Каждые 5 минут, в последний день месяца, только январь')
245
+ end
246
+
247
+ it 'between a day and last day of the month' do
248
+ expect(desc('*/5 * 23-L JAN *')).to eq('Каждые 5 минут, между 23 днем и последним днем месяца, только январь')
249
+ end
243
250
  end
244
251
 
245
252
  it 'time of day with seconds' do
@@ -252,7 +259,7 @@ module Cronex
252
259
 
253
260
  it 'second minutes hours intervals' do
254
261
  expect(desc('5-10 30-35 10-12 * * *')).to eq(
255
- 'Секунды с 5 по 10, минуты с 30 по 35, с 10:00 AM по 12:59 PM')
262
+ 'Секунды с 5 по 10, минуты с 30 по 35, между 10:00 AM и 12:59 PM')
256
263
  end
257
264
 
258
265
  it 'every 5 minutes at 30 seconds' do
@@ -261,7 +268,7 @@ module Cronex
261
268
 
262
269
  it 'minutes past the hour range' do
263
270
  expect(desc('0 30 10-13 ? * WED,FRI')).to eq(
264
- 'В 30 минут часа, с 10:00 AM по 1:59 PM, только среда и пятница')
271
+ 'В 30 минут часа, между 10:00 AM и 1:59 PM, только среда и пятница')
265
272
  end
266
273
 
267
274
  it 'seconds past the minute interval' do
@@ -270,7 +277,7 @@ module Cronex
270
277
 
271
278
  it 'between with interval' do
272
279
  expect(desc('2-59/3 1,9,22 11-26 1-6 ?')).to eq(
273
- 'Каждые 3 минут, минуты с 02 по 59, в 1:00 AM, 9:00 AM и 10:00 PM, с 11 по 26 число месяца, январь - июнь')
280
+ 'Каждые 3 минут, минуты с 02 по 59, в 1:00 AM, 9:00 AM и 10:00 PM, между 11 днем и 26 днем месяца, январь - июнь')
274
281
  end
275
282
 
276
283
  it 'recurring first of month' do
@@ -291,6 +298,10 @@ module Cronex
291
298
  'Каждые 2 минут, минуты с 00 по 30, в 5:00 PM, понедельник - пятница')
292
299
  end
293
300
 
301
+ it 'every x days with interval' do
302
+ expect(desc('30 7 1-L/2 * *')).to eq('В 7:30 AM, каждые 2 дня(ей), между 1 днем и последним днем месяца')
303
+ end
304
+
294
305
  it 'one year only with seconds' do
295
306
  expect(desc('* * * * * * 2013')).to eq('Каждую секунду, только 2013')
296
307
  end
@@ -327,11 +338,11 @@ module Cronex
327
338
  end
328
339
 
329
340
  it 'minutes past the hour 5,10 day 2' do
330
- expect(desc('5,10 0 2 * *')).to eq('В 05 и 10 минут часа, 2 число месяца')
341
+ expect(desc('5,10 0 2 * *')).to eq('В 05 и 10 минут часа, 2 день месяца')
331
342
  end
332
343
 
333
344
  it 'minutes past the hour 5/10 day 2' do
334
- expect(desc('5/10 0 2 * *')).to eq('Каждые 10 минут, начало в 05 минут часа, 2 число месяца')
345
+ expect(desc('5/10 0 2 * *')).to eq('Каждые 10 минут, начало в 05 минут часа, 2 день месяца')
335
346
  end
336
347
  end
337
348
 
@@ -345,7 +356,7 @@ module Cronex
345
356
  end
346
357
 
347
358
  it 'seconds past the minute 5,6 day 2' do
348
- expect(desc('5,6 0 0 2 * *')).to eq('В 5 и 6 секунд, 2 число месяца')
359
+ expect(desc('5,6 0 0 2 * *')).to eq('В 5 и 6 секунд, 2 день месяца')
349
360
  end
350
361
  end
351
362
 
@@ -363,7 +374,7 @@ module Cronex
363
374
  end
364
375
 
365
376
  it 'day of month increments' do
366
- expect(desc('0 30 8 2/7 * *')).to eq('В 8:30 AM, каждые 7 дня(ей), начало 2 число месяца')
377
+ expect(desc('0 30 8 2/7 * *')).to eq('В 8:30 AM, каждые 7 дня(ей), начало 2 день месяца')
367
378
  end
368
379
 
369
380
  it 'day of week increments' do
@@ -375,7 +386,7 @@ module Cronex
375
386
  end
376
387
 
377
388
  it 'year increments' do
378
- expect(desc('0 0 0 1 MAR * 2010/5')).to eq('В 12:00 AM, 1 число месяца, только март, каждые 5 лет, начало в 2010')
389
+ expect(desc('0 0 0 1 MAR * 2010/5')).to eq('В 12:00 AM, 1 день месяца, только март, каждые 5 лет, начало в 2010')
379
390
  end
380
391
  end
381
392
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cronex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Kazaku
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-23 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.5
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.5
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: unicode
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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: '10.1'
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: '10.1'
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
@@ -131,7 +133,7 @@ homepage: https://github.com/alpinweis/cronex
131
133
  licenses:
132
134
  - Apache-2.0
133
135
  metadata: {}
134
- post_install_message:
136
+ post_install_message:
135
137
  rdoc_options: []
136
138
  require_paths:
137
139
  - lib
@@ -146,9 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
148
  - !ruby/object:Gem::Version
147
149
  version: '0'
148
150
  requirements: []
149
- rubyforge_project:
150
- rubygems_version: 2.6.14
151
- signing_key:
151
+ rubygems_version: 3.0.8
152
+ signing_key:
152
153
  specification_version: 4
153
154
  summary: Ruby library that converts cron expressions into human readable strings
154
155
  test_files:
@@ -156,6 +157,7 @@ test_files:
156
157
  - spec/exp_descriptor_de_spec.rb
157
158
  - spec/exp_descriptor_en_spec.rb
158
159
  - spec/exp_descriptor_fr_spec.rb
160
+ - spec/exp_descriptor_it_spec.rb
159
161
  - spec/exp_descriptor_pt_BR_spec.rb
160
162
  - spec/exp_descriptor_ro_spec.rb
161
163
  - spec/exp_descriptor_ru_spec.rb