timequiz 1.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0daed4c2b70d554ac2bc2bb05212e049dc91dad41a25e02fe45cd24e0f0e6a90
4
- data.tar.gz: f1fcd7c7460e89dc2870c3442895253b5c09dde4ca02b7294c0a37e64da1dbfe
3
+ metadata.gz: 5a0517e2a94d008d80ebd5127361bbdabf479cedd87815c7237e7139d94afdf6
4
+ data.tar.gz: 9a08de0793bb656b9496ce192158f5f418ef5516ffdc4719a25efed61e668f1d
5
5
  SHA512:
6
- metadata.gz: 878029819eef267aadb8ba572f02cd65f83d9543d989bf9ccd672b5d7229198205bdec4dfb030616d84bab722961ab5522cf182ee23b3e1604a4ab5e1311ab45
7
- data.tar.gz: 81b25a5d9b955bb381aeef5e644e03d99ec3b064618c9c5cb3cb4a1e098954f68c82dbe23332ff0dda042eac1c01188cff8efb9ab5dcb6e658710ee8df678b6b
6
+ metadata.gz: c44ef9a1ebab50745bde35f83a5189bebab1ef735b5ca9529d2ca3927f9e44aa9250ad449c9c4b9047414fbfc359e160e905a783b34c42744421209264c684ca
7
+ data.tar.gz: 33a3622ca2894f89d2134f0588d9aebdeec60dfbf7008540d2d9ba00d98245e5130d8cadc462dfbaa19df3a9c35c88c4dc5a1f88ea64450e5cd0780ce9846575
data/changes.txt ADDED
@@ -0,0 +1,11 @@
1
+ V 1.2
2
+ -) Bugfix: Word wrapping
3
+ * does no longer eliminate dashes.
4
+ * better handling of special characters
5
+ -) some new events added
6
+
7
+ V 1.1
8
+ -) version information extended
9
+ -) superfluous code removed
10
+ -) This file changes.txt
11
+ -) License WTFPL
data/lib/argparser.rb CHANGED
@@ -57,6 +57,7 @@ class ArgParser
57
57
  end
58
58
  opts.on("-v", "--version", 'Show program version') do
59
59
  puts APPNAME.dup << ", version " << VERSION
60
+ puts "©#{YEARS} #{AUTHOR} #{AUTHOR_MAIL}"
60
61
  exit true
61
62
  end
62
63
  end
data/lib/events.rb CHANGED
@@ -15,8 +15,10 @@
15
15
  =end
16
16
 
17
17
  # All events known.
18
+ $events << ['The Liberation of Dachau Concentration Camp', 1945, 'The 42nd and 45th Infantry Divisions, as well as the 20th Armored Division of the US Army liberate approximately 32,000 prisoners at Dachau on April 29, 1945. Unprepared for the situation, the smell of decaying bodies and human excrement and the sight of naked, emaciated bodies induced vomiting, crying, disbelief, and rage in the advancing troops. Some of the SS-men who were in charge of the camp were killed by US soldiers after having surrendered, which is considered a war crime. But any charges against the men involved in the killings were dismissed by General George S. Patton.']
19
+ $events << ['The Massacre of Béziers', 1209, 'At the beginning of the Albigensian Crusade against the Cathar movement in the Longuedoc (France), Béziers was the first town that was besieged and conquered by the Crusader army, commanded by the papal legate Arnaud Almaric on 22 July 1209. Almarics own receit of the siege and massacre includes this passage: "Our men spared no one, irrespective of rank, sex or age, and put to the sword almost 20,000 people. After this great slaughter the whole city was despoiled and burnt, as divine vengeance miraculously raged against it."']
18
20
  $events << ['Ibn Battuta visits the sultanate of Mali', 1352, 'Ibn Battuta, the great Morrocan voyager, in his journal described many of the territories under Muslim domination and became, thus, the only eyewitness of West-African societies and their political organization at that time. His writings contrast with that of later authors who – often in a colonial context – deny the existence of developped societies in this part of the world and, thus, imposed that “Africa has had no history”.']
19
- $events << ['Obligations towards Britain as the colonial Power create a huge famine in Bengal (India)', 1943, 'Following the Japanese occupation of Burma, Britain demanded material support for its war efforts from the Indian colonies and - at the same time – refused its care for an already suffering population. When the extend of the resulting famine began to get known, feeble counter-measures were sufficient to downplay the the catastrophy.']
21
+ $events << ['Obligations towards Britain as the colonial Power create a huge famine in Bengal (India)', 1943, 'Following the Japanese occupation of Burma, Britain demanded material support for its war efforts from the Indian colonies and at the same time – refused its care for an already suffering population. When the extend of the resulting famine began to get known, feeble counter-measures were sufficient to downplay the the catastrophy.']
20
22
  $events << ['Howard Hughes founds his own aircraft company', 1932,'Hughes was an American manufacturer, aviator, and motion-picture producer and director who acquired enormous wealth and celebrity from his various ventures but was perhaps better known for his eccentricities, especially his reclusiveness (britannica.com).' ]
