Class: GamesParadise::CreateGamesWebpage
- Inherits:
-
Base
- Object
- Base
- GamesParadise::CreateGamesWebpage
show all
- Defined in:
- lib/games_paradise/utility_scripts/create_games_webpage.rb
Overview
GamesParadise::CreateGamesWebpage
Constant Summary
Constants inherited
from Base
Base::CONTROL_C_CODE, Base::N
Class Method Summary
collapse
-
.[](i = '') ⇒ Object
# === GamesParadise::CreateGamesWebpage[] ========================================================================= #.
Instance Method Summary
collapse
Methods inherited from Base
#cat, #commandline_arguments?, #efancy, #eparse, #first_argument?, #forestgreen, #gold, #lightblue, #lightgreen, #mediumorchid, #mediumslateblue, #opnn, #peru, #register_sigint, #rev, #royalblue, #set_commandline_arguments, #sfile, #steelblue, #teal, #tomato, #yellow
Methods included from BaseModule
#cliner, #commandline_arguments?, #first_argument?, #infer_the_namespace, #namespace?, #rename_file, #reset_the_internal_hash, #return_pwd, #set_commandline_arguments
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ CreateGamesWebpage
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/games_paradise/utility_scripts/create_games_webpage.rb', line 26
def initialize(
commandline_arguments = nil,
run_already = true
)
reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.[](i = '') ⇒ Object
#
GamesParadise::CreateGamesWebpage[]
#
106
107
108
|
# File 'lib/games_paradise/utility_scripts/create_games_webpage.rb', line 106
def self.[](i = '')
new(i)
end
|
Instance Method Details
#liner ⇒ Object
52
53
54
|
# File 'lib/games_paradise/utility_scripts/create_games_webpage.rb', line 52
def liner
'-'*80+"<br>\n"
end
|
#reset ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/games_paradise/utility_scripts/create_games_webpage.rb', line 40
def reset
super()
infer_the_namespace
@hash_containing_all_local_files = {}
end
|
#run ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/games_paradise/utility_scripts/create_games_webpage.rb', line 59
def run
require 'cyberweb'
target = return_pwd
_ = Dir[target+'*'].reject {|entry|
entry.include?('index.html')
}
opnn; e 'Working through '+target+'.'
_.map! {|entry|
original_entry = entry.dup
if entry.include?('/')
entry = File.basename(entry)
end
entry = entry.delete_suffix('.xz').
delete_suffix('.tar').
delete_suffix('.exe').
delete_suffix('.bin')
@hash_containing_all_local_files[entry] = original_entry
entry
}
result = ''.dup
_.each_with_index {|entry, index| index += 1
file_size = File.size(
@hash_containing_all_local_files[entry]
)
result << '<b>('+(index).to_s+')</b> '+
HtmlTags.a(entry)+
' (File size: <b>'+
(file_size / 1000.0 / 1000.0).round(1).to_s+
' mb</b>)'+
"<br>\n"
result << liner
}
dataset = Cyberweb.html_template(
body: result,
body_css_style: 'font-size: 1.2em',
title: 'Games Collection'
).to_s
require 'save_file'
this_file = 'index.html'
::SaveFile.write_what_into(dataset, this_file)
require 'open'
Open.in_browser(this_file)
end
|