timequiz 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +152 -0
- data/doc/license.txt +9 -670
- data/lib/adder.rb +25 -34
- data/lib/argparser.rb +7 -17
- data/lib/basic_logging.rb +167 -0
- data/lib/busy_indicator.rb +12 -19
- data/lib/color_output.rb +12 -19
- data/lib/console.rb +4 -12
- data/lib/constants.rb +6 -15
- data/lib/event.rb +12 -19
- data/lib/events.rb +17 -19
- data/lib/extstring.rb +12 -19
- data/lib/file_checking.rb +4 -10
- data/lib/timequiz.rb +28 -40
- data/lib/user_input.rb +4 -10
- data/lib/version.rb +17 -22
- data/timequiz.gemspec +2 -2
- metadata +10 -11
- data/lib/log.conf +0 -55
- data/lib/logging.rb +0 -204
data/lib/adder.rb
CHANGED
@@ -1,72 +1,63 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#encoding: UTF-8
|
3
|
-
|
4
3
|
=begin
|
5
|
-
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* This program is free software; you can redistribute it and/or modify
|
9
|
-
* it under the terms of the
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
|
17
|
-
* *
|
18
|
-
* You should have received a copy of the GNU General Public License *
|
19
|
-
* along with this program; if not, write to the *
|
20
|
-
* Free Software Foundation, Inc., *
|
21
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
22
|
-
******************************************************************************/
|
4
|
+
/***************************************************************************
|
5
|
+
* ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
6
|
+
* *
|
7
|
+
* This program is free software; you can redistribute it and/or modify *
|
8
|
+
* it under the terms of the WTFPL 2.0 or later, see *
|
9
|
+
* http://www.wtfpl.net/about/ *
|
10
|
+
* *
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
14
|
+
* *
|
15
|
+
***************************************************************************/
|
23
16
|
=end
|
24
17
|
|
18
|
+
|
25
19
|
require_relative 'constants'
|
26
|
-
require_relative '
|
20
|
+
require_relative 'basic_logging'
|
27
21
|
|
28
22
|
class Adder
|
29
23
|
#@@events_file = File.dirname(__FILE__) << File::Separator << 'events.rb'
|
30
24
|
#@@events_backup = File.dirname(__FILE__) << File::Separator << 'bak_events.rb'
|
31
|
-
|
32
|
-
@@log = self::init_logger
|
33
|
-
# Do not present as 'Adder' on the command-line
|
34
|
-
self::log_label=$APPNAME
|
25
|
+
include BasicLogging
|
35
26
|
|
36
27
|
def self::add(options)
|
37
|
-
|
28
|
+
debug('options are ' << options.to_s)
|
38
29
|
if options.file
|
39
30
|
@@events_file = options.file
|
40
31
|
@@events_backup = File.dirname(@@events_file) << File::Separator << 'bak_' << File.basename(@@events_file)
|
41
32
|
else
|
42
|
-
|
33
|
+
error('To add events, you must name a file on the command-line. Aborting')
|
43
34
|
exit false
|
44
35
|
end
|
45
36
|
if(!options.event || !options.year)
|
46
|
-
|
37
|
+
error("To add events, you must provide them on the command-line.\n\tPSE start the program with option -h or --help to see an option-overview.")
|
47
38
|
exit false
|
48
39
|
end
|
49
40
|
|
50
|
-
|
41
|
+
@level = $LOG_LEVEL if $LOG_LEVEL
|
51
42
|
fields = [:event, :year, :background]
|
52
|
-
|
43
|
+
debug('options are ' << options.to_s)
|
53
44
|
if options[:event] && options[:year]
|
54
45
|
if !options[:background]
|
55
|
-
|
46
|
+
warn('Optional background information is missing')
|
56
47
|
bg = ''
|
57
48
|
else
|
58
49
|
bg = options.background
|
59
50
|
end
|
60
51
|
|
61
52
|
ev_def = "$events << [\"" << options.event << "\", " << options.year << ", \"" << bg << "\"]"
|
62
|
-
|
53
|
+
debug('writing events-backup to ' << @@events_backup)
|
63
54
|
File.open(@@events_backup, 'w+') {|bak| bak.write( File.read(@@events_file))}
|
64
|
-
|
55
|
+
debug('adding new event to the list: ' << ev_def)
|
65
56
|
File.open(@@events_file, 'a') {|evf| evf.puts(ev_def)}
|
66
|
-
|
57
|
+
info('A new event has been added to ' << @@events_file << '.')
|
67
58
|
else
|
68
59
|
opts = options.to_h.keys
|
69
|
-
|
60
|
+
error('Option missing: ' << fields.each {|f| opts.delete(f) }.join(', '))
|
70
61
|
exit false
|
71
62
|
end
|
72
63
|
end
|
data/lib/argparser.rb
CHANGED
@@ -1,38 +1,28 @@
|
|
1
1
|
#encoding: UTF-8
|
2
2
|
=begin
|
3
3
|
/***************************************************************************
|
4
|
-
* ©
|
4
|
+
* ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
5
5
|
* *
|
6
6
|
* This program is free software; you can redistribute it and/or modify *
|
7
|
-
* it under the terms of the
|
8
|
-
*
|
9
|
-
* (at your option) any later version. *
|
7
|
+
* it under the terms of the WTFPL 2.0 or later, see *
|
8
|
+
* http://www.wtfpl.net/about/ *
|
10
9
|
* *
|
11
10
|
* This program is distributed in the hope that it will be useful, *
|
12
11
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
-
* GNU General Public License for more details. *
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
15
13
|
* *
|
16
|
-
* You should have received a copy of the GNU General Public License *
|
17
|
-
* along with this program; if not, write to the *
|
18
|
-
* Free Software Foundation, Inc., *
|
19
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
20
14
|
***************************************************************************/
|
21
15
|
=end
|
22
16
|
|
23
|
-
|
24
17
|
require 'optparse'
|
25
18
|
require 'optparse/time'
|
26
19
|
require 'ostruct'
|
27
|
-
require_relative '
|
28
|
-
# require_relative 'translating'
|
20
|
+
require_relative 'basic_logging'
|
29
21
|
require_relative 'constants'
|
30
22
|
|
31
23
|
class ArgParser
|
32
24
|
# Class level logger. This is a static class.
|
33
|
-
|
34
|
-
# self.extend(Translating)
|
35
|
-
@@log = init_logger()
|
25
|
+
include BasicLogging
|
36
26
|
|
37
27
|
# Returns a structure describing the options.
|
38
28
|
#
|
@@ -58,7 +48,7 @@ class ArgParser
|
|
58
48
|
opts.on("-bINFO", "--background=INFO", 'Background information') do |info|
|
59
49
|
options.background = info
|
60
50
|
end
|
61
|
-
opts.on("-fFILE", "--file=FILE", 'The file
|
51
|
+
opts.on("-fFILE", "--file=FILE", 'The file that events are read from') do |file|
|
62
52
|
options.file = file
|
63
53
|
end
|
64
54
|
opts.on("-d", "--debug", 'Be verbose') do
|
@@ -0,0 +1,167 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
#encoding: UTF-8
|
3
|
+
=begin
|
4
|
+
/***************************************************************************
|
5
|
+
* ©2013-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
6
|
+
* *
|
7
|
+
* This program is free software; you can redistribute it and/or modify *
|
8
|
+
* it under the terms of the WTFPL 2.0 or later, see *
|
9
|
+
* http://www.wtfpl.net/about/ *
|
10
|
+
* *
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
14
|
+
* *
|
15
|
+
***************************************************************************/
|
16
|
+
=end
|
17
|
+
|
18
|
+
#
|
19
|
+
# Simplified logging.
|
20
|
+
# See example code at the bottom of this file.
|
21
|
+
# Execute this file to see the output.
|
22
|
+
module BasicLogging
|
23
|
+
|
24
|
+
DEBUG = 0
|
25
|
+
INFO = 1
|
26
|
+
WARN = 2
|
27
|
+
ERROR = 3
|
28
|
+
FATAL = 4
|
29
|
+
UNKNOWN = nil
|
30
|
+
|
31
|
+
# this is mainly for the translation of method calls into log levels
|
32
|
+
Levels = {:debug => DEBUG, :info => INFO, :warn => WARN, :error => ERROR,
|
33
|
+
:fatal => FATAL, :unknown => UNKNOWN}
|
34
|
+
|
35
|
+
@@log_level = UNKNOWN
|
36
|
+
@@target = STDOUT
|
37
|
+
@@muted = []
|
38
|
+
|
39
|
+
# do not log, if caller is obj (class or instance)
|
40
|
+
def self.mute(obj)
|
41
|
+
name = obj.class == Class ? obj.name.dup : obj.class.name
|
42
|
+
@@muted << name
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.is_muted?(obj)
|
46
|
+
name = obj.class == Class ? obj.name.dup : obj.class.name
|
47
|
+
@@muted.include?(name)
|
48
|
+
end
|
49
|
+
|
50
|
+
# set the log level
|
51
|
+
def set_level(lv)
|
52
|
+
if lv.respond_to?(:to_str)
|
53
|
+
lv = Levels[lv.to_sym]
|
54
|
+
end
|
55
|
+
|
56
|
+
if(!lv || (lv.respond_to?(:to_int) && lv >= DEBUG && lv <= FATAL) )
|
57
|
+
@@log_level = lv
|
58
|
+
else
|
59
|
+
STDERR.puts __FILE__.dup << ": ERROR : invalid log level \"" << lv.to_s << "\""
|
60
|
+
STDERR.puts "Keepinng old log level " << Levels.keys.detect {| k| Levels[k] == @@log_level}.to_s
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# set the log target
|
65
|
+
def set_target(tg)
|
66
|
+
if tg.respond_to?(:to_io)
|
67
|
+
@@target = tg
|
68
|
+
elsif(!File::exist?(tg) || ( File.file?(tg) && File.writable?(tg) ) )
|
69
|
+
@@target = File.open(tg, 'w+')
|
70
|
+
else
|
71
|
+
STDERR.puts __FILE__.dup << ': ERROR : target ' << tg << ' cannot be set'
|
72
|
+
STDERR.puts "Keeping old target " << @@target.inspect
|
73
|
+
return
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Output of log messages, depending on the log level set for the calling class
|
78
|
+
# and the name of the alias method which is actually called.
|
79
|
+
def log(message)
|
80
|
+
if !BasicLogging.is_muted?(self)
|
81
|
+
# how has this method been called?
|
82
|
+
mlevel = __callee__
|
83
|
+
if Levels.has_key?(mlevel) && Levels[mlevel] <= FATAL
|
84
|
+
# output only for levels equal or above the value that corresponds to
|
85
|
+
# the calling alias.
|
86
|
+
format_log( message, mlevel) if @@log_level && Levels[mlevel] >= @@log_level
|
87
|
+
else
|
88
|
+
STDERR.puts __FILE__.dup << ": ERROR : invalid log level \"" << mlevel.to_s << "\""
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
alias :debug :log
|
94
|
+
alias :info :log
|
95
|
+
alias :warn :log
|
96
|
+
alias :error :log
|
97
|
+
alias :fatal :log
|
98
|
+
|
99
|
+
attr_reader :target, :log_level
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
# 1 format_log for all loggers.
|
104
|
+
def format_log(message, mlevel)
|
105
|
+
# indicate if a registered class or the registered object of a class is calling.
|
106
|
+
name = self.class == Class ? self.name.dup << ' [class]' : self.class.name
|
107
|
+
@@target.puts '' << name << ' ' << mlevel.to_s << ' ' << Time.now.strftime("%H:%M:%S:%6N") << ': ' << message.gsub("\n", "\n |")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
#---------test: execute file----------
|
111
|
+
if $0 == __FILE__
|
112
|
+
Array.extend(BasicLogging)
|
113
|
+
Array.set_level(BasicLogging::INFO)
|
114
|
+
Array.info('TEST')
|
115
|
+
ar = Array.new
|
116
|
+
ar.extend(BasicLogging)
|
117
|
+
# --- no output :
|
118
|
+
l = __LINE__
|
119
|
+
ar.debug(l.next.to_s << ': debug-test 0')
|
120
|
+
# output
|
121
|
+
ar.set_level(BasicLogging::DEBUG)
|
122
|
+
l = __LINE__
|
123
|
+
ar.debug(l.next.to_s << ': debug-test 1')
|
124
|
+
|
125
|
+
obj = Object.new
|
126
|
+
obj.extend(BasicLogging)
|
127
|
+
obj.set_level(BasicLogging::DEBUG)
|
128
|
+
puts "--------debug-----------"
|
129
|
+
obj.debug('debug')
|
130
|
+
obj.info('info')
|
131
|
+
obj.warn('warn')
|
132
|
+
obj.error('error')
|
133
|
+
obj.fatal('fatal')
|
134
|
+
puts "--------info-----------"
|
135
|
+
obj.set_level("info")
|
136
|
+
obj.debug('debug')
|
137
|
+
obj.info('info')
|
138
|
+
obj.warn('warn')
|
139
|
+
obj.error('error')
|
140
|
+
obj.fatal('fatal')
|
141
|
+
puts "--------fatal-----------"
|
142
|
+
obj.set_level("fatal")
|
143
|
+
obj.debug('debug')
|
144
|
+
obj.info('info')
|
145
|
+
obj.warn('warn')
|
146
|
+
obj.error('error')
|
147
|
+
obj.fatal('fatal')
|
148
|
+
puts "--------UNKNOWN-----------"
|
149
|
+
obj.set_level(nil)
|
150
|
+
obj.debug('debug')
|
151
|
+
obj.info('info')
|
152
|
+
obj.warn('warn')
|
153
|
+
obj.error('error')
|
154
|
+
obj.fatal('fatal')
|
155
|
+
puts " ------ Output into file ----"
|
156
|
+
obj.set_target "/tmp/test_log.log"
|
157
|
+
puts " ------ INFO -----------"
|
158
|
+
obj.set_level BasicLogging::INFO
|
159
|
+
obj.info('info output')
|
160
|
+
|
161
|
+
obj.info('info output 2')
|
162
|
+
puts "---------- invalid -------"
|
163
|
+
obj.set_target "/dev/sr0"
|
164
|
+
obj.set_level "power"
|
165
|
+
end
|
166
|
+
|
167
|
+
# EOF
|
data/lib/busy_indicator.rb
CHANGED
@@ -1,26 +1,19 @@
|
|
1
1
|
#encoding: UTF-8
|
2
2
|
|
3
3
|
=begin
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* This program is free software; you can redistribute it and/or modify
|
8
|
-
* it under the terms of the
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
|
16
|
-
* *
|
17
|
-
* You should have received a copy of the GNU General Public License *
|
18
|
-
* along with this program; if not, write to the *
|
19
|
-
* Free Software Foundation, Inc., *
|
20
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
21
|
-
******************************************************************************/
|
4
|
+
/***************************************************************************
|
5
|
+
* ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
6
|
+
* *
|
7
|
+
* This program is free software; you can redistribute it and/or modify *
|
8
|
+
* it under the terms of the WTFPL 2.0 or later, see *
|
9
|
+
* http://www.wtfpl.net/about/ *
|
10
|
+
* *
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
14
|
+
* *
|
15
|
+
***************************************************************************/
|
22
16
|
=end
|
23
|
-
|
24
17
|
# BusyIndicator provides a way to show 'activity' in a terminal-window, while
|
25
18
|
# the main thread does something else. For a usage example see the test-code at
|
26
19
|
# the bottom of this file and execute the file (e.g. ruby ./busy_indicator.rb)
|
data/lib/color_output.rb
CHANGED
@@ -1,24 +1,17 @@
|
|
1
1
|
#encoding: UTF-8
|
2
|
-
|
3
2
|
=begin
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* This program is free software; you can redistribute it and/or modify
|
8
|
-
* it under the terms of the
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
|
16
|
-
* *
|
17
|
-
* You should have received a copy of the GNU General Public License *
|
18
|
-
* along with this program; if not, write to the *
|
19
|
-
* Free Software Foundation, Inc., *
|
20
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
21
|
-
******************************************************************************/
|
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
|
+
***************************************************************************/
|
22
15
|
=end
|
23
16
|
|
24
17
|
# Functions to apply colors to terminal output.
|
data/lib/console.rb
CHANGED
@@ -1,26 +1,18 @@
|
|
1
1
|
#encoding: UTF-8
|
2
|
-
|
3
2
|
=begin
|
4
3
|
/***************************************************************************
|
5
|
-
*
|
4
|
+
* ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
6
5
|
* *
|
7
6
|
* This program is free software; you can redistribute it and/or modify *
|
8
|
-
* it under the terms of the
|
9
|
-
*
|
10
|
-
* (at your option) any later version. *
|
7
|
+
* it under the terms of the WTFPL 2.0 or later, see *
|
8
|
+
* http://www.wtfpl.net/about/ *
|
11
9
|
* *
|
12
10
|
* This program is distributed in the hope that it will be useful, *
|
13
11
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
15
|
-
* GNU General Public License for more details. *
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
16
13
|
* *
|
17
|
-
* You should have received a copy of the GNU General Public License *
|
18
|
-
* along with this program; if not, write to the *
|
19
|
-
* Free Software Foundation, Inc., *
|
20
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
21
14
|
***************************************************************************/
|
22
15
|
=end
|
23
|
-
|
24
16
|
require_relative 'extstring'
|
25
17
|
require_relative 'user_input'
|
26
18
|
require_relative 'constants'
|
data/lib/constants.rb
CHANGED
@@ -1,35 +1,26 @@
|
|
1
1
|
#encoding: UTF-8
|
2
|
-
|
3
2
|
=begin
|
4
3
|
/***************************************************************************
|
5
|
-
*
|
4
|
+
* ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
6
5
|
* *
|
7
6
|
* This program is free software; you can redistribute it and/or modify *
|
8
|
-
* it under the terms of the
|
9
|
-
*
|
10
|
-
* (at your option) any later version. *
|
7
|
+
* it under the terms of the WTFPL 2.0 or later, see *
|
8
|
+
* http://www.wtfpl.net/about/ *
|
11
9
|
* *
|
12
10
|
* This program is distributed in the hope that it will be useful, *
|
13
11
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
15
|
-
* GNU General Public License for more details. *
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
16
13
|
* *
|
17
|
-
* You should have received a copy of the GNU General Public License *
|
18
|
-
* along with this program; if not, write to the *
|
19
|
-
* Free Software Foundation, Inc., *
|
20
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
21
14
|
***************************************************************************/
|
22
15
|
=end
|
23
|
-
require_relative 'logging'
|
24
16
|
|
25
|
-
|
26
|
-
$VERSION = '0.1.3'
|
17
|
+
require_relative 'basic_logging'
|
27
18
|
|
28
19
|
# number of initial events
|
29
20
|
$num_events = 3
|
30
21
|
# maximal, final number of events per game
|
31
22
|
$MAX_NUM_EVENTS = 15
|
32
|
-
$LOG_LEVEL=
|
23
|
+
$LOG_LEVEL=BasicLogging::INFO
|
33
24
|
$events = Array.new
|
34
25
|
# Constants for the Gtk-Interface
|
35
26
|
# EVENTS
|
data/lib/event.rb
CHANGED
@@ -1,24 +1,17 @@
|
|
1
1
|
#encoding: UTF-8
|
2
|
-
|
3
2
|
=begin
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* This program is free software; you can redistribute it and/or modify
|
8
|
-
* it under the terms of the
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
|
16
|
-
* *
|
17
|
-
* You should have received a copy of the GNU General Public License *
|
18
|
-
* along with this program; if not, write to the *
|
19
|
-
* Free Software Foundation, Inc., *
|
20
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
21
|
-
******************************************************************************/
|
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
|
+
***************************************************************************/
|
22
15
|
=end
|
23
16
|
|
24
17
|
# An object of this class is representing a historical event.
|
data/lib/events.rb
CHANGED
@@ -1,24 +1,17 @@
|
|
1
1
|
#encoding: UTF-8
|
2
|
-
|
3
2
|
=begin
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* This program is free software; you can redistribute it and/or modify
|
8
|
-
* it under the terms of the
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
|
16
|
-
* *
|
17
|
-
* You should have received a copy of the GNU General Public License *
|
18
|
-
* along with this program; if not, write to the *
|
19
|
-
* Free Software Foundation, Inc., *
|
20
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
21
|
-
******************************************************************************/
|
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
|
+
***************************************************************************/
|
22
15
|
=end
|
23
16
|
|
24
17
|
# All events known.
|
@@ -44,3 +37,8 @@ $events << ['First siege of Vienna (Austria) by Süleyman the Magnificent', 1529
|
|
44
37
|
$events << ['The Roman empress Galla Placidia dies', 450, 'Born around the year 390 as the daughter of Theodosius I, she was first married to Alaric\'s brother in law, Athaulf, king of the Visigoths, then to the future Constantius III, a general of her brother Honorius who inherited from her the title of "Augustus". After Honorius\' death and at the decision of Theodosius II, grandson of Theodosius I and emperor of the orient, Galla Placida governed the western empire for her six year old son Valentinian (the future Valentinian III).']
|
45
38
|
$events << ['Birth of Kathleen Mansfield', 1888, '(1888 Wellington, New-Zealand). Of vivid sensibility, Katherine Mansfield is the most representative novelist and poet of the era after World War I. Her novels had the biggest success in France. She died in 1923 on tuberculosis.']
|
46
39
|
$events << ['Spanish victory over the last Maya kingdom', 1697, 'The Itza kingdom submitted to Spanish rule, after a force led by Martín de Ursua, governor of Yucatán, had conquered the Itza capital Nojpetén on 13 March 1697' ]
|
40
|
+
$events << ['Alexander The Great becomes king of Macedonia', -336, 'Son of Philippe II of Macedonia – a small kingdom a few hundred kilometers north of Athens – tutored by Aristotel, was of unbound ambition. His objective: reach the confines of the world and the big ocean at its exterior...']
|
41
|
+
$events << ['Conquest of Constantinople by the Ottoman Empire', 1453, '21 year old Sultan Mehmed II commanded the Ottoman army which began a siege of the city at 6 April 1453 and captured Constantinople on 29 May']
|
42
|
+
$events << ['Inauguration of the “Kinkaku-ji” – Tempel of the Golden Pavilion (Japan)', 1397, 'The Muromachi period is considered to be a classical age of Japanese garden design. The correlation between buildings and its settings were greatly emphasized during this period (Wikipedia)']
|
43
|
+
$events << ['French mathematician Blaise Pascal is born', 1623, 'Pascal – who was also physicist, philosopher, writer and Catholic theologian – was the inventor of a series of mechanical calculators, the “Pascalines”.']
|
44
|
+
$events << ['St. Bartholomew\'s Day massacre', 1572, 'Many assassinations were directed against a French Protestant movement at the end of August 1572. Depending on the sources, up to 30000 people may have been murdered in the events.']
|
data/lib/extstring.rb
CHANGED
@@ -1,24 +1,17 @@
|
|
1
1
|
#encoding: UTF-8
|
2
|
-
|
3
2
|
=begin
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* This program is free software; you can redistribute it and/or modify
|
8
|
-
* it under the terms of the
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
|
16
|
-
* *
|
17
|
-
* You should have received a copy of the GNU General Public License *
|
18
|
-
* along with this program; if not, write to the *
|
19
|
-
* Free Software Foundation, Inc., *
|
20
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
21
|
-
******************************************************************************/
|
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
|
+
***************************************************************************/
|
22
15
|
=end
|
23
16
|
|
24
17
|
require_relative 'color_output'
|
data/lib/file_checking.rb
CHANGED
@@ -1,22 +1,16 @@
|
|
1
1
|
#encoding: UTF-8
|
2
2
|
=begin
|
3
3
|
/***************************************************************************
|
4
|
-
* ©
|
4
|
+
* ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
5
5
|
* *
|
6
6
|
* This program is free software; you can redistribute it and/or modify *
|
7
|
-
* it under the terms of the
|
8
|
-
*
|
9
|
-
* (at your option) any later version. *
|
7
|
+
* it under the terms of the WTFPL 2.0 or later, see *
|
8
|
+
* http://www.wtfpl.net/about/ *
|
10
9
|
* *
|
11
10
|
* This program is distributed in the hope that it will be useful, *
|
12
11
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
-
* GNU General Public License for more details. *
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
15
13
|
* *
|
16
|
-
* You should have received a copy of the GNU General Public License *
|
17
|
-
* along with this program; if not, write to the *
|
18
|
-
* Free Software Foundation, Inc., *
|
19
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
20
14
|
***************************************************************************/
|
21
15
|
=end
|
22
16
|
|