21
23
  $events << ['Destruction of the German town Dresden', 1945,'The bombing on February 1945 caused a firestorm which left the town ablaze for weeks and killed about 35000 people although the precise number will probably never be established.' ]
22
24
  $events << ['The aviator Charles Lindbergh dies', 1974,'Charles Lindbergh was the first aviator to complete a solo transatlantic flight in May 1927.' ]
@@ -32,7 +34,7 @@ $events << ['Christian Huygens is born', 1629, 'Christiaan Huygens was a Dutch m
32
34
  $events << ['Foundation of the Royal Society in London', 1660, 'From its first meeting, on 28 November 1660, following a lecture by the Professor of Astronomy at Gresham College in London, Christopher Wren, the new Fellowship would concern itself with natural philosophy – what we would now term science. Wren considered that it should act to transform knowledge, profit, and health and the conveniences of life.']
33
35
  $events << ['Galileo Galilée observes the first known satellites of Jupiter', 1610, 'A few weeks after his observations, Galileo determined that he was observing not stars, but objects in orbit around Jupiter. Today, Jupiter’s four largest satellites—Io, Europa, Ganymede, and Callisto—are named the Galilean moons in honor of their discoverer.']
34
36
  $events << ['The Persian astronomer Al Soufi is born', 903, 'Abd-al-Rahman Al Sufi published his famous "Book of Fixed Stars" in 964 describing much of his work, both in textual descriptions and pictures. In his descriptions and pictures of Andromeda, he included "A Little Cloud" which is actually the Andromeda Galaxy M31.']
35
- $events << ["Failed British Macartney Embassy in China",1793, 'The British mission traveled to China in 179293 in an attempt to secure more favourable trade and diplomatic relations for the United Kingdom. Macartney was expected by his hosts to kneel three times and to touch his head several times on the ground in acknowledgment of the emperor as the “son of heaven” (tianzi) and of China as the Central Kingdom (Zhongguo). He refused to kowtow, however, and instead went down on only one knee, as he would before a British monarch. The whole mission was marked by misunderstandings, and the Embassy failed to achieve its goals.']
37
+ $events << ["Failed British Macartney Embassy in China",1793, 'The British mission traveled to China in 1792-93 in an attempt to secure more favourable trade and diplomatic relations for the United Kingdom. Macartney was expected by his hosts to kneel three times and to touch his head several times on the ground in acknowledgment of the emperor as the “son of heaven” (tianzi) and of China as the Central Kingdom (Zhongguo). He refused to kowtow, however, and instead went down on only one knee, as he would before a British monarch. The whole mission was marked by misunderstandings, and the Embassy failed to achieve its goals.']
36
38
  $events << ['Copernicus publishes “De revolutionibus orbium coelestium”', 1543,"Copernicus' major work, first edition 1543 in Nuremberg, was a compendium of six books published during the year of his death, though he had arrived at his theory several decades earlier: Copernicus held that the Earth is another planet revolving around the fixed Sun once a year and turning on its axis once a day."]
37
39
  $events << ['First universal time, “Greenich Meen Time”', 1884, 'People had been trying to standardise time for years, but nobody could agree. And so, to settle the subject once and for all, in 1884 a conference was called by the president of the USA, Chester Arthur. On 13 October 1884, the International Meridian Conference resolved by 22 votes to one, and two abstentions (one of which was France, obviously), that Greenwich would be the prime meridian of longitude.']
38
40
  $events << ['Begining of the Islamic Calendar', 622, 'The Islamic Calendar, also known as the Hijri or lunar calendar, began on July 16, 622 CE, marking the first day of the first year of the Hegira (Hijra). This significant event commemorates the migration of the Prophet Muhammad from Mecca to Medina, a pivotal moment in Islamic history that not only shaped the early Muslim community but also established a new chronological framework for Muslims.']
data/lib/extstring.rb CHANGED
@@ -110,11 +110,12 @@ class String
110
110
 
111
111
  # A wrap-function which works here, but may fail everywhere else.
112
112
  def wrap(width, delimiter = "\n")
113
- # YEAH. Ruby is crap because its regular expressions do not work as they
114
- # should with special characters. And your coffee mug has a speech
115
- # impediment. Face it!
116
- words = self.scan(/\p{P}*[\wöÖüÜäÄßéèàôûùîçÇœæŒÆ]+\p{P}*/)
117
-
113
+
114
+ #words = self.scan(/\p{P}*[\wöÖüÜ-äÄßéèàôûùîçÇœæŒÆ]+\p{P}*/)
115
+
116
+ # Use Unicode character classes
117
+ words = self.scan(/\p{P}*[\w\p{Alpha}\p{Pd}]+\p{P}*/)
118
+
118
119
  lines = []
119
120
  lines << ''
120
121
  li = 0
@@ -141,7 +142,7 @@ if __FILE__ == $0
141
142
 
142
143
  s = "1) Ein Koenig mit Krone ist besser als ohne,\n\n(du Nase)!!\n2) We are not in Kansas anymore.\n3) Toto? Ich glaub, der Köter hieß Toto... ".wrap(12, /^\d/)
143
144
  puts s
144
-
145
+
145
146
 
146
147
  # puts "Ein Koenig mit Krone ist besser als ohne,\n\ndu Nase!!".box(:padding=>2)
147
148
 
@@ -149,6 +150,7 @@ if __FILE__ == $0
149
150
  s << "2) Man gab uns mancherlei auf Erden.\nZum Denken gab man uns die Stirn."
150
151
  s << "2a) Man gab uns Herz- und Leibbeschwerden.\nDoch auch den Himmel und den Zwirn."
151
152
  s << "3) Himmel, Ding und Zwirn."
152
- s.wrap(12, /\d\)/)
153
+ s.wrap(80, /\d\)/)
154
+ puts s
153
155
  puts s.box(:min_width=>20, :left => 20)
