calendarium-romanum 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +15 -13
- data/.yardopts +1 -1
- data/CHANGELOG.md +91 -0
- data/README.md +128 -45
- data/Rakefile +7 -0
- data/calendarium-romanum.gemspec +6 -1
- data/config/locales/cs.yml +2 -0
- data/config/locales/en.yml +4 -0
- data/config/locales/es.yml +4 -0
- data/config/locales/fr.yml +4 -0
- data/config/locales/it.yml +4 -0
- data/config/locales/la.yml +4 -0
- data/data/README.md +27 -23
- data/data/czech-cs.txt +13 -15
- data/data/easter_dates.txt +67 -0
- data/data/universal-1969-la.txt +234 -0
- data/data/universal-en.txt +4 -4
- data/data/universal-es.txt +4 -4
- data/data/universal-fr.txt +4 -4
- data/data/universal-it.txt +4 -4
- data/data/universal-la.txt +4 -4
- data/lib/calendarium-romanum.rb +5 -0
- data/lib/calendarium-romanum/abstract_date.rb +6 -3
- data/lib/calendarium-romanum/calendar.rb +37 -15
- data/lib/calendarium-romanum/cli.rb +49 -111
- data/lib/calendarium-romanum/cli/comparator.rb +63 -0
- data/lib/calendarium-romanum/cli/date_parser.rb +30 -0
- data/lib/calendarium-romanum/cli/dumper.rb +68 -0
- data/lib/calendarium-romanum/cli/helper.rb +23 -0
- data/lib/calendarium-romanum/cli/querier.rb +73 -0
- data/lib/calendarium-romanum/data.rb +4 -1
- data/lib/calendarium-romanum/day.rb +49 -40
- data/lib/calendarium-romanum/enum.rb +37 -39
- data/lib/calendarium-romanum/enums.rb +28 -4
- data/lib/calendarium-romanum/ordinalizer.rb +2 -2
- data/lib/calendarium-romanum/perpetual_calendar.rb +6 -3
- data/lib/calendarium-romanum/rank.rb +16 -22
- data/lib/calendarium-romanum/rank_predicates.rb +43 -0
- data/lib/calendarium-romanum/sanctorale.rb +9 -8
- data/lib/calendarium-romanum/sanctorale_loader.rb +7 -3
- data/lib/calendarium-romanum/sanctorale_writer.rb +119 -0
- data/lib/calendarium-romanum/temporale.rb +44 -17
- data/lib/calendarium-romanum/temporale/celebration_factory.rb +4 -3
- data/lib/calendarium-romanum/temporale/dates.rb +5 -5
- data/lib/calendarium-romanum/temporale/easter_table.rb +27 -0
- data/lib/calendarium-romanum/temporale/extensions.rb +15 -0
- data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +3 -2
- data/lib/calendarium-romanum/temporale/extensions/dedication_before_all_saints.rb +73 -0
- data/lib/calendarium-romanum/transfers.rb +44 -18
- data/lib/calendarium-romanum/util.rb +10 -24
- data/lib/calendarium-romanum/version.rb +2 -2
- data/liturgical_law/1969_normae_universales.md +568 -0
- data/liturgical_law/1977_decretum_de_celebratione_baptismatis_domini.md +58 -0
- data/liturgical_law/1990_decretum_de_variatione_inducenda.md +67 -0
- data/liturgical_law/1998_notificatio_de_occurrentia.md +57 -0
- data/liturgical_law/2002_normae_universales.md +946 -0
- data/liturgical_law/2006_notification.md +37 -0
- data/liturgical_law/2012_declarationes.md +38 -0
- data/liturgical_law/README.md +74 -0
- metadata +28 -5
data/data/universal-en.txt
CHANGED
@@ -122,7 +122,7 @@ locale: en
|
|
122
122
|
24 sharbel : Saint Sharbel Makhluf, hermit
|
123
123
|
25 f R james : Saint James, apostle
|
124
124
|
26 m joachim_anne : Saints Joachim and Anne
|
125
|
-
29 m
|
125
|
+
29 m martha : Saint Martha
|
126
126
|
30 peter_chrysologus : Saint Peter Chrysologus, bishop and doctor
|
127
127
|
31 m ignatius_of_loyola : Saint Ignatius of Loyola, priest
|
128
128
|
|
@@ -203,11 +203,11 @@ locale: en
|
|
203
203
|
= 11
|
204
204
|
1 s all_saints : All Saints
|
205
205
|
2 s all_souls : All Souls
|
206
|
-
3
|
206
|
+
3 de_porres : Saint Martin de Porres, religious
|
207
207
|
4 m borromeo : Saint Charles Borromeo, bishop
|
208
|
-
9
|
208
|
+
9 f2.5 lateran_basilica : Dedication of the Lateran basilica
|
209
209
|
10 m leo_great : Saint Leo the Great, pope and doctor
|
210
|
-
11 m
|
210
|
+
11 m martin : Saint Martin of Tours, bishop
|
211
211
|
12 m R josaphat : Saint Josaphat, bishop and martyr
|
212
212
|
15 albert : Saint Albert the Great, bishop and doctor
|
213
213
|
16 margaret_of_scotland : Saint Margaret of Scotland
|
data/data/universal-es.txt
CHANGED
@@ -122,7 +122,7 @@ locale: es
|
|
122
122
|
24 sharbel : San Chárbel Makhlouf, Ermitaño
|
123
123
|
25 f R james : Santiago, apóstol
|
124
124
|
26 m joachim_anne : Santos Joaquín y Ana, padres de la Santísima Virgen María
|
125
|
-
29 m
|
125
|
+
29 m martha : Santa Marta
|
126
126
|
30 peter_chrysologus : San Pedro Crisólogo, Obispo y Doctor de la Iglesia
|
127
127
|
31 m ignatius_of_loyola : San Ignacio de Loyola, Presbítero
|
128
128
|
|
@@ -203,11 +203,11 @@ locale: es
|
|
203
203
|
= 11
|
204
204
|
1 s all_saints : Todos los Santos
|
205
205
|
2 s all_souls : Conmemoración de Todos los Difuntos
|
206
|
-
3
|
206
|
+
3 de_porres : San Martín de Porres, Religioso
|
207
207
|
4 m borromeo : San Carlos Borromeo, Obispo
|
208
|
-
9
|
208
|
+
9 f2.5 lateran_basilica : Dedicación de la Basílica de Letrán
|
209
209
|
10 m leo_great : San León el Magno, Papa y Doctor de la Iglesia
|
210
|
-
11 m
|
210
|
+
11 m martin : San Martín de Tours, Obispo
|
211
211
|
12 m R josaphat : San Josafat, Obispo y Mártir
|
212
212
|
15 albert : San Alberto Magno, Obispo y Doctor de la Iglesia
|
213
213
|
16 margaret_of_scotland : Santa Margarita de Escocia
|
data/data/universal-fr.txt
CHANGED
@@ -122,7 +122,7 @@ locale: fr
|
|
122
122
|
24 sharbel : Saint Charbel Makhlouf, ermite
|
123
123
|
25 f R james : Saint Jacques, apôtre
|
124
124
|
26 m joachim_anne : Saints Joachim et Anne
|
125
|
-
29 m
|
125
|
+
29 m martha : Sainte Marthe
|
126
126
|
30 peter_chrysologus : Saint Pierre Chrysologue, évêque et docteur de l'Église
|
127
127
|
31 m ignatius_of_loyola : Saint Ignace de Loyola, prêtre
|
128
128
|
|
@@ -203,11 +203,11 @@ locale: fr
|
|
203
203
|
= 11
|
204
204
|
1 s all_saints : Toussaint
|
205
205
|
2 s all_souls : Commémoration des fidèles défunts
|
206
|
-
3
|
206
|
+
3 de_porres : Saint Martin de Porrès, religieux
|
207
207
|
4 m borromeo : Saint Charles Borromée, évêque
|
208
|
-
9
|
208
|
+
9 f2.5 lateran_basilica : Dédicace de la Basilique Saint-Jean-de-Latran
|
209
209
|
10 m leo_great : Saint Léon le Grand, pape et docteur de l'Église
|
210
|
-
11 m
|
210
|
+
11 m martin : Saint Martin de Tours, évêque
|
211
211
|
12 m R josaphat : Saint Josaphat, évêque et martyr
|
212
212
|
15 albert : Saint Albert le Grand, évêque et docteur de l'Église
|
213
213
|
16 margaret_of_scotland : Sainte Marguerite
|
data/data/universal-it.txt
CHANGED
@@ -121,7 +121,7 @@ locale: it
|
|
121
121
|
24 sharbel : San Charbel Makhlouf, eremita
|
122
122
|
25 f R james : San Giacomo, apostolo
|
123
123
|
26 m joachim_anne : Santi Gioacchino ed Anna, genitori della Beata Vergine Maria
|
124
|
-
29 m
|
124
|
+
29 m martha : Santa Marta
|
125
125
|
30 peter_chrysologus : San Pietro Crisologo, vescovo e dottore della Chiesa
|
126
126
|
31 m ignatius_of_loyola : Sant'Ignazio di Loyola, sacerdote
|
127
127
|
|
@@ -202,11 +202,11 @@ locale: it
|
|
202
202
|
= 11
|
203
203
|
1 s all_saints : Tutti i Santi
|
204
204
|
2 s all_souls : Commemorazione di tutti i fedeli defunti
|
205
|
-
3
|
205
|
+
3 de_porres : San Martino de Porres, religioso
|
206
206
|
4 m borromeo : San Carlo Borromeo, vescovo
|
207
|
-
9
|
207
|
+
9 f2.5 lateran_basilica : Dedicazione della basilica Lateranense
|
208
208
|
10 m leo_great : San Leone Magno, papa e dottore della Chiesa
|
209
|
-
11 m
|
209
|
+
11 m martin : San Martino di Tours, vescovo
|
210
210
|
12 m R josaphat : San Giosafat, vescovo e martire
|
211
211
|
15 albert : Sant'Alberto Magno, vescovo e dottore della Chiesa
|
212
212
|
16 margaret_of_scotland : Santa Margherita di Scozia
|
data/data/universal-la.txt
CHANGED
@@ -122,7 +122,7 @@ locale: la
|
|
122
122
|
24 sharbel : S. Sarbelii Makhlūf, presbyteri
|
123
123
|
25 f R james : S. Iacobi, apostoli
|
124
124
|
26 m joachim_anne : Ss. Ioachim et Annae, parentum B. Mariae Virginis
|
125
|
-
29 m
|
125
|
+
29 m martha : S. Marthae
|
126
126
|
30 peter_chrysologus : S. Petri Chrysologi, episcopi et Ecclesiae doctoris
|
127
127
|
31 m ignatius_of_loyola : S. Ignatii de Loyola, presbyteri
|
128
128
|
|
@@ -203,11 +203,11 @@ locale: la
|
|
203
203
|
= 11
|
204
204
|
1 s all_saints : OMNIUM SANCTORUM
|
205
205
|
2 s all_souls : IN COMMEMORATIONE OMNIUM FIDELIUM DEFUNCTORUM
|
206
|
-
3
|
206
|
+
3 de_porres : S. Martini de Porres, religiosi
|
207
207
|
4 m borromeo : S. Caroli Borromeo, episcopi
|
208
|
-
9
|
208
|
+
9 f2.5 lateran_basilica : IN DEDICATIONE BASILICAE LATERANENSIS
|
209
209
|
10 m leo_great : S. Leonis Magni, papae et Ecclesiae doctoris
|
210
|
-
11 m
|
210
|
+
11 m martin : S. Martini Turonensis, episcopi
|
211
211
|
12 m R josaphat : S. Iosaphat, episcopi et martyris
|
212
212
|
15 albert : S. Alberti Magni, episcopi et Ecclesiae doctoris
|
213
213
|
16 margaret_of_scotland : S. Margaritae Scotiae
|
data/lib/calendarium-romanum.rb
CHANGED
@@ -8,6 +8,7 @@ end
|
|
8
8
|
version
|
9
9
|
i18n_setup
|
10
10
|
abstract_date
|
11
|
+
rank_predicates
|
11
12
|
rank
|
12
13
|
enum
|
13
14
|
enums
|
@@ -18,10 +19,14 @@ end
|
|
18
19
|
perpetual_calendar
|
19
20
|
temporale/dates
|
20
21
|
temporale/celebration_factory
|
22
|
+
temporale/easter_table
|
23
|
+
temporale/extensions
|
21
24
|
temporale/extensions/christ_eternal_priest
|
25
|
+
temporale/extensions/dedication_before_all_saints
|
22
26
|
temporale
|
23
27
|
sanctorale
|
24
28
|
sanctorale_loader
|
29
|
+
sanctorale_writer
|
25
30
|
sanctorale_factory
|
26
31
|
transfers
|
27
32
|
util
|
@@ -4,8 +4,8 @@ module CalendariumRomanum
|
|
4
4
|
class AbstractDate
|
5
5
|
include Comparable
|
6
6
|
|
7
|
-
# @param month [
|
8
|
-
# @param day [
|
7
|
+
# @param month [Integer]
|
8
|
+
# @param day [Integer]
|
9
9
|
# @raise [RangeError] on invalid +month+/+day+ value
|
10
10
|
def initialize(month, day)
|
11
11
|
validate! month, day
|
@@ -42,12 +42,15 @@ module CalendariumRomanum
|
|
42
42
|
|
43
43
|
# Produce a +Date+ by providing a year to an +AbstractDate+
|
44
44
|
#
|
45
|
-
# @param year [
|
45
|
+
# @param year [Integer]
|
46
46
|
# @return [Date]
|
47
47
|
def concretize(year)
|
48
48
|
Date.new(year, month, day)
|
49
49
|
end
|
50
50
|
|
51
|
+
# @since 0.8.0
|
52
|
+
alias in_year concretize
|
53
|
+
|
51
54
|
private
|
52
55
|
|
53
56
|
def validate!(month, day)
|
@@ -17,19 +17,34 @@ module CalendariumRomanum
|
|
17
17
|
# Returns a calendar for the liturgical year beginning with
|
18
18
|
# Advent of the specified civil year.
|
19
19
|
#
|
20
|
-
# @
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
20
|
+
# @overload initialize(year, sanctorale = nil, temporale = nil, vespers: false)
|
21
|
+
# @param year [Integer]
|
22
|
+
# Civil year when the liturgical year begins.
|
23
|
+
# @param sanctorale [Sanctorale, nil]
|
24
|
+
# If not provided, the +Calendar+ will only know celebrations
|
25
|
+
# of the temporale cycle, no feasts of the saints!
|
26
|
+
# @param temporale [Temporale, nil]
|
27
|
+
# If not provided, +Temporale+ for the given year with default
|
28
|
+
# configuration will built.
|
29
|
+
# @param vespers [Boolean] Set to true if you want the +Calendar+ to populate {Day#vespers}
|
30
|
+
#
|
31
|
+
# @overload initialize(temporale, sanctorale=nil, vespers: false)
|
32
|
+
# @param temporale [Temporale]
|
33
|
+
# @param sanctorale [Sanctorale, nil]
|
34
|
+
# If not provided, the +Calendar+ will only know celebrations
|
35
|
+
# of the temporale cycle, no feasts of the saints!
|
36
|
+
# @param vespers [Boolean] Set to true if you want the +Calendar+ to populate {Day#vespers}
|
37
|
+
# @since 0.8.0
|
38
|
+
#
|
29
39
|
# @raise [RangeError]
|
30
40
|
# if +year+ is specified for which the implemented calendar
|
31
41
|
# system wasn't in force
|
32
42
|
def initialize(year, sanctorale = nil, temporale = nil, vespers: false)
|
43
|
+
unless year.is_a? Integer
|
44
|
+
temporale = year
|
45
|
+
year = temporale.year
|
46
|
+
end
|
47
|
+
|
33
48
|
if year < (EFFECTIVE_FROM.year - 1)
|
34
49
|
raise system_not_effective
|
35
50
|
end
|
@@ -43,7 +58,7 @@ module CalendariumRomanum
|
|
43
58
|
@temporale = temporale || Temporale.new(year)
|
44
59
|
@populate_vespers = vespers
|
45
60
|
|
46
|
-
@transferred = Transfers.
|
61
|
+
@transferred = Transfers.call(@temporale, @sanctorale).freeze
|
47
62
|
end
|
48
63
|
|
49
64
|
class << self
|
@@ -89,7 +104,7 @@ module CalendariumRomanum
|
|
89
104
|
# @return [Season]
|
90
105
|
def_delegators :@temporale, :range_check, :season
|
91
106
|
|
92
|
-
# @return [
|
107
|
+
# @return [Integer]
|
93
108
|
attr_reader :year
|
94
109
|
|
95
110
|
# @return [Temporale]
|
@@ -98,6 +113,13 @@ module CalendariumRomanum
|
|
98
113
|
# @return [Sanctorale]
|
99
114
|
attr_reader :sanctorale
|
100
115
|
|
116
|
+
# Solemnities transferred to a date different from the usual one
|
117
|
+
# due to occurrence with a higher-ranking celebration.
|
118
|
+
#
|
119
|
+
# @return [Hash<Date=>Celebration>]
|
120
|
+
# @since 0.8.0
|
121
|
+
attr_reader :transferred
|
122
|
+
|
101
123
|
# Do {Day} instances returned by this +Calendar+
|
102
124
|
# have {Day#vespers} populated?
|
103
125
|
# @return [Boolean]
|
@@ -138,9 +160,9 @@ module CalendariumRomanum
|
|
138
160
|
# @overload day(date, vespers: false)
|
139
161
|
# @param date [Date]
|
140
162
|
# @overload day(year, month, day, vespers: false)
|
141
|
-
# @param year [
|
142
|
-
# @param month [
|
143
|
-
# @param day [
|
163
|
+
# @param year [Integer]
|
164
|
+
# @param month [Integer]
|
165
|
+
# @param day [Integer]
|
144
166
|
# @param vespers [Boolean]
|
145
167
|
# Set to +true+ in order to get {Day} with {Day#vespers}
|
146
168
|
# populated (overrides instance-wide setting {#populates_vespers?}).
|
@@ -230,7 +252,7 @@ module CalendariumRomanum
|
|
230
252
|
private
|
231
253
|
|
232
254
|
def celebrations_for(date)
|
233
|
-
tr = @transferred
|
255
|
+
tr = @transferred[date]
|
234
256
|
return [tr] if tr
|
235
257
|
|
236
258
|
t = @temporale[date]
|
@@ -1,5 +1,17 @@
|
|
1
1
|
require 'thor'
|
2
2
|
|
3
|
+
# monkey patch preventing Thor from screwing formatting in our commands' long_desc
|
4
|
+
# credits: https://github.com/erikhuda/thor/issues/398#issuecomment-237400762
|
5
|
+
class Thor
|
6
|
+
module Shell
|
7
|
+
class Basic
|
8
|
+
def print_wrapped(message, options = {})
|
9
|
+
stdout.puts message
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
3
15
|
module CalendariumRomanum
|
4
16
|
|
5
17
|
# Implementation of the +calendariumrom+ executable.
|
@@ -7,102 +19,48 @@ module CalendariumRomanum
|
|
7
19
|
#
|
8
20
|
# @api private
|
9
21
|
class CLI < Thor
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
22
|
+
desc 'query [DATE]', 'show calendar information for a specified date/month/year'
|
23
|
+
long_desc <<-EOS
|
24
|
+
show calendar information for a specified date/month/year
|
25
|
+
|
26
|
+
DATE formats:
|
27
|
+
not specified - today
|
28
|
+
2000-01-02 - single date
|
29
|
+
2000-01 - month
|
30
|
+
2000 - year
|
31
|
+
EOS
|
32
|
+
option :calendar, default: Data::GENERAL_ROMAN_ENGLISH.siglum, aliases: :c, desc: 'sanctorale data file to use (filesystem path or identifier of a bundled one)'
|
33
|
+
option :locale, default: 'en', aliases: :l, desc: 'locale to use for localized strings'
|
15
34
|
def query(date_str = nil)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
begin
|
20
|
-
sanctorale = SanctoraleLoader.new.load_from_file(calendar)
|
21
|
-
rescue CalendariumRomanum::InvalidDataError
|
22
|
-
die! 'Invalid file format.'
|
23
|
-
end
|
24
|
-
else
|
25
|
-
data_file = Data[calendar]
|
26
|
-
|
27
|
-
if data_file.nil?
|
28
|
-
die! "Invalid calendar. Either loading a calendar from filesystem did not succeed, \n or a preinstalled calendar was specified which doesn't exist. See subcommand `calendars` for valid options."
|
29
|
-
end
|
30
|
-
sanctorale = data_file.load
|
31
|
-
end
|
32
|
-
|
33
|
-
pcal = PerpetualCalendar.new sanctorale: sanctorale
|
34
|
-
|
35
|
-
if date_str
|
36
|
-
begin
|
37
|
-
parsed_date = DateParser.new(date_str)
|
38
|
-
parsed_date.date_range.each do |day|
|
39
|
-
print_single_date(pcal, day)
|
40
|
-
end
|
41
|
-
rescue ArgumentError
|
42
|
-
die! 'Invalid date.'
|
43
|
-
end
|
44
|
-
else
|
45
|
-
print_single_date(pcal, Date.today)
|
46
|
-
end
|
35
|
+
Querier
|
36
|
+
.new(locale: options[:locale], calendar: options[:calendar])
|
37
|
+
.call(date_str)
|
47
38
|
end
|
48
39
|
|
49
|
-
desc 'calendars', '
|
40
|
+
desc 'calendars', 'list calendars available for querying'
|
50
41
|
def calendars
|
51
42
|
Data.each {|c| puts c.siglum }
|
52
43
|
end
|
53
44
|
|
54
|
-
desc 'errors FILE1, ...', '
|
45
|
+
desc 'errors FILE1, ...', 'find errors in sanctorale data files'
|
55
46
|
def errors(*files)
|
56
|
-
loader = SanctoraleLoader.new
|
57
47
|
files.each do |path|
|
58
|
-
s = Sanctorale.new
|
59
48
|
begin
|
60
|
-
|
49
|
+
sanctorale_from_path path
|
61
50
|
rescue Errno::ENOENT, InvalidDataError => err
|
62
51
|
die! err.message
|
63
52
|
end
|
64
53
|
end
|
65
54
|
end
|
66
55
|
|
67
|
-
desc 'cmp FILE1, FILE2', 'detect differences
|
56
|
+
desc 'cmp FILE1, FILE2', 'detect differences between two sanctorale data files'
|
68
57
|
def cmp(a, b)
|
69
|
-
|
70
|
-
|
71
|
-
sanctoralia = paths.collect {|source| loader.load_from_file source }
|
72
|
-
names = paths.collect {|source| File.basename source }
|
73
|
-
|
74
|
-
# a leap year must be chosen in order to iterate over
|
75
|
-
# all possible days of a Sanctorale
|
76
|
-
Year.new(1990).each_day do |d|
|
77
|
-
a, b = sanctoralia.collect {|s| s.get(d) }
|
78
|
-
|
79
|
-
0.upto([a.size, b.size].max - 1) do |i|
|
80
|
-
ca = a[i]
|
81
|
-
cb = b[i]
|
82
|
-
compared = [ca, cb]
|
83
|
-
|
84
|
-
if compared.index(&:nil?)
|
85
|
-
notnili = compared.index {|c| !c.nil? }
|
86
|
-
|
87
|
-
print date(d)
|
88
|
-
puts " only in #{names[notnili]}:"
|
89
|
-
puts celebration(compared[notnili])
|
90
|
-
puts
|
91
|
-
next
|
92
|
-
end
|
93
|
-
|
94
|
-
differences = %i(rank colour symbol).select do |property|
|
95
|
-
ca.public_send(property) != cb.public_send(property)
|
96
|
-
end
|
58
|
+
Comparator.new.call(a, b)
|
59
|
+
end
|
97
60
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
puts celebration(ca)
|
102
|
-
puts celebration(cb)
|
103
|
-
puts
|
104
|
-
end
|
105
|
-
end
|
61
|
+
desc 'dump YEAR', 'print calendar of the specified year for use in regression tests'
|
62
|
+
def dump(year)
|
63
|
+
Dumper.new.regression_tests_dump year.to_i
|
106
64
|
end
|
107
65
|
|
108
66
|
desc 'version', 'print version information'
|
@@ -110,40 +68,20 @@ module CalendariumRomanum
|
|
110
68
|
puts 'calendarium-romanum CLI'
|
111
69
|
puts "calendarium-romanum: version #{CalendariumRomanum::VERSION}, released #{CalendariumRomanum::RELEASE_DATE}"
|
112
70
|
end
|
71
|
+
end
|
72
|
+
end
|
113
73
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
"#{d.month}/#{d.day}"
|
118
|
-
end
|
119
|
-
|
120
|
-
def celebration(c)
|
121
|
-
"#{c.rank.priority} #{c.colour.symbol} | #{c.title}"
|
122
|
-
end
|
123
|
-
|
124
|
-
def die!(message, code = 1)
|
125
|
-
STDERR.puts message
|
126
|
-
exit code
|
127
|
-
end
|
128
|
-
|
129
|
-
def print_single_date(calendar, date)
|
130
|
-
day = calendar.day date
|
131
|
-
|
132
|
-
puts date
|
133
|
-
puts "season: #{day.season.name}"
|
134
|
-
puts
|
135
|
-
|
136
|
-
rank_length = day.celebrations.collect {|c| c.rank.short_desc.nil? ? 0 : c.rank.short_desc.size }.max
|
137
|
-
day.celebrations.each do |c|
|
138
|
-
if [Ranks::PRIMARY, Ranks::TRIDUUM].include? c.rank
|
139
|
-
puts c.title
|
140
|
-
elsif !c.rank.short_desc.nil?
|
141
|
-
print c.rank.short_desc.rjust(rank_length)
|
142
|
-
print ' : '
|
143
|
-
puts c.title
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
74
|
+
# required files reopen the CLI class - require after the class'es main definition
|
75
|
+
# in order to prevent superclass mismatch errors
|
76
|
+
require_relative 'cli/helper'
|
147
77
|
|
78
|
+
module CalendariumRomanum
|
79
|
+
class CLI
|
80
|
+
include Helper
|
148
81
|
end
|
149
82
|
end
|
83
|
+
|
84
|
+
require_relative 'cli/comparator'
|
85
|
+
require_relative 'cli/date_parser'
|
86
|
+
require_relative 'cli/dumper'
|
87
|
+
require_relative 'cli/querier'
|