backup_paradise 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +452 -0
  3. data/backup_paradise.gemspec +50 -0
  4. data/bin/backup_for_ingrid +10 -0
  5. data/bin/backup_paradise +7 -0
  6. data/bin/windows_backup_paradise +9 -0
  7. data/doc/README.gen +390 -0
  8. data/doc/TODO.md +130 -0
  9. data/img/BackupParadise_Logo.png +0 -0
  10. data/lib/backup_paradise/actions/README.md +2 -0
  11. data/lib/backup_paradise/actions/backup.rb +62 -0
  12. data/lib/backup_paradise/base/base.rb +529 -0
  13. data/lib/backup_paradise/base/colours.rb +137 -0
  14. data/lib/backup_paradise/base/namespace.rb +16 -0
  15. data/lib/backup_paradise/base/tab.rb +47 -0
  16. data/lib/backup_paradise/colours/colours.rb +88 -0
  17. data/lib/backup_paradise/constants/constants.rb +162 -0
  18. data/lib/backup_paradise/gui/glimmer/libui/backup_for_ingrid/backup_for_ingrid.rb +87 -0
  19. data/lib/backup_paradise/gui/gtk2/OLD_backup.rb +165 -0
  20. data/lib/backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb +99 -0
  21. data/lib/backup_paradise/gui/shared_code/simple_backup_widget/simple_backup_widget_module.rb +0 -0
  22. data/lib/backup_paradise/gui/tk/backup.rb +108 -0
  23. data/lib/backup_paradise/gui/universal_widgets/simple_backup_widget/simple_backup_widget.rb +921 -0
  24. data/lib/backup_paradise/images/BACKUP_IMAGE.png +0 -0
  25. data/lib/backup_paradise/images/right_arrow.png +0 -0
  26. data/lib/backup_paradise/project/project.rb +40 -0
  27. data/lib/backup_paradise/requires/require_the_backup_paradise_project.rb +18 -0
  28. data/lib/backup_paradise/requires/require_yaml.rb +7 -0
  29. data/lib/backup_paradise/tab/tab.rb +87 -0
  30. data/lib/backup_paradise/toplevel_methods/cliner.rb +16 -0
  31. data/lib/backup_paradise/toplevel_methods/config.rb +86 -0
  32. data/lib/backup_paradise/toplevel_methods/create_and_remove.rb +63 -0
  33. data/lib/backup_paradise/toplevel_methods/e.rb +16 -0
  34. data/lib/backup_paradise/toplevel_methods/esystem.rb +19 -0
  35. data/lib/backup_paradise/toplevel_methods/files_and_directories.rb +181 -0
  36. data/lib/backup_paradise/toplevel_methods/help.rb +93 -0
  37. data/lib/backup_paradise/toplevel_methods/misc.rb +153 -0
  38. data/lib/backup_paradise/toplevel_methods/mountpoint.rb +188 -0
  39. data/lib/backup_paradise/toplevel_methods/opnn.rb +27 -0
  40. data/lib/backup_paradise/utility_scripts/backup/backup.rb +1942 -0
  41. data/lib/backup_paradise/version/version.rb +19 -0
  42. data/lib/backup_paradise/windows/README.md +1 -0
  43. data/lib/backup_paradise/windows/windows.rb +101 -0
  44. data/lib/backup_paradise/www/backup.cgi +63 -0
  45. data/lib/backup_paradise/yaml/config.yml +82 -0
  46. data/lib/backup_paradise.rb +5 -0
  47. data/test/testing_toplevel_functionality.rb +11 -0
  48. metadata +192 -0
