rusary 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +80 -0
- data/exe/rusary +1 -1
- data/lib/cli.rb +96 -0
- data/lib/guides/{LUMINOUS-MYSTERIES → latin/LUMINOUS-MYSTERIES} +20 -27
- data/lib/guides/{SORROWFUL-MYSTERIES → latin/SORROWFUL-MYSTERIES} +2 -1
- data/lib/mysteries.rb +42 -15
- data/lib/pager.rb +14 -0
- data/lib/rusary/version.rb +1 -1
- data/lib/rusary.rb +3 -19
- data/sig/rusary.rbs +48 -1
- metadata +10 -8
- /data/lib/guides/{GLORIOUS-MYSTERIES → latin/GLORIOUS-MYSTERIES} +0 -0
- /data/lib/guides/{JOYFUL-MYSTERIES → latin/JOYFUL-MYSTERIES} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78291346afbbec14b85dad702b297946e1c40d625d4945f0ef919137dfe94153
|
|
4
|
+
data.tar.gz: 90533864bc5b76bcd5c98faf0469cdbead51537c4812c4cc2b9e7681a7ba800c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 297a3a785fa3dde40ab48a23b5ac32eab1b691dbdcd93c98bda86b6019c077539f8deaf2a299002a9d5341aff3061ff3d64a03b7f28859d613ea801801fbd6b8
|
|
7
|
+
data.tar.gz: '0953960d84f877e5bb03ca183336554a45c840b5f04ae9d921c9bb43e7bc2f3b44b70ad736ed730fefd1ed93a8529977a3dd86a9189185cc73feb7cf377aa1ca'
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1 +1,81 @@
|
|
|
1
1
|
# Rusary
|
|
2
|
+
|
|
3
|
+
Rusary is a small terminal guide for praying the Rosary. It picks the mysteries of the day, shows every prayer in order, and gets out of the way so you can pray and meditate.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
gem install rusary
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
rusary # the mystery of the day
|
|
15
|
+
rusary glorious # a specific mystery
|
|
16
|
+
rusary --list # the mysteries and their weekdays
|
|
17
|
+
rusary --list-translations # the available translations
|
|
18
|
+
rusary --translation la # choose a translation (default: la)
|
|
19
|
+
rusary --no-luminous # leave out the Luminous mysteries
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The guide opens in `less`. Use the arrow keys or the space bar to move and `q` to quit. Long lines are not wrapped, so a terminal at least 73 columns wide shows the whole frame.
|
|
23
|
+
|
|
24
|
+
## The mystery of the day
|
|
25
|
+
|
|
26
|
+
* Monday and Saturday: Joyful
|
|
27
|
+
* Tuesday and Friday: Sorrowful
|
|
28
|
+
* Wednesday and Sunday: Glorious
|
|
29
|
+
* Thursday: Luminous
|
|
30
|
+
|
|
31
|
+
With `--no-luminous`, for those who pray only three sets:
|
|
32
|
+
|
|
33
|
+
* Monday and Thursday: Joyful
|
|
34
|
+
* Tuesday and Friday: Sorrowful
|
|
35
|
+
* Wednesday, Saturday and Sunday: Glorious
|
|
36
|
+
|
|
37
|
+
## How to pray the Rosary
|
|
38
|
+
|
|
39
|
+
The Rosary is a prayer that repeats short vocal prayers while the mind rests on the life of Jesus. You can count the prayers on a rosary, on your fingers, or just follow the guide. It has an opening, five decades and a closing.
|
|
40
|
+
|
|
41
|
+
Opening
|
|
42
|
+
|
|
43
|
+
1. Make the Sign of the Cross and say the Creed.
|
|
44
|
+
2. Say one Our Father, three Hail Marys and one Glory Be.
|
|
45
|
+
3. Say the Fatima prayer.
|
|
46
|
+
|
|
47
|
+
Each of the five decades
|
|
48
|
+
|
|
49
|
+
1. Announce the mystery and take a moment to picture it.
|
|
50
|
+
2. Say one Our Father.
|
|
51
|
+
3. Say ten Hail Marys while you keep thinking about the mystery.
|
|
52
|
+
4. Say one Glory Be and the Fatima prayer.
|
|
53
|
+
|
|
54
|
+
Closing
|
|
55
|
+
|
|
56
|
+
1. Say the Salve Regina.
|
|
57
|
+
2. The guide also includes the Regina Caeli, which is traditionally prayed in Eastertide.
|
|
58
|
+
|
|
59
|
+
## How to meditate on the mysteries
|
|
60
|
+
|
|
61
|
+
* Read the title of the mystery slowly and picture the scene as if you were there.
|
|
62
|
+
* Recall the Gospel passage if you know it. Staying with one detail is enough.
|
|
63
|
+
* Let the Hail Marys be a quiet rhythm in the background. There is no race to finish.
|
|
64
|
+
* When your mind wanders, return to the scene without worry.
|
|
65
|
+
* Ask for the fruit of the mystery, the virtue it invites you to grow in, such as humility at the Annunciation or hope at the Ascension.
|
|
66
|
+
* Keep a short silence at the end of each decade before the next one begins.
|
|
67
|
+
|
|
68
|
+
The five mysteries of each set:
|
|
69
|
+
|
|
70
|
+
* Joyful: the Annunciation, the Visitation, the Nativity, the Presentation in the Temple, the Finding of Jesus in the Temple.
|
|
71
|
+
* Luminous: the Baptism of Jesus, the Wedding at Cana, the Proclamation of the Kingdom, the Transfiguration, the Institution of the Eucharist.
|
|
72
|
+
* Sorrowful: the Agony in the Garden, the Scourging at the Pillar, the Crowning with Thorns, the Carrying of the Cross, the Crucifixion.
|
|
73
|
+
* Glorious: the Resurrection, the Ascension, the Descent of the Holy Spirit, the Assumption of Mary, the Coronation of Mary.
|
|
74
|
+
|
|
75
|
+
## Translations
|
|
76
|
+
|
|
77
|
+
Each translation is a folder inside `lib/guides` named after its language code, holding the four guide files. Only Latin (`la`) is included for now. A new folder with the same four file names is found automatically by `rusary --list-translations`.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT. See LICENSE.txt.
|
data/exe/rusary
CHANGED
data/lib/cli.rb
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "date"
|
|
4
|
+
require "optparse"
|
|
5
|
+
|
|
6
|
+
module Rusary
|
|
7
|
+
class UsageError < Error; end
|
|
8
|
+
|
|
9
|
+
class CLI
|
|
10
|
+
DEFAULT_LANG = "latim"
|
|
11
|
+
EX_USAGE = 64
|
|
12
|
+
|
|
13
|
+
Options = Struct.new(:mystery, :lang, :command, :schedule, keyword_init: true)
|
|
14
|
+
|
|
15
|
+
# Returns an exit status. It never calls exit, so it is easy to test.
|
|
16
|
+
def self.run(argv, out: $stdout, err: $stderr, pager: Pager)
|
|
17
|
+
new(out, err, pager).run(argv)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def initialize(out, err, pager)
|
|
21
|
+
@out = out
|
|
22
|
+
@err = err
|
|
23
|
+
@pager = pager
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def run(argv)
|
|
27
|
+
opts = parse(argv)
|
|
28
|
+
case opts.command
|
|
29
|
+
when :help then @out.puts(@parser)
|
|
30
|
+
when :version then @out.puts("rusary #{VERSION}")
|
|
31
|
+
when :list then list_mysteries(opts)
|
|
32
|
+
when :list_translations then list_translations
|
|
33
|
+
else read(opts)
|
|
34
|
+
end
|
|
35
|
+
0
|
|
36
|
+
rescue OptionParser::ParseError, UsageError => e
|
|
37
|
+
@err.puts "rusary: #{e.message}"
|
|
38
|
+
@err.puts "Try 'rusary --help' for usage."
|
|
39
|
+
EX_USAGE
|
|
40
|
+
rescue Errno::EPIPE
|
|
41
|
+
0
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def parse(argv)
|
|
47
|
+
opts = Options.new(lang: DEFAULT_LANG, command: :read, schedule: :standard)
|
|
48
|
+
@parser = OptionParser.new do |o|
|
|
49
|
+
o.banner = "Usage: rusary [options] [MYSTERY]"
|
|
50
|
+
o.separator ""
|
|
51
|
+
o.separator "Shows the mystery of the day. MYSTERY is one of: #{Mysteries.names.join(', ')}."
|
|
52
|
+
o.separator ""
|
|
53
|
+
o.on("-t", "--translation LANG", String, "Show the guide in LANG (default: #{DEFAULT_LANG})") { |v| opts.lang = v }
|
|
54
|
+
o.on("-T", "--list-translations", "List the available translations") { opts.command = :list_translations }
|
|
55
|
+
o.on("-l", "--list", "List the mysteries and their weekdays") { opts.command = :list }
|
|
56
|
+
o.on("--no-luminous", "Leave out the Luminous mysteries") { opts.schedule = :traditional }
|
|
57
|
+
o.on("-v", "--version", "Show the version") { opts.command = :version }
|
|
58
|
+
o.on("-h", "--help", "Show this help") { opts.command = :help }
|
|
59
|
+
end
|
|
60
|
+
rest = @parser.parse(argv)
|
|
61
|
+
raise UsageError, "too many arguments" if rest.size > 1
|
|
62
|
+
|
|
63
|
+
opts.mystery = rest.first&.downcase&.to_sym
|
|
64
|
+
opts
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def validate!(opts)
|
|
68
|
+
names = Mysteries.names(opts.schedule)
|
|
69
|
+
if opts.mystery && !names.include?(opts.mystery)
|
|
70
|
+
raise UsageError, "unknown mystery '#{opts.mystery}' (expected one of: #{names.join(', ')})"
|
|
71
|
+
end
|
|
72
|
+
return if Mysteries.translations.include?(opts.lang)
|
|
73
|
+
|
|
74
|
+
raise UsageError, "unknown translation '#{opts.lang}' (see --list-translations)"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def read(opts)
|
|
78
|
+
validate!(opts)
|
|
79
|
+
name = opts.mystery || Mysteries.for_date(Date.today, opts.schedule)
|
|
80
|
+
path = Mysteries.path(name, opts.lang)
|
|
81
|
+
raise UsageError, "translation '#{opts.lang}' has no guide for '#{name}'" unless File.file?(path)
|
|
82
|
+
|
|
83
|
+
@pager.show(path)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def list_mysteries(opts)
|
|
87
|
+
Mysteries.days_by_mystery(opts.schedule).each do |name, days|
|
|
88
|
+
@out.puts format("%-10s %s", name, days.join(", "))
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def list_translations
|
|
93
|
+
Mysteries.translations.each { |lang| @out.puts lang }
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -11,32 +11,24 @@
|
|
|
11
11
|
┃ Codeberg: https://codeberg.org/grassleaff ┃
|
|
12
12
|
┃ ┃
|
|
13
13
|
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
14
|
-
┃
|
|
15
|
-
┃
|
|
16
|
-
┃
|
|
17
|
-
┃
|
|
18
|
-
┃
|
|
19
|
-
┃
|
|
20
|
-
┃
|
|
21
|
-
┃
|
|
22
|
-
┃
|
|
23
|
-
┃
|
|
24
|
-
┃
|
|
25
|
-
┃
|
|
26
|
-
┃
|
|
27
|
-
┃
|
|
28
|
-
┃
|
|
29
|
-
┃
|
|
30
|
-
┃
|
|
31
|
-
┃
|
|
32
|
-
┃ |\| |\\\| |\| / \ |/| |///| |/|
|
|
33
|
-
┃ |\| |\\\| |\| '-...-' |/| |///| |/|
|
|
34
|
-
┃ |\| |\O\| |\| |/| |/O/| |/|
|
|
35
|
-
┃ /_ _\/_ _\'='==================='='/_ _\/_ _\
|
|
36
|
-
┃ /['''][''-''] \'''''''''''''''''''''/ [''-''][''']\
|
|
37
|
-
┃ /===================================================\
|
|
38
|
-
┃ [___________________________________________________]
|
|
39
|
-
┃
|
|
14
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣭⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡶⡤⠈⠓⠘⢧⡀⠈⠠⠑⠂⡜⠢⡜⢰⢡⡘⢥⢩ ┃
|
|
15
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢷⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠑⡄⠹⣆⠀⢁⠣⢌⠱⡌⢆⠣⢜⢢⢣ ┃
|
|
16
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⢸⡄⢸⡆⠀⠘⢢⢱⠘⡌⢳⡌⡆⣧ ┃
|
|
17
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠳⠦⣄⡀⢿⡄⠐⡌⢦⣙⡱⢦⢱⢚⡴ ┃
|
|
18
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡦⠘⡇⠈⣷⡀⡘⢆⡲⢱⡍⣎⠳⣜ ┃
|
|
19
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠷⠦⣽⡀⢹⡇⠘⢦⡑⢧⡚⣬⢓⢮ ┃
|
|
20
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣄⣸⡆⢸⡇⣈⢧⡛⢦⡝⢦⣋⢮ ┃
|
|
21
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⢿⣿⣿⣿⣿⠿⠾⣿⡇⢸⡇⣜⡲⣝⣣⠞⡧⢞⡼ ┃
|
|
22
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⣛⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣟⡷⣯⣟⢾⡹⣒⢣⠒⣴⡛⣸⠟⣡⣿⠙⣶⠹⣜⠶⣋⣗⢫⡞ ┃
|
|
23
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣍⣳⣢⣽⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⢿⣻⣽⣯⢿⡽⣻⢾⣹⣎⡵⡈⢆⣱⠏⣴⣯⠾⢯⣥⣛⣶⣻⣼⣫⢷⣚⡿⣼ ┃
|
|
24
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣯⣟⣧⢻⢝⣻⢿⣯⣷⣛⡮⣱⣿⠞⠁⣸⣿⣰⣛⡾⣶⣻⣞⡷⣯⣟⣳⢏⣟⡷ ┃
|
|
25
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡽⣳⣛⢾⡙⢮⠿⣷⣦⣽⣿⣿⢿⣤⣤⣾⣿⣞⣷⣿⣻⢷⣯⢿⣽⣳⢭⡟⣾⣹⢾ ┃
|
|
26
|
+
┃ ⣯⣿⣿⣿⣿⡑⠆⠡⢤⣬⣝⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⣽⣿⣿⣿⣿⣿⣿⣿⡳⣭⢋⣎⠹⡄⢫⠜⣛⡿⣿⣿⣿⡿⣽⣾⣿⢾⣿⣿⣟⡿⣟⣿⢾⡽⣧⣻⢧⣟⣾ ┃
|
|
27
|
+
┃ ⣷⣿⣿⣿⣿⣿⣿⣶⣤⣌⠉⠻⢾⡽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⡽⣻⠶⣹⣿⣿⣿⣿⣿⣿⣿⣳⡜⡳⢌⡓⣬⣶⣿⣿⣹⣾⢳⣿⣿⣿⣿⣻⣿⣿⣯⢿⡿⣽⣿⢿⣻⡷⣯⢿⣾⣽ ┃
|
|
28
|
+
┃ ⣿⣿⣿⣿⣿⣿⣷⣏⡿⣿⣿⡤⣈⢹⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣞⣯⢳⠯⡝⢦⠻⣿⣿⣿⣿⣿⣿⣷⣯⣵⣾⣾⣿⣧⣏⠳⣽⣏⣿⣿⣿⣟⣿⣿⣿⣿⣯⢿⣽⣻⣾⣿⣿⣿⣽⣿⣿⣿ ┃
|
|
29
|
+
┃ ⣿⣿⣿⣿⣿⣿⢯⣿⡿⣭⢟⣿⣷⣎⠷⣞⣿⣿⣿⣿⣿⣿⣿⣿⣟⠮⡝⣍⠻⣜⣣⣿⢿⣿⣿⣿⣿⣿⣿⣿⡿⣿⡿⢿⣿⣿⣿⣾⣿⣻⣟⡿⣿⣻⣿⣿⣿⣯⢿⣞⡷⣿⣿⡿⣯⢿⣿⣿⣿ ┃
|
|
30
|
+
┃ ⣿⣿⣿⣿⣿⣿⣿⢷⣿⣿⢿⡸⢿⣿⣿⢹⣾⣹⣿⣿⣿⣿⣿⣿⡏⢷⠹⣰⣿⡿⠁⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣁⣿⠀⢹⡷⣏⢿⡿⣿⣏⡿⣿⣿⣹⢿⣾⣹⣷⡿⣿⣹⣿⢿⣿⣿ ┃
|
|
31
|
+
┃ ⣿⣿⣿⣿⣿⣿⢿⣟⡾⣽⢿⣟⣷⢻⣿⣿⡷⣯⢿⣿⣿⣿⣿⣿⣙⣦⢿⣏⣽⠀⡇⠀⠀⠛⣿⣿⣿⣿⣿⣿⣿⢿⣽⣿⣿⡇⠀⣼⣧⠈⠙⢿⣿⣾⣽⢻⡿⣭⢟⡶⣯⢷⣻⢷⣻⣯⣿⣿⣿ ┃
|
|
40
32
|
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
41
33
|
┃ ┃
|
|
42
34
|
┃ ┃
|
|
@@ -382,7 +374,6 @@
|
|
|
382
374
|
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
383
375
|
┃ ┃
|
|
384
376
|
┃ ┃
|
|
385
|
-
┃ ┃
|
|
386
377
|
┃ [ VII ] - (1x) SALVE REGINA ┃
|
|
387
378
|
┃ ┃
|
|
388
379
|
┃ Salve, Regina, mater misericoridiae, vita, dulcedo, ┃
|
|
@@ -396,8 +387,10 @@
|
|
|
396
387
|
┃ Ora pro nobis, Sancta Dei Genitrix. ┃
|
|
397
388
|
┃ Ut digni efficiamur promissionibus Christi. ┃
|
|
398
389
|
┃ ┃
|
|
390
|
+
┃ ┃
|
|
399
391
|
┠───────────────────────────────────────────────────────────────────────┨
|
|
400
392
|
┃ ┃
|
|
393
|
+
┃ ┃
|
|
401
394
|
┃ [ VIII ] - (1x) REGINA CAELI ┃
|
|
402
395
|
┃ ┃
|
|
403
396
|
┃ Regina Caeli, laetare, alleluia; ┃
|
|
@@ -372,7 +372,6 @@
|
|
|
372
372
|
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
373
373
|
┃ ┃
|
|
374
374
|
┃ ┃
|
|
375
|
-
┃ ┃
|
|
376
375
|
┃ [ VII ] - (1x) SALVE REGINA ┃
|
|
377
376
|
┃ ┃
|
|
378
377
|
┃ Salve, Regina, mater misericoridiae, vita, dulcedo, ┃
|
|
@@ -386,8 +385,10 @@
|
|
|
386
385
|
┃ Ora pro nobis, Sancta Dei Genitrix. ┃
|
|
387
386
|
┃ Ut digni efficiamur promissionibus Christi. ┃
|
|
388
387
|
┃ ┃
|
|
388
|
+
┃ ┃
|
|
389
389
|
┠───────────────────────────────────────────────────────────────────────┨
|
|
390
390
|
┃ ┃
|
|
391
|
+
┃ ┃
|
|
391
392
|
┃ [ VIII ] - (1x) REGINA CAELI ┃
|
|
392
393
|
┃ ┃
|
|
393
394
|
┃ Regina Caeli, laetare, alleluia; ┃
|
data/lib/mysteries.rb
CHANGED
|
@@ -1,26 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "date"
|
|
1
4
|
|
|
2
5
|
module Mysteries
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
GUIDES_DIR = File.join(__dir__, "guides")
|
|
7
|
+
|
|
8
|
+
FILES = {
|
|
9
|
+
joyful: "JOYFUL-MYSTERIES",
|
|
10
|
+
luminous: "LUMINOUS-MYSTERIES",
|
|
11
|
+
sorrowful: "SORROWFUL-MYSTERIES",
|
|
12
|
+
glorious: "GLORIOUS-MYSTERIES"
|
|
13
|
+
}.freeze
|
|
14
|
+
|
|
15
|
+
# Weekday (Date#wday, Sunday is 0) to mystery
|
|
16
|
+
SCHEDULES = {
|
|
17
|
+
standard: {
|
|
18
|
+
0 => :glorious, 1 => :joyful, 2 => :sorrowful, 3 => :glorious,
|
|
19
|
+
4 => :luminous, 5 => :sorrowful, 6 => :joyful
|
|
20
|
+
}.freeze,
|
|
21
|
+
# Used when the Luminous mysteries are left out
|
|
22
|
+
traditional: {
|
|
23
|
+
0 => :glorious, 1 => :joyful, 2 => :sorrowful, 3 => :glorious,
|
|
24
|
+
4 => :joyful, 5 => :sorrowful, 6 => :glorious
|
|
25
|
+
}.freeze
|
|
26
|
+
}.freeze
|
|
27
|
+
|
|
28
|
+
def self.names(schedule = :standard)
|
|
29
|
+
FILES.keys & SCHEDULES.fetch(schedule).values
|
|
7
30
|
end
|
|
8
31
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exec "cd '#{__dir__}' && cd guides/ && less -S SORROWFUL-MYSTERIES"
|
|
12
|
-
end
|
|
32
|
+
def self.for_date(date, schedule = :standard)
|
|
33
|
+
SCHEDULES.fetch(schedule).fetch(date.wday)
|
|
13
34
|
end
|
|
14
35
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
def self.days_by_mystery(schedule = :standard)
|
|
37
|
+
table = SCHEDULES.fetch(schedule)
|
|
38
|
+
names(schedule).to_h do |name|
|
|
39
|
+
days = table.select { |_, mystery| mystery == name }.keys
|
|
40
|
+
[name, days.sort_by { |wday| (wday - 1) % 7 }.map { |wday| Date::ABBR_DAYNAMES[wday] }]
|
|
18
41
|
end
|
|
19
42
|
end
|
|
20
43
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
44
|
+
def self.translations
|
|
45
|
+
Dir.children(GUIDES_DIR).select { |entry| File.directory?(File.join(GUIDES_DIR, entry)) }.sort
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.path(name, lang)
|
|
49
|
+
raise ArgumentError, "unknown translation '#{lang}'" unless translations.include?(lang)
|
|
50
|
+
|
|
51
|
+
File.join(GUIDES_DIR, lang, FILES.fetch(name))
|
|
25
52
|
end
|
|
26
53
|
end
|
data/lib/pager.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Shows a guide through less. The -S flag chops long lines instead of wrapping
|
|
4
|
+
# them, which keeps the 73 column frame intact on narrow terminals.
|
|
5
|
+
module Pager
|
|
6
|
+
COMMAND = %w[less -S].freeze
|
|
7
|
+
|
|
8
|
+
def self.show(path)
|
|
9
|
+
exec(*COMMAND, File.basename(path), chdir: File.dirname(path))
|
|
10
|
+
rescue Errno::ENOENT
|
|
11
|
+
# less is not installed, print the guide instead.
|
|
12
|
+
$stdout.write(File.read(path))
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/rusary/version.rb
CHANGED
data/lib/rusary.rb
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "rusary/version"
|
|
4
|
-
require_relative "mysteries.rb"
|
|
5
|
-
require "date"
|
|
6
4
|
|
|
7
5
|
module Rusary
|
|
8
6
|
class Error < StandardError; end
|
|
9
|
-
class Parser
|
|
10
|
-
def self.start
|
|
11
|
-
date = Date.today.strftime("%A")
|
|
12
|
-
if date == "Monday" || date == "Saturday"
|
|
13
|
-
Mysteries::JoyfulM.read
|
|
14
|
-
elsif date == "Tuesday" || date == "Friday"
|
|
15
|
-
Mysteries::SorrowfulM.read
|
|
16
|
-
elsif date == "Wednesday" || date == "Sunday"
|
|
17
|
-
Mysteries::GloriousM.read
|
|
18
|
-
elsif date == "Thursday"
|
|
19
|
-
Mysteries::LuminousM.read
|
|
20
|
-
else
|
|
21
|
-
raise Exception.new "Invalid weekday '#{date}' specified for Rusary parser. Expected a valid weekday."
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
7
|
end
|
|
26
8
|
|
|
27
|
-
|
|
9
|
+
require_relative "mysteries"
|
|
10
|
+
require_relative "pager"
|
|
11
|
+
require_relative "cli"
|
data/sig/rusary.rbs
CHANGED
|
@@ -1,4 +1,51 @@
|
|
|
1
1
|
module Rusary
|
|
2
2
|
VERSION: String
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
class Error < StandardError
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class UsageError < Error
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class CLI
|
|
11
|
+
DEFAULT_LANG: String
|
|
12
|
+
EX_USAGE: Integer
|
|
13
|
+
|
|
14
|
+
class Options < Struct[untyped]
|
|
15
|
+
attr_accessor mystery: Symbol?
|
|
16
|
+
attr_accessor lang: String
|
|
17
|
+
attr_accessor command: Symbol
|
|
18
|
+
attr_accessor schedule: Symbol
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.run: (Array[String] argv, ?out: IO, ?err: IO, ?pager: singleton(::Pager)) -> Integer
|
|
22
|
+
def initialize: (IO out, IO err, singleton(::Pager) pager) -> void
|
|
23
|
+
def run: (Array[String] argv) -> Integer
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def parse: (Array[String] argv) -> Options
|
|
28
|
+
def validate!: (Options opts) -> void
|
|
29
|
+
def read: (Options opts) -> void
|
|
30
|
+
def list_mysteries: (Options opts) -> void
|
|
31
|
+
def list_translations: () -> void
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
module Mysteries
|
|
36
|
+
GUIDES_DIR: String
|
|
37
|
+
FILES: Hash[Symbol, String]
|
|
38
|
+
SCHEDULES: Hash[Symbol, Hash[Integer, Symbol]]
|
|
39
|
+
|
|
40
|
+
def self.names: (?Symbol schedule) -> Array[Symbol]
|
|
41
|
+
def self.for_date: (Date date, ?Symbol schedule) -> Symbol
|
|
42
|
+
def self.days_by_mystery: (?Symbol schedule) -> Hash[Symbol, Array[String]]
|
|
43
|
+
def self.translations: () -> Array[String]
|
|
44
|
+
def self.path: (Symbol name, String lang) -> String
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
module Pager
|
|
48
|
+
COMMAND: Array[String]
|
|
49
|
+
|
|
50
|
+
def self.show: (String path) -> void
|
|
4
51
|
end
|
metadata
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rusary
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- mavictor
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
@@ -22,11 +22,13 @@ files:
|
|
|
22
22
|
- README.md
|
|
23
23
|
- Rakefile
|
|
24
24
|
- exe/rusary
|
|
25
|
-
- lib/
|
|
26
|
-
- lib/guides/
|
|
27
|
-
- lib/guides/
|
|
28
|
-
- lib/guides/
|
|
25
|
+
- lib/cli.rb
|
|
26
|
+
- lib/guides/latin/GLORIOUS-MYSTERIES
|
|
27
|
+
- lib/guides/latin/JOYFUL-MYSTERIES
|
|
28
|
+
- lib/guides/latin/LUMINOUS-MYSTERIES
|
|
29
|
+
- lib/guides/latin/SORROWFUL-MYSTERIES
|
|
29
30
|
- lib/mysteries.rb
|
|
31
|
+
- lib/pager.rb
|
|
30
32
|
- lib/rusary.rb
|
|
31
33
|
- lib/rusary/version.rb
|
|
32
34
|
- sig/rusary.rbs
|
|
@@ -36,8 +38,8 @@ licenses:
|
|
|
36
38
|
metadata:
|
|
37
39
|
allowed_push_host: https://rubygems.org
|
|
38
40
|
homepage_uri: https://codeberg.org/grassleaff/rusary
|
|
39
|
-
source_code_uri: https://codeberg.org/
|
|
40
|
-
changelog_uri: https://codeberg.org/
|
|
41
|
+
source_code_uri: https://codeberg.org/mavictor/rusary
|
|
42
|
+
changelog_uri: https://codeberg.org/mavictor/rusary
|
|
41
43
|
rdoc_options: []
|
|
42
44
|
require_paths:
|
|
43
45
|
- lib
|
|
File without changes
|
|
File without changes
|