frenchrevcal-ruby 1.0.0

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.
Files changed (3) hide show
  1. data/bin/revcal +39 -0
  2. data/lib/RevCal.rb +414 -0
  3. metadata +68 -0
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require 'optparse'
5
+ require 'ostruct'
6
+ require 'date'
7
+ require 'RevCal'
8
+
9
+ opt = OpenStruct.new
10
+ opt.europe = false
11
+
12
+ o = OptionParser.new
13
+ o.banner << " [date]"
14
+ o.on("-e", "--europe", "Use European DD/MM/YYYY dates (false)") {opt.european = true}
15
+ begin
16
+ o.parse!
17
+ rescue
18
+ STDERR << $!.message << "\n"
19
+ STDERR << o
20
+ exit(1)
21
+ end
22
+ if (ARGV.size > 1)
23
+ STDERR << o
24
+ exit(1)
25
+ end
26
+
27
+ date = Date.today
28
+ if (ARGV.size > 0)
29
+ date = ARGV.pop
30
+ if (!opt.european && RUBY_VERSION.to_f >= 1.9 && date =~/([0-9]*)\/([0-9]*)\/([0-9]*)/)
31
+ date = $3 + "-" + $1 + "-" + $2
32
+ end
33
+ date = Date.parse(date)
34
+ end
35
+
36
+ date = RevDate.fromGregorian(date)
37
+
38
+ print date.to_s + "\n"
39
+ print "Today is dedicated to " + date.daySymbol + "\n"
@@ -0,0 +1,414 @@
1
+ # coding: utf-8
2
+ class RevDate
3
+ attr_reader :year, :month, :day
4
+ # create new RevDate with given year, month, day (numeric, using revolutionary year, month, day)
5
+ def initialize(year, month, day)
6
+ @year = year
7
+ @month = month
8
+ @day = day
9
+ end
10
+ # create human readable string of date
11
+ def to_s
12
+ names = ["Vendémiaire", "Brumaire", "Frimaire", "Nivôse", "Pluviôse",
13
+ "Ventôse", "Germinal", "Floréal", "Prairial", "Messidor",
14
+ "Thermidor", "Fructidor", "Sansculottides"]
15
+ s = ""
16
+ s += @day.to_s + " " + names[@month - 1] + " " + @year.to_s
17
+ end
18
+ # return number of days in given revolutionary year
19
+ def RevDate.length(year)
20
+ if (year == 3 || year == 7 || year == 11 || year == 15 || year == 20)
21
+ return 366
22
+ elsif (year > 20 && (year % 4 == 0 && (year % 100 > 0) || year % 400 == 0))
23
+ return 366
24
+ else
25
+ return 365
26
+ end
27
+ end
28
+ # convert the despised reactionary date of the ancien regime to our glorious rational format
29
+ def RevDate.fromGregorian(d)
30
+ start = Date.new(1792,9,22)
31
+ days = d - start
32
+ year = 1
33
+ month = 1
34
+ while (days >= yearLen = RevDate.length(year))
35
+ days -= yearLen
36
+ year += 1
37
+ end
38
+ month = (1 + (days / 30)).to_i
39
+ day = (1 + (days % 30)).to_i
40
+ return RevDate.new(year, month, day)
41
+ end
42
+ #return the date's symbol (associated plant, animal, or tool)
43
+ def daySymbol
44
+ dayNum = 30*(@month - 1) + (@day - 1)
45
+ symbols = ["Raisin (Grape)",
46
+ "Safran (Saffron)",
47
+ "Châtaigne (Chestnut)",
48
+ "Colchique (Crocus)",
49
+ "Cheval (Horse)",
50
+ "Balsamine (Impatiens)",
51
+ "Carotte (Carrot)",
52
+ "Amarante (Amaranth)",
53
+ "Panais (Parsnip)",
54
+ "Cuve (Vat)",
55
+ "Pomme de terre (Potato)",
56
+ "Immortelle (Strawflower)",
57
+ "Potiron (Calabaza)",
58
+ "Réséda (Mignonette)",
59
+ "Âne (Donkey)",
60
+ "Belle de nuit (The four o’clock flower)",
61
+ "Citrouille (Pumpkin)",
62
+ "Sarrasin (Buckwheat)",
63
+ "Tournesol (Sunflower)",
64
+ "Pressoir (Wine-Press)",
65
+ "Chanvre (Hemp)",
66
+ "Pêche (Peach)",
67
+ "Navet (Turnip)",
68
+ "Amaryllis (Amaryllis)",
69
+ "Bœuf (Cow)",
70
+ "Aubergine (Eggplant)",
71
+ "Piment (Chili Pepper)",
72
+ "Tomate (Tomato)",
73
+ "Orge (Barley)",
74
+ "Tonneau (Barrel)",
75
+ "Pomme (Apple)",
76
+ "Céleri (Celery)",
77
+ "Poire (Pear)",
78
+ "Betterave (Beet root)",
79
+ "Oie (Goose)",
80
+ "Héliotrope (Heliotrope)",
81
+ "Figue (Fig)",
82
+ "Scorsonère (Black Salsify)",
83
+ "Alisier (Chequer Tree)",
84
+ "Charrue (Plough)",
85
+ "Salsifis (Salsify)",
86
+ "Macre (Water chestnut)",
87
+ "Topinambour (Jerusalem Artichoke)",
88
+ "Endive (Endive)",
89
+ "Dindon (Turkey)",
90
+ "Chervis (Skirret)",
91
+ "Cresson (Watercress)",
92
+ "Dentelaire (Leadworts)",
93
+ "Grenade (Pomegranate)",
94
+ "Herse (Harrow)",
95
+ "Bacchante (Asarum baccharis)",
96
+ "Azerole (Acerola)",
97
+ "Garance (Madder)",
98
+ "Orange (Orange)",
99
+ "Faisan (Pheasant)",
100
+ "Pistache (Pistachio)",
101
+ "Macjonc (Tuberous pea)",
102
+ "Coing (Quince)",
103
+ "Cormier (Service tree)",
104
+ "Rouleau (Roller)",
105
+ "Raiponce (Rampion)",
106
+ "Turneps (Turnip)",
107
+ "Chicorée (Chicory)",
108
+ "Nèfle (Medlar)",
109
+ "Cochon (Pig)",
110
+ "Mâche (Corn Salad)",
111
+ "Chou-fleur (Cauliflower)",
112
+ "Miel (Honey)",
113
+ "Genièvre (Juniper)",
114
+ "Pioche (Pickaxe)",
115
+ "Cire (Wax)",
116
+ "Raifort (Horseradish)",
117
+ "Cèdre (Cedar tree)",
118
+ "Sapin (Fir tree)",
119
+ "Chevreuil (Roe Deer)",
120
+ "Ajonc (Gorse)",
121
+ "Cyprès (Cypress Tree)",
122
+ "Lierre (Ivy)",
123
+ "Sabine (Juniper)",
124
+ "Hoyau (Grub-hoe)",
125
+ "Érable sucré (Maple Tree)",
126
+ "Bruyère (Heather)",
127
+ "Roseau (Reed plant)",
128
+ "Oseille (Sorrel)",
129
+ "Grillon (Cricket)",
130
+ "Pignon (Pinenut)",
131
+ "Liège (cork)",
132
+ "Truffe (Truffle)",
133
+ "Olive (Olive)",
134
+ "Pelle (shovel)",
135
+ "Tourbe (Peat)",
136
+ "Houille (Coal)",
137
+ "Bitume (Bitumen)",
138
+ "Soufre (Sulphur)",
139
+ "Chien (Dog)",
140
+ "Lave (Lava)",
141
+ "Terre végétale (Topsoil)",
142
+ "Fumier (Manure)",
143
+ "Salpêtre (Saltpeter)",
144
+ "Fléau (Flail)",
145
+ "Granit (Granite stone)",
146
+ "Argile (Clay)",
147
+ "Ardoise (Slate)",
148
+ "Grès (Sandstone)",
149
+ "Lapin (Rabbit)",
150
+ "Silex (Flint)",
151
+ "Marne (Marl)",
152
+ "Pierre à chaux (Limestone)",
153
+ "Marbre (Marble)",
154
+ "Van (Winnowing basket)",
155
+ "Pierre à plâtre (Gypsum)",
156
+ "Sel (Salt)",
157
+ "Fer (Iron)",
158
+ "Cuivre (Copper)",
159
+ "Chat (Cat)",
160
+ "Étain (Tin)",
161
+ "Plomb (Lead)",
162
+ "Zinc (Zinc)",
163
+ "Mercure (Mercury (metal))",
164
+ "Crible (Sieve)",
165
+ "Lauréole (Spurge-laurel)",
166
+ "Mousse (Moss)",
167
+ "Fragon (Butcher’s Broom)",
168
+ "Perce-neige (Snowdrop)",
169
+ "Taureau (Bull)",
170
+ "Laurier-thym (Laurustinus)",
171
+ "Amadouvier (Tinder polypore)",
172
+ "Mézéréon (Daphne mezereum)",
173
+ "Peuplier (Poplar Tree)",
174
+ "Coignée (Axe)",
175
+ "Ellébore (Hellebore)",
176
+ "Brocoli (Broccoli)",
177
+ "Laurier (Laurel)",
178
+ "Avelinier (Cob or filbert)",
179
+ "Vache (Cow)",
180
+ "Buis (Box Tree)",
181
+ "Lichen (Lichen)",
182
+ "If (Yew tree)",
183
+ "Pulmonaire (Lungwort)",
184
+ "Serpette (Billhook)",
185
+ "Thlaspi (Pennycress)",
186
+ "Thimelé (Rose Daphne)",
187
+ "Chiendent (Couch Grass)",
188
+ "Trainasse (Knotweed)",
189
+ "Lièvre (Hare)",
190
+ "Guède (Woad)",
191
+ "Noisetier (Hazel)",
192
+ "Cyclamen (Cyclamen)",
193
+ "Chélidoine (Celandine)",
194
+ "Traîneau (Sleigh)",
195
+ "Tussilage (Coltsfoot)",
196
+ "Cornouiller (Dogwood)",
197
+ "Violier (Matthiola)",
198
+ "Troène (Privet)",
199
+ "Bouc (Billygoat)",
200
+ "Asaret (Wild Ginger)",
201
+ "Alaterne (Buckthorn)",
202
+ "Violette (Violet (plant))",
203
+ "Marceau (Goat Willow)",
204
+ "Bêche (Spade)",
205
+ "Narcisse (Narcissus)",
206
+ "Orme (Elm Tree)",
207
+ "Fumeterre (Common fumitory)",
208
+ "Vélar (Hedge Mustard)",
209
+ "Chèvre (Goat)",
210
+ "Épinard (Spinach)",
211
+ "Doronic (Large-flowered Leopard’s Bane)",
212
+ "Mouron (Pimpernel)",
213
+ "Cerfeuil (Chervil)",
214
+ "Cordeau (Twine)",
215
+ "Mandragore (Mandrake)",
216
+ "Persil (Parsley)",
217
+ "Cochléaria (Scurvy-grass)",
218
+ "Pâquerette (Daisy)",
219
+ "Thon (Tuna)",
220
+ "Pissenlit (Dandelion)",
221
+ "Sylve (Forest)",
222
+ "Capillaire (Maidenhair fern)",
223
+ "Frêne (Ash Tree)",
224
+ "Plantoir (Dibber: a hand gardening tool)",
225
+ "Primevère (Primrose)",
226
+ "Platane (Plane Tree)",
227
+ "Asperge (Asparagus)",
228
+ "Tulipe (Tulip)",
229
+ "Poule (Hen)",
230
+ "Bette (Chard Plant)",
231
+ "Bouleau (Birch Tree)",
232
+ "Jonquille (Daffodil)",
233
+ "Aulne (Alder)",
234
+ "Couvoir (Hatchery)",
235
+ "Pervenche (Periwinkle)",
236
+ "Charme (Ironwood)",
237
+ "Morille (Morel)",
238
+ "Hêtre (Beech Tree)",
239
+ "Abeille (Bee)",
240
+ "Laitue (Lettuce)",
241
+ "Mélèze (Larch)",
242
+ "Ciguë (Hemlock)",
243
+ "Radis (Radish)",
244
+ "Ruche (Hive)",
245
+ "Gainier (Judas tree)",
246
+ "Romaine (Lettuce)",
247
+ "Marronnier (Chestnut Oak)",
248
+ "Roquette (Arugula or Rocket)",
249
+ "Pigeon (Pigeon)",
250
+ "Lilas (Lilac)",
251
+ "Anémone (Anemone)",
252
+ "Pensée (Pansy)",
253
+ "Myrtille (Blueberry)",
254
+ "Greffoir (Knife)",
255
+ "Rose (Rose)",
256
+ "Chêne (Oak Tree)",
257
+ "Fougère (Fern)",
258
+ "Aubépine (Hawthorn)",
259
+ "Rossignol (Nightingale)",
260
+ "Ancolie (Columbine)",
261
+ "Muguet (Lily of the Valley)",
262
+ "Champignon (Button mushroom)",
263
+ "Hyacinthe (Hyacinth)",
264
+ "Râteau (Rake)",
265
+ "Rhubarbe (Rhubarb)",
266
+ "Sainfoin (Sainfoin)",
267
+ "Bâton-d’or (Wallflower)",
268
+ "Chamérops (Palm tree)",
269
+ "Ver à soie (Silkworm)",
270
+ "Consoude (Comfrey)",
271
+ "Pimprenelle (Salad Burnet)",
272
+ "Corbeille d’or (Basket of Gold)",
273
+ "Arroche (Orache)",
274
+ "Sarcloir (Garden hoe)",
275
+ "Statice (Sea Lavender)",
276
+ "Fritillaire (Fritillary)",
277
+ "Bourrache (Borage)",
278
+ "Valériane (Valerian)",
279
+ "Carpe (Carp)",
280
+ "Fusain (Spindle (shrub))",
281
+ "Civette (Chive)",
282
+ "Buglosse (Bugloss)",
283
+ "Sénevé (Wild mustard)",
284
+ "Houlette (Shepherd’s crook)",
285
+ "Luzerne (Alfalfa)",
286
+ "Hémérocalle (Daylily)",
287
+ "Trèfle (Clover)",
288
+ "Angélique (Angelica)",
289
+ "Canard (Duck)",
290
+ "Mélisse (Lemon Balm)",
291
+ "Fromental (Oat grass)",
292
+ "Martagon (Martagon lily)",
293
+ "Serpolet (Thyme plant)",
294
+ "Faux (Scythe)",
295
+ "Fraise (Strawberry)",
296
+ "Bétoine (Woundwort)",
297
+ "Pois (Pea)",
298
+ "Acacia (Acacia)",
299
+ "Caille (Quail)",
300
+ "Œillet (Carnation)",
301
+ "Sureau (Elderberry)",
302
+ "Pavot (Poppy plant)",
303
+ "Tilleul (Linden or Lime tree)",
304
+ "Fourche (Pitchfork)",
305
+ "Barbeau (Cornflower)",
306
+ "Camomille (Camomile)",
307
+ "Chèvrefeuille (Honeysuckle)",
308
+ "caille-lait (Bedstraw)",
309
+ "Tanche (Tench)",
310
+ "Jasmin (Jasmine Plant)",
311
+ "Verveine (Verbena)",
312
+ "Thym (Thyme Plant)",
313
+ "Pivoine (Peony Plant)",
314
+ "Chariot (Hand Cart)",
315
+ "Seigle (Rye)",
316
+ "Avoine (Oats)",
317
+ "Oignon (Onion)",
318
+ "Véronique (Speedwell)",
319
+ "Mulet (Mule)",
320
+ "Romarin (Rosemary)",
321
+ "Concombre (Cucumber)",
322
+ "Échalote (Shallot)",
323
+ "Absinthe (Wormwood)",
324
+ "Faucille (Sickle)",
325
+ "Coriandre (Coriander)",
326
+ "Artichaut (Artichoke)",
327
+ "Girofle (Clove)",
328
+ "Lavande (Lavender)",
329
+ "Chamois (Chamois)",
330
+ "Tabac (Tobacco)",
331
+ "Groseille (Currant)",
332
+ "Gesse (Hairy Vetchling)",
333
+ "Cerise (Cherry)",
334
+ "Parc (Park)",
335
+ "Menthe (Mint)",
336
+ "Cumin (Cumin)",
337
+ "Haricot (Bean)",
338
+ "Orcanète (Alkanet)",
339
+ "Pintade (Guinea fowl)",
340
+ "Sauge (Sage Plant)",
341
+ "Ail (Garlic)",
342
+ "Vesce (Tare)",
343
+ "Blé (Wheat)",
344
+ "Chalémie (Shawm)",
345
+ "Épeautre (Einkorn Wheat)",
346
+ "Bouillon blanc (Common Mullein)",
347
+ "Melon (Honeydew Melon)",
348
+ "Ivraie (Ryegrass)",
349
+ "Bélier (Ram)",
350
+ "Prêle (Horsetail)",
351
+ "Armoise (Mugwort)",
352
+ "Carthame (Safflower)",
353
+ "Mûre (Blackberry)",
354
+ "Arrosoir (Watering Can)",
355
+ "Panis (Panic grass)",
356
+ "Salicorne (Common Glasswort)",
357
+ "Abricot (Apricot)",
358
+ "Basilic (Basil)",
359
+ "Brebis (Ewe)",
360
+ "Guimauve (Marshmallow root)",
361
+ "Lin (Flax)",
362
+ "Amande (Almond)",
363
+ "Gentiane (Gentian)",
364
+ "Écluse (Lock)",
365
+ "Carline (Carline thistle)",
366
+ "Câprier (Caper)",
367
+ "Lentille (Lentil)",
368
+ "Aunée (Yellow starwort)",
369
+ "Loutre (Otter)",
370
+ "Myrte (Myrtle)",
371
+ "Colza (Rapeseed)",
372
+ "Lupin (Lupin)",
373
+ "Coton (Cotton)",
374
+ "Moulin (Mill)",
375
+ "Prune (Plum)",
376
+ "Millet (Millet)",
377
+ "Lycoperdon (Puffball)",
378
+ "Escourgeon (Six-row Barley)",
379
+ "Saumon (Salmon)",
380
+ "Tubéreuse (Tuberose)",
381
+ "Sucrion (Sugar melon)",
382
+ "Apocyn (Apocynum)",
383
+ "Réglisse (Liquorice)",
384
+ "Échelle (Ladder)",
385
+ "Pastèque (Watermelon)",
386
+ "Fenouil (Fennel)",
387
+ "Épine vinette (Barberry)",
388
+ "Noix (Walnut)",
389
+ "Truite (Trout)",
390
+ "Citron (Lemon)",
391
+ "Cardère (Teasel)",
392
+ "Nerprun (Buckthorn)",
393
+ "Tagette (Mexican Marigold)",
394
+ "Hotte (Sack)",
395
+ "Églantine (Wild Rose)",
396
+ "Noisette (Hazelnut)",
397
+ "Houblon (Hops)",
398
+ "Sorgho (Sorghum)",
399
+ "Écrevisse (Crayfish)",
400
+ "Bigarade (Bitter Orange)",
401
+ "Verge d’or (Goldenrod)",
402
+ "Maïs (Maize or Corn)",
403
+ "Marron (Chestnut)",
404
+ "Panier (Basket)",
405
+ "La Fête de la Vertu (Celebration of Virtue)",
406
+ "La Fête du Génie (Celebration of Talent)",
407
+ "La Fête du Travail (Celebration of Labour)",
408
+ "La Fête de l'Opinion (Celebration of Principles)",
409
+ "La Fête des Récompenses (Celebration of Honours)",
410
+ "La Fête de la Révolution (Celebration of the Revolution)"]
411
+ return symbols[dayNum]
412
+ end
413
+ end
414
+
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: frenchrevcal-ruby
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Jonathan Badger
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-28 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: frenchrevcal-ruby implements the French Revolutionary (or Republican) calendar.
23
+ email: jhbadger@gmail.com
24
+ executables:
25
+ - revcal
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/RevCal.rb
32
+ - bin/revcal
33
+ has_rdoc: true
34
+ homepage: http://github.com/jhbadger/FrenchRevCal-ruby
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.7
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: frenchrevcal-ruby implements the French Revolutionary (or Republican) calendar.
67
+ test_files: []
68
+