154
156
  end
data/lib/version.rb CHANGED
@@ -16,8 +16,8 @@
16
16
  =end
17
17
 
18
18
  APPNAME = 'Timequiz'
19
- VERSION = '1.0'
20
- SUMMARY = 'Added events, version clashes on rubygems.org resolved'
19
+ VERSION = '1.2'
20
+ SUMMARY = 'Play a history game'
21
21
  AUTHOR = 'Michael Uplawski'
22
22
  AUTHOR_MAIL = '<michael.uplawski@uplawski.eu>'
23
- YEARS = 2017 - 2026
23
+ YEARS = '2017 - 2026'
data/timequiz.gemspec CHANGED
@@ -6,17 +6,18 @@ Gem::Specification.new do |s|
6
6
  s.name = File.basename(__FILE__, '.gemspec')
7
7
  s.date = Date.today.strftime('%F')
8
8
  s.summary = SUMMARY
9
- s.description = "Play a history game"
9
+ s.description = "A game that makes you put historical events in chronological order."
10
10
  s.authors = ["Michael Uplawski"]
11
11
  s.email = 'michael.uplawski@uplawski.eu'
12
- s.files = %w~timequiz~.collect{|f| 'bin/' << f} + %w~basic_logging.rb version.rb file_checking.rb adder.rb argparser.rb busy_indicator.rb color_output.rb console.rb constants.rb event.rb events.rb extstring.rb user_input.rb timequiz.rb~.collect{|f| 'lib/' << f} + %w~timequiz.gemspec~.collect{|f|f} + %w~man/timequiz.6.gz html/timequiz.html pdf/timequiz.pdf rst/timequiz.rst license.txt~.collect{|f| 'doc/' << f} + ["README.md"]
12
+ s.files = %w~timequiz~.collect{|f| 'bin/' << f} + %w~basic_logging.rb version.rb adder.rb argparser.rb busy_indicator.rb color_output.rb console.rb constants.rb event.rb events.rb extstring.rb user_input.rb timequiz.rb~.collect{|f| 'lib/' << f} + %w~timequiz.gemspec changes.txt README.md~.collect{|f|f} + %w~man/timequiz.6.gz html/timequiz.html pdf/timequiz.pdf rst/timequiz.rst license.txt~.collect{|f| 'doc/' << f}
13
13
  #s.requirements = ''
14
14
  #s.add_runtime_dependency ''
15
15
  s.executables = 'timequiz'
16
- s.license = 'Nonstandard'
16
+ s.license = 'WTFPL'
17
17
  s.required_ruby_version = '>= 2.7'
18
18
  s.metadata = {
19
19
  "homepage_uri" => 'https://www.uplawski.eu/software/timequiz/',
20
- "documentation_uri" => 'https://www.uplawski.eu/software/timequiz/man_timequiz.html'
20
+ "documentation_uri" => 'https://www.uplawski.eu/software/timequiz/man_timequiz.html',
21
+ "changelog_uri" => 'https://www.uplawski.eu/software/timequiz/changes.txt'
21
22
  }
