hardware_information 1.0.71
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.
Potentially problematic release.
This version of hardware_information might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +65 -0
- data/bin/hardware_information +12 -0
- data/doc/README.gen +25 -0
- data/hardware_information.gemspec +44 -0
- data/lib/hardware_information/class/colours.rb +82 -0
- data/lib/hardware_information/class/constants.rb +145 -0
- data/lib/hardware_information/class/hardware_information.rb +32 -0
- data/lib/hardware_information/class/initialize.rb +24 -0
- data/lib/hardware_information/class/make_line.rb +55 -0
- data/lib/hardware_information/class/menu.rb +52 -0
- data/lib/hardware_information/class/misc.rb +275 -0
- data/lib/hardware_information/class/obtain.rb +255 -0
- data/lib/hardware_information/class/reset.rb +54 -0
- data/lib/hardware_information/class/run.rb +48 -0
- data/lib/hardware_information/css/project.css +3 -0
- data/lib/hardware_information/gui/gtk2/purchased_hardware/purchased_hardware.rb +34 -0
- data/lib/hardware_information/gui/gtk2/show_input_devices/show_input_devices.rb +34 -0
- data/lib/hardware_information/gui/gtk3/mounted_harddiscs/mounted_harddiscs.rb +103 -0
- data/lib/hardware_information/gui/gtk3/purchased_hardware/purchased_hardware.rb +34 -0
- data/lib/hardware_information/gui/gtk3/show_input_devices/show_input_devices.rb +34 -0
- data/lib/hardware_information/gui/libui/mounted_harddiscs/mounted_harddiscs.rb +88 -0
- data/lib/hardware_information/gui/shared_code/mounted_harddiscs/mounted_harddiscs_module.rb +107 -0
- data/lib/hardware_information/gui/shared_code/purchased_hardware/purchased_hardware_module.rb +291 -0
- data/lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb +187 -0
- data/lib/hardware_information/misc/purchased_hardware/README.md +7 -0
- data/lib/hardware_information/misc/purchased_hardware/purchased_hardware.rb +169 -0
- data/lib/hardware_information/monitor/README.md +6 -0
- data/lib/hardware_information/monitor/monitor.rb +36 -0
- data/lib/hardware_information/project/project.rb +29 -0
- data/lib/hardware_information/version/version.rb +19 -0
- data/lib/hardware_information/www/embeddable_interface.rb +52 -0
- data/lib/hardware_information/www/my_hardware.cgi +7 -0
- data/lib/hardware_information/www/my_hardware.rb +462 -0
- data/lib/hardware_information/www/my_hardware_for_sinatra.rb +65 -0
- data/lib/hardware_information/yaml/colours_for_the_hardware_information_project.yml +30 -0
- data/lib/hardware_information/yaml/usb_errors/usb_errors.yml +2 -0
- data/lib/hardware_information.rb +7 -0
- metadata +95 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'hardware_information/monitor/monitor.rb'
|
6
|
+
# HardwareInformation.return_the_monitor_resolution
|
7
|
+
# =========================================================================== #
|
8
|
+
class HardwareInformation
|
9
|
+
|
10
|
+
# ========================================================================= #
|
11
|
+
# === HardwareInformation.return_the_monitor_resolution
|
12
|
+
#
|
13
|
+
# This method essentially captures the resolution from a String
|
14
|
+
# such as:
|
15
|
+
#
|
16
|
+
# dimensions: 1920x1080 pixels (508x285 millimeters)
|
17
|
+
#
|
18
|
+
# It will then return a String, as result, such as "1920x1080".
|
19
|
+
# ========================================================================= #
|
20
|
+
def self.return_the_monitor_resolution
|
21
|
+
result = `xdpyinfo`.split("\n").select {|entry| entry.include? 'dimensions' }
|
22
|
+
if result.is_a? Array
|
23
|
+
result = result.first
|
24
|
+
end
|
25
|
+
result.strip!
|
26
|
+
if result.include? 'x'
|
27
|
+
result = result.scan(/(\d{2,4}x\d{2,4})/).flatten.first.strip
|
28
|
+
end
|
29
|
+
return result
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
if __FILE__ == $PROGRAM_NAME
|
35
|
+
puts HardwareInformation.return_the_monitor_resolution
|
36
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'hardware_information/project/project.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
class HardwareInformation
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === PROJECT_BASE_DIRECTORY
|
11
|
+
# ========================================================================= #
|
12
|
+
PROJECT_BASE_DIRECTORY =
|
13
|
+
File.absolute_path("#{__dir__}/..")+'/'
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === PROJECT_YAML_DIRECTORY
|
17
|
+
#
|
18
|
+
# Refer to the internal yaml-directory as well.
|
19
|
+
# ========================================================================= #
|
20
|
+
PROJECT_YAML_DIRECTORY = "#{PROJECT_BASE_DIRECTORY}yaml/"
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# === HardwareInformation.project_base_directory?
|
24
|
+
# ========================================================================= #
|
25
|
+
def self.project_base_directory?
|
26
|
+
PROJECT_BASE_DIRECTORY
|
27
|
+
end; self.instance_eval { alias project_base_dir? project_base_directory? } # === HardwareInformation.project_base_dir?
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'hardware_information/version/version.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
class HardwareInformation
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === VERSION
|
11
|
+
# ========================================================================= #
|
12
|
+
VERSION = '1.0.71'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === LAST_UPDATE
|
16
|
+
# ========================================================================= #
|
17
|
+
LAST_UPDATE = '11.08.2022'
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'hardware_information/www/embeddable_interface.rb'
|
6
|
+
# include HardwareInformation::EmbeddableInterface
|
7
|
+
# =========================================================================== #
|
8
|
+
class HardwareInformation
|
9
|
+
|
10
|
+
module EmbeddableInterface
|
11
|
+
|
12
|
+
require 'hardware_information/misc/purchased_hardware/purchased_hardware.rb'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === HardwareInformation::EmbeddableInterface.routes?
|
16
|
+
#
|
17
|
+
# Define all legal routes via this Array. This Array will then be used
|
18
|
+
# to add more routes to any sinatra-application that needs it.
|
19
|
+
# ========================================================================= #
|
20
|
+
def self.routes?
|
21
|
+
[
|
22
|
+
'hardware_information'
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
# ========================================================================= #
|
27
|
+
# === return_sinatra_hardware_information
|
28
|
+
# ========================================================================= #
|
29
|
+
def return_sinatra_hardware_information
|
30
|
+
hash = HardwareInformation::PurchasedHardware.my_hardware
|
31
|
+
_ = ''.dup
|
32
|
+
hash.each_pair {|key, inner_hash|
|
33
|
+
_ << "#{key}<br>"
|
34
|
+
_ << '<span style="margin-left: 1em">bought at: '+
|
35
|
+
inner_hash['bought_at'].to_s+'</span><br>'
|
36
|
+
_ << '<br>'
|
37
|
+
}
|
38
|
+
return _
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
# =========================================================================== #
|
44
|
+
# === HardwareInformation.embeddable_interface
|
45
|
+
# =========================================================================== #
|
46
|
+
def self.embeddable_interface
|
47
|
+
object = Object.new
|
48
|
+
object.extend(::HardwareInformation::EmbeddableInterface)
|
49
|
+
return object
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# http://localhost/programming/ruby/src/hardware_information/lib/hardware_information/www/my_hardware.cgi
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'cyberweb/evaluate_from_the_same_named_file_then_serve'
|
@@ -0,0 +1,462 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This page should be kept in german.
|
6
|
+
# =========================================================================== #
|
7
|
+
# http://localhost/programming/ruby/src/hardware_information/lib/hardware_information/www/my_hardware.cgi
|
8
|
+
# =========================================================================== #
|
9
|
+
# rffhware
|
10
|
+
# =========================================================================== #
|
11
|
+
require 'hardware_information/misc/purchased_hardware/purchased_hardware.rb'
|
12
|
+
|
13
|
+
# =========================================================================== #
|
14
|
+
# Note that the main hardware-related dataset is stored in this file:
|
15
|
+
#
|
16
|
+
# bl /home/x/data/personal/yaml/my_hardware/my_hardware.yml
|
17
|
+
#
|
18
|
+
# =========================================================================== #
|
19
|
+
german(HardwareInformation::PurchasedHardware.title?) {
|
20
|
+
autoextend
|
21
|
+
favicon 'PC/HARDWARE/HWARE_FAVICON.png'
|
22
|
+
css_style '
|
23
|
+
pre {
|
24
|
+
font-size: 1.3em;
|
25
|
+
color:green;
|
26
|
+
}
|
27
|
+
body {
|
28
|
+
padding-left: 8px;
|
29
|
+
padding-right: 8px;
|
30
|
+
font-weight: normal;
|
31
|
+
color: white;
|
32
|
+
}
|
33
|
+
div {
|
34
|
+
font-weight: normal;
|
35
|
+
}
|
36
|
+
h1,h2,h3,h4,h5,h6 {
|
37
|
+
margin-top: 2px;
|
38
|
+
padding: 2px;
|
39
|
+
}
|
40
|
+
|
41
|
+
a { color: steelblue; text-decoration: none; }
|
42
|
+
a:link { color: steelblue; }
|
43
|
+
a:visited { color: steelblue; }
|
44
|
+
a:hover { color: mediumspringgreen; text-decoration: none; }
|
45
|
+
a:active { color: steelblue ; }
|
46
|
+
a { color: steelblue; }
|
47
|
+
i { font-size: bigger; font-weight:500}
|
48
|
+
img { margin-right: 2px;}'
|
49
|
+
body_css_class HardwareInformation::PurchasedHardware.body_css_class
|
50
|
+
body_css_style HardwareInformation::PurchasedHardware.body_css_style
|
51
|
+
|
52
|
+
font_size '1em'
|
53
|
+
|
54
|
+
EURO_IMAGE = sg(:euro, 'mar1px mars5px').dup
|
55
|
+
MARGIN_RIGHT = 'marr8px'
|
56
|
+
S_CHAOS = sg :square_chaos, MARGIN_RIGHT
|
57
|
+
S_DARKGOLDENROD = sg :square_darkgoldenrod, MARGIN_RIGHT
|
58
|
+
GREEN_SQUARE = sg(:green_square, "bblack1 #{MARGIN_RIGHT}")
|
59
|
+
|
60
|
+
# =========================================================================== #
|
61
|
+
# === external_link
|
62
|
+
# =========================================================================== #
|
63
|
+
def external_link(
|
64
|
+
remote,
|
65
|
+
name,
|
66
|
+
optional_use_this_id = nil
|
67
|
+
)
|
68
|
+
abr(
|
69
|
+
remote,
|
70
|
+
content: S_CHAOS+name,
|
71
|
+
css_class: 's1em',
|
72
|
+
id: optional_use_this_id
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
# =========================================================================== #
|
77
|
+
# === show_local_sitemap
|
78
|
+
# =========================================================================== #
|
79
|
+
def show_local_sitemap
|
80
|
+
h2 'Sitemap','yel martb1px'
|
81
|
+
p('marr1em FS1em mart0_1em'){
|
82
|
+
sitemap_link '#Laptop1_Fujitsu_Siemens_Computers',
|
83
|
+
'Laptop FSC Amilo Pro V2030'
|
84
|
+
sitemap_link '#USB_Netgear_108_WG111T',
|
85
|
+
'USB Netgear 108 WG111T Sticks '
|
86
|
+
sitemap_link '#Maxtor_OneTouch_III_750',
|
87
|
+
'Maxtor External USB HDD 750 GIG'
|
88
|
+
sitemap_link '#Imation_clip_Flash_Drive',
|
89
|
+
'Imitation 4 GIG USB Stick'
|
90
|
+
sitemap_link '#Buffalo_Wireless_G_125',
|
91
|
+
'Buffalo Wireless Router'
|
92
|
+
sitemap_link '#computer3',
|
93
|
+
'Rechner Computer3' # Mit K8M890
|
94
|
+
sitemap_link '#Rechner_Miraculix_mit_xxxxx',
|
95
|
+
'Rechner Miraculix'
|
96
|
+
sitemap_link '#Benq_G2000WA_LCD_Monitor',
|
97
|
+
'Benq LCD Monitor'
|
98
|
+
sitemap_link '#Pinnacle_PCTV_Hybrid_Pro',
|
99
|
+
'Pinnacle PCTV Hybrid Pro Stick 330E'
|
100
|
+
sitemap_link '#LCD_TV_19LG3000',
|
101
|
+
'LCD TV 19LG3000'
|
102
|
+
sitemap_link '#FREECOM_EXTERNAL_HARD_DRIVE_3TB',
|
103
|
+
'FREECOM_EXTERNAL_HARD_DRIVE_3TB'
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
# =========================================================================== #
|
108
|
+
# === discarded_on_this_day
|
109
|
+
# =========================================================================== #
|
110
|
+
def discarded_on_this_day(i = nil)
|
111
|
+
if i
|
112
|
+
s2 sg(:rip,'marr8px').dup+
|
113
|
+
'<span class="cyan">Entsorgt am: </span>','padl2_5em'
|
114
|
+
s2 i.to_s, 'BO green'
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# =========================================================================== #
|
119
|
+
# === sitemap_link
|
120
|
+
# =========================================================================== #
|
121
|
+
def sitemap_link(intralink, desc)
|
122
|
+
unless intralink.start_with? '#'
|
123
|
+
intralink[0, 0] = '#'
|
124
|
+
end
|
125
|
+
abr(
|
126
|
+
intralink,
|
127
|
+
{
|
128
|
+
content: S_DARKGOLDENROD+desc,
|
129
|
+
css_class: 'slateblue'
|
130
|
+
}
|
131
|
+
)
|
132
|
+
end
|
133
|
+
|
134
|
+
# =========================================================================== #
|
135
|
+
# === show_external_links
|
136
|
+
#
|
137
|
+
# This method will display all external links.
|
138
|
+
# =========================================================================== #
|
139
|
+
def show_external_links
|
140
|
+
# ========================================================================= #
|
141
|
+
# LINKS ZU HARDWARE
|
142
|
+
# ========================================================================= #
|
143
|
+
div(HardwareInformation::PurchasedHardware::MAIN_DIV+' float_container',
|
144
|
+
'',
|
145
|
+
'margin-left: 1em;
|
146
|
+
margin-right: 1em;
|
147
|
+
border:1px ridge lightblue;
|
148
|
+
min-height: 500px'){
|
149
|
+
h2 sg(:big_star,'marr5px','drag_the_big_star')+
|
150
|
+
'Links',
|
151
|
+
'marl0_5em mart10px mar2px pad4px darkkhaki marb1em'
|
152
|
+
# ========================================================================= #
|
153
|
+
# Add the CSS rules for the following side-by-sid divs next:
|
154
|
+
# ========================================================================= #
|
155
|
+
add_this_css_style '
|
156
|
+
|
157
|
+
.float_container {
|
158
|
+
padding: 10px;
|
159
|
+
margin-left: 1em;
|
160
|
+
margin-right: 1em;
|
161
|
+
}
|
162
|
+
|
163
|
+
.float_child {
|
164
|
+
width: 43%;
|
165
|
+
float: left;
|
166
|
+
padding: 20px;
|
167
|
+
margin: 5px;
|
168
|
+
min-height: 320px;
|
169
|
+
border: 1px dotted gold;
|
170
|
+
margin-left: 0.5em;
|
171
|
+
margin-right: 0.5em;
|
172
|
+
}
|
173
|
+
'
|
174
|
+
div('float_child') {
|
175
|
+
div('mar0px pad0px') {
|
176
|
+
external_link 'https://www.motherboards.org/',
|
177
|
+
'Motherboards'
|
178
|
+
external_link 'https://kmuto.jp/debian/hcl/index.cgi',
|
179
|
+
'Debian Hardware Page'
|
180
|
+
external_link 'https://geizhals.at/?m=1',
|
181
|
+
'Geizhals'
|
182
|
+
external_link 'https://www.hardwareschrott.de/',
|
183
|
+
'Hardware Schrott','Hardware_Schrott'
|
184
|
+
external_link 'https://www.rudiratz.de/index.php?m=2',
|
185
|
+
'Computer Lexikon'
|
186
|
+
external_link 'https://www.alleseineuro.de/article_info.php/articles_id/1',
|
187
|
+
'Richtiges Löten'
|
188
|
+
external_link 'https://www.tomshardware.com/',
|
189
|
+
'Toms Hardware Tips'
|
190
|
+
external_link 'https://www.pcmasters.de/',
|
191
|
+
'Hardware News'
|
192
|
+
external_link 'https://de.wikipedia.org/wiki/Liste_der_BIOS-Signalt%C3%B6ne',
|
193
|
+
'Biep Fehlercodes (Wikipedia)'
|
194
|
+
external_link 'https://www.website-go.com/artikel/beepcodes.php',
|
195
|
+
'Gute Biep Fehlercodes mit Hilfestellung'
|
196
|
+
external_link 'https://www.website-go.com/artikel/beepcodes.php',
|
197
|
+
'Deutschprachige Biep Fehlercodes'
|
198
|
+
external_link 'https://www.alltests.de/index.php?sel=php/news/shortnews.php',
|
199
|
+
'Gute Hardware Tips'
|
200
|
+
external_link 'https://www.digiwelt.at/officewelt-at/cf/frameset.cfm?bid=D3D9446802A44259755D38E6D163E820&fuseaction=Artikel.detail&artikel_id=1468',
|
201
|
+
'Hardware bei InterSpar'
|
202
|
+
}
|
203
|
+
}
|
204
|
+
div('float_child') {
|
205
|
+
div('mar0px pad0px') {
|
206
|
+
external_link :local_hardware_assembly,
|
207
|
+
'Lokaler Link zu Hardware Assembly'
|
208
|
+
external_link :wlan,
|
209
|
+
'Lokaler Link zu WLAN'
|
210
|
+
external_link :local_ram,
|
211
|
+
'Lokaler Link zu RAM'
|
212
|
+
external_link :local_scanner,
|
213
|
+
'Lokaler Link zu SCANNERS'
|
214
|
+
external_link :local_sitemap,
|
215
|
+
'Lokaler Link zur SITEMAP'
|
216
|
+
external_link :local_kabel,
|
217
|
+
'Lokaler Link zu KABEL und ADAPTOREN'
|
218
|
+
external_link :local_computersystem,
|
219
|
+
'Lokaler Link zu Computersystemen'
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
end
|
224
|
+
|
225
|
+
# =========================================================================== #
|
226
|
+
# === display_the_total_costs
|
227
|
+
#
|
228
|
+
# This method will show the sum of the total purchase cost; the module
|
229
|
+
# PurchasedHardware will keep track of this, so here we only display
|
230
|
+
# that value.
|
231
|
+
# =========================================================================== #
|
232
|
+
def display_the_total_costs(
|
233
|
+
i = HardwareInformation::PurchasedHardware.total_cost?
|
234
|
+
)
|
235
|
+
i = i.to_f
|
236
|
+
# ========================================================================= #
|
237
|
+
# === REGISTRIERTE GESAMTKOSTEN
|
238
|
+
# ========================================================================= #
|
239
|
+
div('mart1em s1em') {
|
240
|
+
e sg(:dot102, 'marr8px')+
|
241
|
+
'<b class="marl0_3em bigger"> Registrierte Gesamtkosten:</b> '
|
242
|
+
br
|
243
|
+
s2 i.round(3).to_s,
|
244
|
+
'yel marl2em BOLD bigger'
|
245
|
+
s2 ' ('+(i * 13.7603).round(2).to_s+' Schilling)','teal'
|
246
|
+
s2 EURO_IMAGE+
|
247
|
+
' <b>Euro</b> <span class="smaller">(seit 27.05.2004)</span>'
|
248
|
+
br
|
249
|
+
br
|
250
|
+
}
|
251
|
+
end
|
252
|
+
|
253
|
+
doc(HardwareInformation::PurchasedHardware::MAIN_DIV,'','min-height:32em') {
|
254
|
+
img 'PC/HARDWARE/HARDWARE.png','FLR BG_White',
|
255
|
+
'drag_hardware',
|
256
|
+
'margin-right:2%; top: 3em; opacity: 0.4;'
|
257
|
+
# ========================================================================= #
|
258
|
+
# Show a little heart-image next.
|
259
|
+
# ========================================================================= #
|
260
|
+
h2 sg(:herz, 'marr8px')+
|
261
|
+
'Meine Hardware - ausgelesen aus der Datei <br><br><b>'+
|
262
|
+
HardwareInformation::PurchasedHardware.file_computer_hardware?+'</b>',
|
263
|
+
'BO s0_2em BLOCK mart1px marb1em',
|
264
|
+
'','padding-top:0.05em'
|
265
|
+
ehtml_comment('Start of MyHardware')
|
266
|
+
# ========================================================================= #
|
267
|
+
# Query our main hash next.
|
268
|
+
# ========================================================================= #
|
269
|
+
HardwareInformation::PurchasedHardware.my_hardware.each_pair {|name_of_the_hardware_in_question, hash|
|
270
|
+
_ = hash
|
271
|
+
s2 GREEN_SQUARE+
|
272
|
+
name_of_the_hardware_in_question
|
273
|
+
# ======================================================================= #
|
274
|
+
# Get the id to store onto the coming <div> tag.
|
275
|
+
# ======================================================================= #
|
276
|
+
the_id_to_store = Cyberweb.remove_html(
|
277
|
+
name_of_the_hardware_in_question.tr(' ', '_')
|
278
|
+
).to_s.strip.tr('-','_')
|
279
|
+
# ======================================================================= #
|
280
|
+
# If we find a newline then we ignore all up to that newline.
|
281
|
+
# ======================================================================= #
|
282
|
+
if the_id_to_store.include? "\n"
|
283
|
+
the_id_to_store = the_id_to_store[0, the_id_to_store.index("\n")]
|
284
|
+
end
|
285
|
+
if the_id_to_store.include? '"'
|
286
|
+
the_id_to_store.delete! '"'
|
287
|
+
end
|
288
|
+
if the_id_to_store.count('_') > 3 # Only keep the first 3 '_'
|
289
|
+
the_id_to_store = the_id_to_store.split('_')[0..3].join('_')
|
290
|
+
end
|
291
|
+
if the_id_to_store.end_with? '_'
|
292
|
+
the_id_to_store.chop!
|
293
|
+
end
|
294
|
+
# ======================================================================= #
|
295
|
+
# The respective <div> for the Hardware in question comes next.
|
296
|
+
# ======================================================================= #
|
297
|
+
div('mart1em mars1em pad4px pad1em', id: the_id_to_store) {
|
298
|
+
# Next a Hash will be used:
|
299
|
+
# ===================================================================== #
|
300
|
+
# === description
|
301
|
+
# ===================================================================== #
|
302
|
+
if _.has_key? 'description'
|
303
|
+
e _['description']
|
304
|
+
end
|
305
|
+
# ===================================================================== #
|
306
|
+
# === image
|
307
|
+
# ===================================================================== #
|
308
|
+
if _.has_key? 'image'
|
309
|
+
this_image = _['image']
|
310
|
+
e sg(
|
311
|
+
this_image[0].to_s,
|
312
|
+
this_image[1].to_s,
|
313
|
+
this_image[2].to_s,
|
314
|
+
this_image[3].to_s
|
315
|
+
)
|
316
|
+
# ===================================================================== #
|
317
|
+
# === draggable_image
|
318
|
+
# ===================================================================== #
|
319
|
+
elsif _.has_key? 'draggable_image'
|
320
|
+
array = [_['draggable_image']].flatten
|
321
|
+
array.each_slice(2) { |a, b|
|
322
|
+
dimg(a.to_s, b.to_s)
|
323
|
+
}
|
324
|
+
br
|
325
|
+
# ===================================================================== #
|
326
|
+
# === draggable_images
|
327
|
+
# ===================================================================== #
|
328
|
+
elsif _.has_key? 'draggable_images'
|
329
|
+
these_images = _['draggable_images']
|
330
|
+
these_images.each {|this_image|
|
331
|
+
dimg(this_image[0].to_s, this_image[1].to_s)
|
332
|
+
br
|
333
|
+
}
|
334
|
+
end
|
335
|
+
# ===================================================================== #
|
336
|
+
# === bought_at
|
337
|
+
#
|
338
|
+
# When did we buy a specific hardware - the date of purchase. Will
|
339
|
+
# be displayed right here.
|
340
|
+
# ======================================================================= #
|
341
|
+
if _.has_key?('bought_at') and !_['bought_at'].empty?
|
342
|
+
bought_at_that_date_specifically = _['bought_at'].to_s.dup
|
343
|
+
einkaufswagen = sg(:einkaufswagen, 'marl1em wid25px').dup
|
344
|
+
# =================================================================== #
|
345
|
+
# Next show when this hardware was purchased.
|
346
|
+
# =================================================================== #
|
347
|
+
s2 'Gekauft am:',
|
348
|
+
'padl2_5em marl1em'
|
349
|
+
s2 bought_at_that_date_specifically+
|
350
|
+
einkaufswagen,
|
351
|
+
'BOLD '+
|
352
|
+
HardwareInformation::PurchasedHardware::COLOUR_PURCHASED_AT_THIS_DATE
|
353
|
+
# =================================================================== #
|
354
|
+
# And register it onto the main module that handles this.
|
355
|
+
# =================================================================== #
|
356
|
+
HardwareInformation::PurchasedHardware.add_bought_at(
|
357
|
+
bought_at_that_date_specifically
|
358
|
+
)
|
359
|
+
end
|
360
|
+
# ===================================================================== #
|
361
|
+
# === cost
|
362
|
+
# ===================================================================== #
|
363
|
+
if _.has_key? 'cost'
|
364
|
+
cost = _['cost'].to_s.to_f
|
365
|
+
case cost
|
366
|
+
when 0
|
367
|
+
e '<b class="BO yel larger">Kosten unbekannt</b>'
|
368
|
+
else
|
369
|
+
HardwareInformation::PurchasedHardware.add_to_the_total_cost(cost)
|
370
|
+
e 'um <b class="BO larger yellow">'+
|
371
|
+
_['cost'].to_s+'</b>'+
|
372
|
+
EURO_IMAGE.to_s
|
373
|
+
"\n"' Euro</b> erworben'
|
374
|
+
end
|
375
|
+
end
|
376
|
+
# ===================================================================== #
|
377
|
+
# === died_at
|
378
|
+
# ===================================================================== #
|
379
|
+
if _.has_key? 'died_at'
|
380
|
+
discarded_on_this_day(_['died_at'])
|
381
|
+
end
|
382
|
+
# ===================================================================== #
|
383
|
+
# === link
|
384
|
+
# ===================================================================== #
|
385
|
+
if _.has_key? 'link'
|
386
|
+
a(
|
387
|
+
_['link'][0].to_s,
|
388
|
+
content: _['link'][0].to_s,
|
389
|
+
css_class: _['link'][1].to_s
|
390
|
+
)
|
391
|
+
# ===================================================================== #
|
392
|
+
# === links
|
393
|
+
# ===================================================================== #
|
394
|
+
elsif _.has_key? 'links'
|
395
|
+
_['links'].each {|entry, inner_array|
|
396
|
+
a(
|
397
|
+
inner_array[0].to_s,
|
398
|
+
content: inner_array[0].to_s,
|
399
|
+
css_class: inner_array[1].to_s
|
400
|
+
)
|
401
|
+
}
|
402
|
+
end
|
403
|
+
# ===================================================================== #
|
404
|
+
# === images
|
405
|
+
#
|
406
|
+
# For reference, an entry matching the following clause may look
|
407
|
+
# like this:
|
408
|
+
#
|
409
|
+
# - PC/HARDWARE/TV/XORO_TV_HTC1546_OUTLETS.jpg
|
410
|
+
# - mar0_3em
|
411
|
+
# - drag_xoro_tv_rückseite
|
412
|
+
#
|
413
|
+
# ===================================================================== #
|
414
|
+
if _.has_key? 'images'
|
415
|
+
_['images'].each {|entry_array, inner_array|
|
416
|
+
img(
|
417
|
+
inner_array[0].to_s,
|
418
|
+
content: inner_array[0].to_s,
|
419
|
+
css_class: inner_array[1].to_s,
|
420
|
+
the_id: inner_array[2].to_s,
|
421
|
+
css_style: inner_array[3].to_s
|
422
|
+
)
|
423
|
+
}
|
424
|
+
end
|
425
|
+
} # this ends the <p> tag.
|
426
|
+
spacer(:middle) # Added this spacer as of August 2014.
|
427
|
+
hr
|
428
|
+
}
|
429
|
+
# ========================================================================= #
|
430
|
+
# === Display the final total costs next, close to the end of the web-app
|
431
|
+
# ========================================================================= #
|
432
|
+
display_the_total_costs
|
433
|
+
show_external_links
|
434
|
+
# ========================================================================= #
|
435
|
+
# bl $LINUX/YAML/Computer_hardware.yml
|
436
|
+
# ========================================================================= #
|
437
|
+
# ========================================================================= #
|
438
|
+
# Sitemap Tag. Hier nur Sachen sammeln die halbwegs wichtig sind!
|
439
|
+
# Sonst läppert sich das wie verrückt zusammen.
|
440
|
+
# ========================================================================= #
|
441
|
+
div('wid30 posab pad1em padt0_5em BG_BLACK White','',
|
442
|
+
'right:0.5em; top:1em; border:1px dotted slateblue;'){
|
443
|
+
show_local_sitemap
|
444
|
+
}
|
445
|
+
# sandisk USB fehlt noch hmmm.
|
446
|
+
# Siehe hier: https://www.amazon.de/SanDisk-Cruzer-32GB-USB-Stick-Schwarz/dp/B00812F7O8
|
447
|
+
# ========================================================================= #
|
448
|
+
# Eventuell mini-pc kaufen:
|
449
|
+
#
|
450
|
+
# https://liliputing.com/2020/07/asus-pn50-is-a-mini-pc-with-up-to-an-amd-ryzen-7-4800u-processor.html
|
451
|
+
# https://geizhals.at/asus-mini-pc-pn50-v26823.html
|
452
|
+
# https://geizhals.at/asus-mini-pc-pn50-bbr343md-90mr00e1-m00150-a2314947.html
|
453
|
+
# ^^^ 331 Euro am 12.12.2020
|
454
|
+
# ^^^ 328 Euro am 22.01.2021
|
455
|
+
# ^^^ 316 Euro am 31.03.2021
|
456
|
+
# ========================================================================= #
|
457
|
+
# Oder:
|
458
|
+
#
|
459
|
+
# https://geizhals.at/shuttle-xpc-slim-pos-ds100-pec-ds10u001-a2221818.html?hloc=at
|
460
|
+
# 4 GIG RAM, 299 Euro.
|
461
|
+
# ========================================================================= #
|
462
|
+
}}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# http://localhost/programming/ruby/src/hardware_information/lib/hardware_information/www/my_hardware_for_sinatra.rb
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'cyberweb/and_sinatra_base.rb'
|
8
|
+
|
9
|
+
class HardwareInformation
|
10
|
+
|
11
|
+
class SinatraMyHardware < ::Sinatra::Base # === HardwareInformation::SinatraMyHardware
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === USE_THIS_PORT
|
15
|
+
# ========================================================================= #
|
16
|
+
USE_THIS_PORT = '4567'
|
17
|
+
|
18
|
+
set :port, USE_THIS_PORT
|
19
|
+
|
20
|
+
# ========================================================================= #
|
21
|
+
# === initialize
|
22
|
+
# ========================================================================= #
|
23
|
+
def initialize
|
24
|
+
super()
|
25
|
+
target = "http://localhost:#{USE_THIS_PORT}/"
|
26
|
+
Cyberweb.try_to_open_this_URL_via_the_browser(target, USE_THIS_PORT)
|
27
|
+
end
|
28
|
+
|
29
|
+
# ========================================================================= #
|
30
|
+
# === /
|
31
|
+
#
|
32
|
+
# Usage Example:
|
33
|
+
#
|
34
|
+
# http://localhost:4567/
|
35
|
+
#
|
36
|
+
# ========================================================================= #
|
37
|
+
get('/'){
|
38
|
+
return Cyberweb::WebObject.evaluate_from_the_same_named_file_then_serve(
|
39
|
+
:do_not_display_anything,
|
40
|
+
HardwareInformation.project_base_dir?+'www/my_hardware_for_sinatra.rb'
|
41
|
+
)
|
42
|
+
}
|
43
|
+
|
44
|
+
# ========================================================================= #
|
45
|
+
# === HardwareInformation::SinatraMyHardware.start_sinatra_interface
|
46
|
+
# ========================================================================= #
|
47
|
+
def self.start_sinatra_interface
|
48
|
+
::HardwareInformation::SinatraMyHardware.run!
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
# =========================================================================== #
|
54
|
+
# === HardwareInformation.start_sinatra_interface
|
55
|
+
# =========================================================================== #
|
56
|
+
def self.start_sinatra_interface
|
57
|
+
puts 'Trying to start the sinatra-interface of HardwareInformation next.'
|
58
|
+
HardwareInformation::SinatraMyHardware.start_sinatra_interface
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
if __FILE__ == $PROGRAM_NAME
|
64
|
+
HardwareInformation::SinatraMyHardware.start_sinatra_interface
|
65
|
+
end # hardwareinformation --sinatra
|