data/doc/README.gen ADDED
@@ -0,0 +1,390 @@
1
+ DEFAULT_HEADER
2
+
3
+ <img src="https://i.imgur.com/Imkvsgs.png" style="margin: 1em">
4
+
5
+ # The Backup Paradise project
6
+
7
+ This project attempts to assist you - and me - in backing up data
8
+ to an **external USB** device specifically.
9
+
10
+ The project is mostly catering to my own use cases, so it may not
11
+ be very useful to other ruby users. I will try to make adjustments
12
+ so that other ruby users can use it (see the file called
13
+ **config.yml**), but this is an ongoing effort that may take
14
+ some time.
15
+
16
+ The project is primarily just a fancy **recursive copy** operation,
17
+ but it will do some minor additional notifications on the commandline,
18
+ make use of colours (if the colours gem has been installed),
19
+ automatically create some log files and even provide ruby-gtk3
20
+ bindings, as well as tk-bindings (although the latter ones are
21
+ currently incomplete).
22
+
23
+ So it is a **recursive copy** script with some add-ons really,
24
+ nothing really sophisticated aside from this on top.
25
+
26
+ The project has **one major goal** and a **few minor goals**.
27
+
28
+ The **major goal** is **to be usable as a backup-assistant**,
29
+ on both linux, but also on windows systems.
30
+
31
+ The **minor goals** include:
32
+
33
+ - **Flexibility**, to also allow us to back up only
34
+ individual files or individual directories. The user should
35
+ be able to specify **what** has to be backed up.
36
+
37
+ - Notify the user about the status of the backup-operation
38
+ and prior backup-operations.
39
+
40
+ - Provide some **simple GUI bindings** to use this project,
41
+ in particular for both ruby-gtk and ruby-tk. The latter
42
+ so that we can use this on windows.
43
+
44
+ ## General usage of the BackupParadise project - backing up data via ruby
45
+
46
+ For the time being, I have aliased the main executable at
47
+ **bin/backup_paradise** onto:
48
+
49
+ backup_paradise
50
+
51
+ To then use this, I can issue the following commands:
52
+
53
+ backup_paradise usb1
54
+ backup_paradise usb2
55
+ backup_paradise tousb1
56
+ backup_paradise tousb2
57
+ backup_paradise tousb3
58
+ backup_paradise tousb4
59
+
60
+ Depending on where the **external USB device** is mounted.
61
+
62
+ What does an argument, such as **usb1**, imply?
63
+
64
+ This used to refer to the hardcoded path at <b>/Mount/USB1/</b>
65
+ on my home system. **usb2** would then point at
66
+ <b>/Mount/USB2/</b> and so forth.
67
+
68
+ These 'main aliases' can also be accessed via some shortcuts,
69
+ such as "tousb1", without the quotes. See the examples listed
70
+ above.
71
+
72
+ I adopted this scheme after having used **GoboLinux**. Note that
73
+ this used to be valid from **December 2018** up to **May 2021**.
74
+
75
+ In **May 2021** this approach was changed. While I still use
76
+ the above instructions, such as via **backup_paradise usb1**,
77
+ a .yml file now decides the target directory. So, usb1,
78
+ usb2 and so forth, are now simply aliases to whatever the
79
+ .yml file specifies. The advantage of this approach is that
80
+ other users can re-define the targets there - simply have
81
+ a look at the **config.yml** file and change it if you
82
+ would like to. (Of course overruling this via the commandline
83
+ still works, so you don't really need to have to modify the
84
+ config.yml file.)
85
+
86
+ Other mount points can also be used, although not with a
87
+ convenience shortcut. Have a look at the option
88
+ **--backup-to=/opt/** documented elsewhere in this
89
+ file, to specify another base-directory to use.
90
+
91
+ ## The configuration file called config.yml
92
+
93
+ The **BackupParadise project** comes with a small configuration file,
94
+ called **config.yml**, in the **yaml/** subdirectory.
95
+
96
+ This is an optional file, though - if it does not exist then the
97
+ project will ignore this file completely and use internal
98
+ defaults as-is. But if it is available, and it can be found by
99
+ ruby, then it will be used as **the default configuration**.
100
+
101
+ Since as of **September 2021* the **config.yml** file
102
+ has the following **five main configuration settings**:
103
+
104
+ use_this_program_to_rename_tabs: String
105
+ show_popup_notification: Boolean
106
+ use_system_cp: Boolean
107
+ backup_these_directories: Array
108
+ local_audio_directory: String
109
+
110
+ The first three entries are not so important, but the fourth
111
+ entry is quite important, because this Array specifies which
112
+ directories we want to back up and thus copy. The fifth entry
113
+ can be used to denote your local collection of audio files,
114
+ if these are kept in a directory. I use **/home/x/songs/** for
115
+ this.
116
+
117
+ More options may be added in the future, but I will try to only
118
+ add options that make sense, rather than overwhelm users with
119
+ lots of configuration options.
120
+
121
+ The individual aliases, such as usb1, usb2, and so forth, are
122
+ also specified now:
123
+
124
+ usb1: /Mount/USB1/
125
+ usb2: /Mount/USB2/
126
+ usb3: /Mount/USB3/
127
+ usb4: /Mount/USB4/
128
+ usb5: /Mount/USB5/
129
+
130
+ The rationale for these default to my home setup, where I
131
+ mount devices to these directories (on Linux).
132
+
133
+ ## Log files
134
+
135
+ The BackupParadise project will try to log as to what has happened,
136
+ since as of **May 2018**. Several different log files may be created.
137
+
138
+ If there is more than one log file stored at the target device
139
+ then the current behaviour is to delete all but one log file.
140
+
141
+ Another log file that may commonly be used is the one
142
+ that targets the file <b>/Depot/Temp/backup.log</b>. This
143
+ will, however had, only work if the directory **/Depot/Temp/**
144
+ exists, which is the case on my home system. The whole gem here
145
+ is heavily tailored to my own needs - I can adapt it to meet
146
+ other people's wishes if necessary, of course.
147
+
148
+ The **format** of the log file going into **backup.log** is
149
+ simply how long it took to make the backup, in seconds, and
150
+ the exact date when that particular log file was created. This
151
+ is equal to when the backup-operation happened, too.
152
+
153
+ ## Backing up individual directories
154
+
155
+ If you have a directory called **FOOBAR/**, then you can back
156
+ it up simply by issuing:
157
+
158
+ backup_paradise --FOOBAR
159
+ backup_paradise FOOBAR
160
+
161
+ Whichever variant you prefer. Note that this requires that the
162
+ external device has been mounted already. You can set where
163
+ the device should reside via:
164
+
165
+ BackupParadise.set_mounted_path()
166
+
167
+ Simply pass the directory that you may wish to use for backup
168
+ purpose there.
169
+
170
+ Note that **class AdvancedBackup** will assume a certain target
171
+ device automatically, tailored to my own system. This is usually
172
+ at **/Mount/USB1** for the first mounted USB device on my
173
+ system.
174
+
175
+ If you wish to overrule that and use another target, which you
176
+ may most likely want to do, then you can use any of the
177
+ following commandline flags for this:
178
+
179
+ backup_paradise --use-this-as-target-for-backup=/opt/
180
+ backup_paradise --use-this-as-target=/opt/
181
+ backup_paradise --backup-to=/opt/
182
+
183
+ In this case **/opt/** would be the target that you use as **source
184
+ directory** for the backup-operation.
185
+
186
+ If you wish to backup the **/Programs/** hierarchy, should you
187
+ keep an **AppDir layout** on your system, then this commandline
188
+ invocation may be of help:
189
+
190
+ backup_paradise --programs-dir
191
+
192
+ To backup the **/home/x/studium/** directory, the following
193
+ commands are possible:
194
+
195
+ backup_paradise --studium-dir
196
+ backup_paradise --studium-directory
197
+ backup_paradise --studium
198
+
199
+ To backup, on my home system, the **/AUTOGENERATED/**
200
+ directory, I do:
201
+
202
+ backup_paradise --autogenerated
203
+
204
+ ## Miscellaneous comments
205
+
206
+ The **BackupParadise** project has been rewritten a few times already
207
+ over the years.
208
+
209
+ In the past there was an instance variable in class AdvancedBackup
210
+ called **@last_backup_directory**, which was pointing to an absolute
211
+ path such as **/Mount/USB1/last_backup-13.08.2018-21:11:15/**.
212
+
213
+ It is no longer in use, but I keep it as a reference hint to
214
+ myself - who knows what may be changed in the future.
215
+
216
+ ## Specific examples
217
+
218
+ This subsection details some invocation examples in a short way.
219
+
220
+ Some of these will only work on my home system for the time being,
221
+ until I have sufficiently changed the project to allow more
222
+ flexibility in this regard.
223
+
224
+ Backup all audio-files to **/opt/**:
225
+
226
+ backup_paradise --backup-to=/opt/ --audio-dir
227
+
228
+ Backup all relevant entries into the default chroot target (on
229
+ my home system):
230
+
231
+ backup_paradise --chroot
232
+
233
+ ## How do I make use of this project
234
+
235
+ I make use of the **backup_paradise** project to back up relevant
236
+ data on my home system. For example, all source-archives that
237
+ are registered within the **RBT project** I also keep available
238
+ locally. Then there is my ruby code, other files, and possibly
239
+ books, papers and tutorials stored in .pdf format.
240
+
241
+ In **September 2020**, the regular backup size was **54G** per
242
+ backup-action, mostly owing to the source archives (krita
243
+ alone occupies more than 167 MB, for example). This is way too
244
+ much, in my opinion, because it takes about **half an hour**
245
+ or so to back up on USB 2.0 already.
246
+
247
+ I will have to keep reducing file size and removing stuff that
248
+ I no longer need; aka do some clean-up. Or perhaps hope that
249
+ future USB variants will improve things here.
250
+
251
+ At any rate, this subsection shows just a bit how I may use
252
+ the project.
253
+
254
+ My usual go-to alias is:
255
+
256
+ rbackup usb1
257
+
258
+ to backup to the mount point /Mount/USB1.
259
+
260
+ This is the command invocation I tend to use most frequently
261
+ so.
262
+
263
+ ## class BackupParadise::Backup
264
+
265
+ This class is the main interface for the BackupParadise project.
266
+
267
+ For a list of documented options, pass in **--help**.
268
+
269
+ A few examples will be mentioned here as well, in a succinct
270
+ manner:
271
+
272
+ rbackup --pwd # backup into the current working directory
273
+
274
+ ## BackupParadise.simple_backup
275
+
276
+ **BackupParadise.simple_backup** can be used as a simpler alternative
277
+ to class BackupParadise::Backup. While the latter class is very
278
+ feature-rich, sometimes you may want to use
279
+ **BackupParadise.simple_backup()** instead.
280
+
281
+ Usage examples:
282
+
283
+ BackupParadise.simple_backup(:audio, '/Mount/HDD1/')
284
+ BackupParadise.simple_backup(:audio, :usb1)
285
+
286
+ ## Backup time (statistics)
287
+
288
+ This subsection is just a remainder for me how long backing up all
289
+ my dataset (which is a LOT) takes. These times are gathered on
290
+ Linux.
291
+
292
+ Ideally this time should be as small as possible, but evidently,
293
+ the more time that has to be transferred, the longer it will
294
+ take. This refers to about 100 GB or more right now. I am open
295
+ for any suggestions to cut the time down.
296
+
297
+ The measurements happen when there is a low CPU load.
298
+
299
+ 04.06.2021: 39.17 minutes
300
+
301
+ ## GUI components
302
+
303
+ Right now the **GTK3 version** (ruby-gtk3) is the most advanced GUI
304
+ component of this project - but it is still rather limited. The
305
+ primary point of the gtk-widgets for the project is to demonstrate
306
+ what **could** be done: we want to show what is possible, in
307
+ the event that others may want to build upon these ideas.
308
+
309
+ Additionally I am working on **ruby-tk** code as well, just so
310
+ that this project can be used on windows (addendum in August
311
+ 2021: this has been superceded by ruby-libui, which is a LOT
312
+ simpler to use on windows). The priority for ruby-tk is lower
313
+ than that of the ruby-gtk3 code. (In the future, one
314
+ day, we may try to use the same, unified code base for
315
+ GUIs, but this is a minor, additional goal.)
316
+
317
+ Yet another use case is ruby-libui, so in the long run it is
318
+ planned to add at the least three different widget sets,
319
+ as well as "GUIs" for the world wide web, such as via
320
+ <b>sinatra</b>.
321
+
322
+ You can try to invoke the **GUI components** from the commandline,
323
+ possibly via any of the following flags:
324
+
325
+ backup_paradise --gui
326
+ backup_paradise --gtk # This variant now defaults to ruby-gtk3.
327
+
328
+ Or more specifically:
329
+
330
+ backup_paradise --gtk3
331
+
332
+ There used to be gtk2-bindings, but they currently (**May 2021**)
333
+ do not work very well. In **August 2021** I abandoned the ruby-gtk2
334
+ code completely - new GUI code will be written either in ruby-gtk3
335
+ and/or in ruby-libui. ruby-gtk2 is still nice, but ruby-gtk3 allows
336
+ for more flexibility, in particular in regards to **CSS**.
337
+
338
+ In **September 2021** I rewrote the old ruby-gtk3 code. The current
339
+ iteration now looks like this:
340
+
341
+ <img src="https://i.imgur.com/g1dxzAb.png" style="margin-left: 2em">
342
+
343
+ The code base for that class is now largely a module, which I use
344
+ for libui-bindings too. In the long run I would like to have
345
+ ruby-tk and fxruby support as well as for the www (via sinatra
346
+ and .cgi files). Stay tuned in this regard, but don't expect this
347
+ to come too soon.
348
+
349
+ ## Automounting
350
+
351
+ Since as of <b>March 2023</b> it is possible to automount a
352
+ second harddisc (should it exist). This is currently only
353
+ the case when the underlying system is a roebe-system,
354
+ and when the default mount target /Mount/HDD, is NOT
355
+ mounted yet. If this is the case then automounting will
356
+ occur, using a hardcoded command.
357
+
358
+ In the future this may be improved, including automounting
359
+ of USB-devices. This has to be revisited eventually; for
360
+ now the code that was added has to suffice.
361
+
362
+ ## Using the backup_paradise gem on Windows
363
+
364
+ On Linux the code I write in ruby tends to work just fine. On Windows,
365
+ this is a bit more difficult. For instance, Windows does not know
366
+ symlinks in the way that Linux does. I tried this recently in July
367
+ 2023, and had awkward error messages - for instance, if you have
368
+ a directory called <b>C++</b> or <b>Cpp</b> and then symlink to
369
+ it via C++ or Cpp. The C++ symlink in particular led to some oddities
370
+ on windows where I could not copy the whole directory. This was
371
+ very confusing. Removing the symlink suddenly allowd the copy-operation.
372
+ Windows is strange.
373
+
374
+ At any rate, since symlinks are not so useful on windows, and may lead
375
+ to errors, since as of August 2023 the backup_paradise gem will
376
+ remove all symlinks found in the backup-target IF a NTFS file system
377
+ is used. Not everyone may want this behaviour by default, but for my
378
+ use case, I found it to work better. I document this behaviour here
379
+ in the event that other users may want to change this for their own
380
+ use cases.
381
+
382
+ ## Licence
383
+
384
+ Since as of **August 2021** the MIT licence is used for new releases of
385
+ this gem. While the GPL is a fine licence in and by itself, I simply do
386
+ not have the time or willingness to want to enforce it for such a simple
387
+ project like **backup_paradise**. MIT is much simpler to adhere to as
388
+ well, so there we go.
389
+
390
+ ADD_CONTACT_INFORMATION
data/doc/TODO.md ADDED
@@ -0,0 +1,130 @@
1
+ ...........................................................................
2
+ (1) → Continue with the ruby-tk bindings on windows. Make this useable
3
+ one day. Improve the ruby-tk bindings. And the fxruby bindings
4
+ too.
5
+ ...........................................................................
6
+ (2) → (Of course overruling this via the commandline
7
+ still works, so you don't really need to have to modify the
8
+ config.yml file.)
9
+ ^^^ enable this
10
+ ^^^ we need a way to overrule these dirs such as:
11
+ --use-these-directories=/home/x,/home/z
12
+ ^^^ and test it. AND document it too.
13
+ ...........................................................................
14
+ (3) → target_hdd_does_not_have_enough_space_left?
15
+ ^^^ fix this. hmmm
16
+ ...........................................................................
17
+ (4) → add some functionality to mount USB devices and umount them again
18
+ # ========================================================================= #
19
+ # === mount_device
20
+ #
21
+ # Normal usage is to call this from:
22
+ #
23
+ # scan_for_usb_entries
24
+ #
25
+ # ========================================================================= #
26
+ def mount_device(which_one = ENV['USB1'])
27
+ @target_device = which_one
28
+ e "Now mounting device #{@which_device_entry} "+
29
+ "to #{@target_device}", CII
30
+ tmp = "mount #{@which_device_entry} #{@target_device}"
31
+ system(tmp)
32
+ @date # zeigt einfach nur das aktuelle datum an
33
+ end
34
+
35
+ # ========================================================================= #
36
+ # === pre_backup_process
37
+ #
38
+ #
39
+ # What is this method doing?
40
+ #
41
+ # It does these things in the following order:
42
+ ##
43
+ # (a) renames last_backup dir to backup_DAY.MONTH.YEAR
44
+ # (b) Deletes log_last_backup file (which contains time of last update)
45
+ # (c) Deletes already existing backup dirs before it continues.
46
+ # (d) Creates directories.
47
+ #
48
+ # base_dir signifies the absolute target.
49
+ # You are in /Mount/USB1 when this method is started.
50
+ # ========================================================================= #
51
+
52
+ # ========================================================================= #
53
+ # === backup_system
54
+ #
55
+ # backup_system() to backup your system. This method is the actual working
56
+ # dog of this script. It accepts one main argument, a symbol, which
57
+ # defaults to nogtk to avoid using gtk, and which also can use tohdd
58
+ # to only backup to my (2nd) harddrive.
59
+ #
60
+ # The mode argument should be either one of these:
61
+ # :nogtk
62
+ # :tohdd
63
+ # :tousb
64
+ # :data_only # this also assumes :tousb
65
+ # ========================================================================= #
66
+ def backup_system(mode = :nogtk, sleep_for_this_time = 0)
67
+ pre_backup_process() # all processes before starting backuping
68
+ # Now splitting towards mode content
69
+ case mode.to_sym
70
+ # dont use gtk
71
+ when :nogtk
72
+ report_backup_process_to('USB device')
73
+ my_sys_cmd = 'cp -vr /Users/x/* .'
74
+ sys(my_sys_cmd)
75
+ synchronize
76
+ # Because my hdd is so slow, we nice the process
77
+ # on -19. Not very important.
78
+ when :tohdd, :festplatte, :hdd
79
+ report_backup_process_to('second HDD')
80
+ backup :audio_dir, :pkg_dir, :system_dir
81
+ when :data_only, :dataonly, :data, :donly, :onlydata
82
+ report_backup_process_to('Data only (default into USB)')
83
+ my_sys_cmd='nice -19 cp -vr /Users/x/DATA/* .'
84
+ e(my_sys_cmd)
85
+ sleep(sleep_for_this_time) # sleeping so that user gets a chance to view the command.
86
+ sys(my_sys_cmd)
87
+ # tousb backup
88
+ when :tousb, :tousb1, :tousb2, :tousb3, :tousb4
89
+ report_backup_process_to('USB Removable media')
90
+ my_sys_cmd = 'nice -19 cp -vr /Users/x/* .'
91
+ e(my_sys_cmd)
92
+ sleep(sleep_for_this_time) # sleeping so that user gets a chance to view the command.
93
+ pp Dir['*']
94
+ sys(my_sys_cmd)
95
+ backup :audio_dir, :pkg_dir, :system_dir
96
+ synchronize # must sync
97
+ # else. Nah, there are no "unhandled cases".
98
+ end
99
+ end
100
+
101
+ # ========================================================================= #
102
+ # === change_to_device_and_start_backup
103
+ # ========================================================================= #
104
+ def change_to_device_and_start_backup(which_mode = @array_arg)
105
+ if Dir.pwd.include? ENV['MY_MOUNT']
106
+ # Prepend the string 'backup_'
107
+ @dir_name = 'last_backup' # name for our backup dir. Normally sets to: last_backup
108
+ # which_mode decides what to do. default is in else
109
+ # The second arg to backup_system means sleep_for_n_seconds
110
+ case which_mode.to_s
111
+ when 'no-gtk','nogtk'
112
+ backup_system()
113
+ when 'tousb3','usb3','3'
114
+ backup_system(:tousb3, 2)
115
+ when 'data_only', 'dataonly', 'data', 'donly', 'onlydata'
116
+ backup_system(:data_only, 2)
117
+ end
118
+ end
119
+ end
120
+
121
+ _ = RBackup.new
122
+ _.scan_for_usb_entries
123
+ _.change_to_device_and_start_backup # also invokes backup_system
124
+ ^^^
125
+ ...........................................................................
126
+ (5) enhance the libui interface
127
+ ideally we should use the same code base, but in September 2021
128
+ this did not work that well, so I abandoned this for now.
129
+ At a later point in time we have to re-evaluate this.
130
+ ...........................................................................
Binary file
@@ -0,0 +1,2 @@
1
+ All activities that relate to moving, copying or deleting files
2
+ are called "actions". They will be stored in this directory.
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === BackupParadise::Actions
6
+ # =========================================================================== #
7
+ # require 'backup_paradise/actions/backup.rb'
8
+ # =========================================================================== #
9
+ module BackupParadise
10
+
11
+ module Actions
12
+
13
+ require 'backup_paradise/project/project.rb'
14
+ require 'backup_paradise/requires/require_yaml.rb'
15
+ require 'backup_paradise/toplevel_methods/e.rb'
16
+
17
+ # ========================================================================= #
18
+ # === BackupParadise::Actions.e
19
+ # ========================================================================= #
20
+ def self.e(i = '')
21
+ ::BackupParadise.e(i)
22
+ end
23
+
24
+ # ========================================================================= #
25
+ # === BackupParadise::Actions.backup
26
+ #
27
+ # This method requires a Hash as input-argument. This Hash must provide
28
+ # some basic information, such as to which target we will backup onto.
29
+ # ========================================================================= #
30
+ def self.backup(
31
+ i = ARGV,
32
+ hash = {
33
+ backup_to_this_target: :usb1
34
+ }
35
+ )
36
+ if block_given?
37
+ yielded = yield
38
+ if yielded.is_a? Hash
39
+ hash.merge!(yielded)
40
+ end
41
+ end
42
+ # ======================================================================= #
43
+ # === :commandline_arguments
44
+ #
45
+ # The key :backup_to_this_target is mandatory.
46
+ # ======================================================================= #
47
+ if i.is_a?(Array) and !i.empty?
48
+ hash[:commandline_arguments] = i
49
+ end
50
+ # ======================================================================= #
51
+ # Delegate to a specialized class next.
52
+ # ======================================================================= #
53
+ require 'backup_paradise/utility_scripts/backup/backup.rb'
54
+ BackupParadise::Backup.new(hash)
55
+ end
56
+
57
+ end; end
58
+
59
+ if __FILE__ == $PROGRAM_NAME
60
+ BackupParadise::Actions.backup(ARGV)
61
+ end # actionbackup
62
+ # actionbackup --help