22
23
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timequiz
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Uplawski
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-06-06 00:00:00.000000000 Z
10
+ date: 2026-09-09 00:00:00.000000000 Z
11
11
  dependencies: []
12
- description: Play a history game
12
+ description: A game that makes you put historical events in chronological order.
13
13
  email: michael.uplawski@uplawski.eu
14
14
  executables:
15
15
  - timequiz
@@ -18,6 +18,7 @@ extra_rdoc_files: []
18
18
  files:
19
19
  - README.md
20
20
  - bin/timequiz
21
+ - changes.txt
21
22
  - doc/html/timequiz.html
22
23
  - doc/license.txt
23
24
  - doc/man/timequiz.6.gz
@@ -33,16 +34,16 @@ files:
33
34
  - lib/event.rb
34
35
  - lib/events.rb
35
36
  - lib/extstring.rb
36
- - lib/file_checking.rb
37
37
  - lib/timequiz.rb
38
38
  - lib/user_input.rb
39
39
  - lib/version.rb
40
40
  - timequiz.gemspec
41
41
  licenses:
42
- - Nonstandard
42
+ - WTFPL
43
43
  metadata:
44
44
  homepage_uri: https://www.uplawski.eu/software/timequiz/
45
45
  documentation_uri: https://www.uplawski.eu/software/timequiz/man_timequiz.html
46
+ changelog_uri: https://www.uplawski.eu/software/timequiz/changes.txt
46
47
  rdoc_options: []
47
48
  require_paths:
48
49
  - lib
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  - !ruby/object:Gem::Version
58
59
  version: '0'
59
60
  requirements: []
60
- rubygems_version: 4.0.13
61
+ rubygems_version: 4.0.18
61
62
  specification_version: 4
62
- summary: Added events, version clashes on rubygems.org resolved
63
+ summary: Play a history game
63
64
  test_files: []
data/lib/file_checking.rb DELETED
@@ -1,83 +0,0 @@
1
- #encoding: UTF-8
2
- =begin
3
- /***************************************************************************
4
- * ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
- * *
6
- * This program is free software; you can redistribute it and/or modify *
7
- * it under the terms of the WTFPL 2.0 or later, see *
8
- * http://www.wtfpl.net/about/ *
9
- * *
10
- * This program is distributed in the hope that it will be useful, *
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
13
- * *
14
- ***************************************************************************/
15
- =end
16
-
17
- =begin
18
- A module to facilitate frequently occuring checks on
19
- file-system objects. You can certainly do without this,
20
- but maybe you find it useful.
21
- =end
22
- module File_Checking
23
-
24
- @@text_messages = {
25
- :exist? => "does not exist!",
26
- :exist => "does not exist!",
27
- :readable? => "is not readable!",
28
- :readable => "is not readable!",
29
- :executable? => "is not executable!",
30
- :executable => "is not executable!",
31
- :writable? => "is not writable!",
32
- :writable => "is not writable!",
33
- :directory? => "is not a directory!",
34
- :directory => "is not a directory!",
35
- :file? => "is not a file!",
36
- :file => "is not a file!",
37
- }
38
-
39
- # Checks if the file with the name from the first
40
- # parameter has the properties, listed in the second.
41
- # The messages parameter is an array of one or several
42
- # of :exist?, :readable?, :writable?, :directory? or
43
- # their string-representations, respectively.
44
- # Returns nil in case of success, otherwise an
45
- # informative message, describing the first negative
46
- # test-result.
47
- def file_check(file, *messages)
48
- File_Checking.file_check(file, *messages)
49
- end
50
-
51
- # Checks if the file with the name from the first
52
- # parameter has the properties, listed in the second.
53
- # The messages parameter is an array of one or all
54
- # of :exist?, :readable?, :writable?, :directory? or
55
- # their string-representations, respectively.
56
- # Returns nil in case of success, otherwise an
57
- # informative message, describing the first negative
58
- # test-result.
59
- def self.file_check(file, *messages)
60
- msg = nil
61
- if(file && messages.respond_to?(:to_ary) && !messages.empty?)
62
- messages.each do |k|
63
- if(! k.to_s.end_with?('?'))
64
- k = (k.to_s << '?').to_sym
65
- end
66
- @log.debug ('checking ' << k.to_s) if @log
67
- if(msg == nil && File.respond_to?(k) && ! File.send(k, file.to_s))
68
- msg = "#{file} #{@@text_messages[k.to_sym]}"
69
- end
70
- end
71
- end
72
- msg
73
- end
74
- alias :check_file :file_check
75
- end
76
-
77
- =begin
78
- # example
79
-
80
- include File_Checking
81
- msg = file_check('some_file.txt', [:exist?, :readable?, 'writable'])
82
- puts msg if msg
83
- =end