backup_paradise 1.3.1
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 backup_paradise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +408 -0
- data/backup_paradise.gemspec +50 -0
- data/bin/backup_for_ingrid +10 -0
- data/bin/backup_paradise +7 -0
- data/bin/windows_backup_paradise +9 -0
- data/doc/README.gen +368 -0
- data/doc/TODO.md +130 -0
- data/lib/backup_paradise/actions/README.md +2 -0
- data/lib/backup_paradise/actions/backup.rb +62 -0
- data/lib/backup_paradise/base/base.rb +502 -0
- data/lib/backup_paradise/base/colours.rb +137 -0
- data/lib/backup_paradise/base/namespace.rb +16 -0
- data/lib/backup_paradise/base/tab.rb +47 -0
- data/lib/backup_paradise/colours/colours.rb +88 -0
- data/lib/backup_paradise/constants/constants.rb +162 -0
- data/lib/backup_paradise/gui/glimmer/libui/backup_for_ingrid/backup_for_ingrid.rb +87 -0
- data/lib/backup_paradise/gui/gtk2/OLD_backup.rb +220 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/create.rb +70 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/misc.rb +33 -0
- data/lib/backup_paradise/gui/gtk3/simple_backup_widget/simple_backup_widget.rb +160 -0
- data/lib/backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb +99 -0
- data/lib/backup_paradise/gui/libui/simple_backup_widget/simple_backup_widget.rb +119 -0
- data/lib/backup_paradise/gui/shared_code/simple_backup_widget/simple_backup_widget_module.rb +587 -0
- data/lib/backup_paradise/gui/tk/backup.rb +108 -0
- data/lib/backup_paradise/images/BACKUP_IMAGE.png +0 -0
- data/lib/backup_paradise/images/right_arrow.png +0 -0
- data/lib/backup_paradise/project/project.rb +40 -0
- data/lib/backup_paradise/requires/require_the_backup_paradise_project.rb +18 -0
- data/lib/backup_paradise/requires/require_yaml.rb +7 -0
- data/lib/backup_paradise/tab/tab.rb +87 -0
- data/lib/backup_paradise/toplevel_methods/cliner.rb +16 -0
- data/lib/backup_paradise/toplevel_methods/config.rb +86 -0
- data/lib/backup_paradise/toplevel_methods/create_and_remove.rb +63 -0
- data/lib/backup_paradise/toplevel_methods/e.rb +16 -0
- data/lib/backup_paradise/toplevel_methods/esystem.rb +19 -0
- data/lib/backup_paradise/toplevel_methods/files_and_directories.rb +181 -0
- data/lib/backup_paradise/toplevel_methods/help.rb +93 -0
- data/lib/backup_paradise/toplevel_methods/misc.rb +153 -0
- data/lib/backup_paradise/toplevel_methods/mountpoint.rb +188 -0
- data/lib/backup_paradise/toplevel_methods/opnn.rb +27 -0
- data/lib/backup_paradise/utility_scripts/backup/backup.rb +1901 -0
- data/lib/backup_paradise/version/version.rb +19 -0
- data/lib/backup_paradise/windows/README.md +1 -0
- data/lib/backup_paradise/windows/windows.rb +101 -0
- data/lib/backup_paradise/www/backup.cgi +63 -0
- data/lib/backup_paradise/yaml/config.yml +82 -0
- data/lib/backup_paradise.rb +5 -0
- data/test/testing_toplevel_functionality.rb +11 -0
- metadata +194 -0
@@ -0,0 +1,502 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/base/base.rb'
|
6
|
+
# < ::BackupParadise::Base
|
7
|
+
# =========================================================================== #
|
8
|
+
module BackupParadise
|
9
|
+
|
10
|
+
class Base
|
11
|
+
|
12
|
+
require 'backup_paradise/constants/constants.rb'
|
13
|
+
require 'backup_paradise/project/project.rb'
|
14
|
+
require 'backup_paradise/toplevel_methods/config.rb'
|
15
|
+
require 'backup_paradise/toplevel_methods/e.rb'
|
16
|
+
require 'backup_paradise/toplevel_methods/files_and_directories.rb'
|
17
|
+
require 'backup_paradise/toplevel_methods/misc.rb'
|
18
|
+
require 'backup_paradise/base/colours.rb'
|
19
|
+
require 'backup_paradise/base/namespace.rb'
|
20
|
+
require 'backup_paradise/base/tab.rb'
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# Next, external code is loaded.
|
24
|
+
# ========================================================================= #
|
25
|
+
begin
|
26
|
+
require 'roebe/time/time.rb'
|
27
|
+
rescue LoadError; end
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'opn'
|
31
|
+
rescue LoadError; end
|
32
|
+
|
33
|
+
begin
|
34
|
+
require 'roebe/toplevel_methods/write_what_into.rb'
|
35
|
+
rescue LoadError => error
|
36
|
+
puts 'Please install the roebe-gem ( gem install roebe ).'
|
37
|
+
pp error
|
38
|
+
end
|
39
|
+
|
40
|
+
# ========================================================================= #
|
41
|
+
# === BackupParadise.e
|
42
|
+
# ========================================================================= #
|
43
|
+
def e(i = '')
|
44
|
+
BackupParadise.e(i)
|
45
|
+
end
|
46
|
+
|
47
|
+
# ========================================================================= #
|
48
|
+
# === reset (reset tag)
|
49
|
+
# ========================================================================= #
|
50
|
+
def reset
|
51
|
+
# ======================================================================= #
|
52
|
+
# === @use_this_program_to_rename_tabs
|
53
|
+
# ======================================================================= #
|
54
|
+
@use_this_program_to_rename_tabs = nil
|
55
|
+
end
|
56
|
+
|
57
|
+
# ========================================================================= #
|
58
|
+
# === rds
|
59
|
+
# ========================================================================= #
|
60
|
+
def rds(i)
|
61
|
+
BackupParadise.rds(i)
|
62
|
+
end
|
63
|
+
|
64
|
+
# ========================================================================= #
|
65
|
+
# === no_such_directory_exists_at
|
66
|
+
# ========================================================================= #
|
67
|
+
def no_such_directory_exists_at(i)
|
68
|
+
e "No such directory exists at `#{sdir(i)}`."
|
69
|
+
end; alias no_directory_at no_such_directory_exists_at # === no_directory_at
|
70
|
+
|
71
|
+
# ========================================================================= #
|
72
|
+
# === no_target_at
|
73
|
+
# ========================================================================= #
|
74
|
+
def no_target_at(i)
|
75
|
+
e "No target at #{sfile(i)} could be found."
|
76
|
+
end
|
77
|
+
|
78
|
+
# ========================================================================= #
|
79
|
+
# === no_file_exists_at
|
80
|
+
# ========================================================================= #
|
81
|
+
def no_file_exists_at(i)
|
82
|
+
e "No file exists at `#{sfile(i)}`."
|
83
|
+
end
|
84
|
+
|
85
|
+
# ========================================================================= #
|
86
|
+
# === exit_program (exit tag)
|
87
|
+
#
|
88
|
+
# This method should be used when we have to exit from the
|
89
|
+
# backup_paradise project.
|
90
|
+
#
|
91
|
+
# The reason why a separate exit-method has been added is so that we
|
92
|
+
# can change this at a later time possibly, if we wish to do further
|
93
|
+
# checks before exiting.
|
94
|
+
# ========================================================================= #
|
95
|
+
def exit_program(be_verbose = false)
|
96
|
+
if be_verbose
|
97
|
+
e 'Quit was called, thus we exit now.'
|
98
|
+
end
|
99
|
+
if @use_this_program_to_rename_tabs
|
100
|
+
rename_tab(@use_this_program_to_rename_tabs)
|
101
|
+
end
|
102
|
+
exit
|
103
|
+
end
|
104
|
+
|
105
|
+
# ========================================================================= #
|
106
|
+
# === home_dir_of_user_x?
|
107
|
+
#
|
108
|
+
# This method is only relevant on my home system.
|
109
|
+
# ========================================================================= #
|
110
|
+
def home_dir_of_user_x?
|
111
|
+
'/home/x/'
|
112
|
+
end
|
113
|
+
|
114
|
+
# ========================================================================= #
|
115
|
+
# === cliner
|
116
|
+
# ========================================================================= #
|
117
|
+
def cliner
|
118
|
+
BackupParadise.cliner
|
119
|
+
end
|
120
|
+
|
121
|
+
# ========================================================================= #
|
122
|
+
# === delete_symlink
|
123
|
+
# ========================================================================= #
|
124
|
+
def delete_symlink(i)
|
125
|
+
if File.symlink? i
|
126
|
+
File.delete(i)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# ========================================================================= #
|
131
|
+
# === register_sigint
|
132
|
+
# ========================================================================= #
|
133
|
+
def register_sigint
|
134
|
+
Signal.trap('SIGINT') { exit_program }
|
135
|
+
end
|
136
|
+
|
137
|
+
# ========================================================================= #
|
138
|
+
# === rename
|
139
|
+
# ========================================================================= #
|
140
|
+
def rename(a, b)
|
141
|
+
if File.exist? b
|
142
|
+
e "Can not rename to #{sfancy(b)} as that target already exists."
|
143
|
+
else
|
144
|
+
FileUtils.mv(a, b)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# ========================================================================= #
|
149
|
+
# === dd_mm_yyyy
|
150
|
+
#
|
151
|
+
# This method will return a String such as "25.12.2018".
|
152
|
+
# ========================================================================= #
|
153
|
+
def dd_mm_yyyy
|
154
|
+
if Object.const_defined? :Roebe
|
155
|
+
::Roebe::Time.dd_mm_yyyy # Tap into the Roebe namespace for this.
|
156
|
+
else
|
157
|
+
Time.now.strftime('%d.%m.%Y')
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# ========================================================================= #
|
162
|
+
# === return_current_date_and_time
|
163
|
+
#
|
164
|
+
# This method will return a String such as:
|
165
|
+
#
|
166
|
+
# "24.05.2018-03:48:50"
|
167
|
+
#
|
168
|
+
# ========================================================================= #
|
169
|
+
def return_current_date_and_time
|
170
|
+
"#{dd_mm_yyyy}-#{hh_mm_ss}"
|
171
|
+
end; alias return_full_date return_current_date_and_time # === return_full_date
|
172
|
+
alias date_and_time? return_current_date_and_time # === date_and_time?
|
173
|
+
|
174
|
+
require 'backup_paradise/toplevel_methods/opnn.rb'
|
175
|
+
# ========================================================================= #
|
176
|
+
# === opnn
|
177
|
+
# ========================================================================= #
|
178
|
+
def opnn(i = NAMESPACE)
|
179
|
+
if i.is_a? String
|
180
|
+
i = {
|
181
|
+
namespace: i,
|
182
|
+
use_colours: use_colours?
|
183
|
+
}
|
184
|
+
end
|
185
|
+
BackupParadise.opnn(i)
|
186
|
+
end
|
187
|
+
|
188
|
+
# ========================================================================= #
|
189
|
+
# === esystem
|
190
|
+
# ========================================================================= #
|
191
|
+
def esystem(i)
|
192
|
+
e i
|
193
|
+
system i
|
194
|
+
end
|
195
|
+
|
196
|
+
# ========================================================================= #
|
197
|
+
# === n_files_in?
|
198
|
+
#
|
199
|
+
# This method will return how many files are in the given directory.
|
200
|
+
# ========================================================================= #
|
201
|
+
def n_files_in?(i)
|
202
|
+
_ = 0
|
203
|
+
if File.directory? i
|
204
|
+
_ = Dir["#{i}*"].size
|
205
|
+
end
|
206
|
+
_
|
207
|
+
end
|
208
|
+
|
209
|
+
# ========================================================================= #
|
210
|
+
# === create_directory (mkdir tag)
|
211
|
+
#
|
212
|
+
# The first argument to this method should be the name of the directory
|
213
|
+
# that has to be created, such as 'foobar/'.
|
214
|
+
# ========================================================================= #
|
215
|
+
def create_directory(
|
216
|
+
i, options = { mode_to_use: 0755 }
|
217
|
+
)
|
218
|
+
BackupParadise.create_directory(i, options)
|
219
|
+
end; alias mkdir create_directory # === mkdir
|
220
|
+
|
221
|
+
# ========================================================================= #
|
222
|
+
# === cd_to_the_mounted_device
|
223
|
+
# ========================================================================= #
|
224
|
+
def cd_to_the_mounted_device
|
225
|
+
cd target_mountpoint?
|
226
|
+
end
|
227
|
+
|
228
|
+
# ========================================================================= #
|
229
|
+
# === do_symlink
|
230
|
+
# ========================================================================= #
|
231
|
+
def do_symlink(
|
232
|
+
from_this_target, create_a_symlink_here
|
233
|
+
)
|
234
|
+
if File.exist? create_a_symlink_here
|
235
|
+
no_target_at(create_a_symlink_here)
|
236
|
+
else
|
237
|
+
File.symlink(from_this_target, create_a_symlink_here)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
# ========================================================================= #
|
242
|
+
# === delete_files
|
243
|
+
# ========================================================================= #
|
244
|
+
def delete_files(
|
245
|
+
i, be_verbose = false
|
246
|
+
)
|
247
|
+
case be_verbose
|
248
|
+
when :be_verbose
|
249
|
+
be_verbose = true
|
250
|
+
end
|
251
|
+
if i.is_a? Array
|
252
|
+
i.each {|entry| delete_files(entry, be_verbose) }
|
253
|
+
else
|
254
|
+
if File.file? i
|
255
|
+
if be_verbose
|
256
|
+
opnn; e "Now deleting the file `#{sfile(i)}`."
|
257
|
+
end
|
258
|
+
File.delete(i)
|
259
|
+
else
|
260
|
+
e sfancy(i)+' is not not a file - we thus can not delete it.'
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end; alias delete_file delete_files # === delete_file
|
264
|
+
alias remove_these_files delete_files # === remove_these_files
|
265
|
+
|
266
|
+
# ========================================================================= #
|
267
|
+
# === remove_directory
|
268
|
+
# ========================================================================= #
|
269
|
+
def remove_directory(i)
|
270
|
+
BackupParadise.remove_directory(i)
|
271
|
+
end
|
272
|
+
|
273
|
+
# ========================================================================= #
|
274
|
+
# === copy_file
|
275
|
+
# ========================================================================= #
|
276
|
+
def copy_file(from, to)
|
277
|
+
BackupParadise.copy_file(from, to)
|
278
|
+
end; alias copy_this_file copy_file # === copy_this_file
|
279
|
+
|
280
|
+
# ========================================================================= #
|
281
|
+
# === write_what_into
|
282
|
+
# ========================================================================= #
|
283
|
+
def write_what_into(what, into)
|
284
|
+
::Roebe.write_what_into(what, into)
|
285
|
+
end
|
286
|
+
|
287
|
+
# ========================================================================= #
|
288
|
+
# === append_what_into
|
289
|
+
# ========================================================================= #
|
290
|
+
def append_what_into(what, into)
|
291
|
+
::Roebe.append_what_into(what, into)
|
292
|
+
end
|
293
|
+
|
294
|
+
# ========================================================================= #
|
295
|
+
# === data_directory?
|
296
|
+
# ========================================================================= #
|
297
|
+
def data_directory?
|
298
|
+
DATA_DIRECTORY
|
299
|
+
end; alias data_dir? data_directory? # === data_dir?
|
300
|
+
|
301
|
+
# ========================================================================= #
|
302
|
+
# === size?
|
303
|
+
# ========================================================================= #
|
304
|
+
def size?(i)
|
305
|
+
BackupParadise.size?(i)
|
306
|
+
end
|
307
|
+
|
308
|
+
# ========================================================================= #
|
309
|
+
# === target_mountpoint?
|
310
|
+
#
|
311
|
+
# Designate to which target we will backup.
|
312
|
+
# ========================================================================= #
|
313
|
+
def target_mountpoint?
|
314
|
+
BackupParadise.target_mountpoint?
|
315
|
+
end; alias main_target? target_mountpoint? # === main_target?
|
316
|
+
alias backup_to_this_directory? target_mountpoint? # === backup_to_this_directory?
|
317
|
+
alias mount_point? target_mountpoint? # === mount_point?
|
318
|
+
alias mount_target? target_mountpoint? # === mount_target?
|
319
|
+
|
320
|
+
# ========================================================================= #
|
321
|
+
# === use_system_cp
|
322
|
+
# ========================================================================= #
|
323
|
+
def use_system_cp?
|
324
|
+
::BackupParadise.use_system_cp?
|
325
|
+
end
|
326
|
+
|
327
|
+
# ========================================================================= #
|
328
|
+
# === hh_mm_ss
|
329
|
+
# ========================================================================= #
|
330
|
+
def hh_mm_ss
|
331
|
+
if Object.const_defined? :Roebe
|
332
|
+
::Roebe::Time.hh_mm_ss # This will yield something like: "03:53:55"
|
333
|
+
else
|
334
|
+
Time.now.strftime('%H:%M:%S')
|
335
|
+
end
|
336
|
+
end; alias current_time hh_mm_ss # === current_time
|
337
|
+
|
338
|
+
# ========================================================================= #
|
339
|
+
# === has_superuser_abilities?
|
340
|
+
# ========================================================================= #
|
341
|
+
def has_superuser_abilities?
|
342
|
+
Process.uid.zero?
|
343
|
+
end
|
344
|
+
|
345
|
+
# ========================================================================= #
|
346
|
+
# === chdir (cd tag)
|
347
|
+
#
|
348
|
+
# Change directory via this method here.
|
349
|
+
# ========================================================================= #
|
350
|
+
def chdir(i)
|
351
|
+
BackupParadise.change_directory(i)
|
352
|
+
end; alias cd chdir # === cd
|
353
|
+
alias change_directory chdir # === change_directory
|
354
|
+
|
355
|
+
# ========================================================================= #
|
356
|
+
# === report_total_size_of
|
357
|
+
#
|
358
|
+
# Use this method to report the total size of a specific directory. We
|
359
|
+
# expect the input to this method thus be a (local) directory.
|
360
|
+
# ========================================================================= #
|
361
|
+
def report_total_size_of(i)
|
362
|
+
size_result = size?(i)
|
363
|
+
kb_size = (size_result.to_f / 1000.0).round(2)
|
364
|
+
mb_size = (kb_size.to_f / 1000.0).round(2)
|
365
|
+
gb_size = (mb_size.to_f / 1000.0).round(2)
|
366
|
+
e "#{rev}Total size of files in bytes at #{sdir(i)}: "\
|
367
|
+
"#{seagreen(size_result)} bytes."
|
368
|
+
e 'This corresponds to '+
|
369
|
+
orangered(kb_size.to_s)+lightcoral(' KB ')+
|
370
|
+
orangered(mb_size.to_s)+lightcoral(' MB ')+
|
371
|
+
orangered(gb_size.to_s)+lightcoral(' GB')+'.'
|
372
|
+
end; alias report_file_size_of report_total_size_of # === report_file_size_of
|
373
|
+
|
374
|
+
# ========================================================================= #
|
375
|
+
# === remove
|
376
|
+
# ========================================================================= #
|
377
|
+
def remove(i)
|
378
|
+
BackupParadise.remove(i)
|
379
|
+
end
|
380
|
+
|
381
|
+
# ========================================================================= #
|
382
|
+
# === remove_file
|
383
|
+
# ========================================================================= #
|
384
|
+
def remove_file(i)
|
385
|
+
File.delete(i) if File.file?(i)
|
386
|
+
end
|
387
|
+
|
388
|
+
# ========================================================================= #
|
389
|
+
# === set_target_mountpoint
|
390
|
+
# ========================================================================= #
|
391
|
+
def set_target_mountpoint(i)
|
392
|
+
i = i.to_s
|
393
|
+
case i
|
394
|
+
when 'chroot'
|
395
|
+
i = '/Depot/Chroot/' unless File.exist?('chroot')
|
396
|
+
# ======================================================================= #
|
397
|
+
# Specify some shortcuts to be used here.
|
398
|
+
# ======================================================================= #
|
399
|
+
when '1',
|
400
|
+
'2',
|
401
|
+
'3',
|
402
|
+
'4',
|
403
|
+
'5',
|
404
|
+
'6',
|
405
|
+
'7',
|
406
|
+
'8',
|
407
|
+
'9',
|
408
|
+
'usb1',
|
409
|
+
'usb2',
|
410
|
+
'usb3',
|
411
|
+
'usb4',
|
412
|
+
'usb5',
|
413
|
+
'usb6',
|
414
|
+
'tousb1',
|
415
|
+
'tousb2',
|
416
|
+
'tousb3',
|
417
|
+
'tousb4',
|
418
|
+
'tousb5'
|
419
|
+
i = i.dup if i.frozen?
|
420
|
+
if BackupParadise.is_this_a_shortcut?(i)
|
421
|
+
i = BackupParadise.return_the_assumed_mountpoint_from_this_input(i)
|
422
|
+
else
|
423
|
+
if i.start_with? 'usb'
|
424
|
+
i.sub!(/^usb/,'')
|
425
|
+
elsif i.start_with? 'to'
|
426
|
+
i.sub!(/^to(-| |_)?usb/,'')
|
427
|
+
end
|
428
|
+
i = "/Mount/USB#{i}/"
|
429
|
+
end
|
430
|
+
end
|
431
|
+
BackupParadise.target_mountpoint = i
|
432
|
+
end; alias set_target_device set_target_mountpoint # === set_target_device
|
433
|
+
alias set_backup_to_this_directory set_target_mountpoint # === set_backup_to_this_directory
|
434
|
+
alias set_target set_target_mountpoint # === set_target
|
435
|
+
alias set_main_target set_target_mountpoint # === set_main_target
|
436
|
+
|
437
|
+
# ========================================================================= #
|
438
|
+
# === copy_recursively
|
439
|
+
#
|
440
|
+
# This method can be used to copy the source to the target in a
|
441
|
+
# recursive manner.
|
442
|
+
#
|
443
|
+
# The third argument to this method, called `be_verbose`, will
|
444
|
+
# feedback what is done, to the user, if it has a value of true.
|
445
|
+
# Symbols such as :be_verbose can be used as an "alias" to true.
|
446
|
+
# If it is set to false, or :be_silent, then no output will be
|
447
|
+
# issued to the user.
|
448
|
+
# ========================================================================= #
|
449
|
+
def copy_recursively(
|
450
|
+
this_directory, # from (also called source)
|
451
|
+
backup_to_this_target, # to (also called target)
|
452
|
+
be_verbose = :be_verbose
|
453
|
+
)
|
454
|
+
::BackupParadise.copy_recursively(
|
455
|
+
this_directory,
|
456
|
+
backup_to_this_target,
|
457
|
+
be_verbose
|
458
|
+
)
|
459
|
+
end; alias cpr copy_recursively # === cpr
|
460
|
+
alias backup_this_directory_if_it_exists copy_recursively # === backup_this_directory_if_it_exists
|
461
|
+
|
462
|
+
# ========================================================================= #
|
463
|
+
# === target_hdd_does_not_have_enough_space_left?
|
464
|
+
# ========================================================================= #
|
465
|
+
def target_hdd_does_not_have_enough_space_left? # FIXME
|
466
|
+
false # for now this is always false. stub
|
467
|
+
# MINIMAL_FILESIZE
|
468
|
+
end
|
469
|
+
|
470
|
+
# ========================================================================= #
|
471
|
+
# === are_we_on_windows?
|
472
|
+
#
|
473
|
+
# Query whether the underlying operating system is windows or whether
|
474
|
+
# it is not.
|
475
|
+
# ========================================================================= #
|
476
|
+
def are_we_on_windows?
|
477
|
+
::BackupParadise.send(__method__)
|
478
|
+
end
|
479
|
+
|
480
|
+
# ========================================================================= #
|
481
|
+
# === all_important_directories?
|
482
|
+
#
|
483
|
+
# Feedback which directories are the most important ones.
|
484
|
+
# ========================================================================= #
|
485
|
+
def all_important_directories?
|
486
|
+
CONFIG['backup_these_directories'].map {|entry|
|
487
|
+
unless entry.end_with?('/')
|
488
|
+
entry = entry.dup if entry.frozen?
|
489
|
+
entry << '/' # Keep a trailing /; it looks better that way.
|
490
|
+
end
|
491
|
+
entry
|
492
|
+
}
|
493
|
+
end
|
494
|
+
|
495
|
+
# ========================================================================= #
|
496
|
+
# === is_on_roebe?
|
497
|
+
# ========================================================================= #
|
498
|
+
def is_on_roebe?
|
499
|
+
BackupParadise.is_on_roebe?
|
500
|
+
end
|
501
|
+
|
502
|
+
end; end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/base/colours.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
class Base
|
10
|
+
|
11
|
+
require 'backup_paradise/colours/colours.rb'
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === use_colours?
|
15
|
+
# ========================================================================= #
|
16
|
+
def use_colours?
|
17
|
+
BackupParadise.use_colours?
|
18
|
+
end
|
19
|
+
|
20
|
+
# ========================================================================= #
|
21
|
+
# === simp
|
22
|
+
# ========================================================================= #
|
23
|
+
def simp(i = '')
|
24
|
+
BackupParadise.simp(i)
|
25
|
+
end
|
26
|
+
|
27
|
+
# ========================================================================= #
|
28
|
+
# === sdir
|
29
|
+
# ========================================================================= #
|
30
|
+
def sdir(i = '')
|
31
|
+
BackupParadise.sdir(i)
|
32
|
+
end
|
33
|
+
|
34
|
+
# ========================================================================= #
|
35
|
+
# === sfile
|
36
|
+
# ========================================================================= #
|
37
|
+
def sfile(i = '')
|
38
|
+
BackupParadise.sfile(i)
|
39
|
+
end
|
40
|
+
|
41
|
+
# ========================================================================= #
|
42
|
+
# === sfancy
|
43
|
+
# ========================================================================= #
|
44
|
+
def sfancy(i = '')
|
45
|
+
BackupParadise.sfancy(i)
|
46
|
+
end
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === tomato
|
50
|
+
# ========================================================================= #
|
51
|
+
def tomato(i)
|
52
|
+
BackupParadise.tomato(i)
|
53
|
+
end
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === royalblue
|
57
|
+
# ========================================================================= #
|
58
|
+
def royalblue(i)
|
59
|
+
BackupParadise.royalblue(i)
|
60
|
+
end
|
61
|
+
|
62
|
+
# ========================================================================= #
|
63
|
+
# === rosybrown
|
64
|
+
# ========================================================================= #
|
65
|
+
def rosybrown(i)
|
66
|
+
if use_colours?
|
67
|
+
return ::Colours.rosybrown(i)
|
68
|
+
end
|
69
|
+
i
|
70
|
+
end
|
71
|
+
|
72
|
+
# ========================================================================= #
|
73
|
+
# === seagreen
|
74
|
+
# ========================================================================= #
|
75
|
+
def seagreen(i)
|
76
|
+
if use_colours?
|
77
|
+
return ::Colours.seagreen(i)
|
78
|
+
end
|
79
|
+
return i
|
80
|
+
end
|
81
|
+
|
82
|
+
# ========================================================================= #
|
83
|
+
# === steelblue
|
84
|
+
# ========================================================================= #
|
85
|
+
def steelblue(i)
|
86
|
+
if use_colours?
|
87
|
+
return ::Colours.steelblue(i)
|
88
|
+
end
|
89
|
+
return i
|
90
|
+
end
|
91
|
+
|
92
|
+
# ========================================================================= #
|
93
|
+
# === orangered
|
94
|
+
# ========================================================================= #
|
95
|
+
def orangered(i)
|
96
|
+
if use_colours?
|
97
|
+
return ::Colours.orangered(i)
|
98
|
+
end
|
99
|
+
return i
|
100
|
+
end
|
101
|
+
|
102
|
+
# ========================================================================= #
|
103
|
+
# === lightcoral
|
104
|
+
# ========================================================================= #
|
105
|
+
def lightcoral(i)
|
106
|
+
if use_colours?
|
107
|
+
return ::Colours.lightcoral(i)
|
108
|
+
end
|
109
|
+
return i
|
110
|
+
end
|
111
|
+
|
112
|
+
# ========================================================================= #
|
113
|
+
# === rev
|
114
|
+
# ========================================================================= #
|
115
|
+
def rev
|
116
|
+
if Object.const_defined? :Colours
|
117
|
+
Colours.rev
|
118
|
+
else
|
119
|
+
''
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# ========================================================================= #
|
124
|
+
# === print_rev
|
125
|
+
# ========================================================================= #
|
126
|
+
def print_rev
|
127
|
+
print rev
|
128
|
+
end
|
129
|
+
|
130
|
+
# ========================================================================= #
|
131
|
+
# === cyan
|
132
|
+
# ========================================================================= #
|
133
|
+
def cyan
|
134
|
+
Colours::CYAN
|
135
|
+
end
|
136
|
+
|
137
|
+
end; end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/base/namespace.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
class Base
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === NAMESPACE
|
13
|
+
# ========================================================================= #
|
14
|
+
NAMESPACE = inspect
|
15
|
+
|
16
|
+
end; end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'backup_paradise/base/tab.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BackupParadise
|
8
|
+
|
9
|
+
class Base
|
10
|
+
|
11
|
+
require 'backup_paradise/tab/tab.rb'
|
12
|
+
require 'backup_paradise/toplevel_methods/config.rb'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === use_this_program_to_rename_tabs?
|
16
|
+
# ========================================================================= #
|
17
|
+
def use_this_program_to_rename_tabs?
|
18
|
+
BackupParadise.use_this_program_to_rename_tabs?
|
19
|
+
end
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === rename_tab
|
23
|
+
#
|
24
|
+
# This method can be used to rename the tab of e. g. mrxvt or KDE konsole.
|
25
|
+
# ========================================================================= #
|
26
|
+
def rename_tab(
|
27
|
+
use_this_terminal = use_this_program_to_rename_tabs?, # or :mrxvt
|
28
|
+
use_this_as_new_title = 'Hello world!'
|
29
|
+
)
|
30
|
+
BackupParadise::Tab.rename_tab(
|
31
|
+
use_this_terminal,
|
32
|
+
use_this_as_new_title
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
# ========================================================================= #
|
37
|
+
# === tab_title
|
38
|
+
#
|
39
|
+
# This is as above, but uses the default terminal.
|
40
|
+
# ========================================================================= #
|
41
|
+
def tab_title(
|
42
|
+
i = ''
|
43
|
+
)
|
44
|
+
rename_tab(use_this_program_to_rename_tabs?, i)
|
45
|
+
end
|
46
|
+
|
47
|
+
end; end
|