backup_paradise 1.2.40

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of backup_paradise might be problematic. Click here for more details.

Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +390 -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 +347 -0
  8. data/doc/TODO.md +130 -0
  9. data/lib/backup_paradise/actions/README.md +2 -0
  10. data/lib/backup_paradise/actions/backup.rb +62 -0
  11. data/lib/backup_paradise/base/base.rb +493 -0
  12. data/lib/backup_paradise/base/colours.rb +137 -0
  13. data/lib/backup_paradise/base/namespace.rb +16 -0
  14. data/lib/backup_paradise/base/tab.rb +47 -0
  15. data/lib/backup_paradise/colours/colours.rb +88 -0
  16. data/lib/backup_paradise/constants/constants.rb +162 -0
  17. data/lib/backup_paradise/gui/glimmer/libui/backup_for_ingrid/backup_for_ingrid.rb +87 -0
  18. data/lib/backup_paradise/gui/gtk2/OLD_backup.rb +222 -0
  19. data/lib/backup_paradise/gui/gtk3/simple_backup_widget/create.rb +64 -0
  20. data/lib/backup_paradise/gui/gtk3/simple_backup_widget/misc.rb +34 -0
  21. data/lib/backup_paradise/gui/gtk3/simple_backup_widget/simple_backup_widget.rb +167 -0
  22. data/lib/backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb +99 -0
  23. data/lib/backup_paradise/gui/libui/simple_backup_widget/simple_backup_widget.rb +119 -0
  24. data/lib/backup_paradise/gui/shared_code/simple_backup_widget/simple_backup_widget_module.rb +595 -0
  25. data/lib/backup_paradise/gui/tk/backup.rb +108 -0
  26. data/lib/backup_paradise/images/BACKUP_IMAGE.png +0 -0
  27. data/lib/backup_paradise/images/right_arrow.png +0 -0
  28. data/lib/backup_paradise/project/project.rb +40 -0
  29. data/lib/backup_paradise/requires/require_the_backup_paradise_project.rb +18 -0
  30. data/lib/backup_paradise/requires/require_yaml.rb +7 -0
  31. data/lib/backup_paradise/tab/tab.rb +87 -0
  32. data/lib/backup_paradise/toplevel_methods/cliner.rb +16 -0
  33. data/lib/backup_paradise/toplevel_methods/config.rb +77 -0
  34. data/lib/backup_paradise/toplevel_methods/create_and_remove.rb +63 -0
  35. data/lib/backup_paradise/toplevel_methods/e.rb +16 -0
  36. data/lib/backup_paradise/toplevel_methods/esystem.rb +19 -0
  37. data/lib/backup_paradise/toplevel_methods/files_and_directories.rb +181 -0
  38. data/lib/backup_paradise/toplevel_methods/help.rb +93 -0
  39. data/lib/backup_paradise/toplevel_methods/misc.rb +153 -0
  40. data/lib/backup_paradise/toplevel_methods/mountpoint.rb +185 -0
  41. data/lib/backup_paradise/toplevel_methods/opnn.rb +25 -0
  42. data/lib/backup_paradise/utility_scripts/backup/backup.rb +1416 -0
  43. data/lib/backup_paradise/utility_scripts/backup/constants.rb +44 -0
  44. data/lib/backup_paradise/utility_scripts/backup/initialize.rb +71 -0
  45. data/lib/backup_paradise/utility_scripts/backup/menu.rb +361 -0
  46. data/lib/backup_paradise/utility_scripts/backup/run.rb +20 -0
  47. data/lib/backup_paradise/version/version.rb +19 -0
  48. data/lib/backup_paradise/windows/README.md +1 -0
  49. data/lib/backup_paradise/windows/windows.rb +101 -0
  50. data/lib/backup_paradise/www/backup.cgi +63 -0
  51. data/lib/backup_paradise/yaml/config.yml +78 -0
  52. data/lib/backup_paradise.rb +5 -0
  53. data/test/testing_toplevel_functionality.rb +11 -0
  54. metadata +198 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4e4a9fef49d3db41edd23029312670c92939bffd483ce3ca73b2998c3cbfdae2
4
+ data.tar.gz: 521803656f9303c3736f879c4fe5b170b28f90e42e5594cb8cb66cd482902fca
5
+ SHA512:
6
+ metadata.gz: 5ebb5fa3e6bbf7d57dd04323e43e7aad3715a1553bd469d4c2d5720ec1dd31390ff777b51c5e489c7c6164c12f95d71a3ecf52f1f661b566c1ba7dac524f36fb
7
+ data.tar.gz: ff97afecfe2592027966792b01233035f47b5380a69670676b7716c0012d8e2f4efff386178190c1c944d59d2b26dfbd4202e80e5044ce9cd7172ff825924f88
data/README.md ADDED
@@ -0,0 +1,390 @@
1
+ # Backup Paradise
2
+ [![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
3
+ [![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
4
+ [![Gem Version](https://badge.fury.io/rb/backup_paradise.svg)](https://badge.fury.io/rb/backup_paradise)
5
+
6
+ This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">09.09.2022</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">15:44:39</span> o'clock.
7
+
8
+ This project attempts to assist you - and me - in backing up data
9
+ to an **external USB** device specifically.
10
+
11
+ The project is mostly catering to my own use cases, so it may not
12
+ be very useful to other ruby users. I will try to make adjustments
13
+ so that other ruby users can use it (see the file called
14
+ **config.yml**), but this is an ongoing effort that may take
15
+ some time.
16
+
17
+ The project is primarily just a fancy **recursive copy** operation,
18
+ but it will do some minor additional notifications on the commandline,
19
+ make use of colours (if the colours gem has been installed),
20
+ automatically create some log files and even provide ruby-gtk3
21
+ bindings, as well as tk-bindings (although the latter ones are
22
+ currently incomplete).
23
+
24
+ So it is a **recursive copy** script with some add-ons really,
25
+ nothing really sophisticated aside from this on top.
26
+
27
+ The project has **one major goal** and a **few minor goals**.
28
+
29
+ The **major goal** is **to be usable as a backup-assistant**,
30
+ on both linux, but also on windows systems.
31
+
32
+ The **minor goals** include:
33
+
34
+ - **Flexibility**, to also allow us to back up only
35
+ individual files or individual directories. The user should
36
+ be able to specify **what** has to be backed up.
37
+
38
+ - Notify the user about the status of the backup-operation
39
+ and prior backup-operations.
40
+
41
+ - Provide some **simple GUI bindings** to use this project,
42
+ in particular for both ruby-gtk and ruby-tk. The latter
43
+ so that we can use this on windows.
44
+
45
+ ## General usage of the BackupParadise project - backing up data via ruby
46
+
47
+ For the time being, I have aliased the main executable at
48
+ **bin/backup_paradise** onto:
49
+
50
+ backup_paradise
51
+
52
+ To then use this, I can issue the following commands:
53
+
54
+ backup_paradise usb1
55
+ backup_paradise usb2
56
+ backup_paradise tousb1
57
+ backup_paradise tousb2
58
+ backup_paradise tousb3
59
+ backup_paradise tousb4
60
+
61
+ Depending on where the **external USB device** is mounted.
62
+
63
+ What does an argument, such as **usb1**, imply?
64
+
65
+ This used to refer to the hardcoded path at <b>/Mount/USB1/</b>
66
+ on my home system. **usb2** would then point at
67
+ <b>/Mount/USB2/</b> and so forth.
68
+
69
+ These 'main aliases' can also be accessed via some shortcuts,
70
+ such as "tousb1", without the quotes. See the examples listed
71
+ above.
72
+
73
+ I adopted this scheme after having used **GoboLinux**. Note that
74
+ this used to be valid from **December 2018** up to **May 2021**.
75
+
76
+ In **May 2021** this approach was changed. While I still use
77
+ the above instructions, such as via **backup_paradise usb1**,
78
+ a .yml file now decides the target directory. So, usb1,
79
+ usb2 and so forth, are now simply aliases to whatever the
80
+ .yml file specifies. The advantage of this approach is that
81
+ other users can re-define the targets there - simply have
82
+ a look at the **config.yml** file and change it if you
83
+ would like to. (Of course overruling this via the commandline
84
+ still works, so you don't really need to have to modify the
85
+ config.yml file.)
86
+
87
+ Other mount points can also be used, although not with a
88
+ convenience shortcut. Have a look at the option
89
+ **--backup-to=/opt/** documented elsewhere in this
90
+ file, to specify another base-directory to use.
91
+
92
+ ## The configuration file called config.yml
93
+
94
+ The **BackupParadise project** comes with a small configuration file,
95
+ called **config.yml**, in the **yaml/** subdirectory.
96
+
97
+ This is an optional file, though - if it does not exist then the
98
+ project will ignore this file completely and use internal
99
+ defaults as-is. But if it is available, and it can be found by
100
+ ruby, then it will be used as **the default configuration**.
101
+
102
+ Since as of **September 2021* the **config.yml** file
103
+ has the following **five main configuration settings**:
104
+
105
+ use_this_program_to_rename_tabs: String
106
+ show_popup_notification: Boolean
107
+ use_system_cp: Boolean
108
+ backup_these_directories: Array
109
+ local_audio_directory: String
110
+
111
+ The first three entries are not so important, but the fourth
112
+ entry is quite important, because this Array specifies which
113
+ directories we want to back up and thus copy. The fifth entry
114
+ can be used to denote your local collection of audio files,
115
+ if these are kept in a directory. I use **/home/x/songs/** for
116
+ this.
117
+
118
+ More options may be added in the future, but I will try to only
119
+ add options that make sense, rather than overwhelm users with
120
+ lots of configuration options.
121
+
122
+ The individual aliases, such as usb1, usb2, and so forth, are
123
+ also specified now:
124
+
125
+ usb1: /Mount/USB1/
126
+ usb2: /Mount/USB2/
127
+ usb3: /Mount/USB3/
128
+ usb4: /Mount/USB4/
129
+ usb5: /Mount/USB5/
130
+
131
+ The rationale for these default to my home setup, where I
132
+ mount devices to these directories (on Linux).
133
+
134
+ ## Log files
135
+
136
+ The BackupParadise project will try to log as to what has happened,
137
+ since as of **May 2018**. Several different log files may be created.
138
+
139
+ If there is more than one log file stored at the target device
140
+ then the current behaviour is to delete all but one log file.
141
+
142
+ Another log file that may commonly be used is the one
143
+ that targets the file <b>/Depot/Temp/backup.log</b>. This
144
+ will, however had, only work if the directory **/Depot/Temp/**
145
+ exists, which is the case on my home system. The whole gem here
146
+ is heavily tailored to my own needs - I can adapt it to meet
147
+ other people's wishes if necessary, of course.
148
+
149
+ The **format** of the log file going into **backup.log** is
150
+ simply how long it took to make the backup, in seconds, and
151
+ the exact date when that particular log file was created. This
152
+ is equal to when the backup-operation happened, too.
153
+
154
+ ## Backing up individual directories
155
+
156
+ If you have a directory called **FOOBAR/**, then you can back
157
+ it up simply by issuing:
158
+
159
+ backup_paradise --FOOBAR
160
+ backup_paradise FOOBAR
161
+
162
+ Whichever variant you prefer. Note that this requires that the
163
+ external device has been mounted already. You can set where
164
+ the device should reside via:
165
+
166
+ BackupParadise.set_mounted_path()
167
+
168
+ Simply pass the directory that you may wish to use for backup
169
+ purpose there.
170
+
171
+ Note that **class AdvancedBackup** will assume a certain target
172
+ device automatically, tailored to my own system. This is usually
173
+ at **/Mount/USB1** for the first mounted USB device on my
174
+ system.
175
+
176
+ If you wish to overrule that and use another target, which you
177
+ may most likely want to do, then you can use any of the
178
+ following commandline flags for this:
179
+
180
+ backup_paradise --use-this-as-target-for-backup=/opt/
181
+ backup_paradise --use-this-as-target=/opt/
182
+ backup_paradise --backup-to=/opt/
183
+
184
+ In this case **/opt/** would be the target that you use as **source
185
+ directory** for the backup-operation.
186
+
187
+ If you wish to backup the **/Programs/** hierarchy, should you
188
+ keep an **AppDir layout** on your system, then this commandline
189
+ invocation may be of help:
190
+
191
+ backup_paradise --programs-dir
192
+
193
+ To backup the **/home/x/studium/** directory, the following
194
+ commands are possible:
195
+
196
+ backup_paradise --studium-dir
197
+ backup_paradise --studium-directory
198
+ backup_paradise --studium
199
+
200
+ To backup, on my home system, the **/AUTOGENERATED/**
201
+ directory, I do:
202
+
203
+ backup_paradise --autogenerated
204
+
205
+ ## Miscellaneous comments
206
+
207
+ The **BackupParadise** project has been rewritten a few times already
208
+ over the years.
209
+
210
+ In the past there was an instance variable in class AdvancedBackup
211
+ called **@last_backup_directory**, which was pointing to an absolute
212
+ path such as **/Mount/USB1/last_backup-13.08.2018-21:11:15/**.
213
+
214
+ It is no longer in use, but I keep it as a reference hint to
215
+ myself - who knows what may be changed in the future.
216
+
217
+ ## Specific examples
218
+
219
+ This subsection details some invocation examples in a short way.
220
+
221
+ Some of these will only work on my home system for the time being,
222
+ until I have sufficiently changed the project to allow more
223
+ flexibility in this regard.
224
+
225
+ Backup all audio-files to **/opt/**:
226
+
227
+ backup_paradise --backup-to=/opt/ --audio-dir
228
+
229
+ Backup all relevant entries into the default chroot target (on
230
+ my home system):
231
+
232
+ backup_paradise --chroot
233
+
234
+ ## How do I make use of this project
235
+
236
+ I make use of the **backup_paradise** project to back up relevant
237
+ data on my home system. For example, all source-archives that
238
+ are registered within the **RBT project** I also keep available
239
+ locally. Then there is my ruby code, other files, and possibly
240
+ books, papers and tutorials stored in .pdf format.
241
+
242
+ In **September 2020**, the regular backup size was **54G** per
243
+ backup-action, mostly owing to the source archives (krita
244
+ alone occupies more than 167 MB, for example). This is way too
245
+ much, in my opinion, because it takes about **half an hour**
246
+ or so to back up on USB 2.0 already.
247
+
248
+ I will have to keep reducing file size and removing stuff that
249
+ I no longer need; aka do some clean-up. Or perhaps hope that
250
+ future USB variants will improve things here.
251
+
252
+ At any rate, this subsection shows just a bit how I may use
253
+ the project.
254
+
255
+ My usual go-to alias is:
256
+
257
+ rbackup usb1
258
+
259
+ to backup to the mount point /Mount/USB1.
260
+
261
+ This is the command invocation I tend to use most frequently
262
+ so.
263
+
264
+ ## class BackupParadise::Backup
265
+
266
+ This class is the main interface for the BackupParadise project.
267
+
268
+ For a list of documented options, pass in **--help**.
269
+
270
+ A few examples will be mentioned here as well, in a succinct
271
+ manner:
272
+
273
+ rbackup --pwd # backup into the current working directory
274
+
275
+ ## BackupParadise.simple_backup
276
+
277
+ **BackupParadise.simple_backup** can be used as a simpler alternative
278
+ to class BackupParadise::Backup. While the latter class is very
279
+ feature-rich, sometimes you may want to use
280
+ **BackupParadise.simple_backup()** instead.
281
+
282
+ Usage examples:
283
+
284
+ BackupParadise.simple_backup(:audio, '/Mount/HDD1/')
285
+ BackupParadise.simple_backup(:audio, :usb1)
286
+
287
+ ## Backup time (statistics)
288
+
289
+ This subsection is just a remainder for me how long backing up all
290
+ my dataset (which is a LOT) takes. These times are gathered on
291
+ Linux.
292
+
293
+ Ideally this time should be as small as possible, but evidently,
294
+ the more time that has to be transferred, the longer it will
295
+ take. This refers to about 100 GB or more right now. I am open
296
+ for any suggestions to cut the time down.
297
+
298
+ The measurements happen when there is a low CPU load.
299
+
300
+ 04.06.2021: 39.17 minutes
301
+
302
+ ## GUI components
303
+
304
+ Right now the **GTK3 version** (ruby-gtk3) is the most advanced GUI
305
+ component of this project - but it is still rather limited.
306
+
307
+ Additionally I am working on **ruby-tk** code as well, just so
308
+ that this project can be used on windows (addendum in August
309
+ 2021: this has been superceded by ruby-libui, which is a LOT
310
+ simpler to use on windows). The priority for ruby-tk is lower
311
+ than that of the ruby-gtk3 code. (In the future, one
312
+ day, we may try to use the same, unified code base for
313
+ GUIs, but this is a minor, additional goal.)
314
+
315
+ You can try to invoke the **GUI components** from the commandline,
316
+ possibly via any of the following flags:
317
+
318
+ backup_paradise --gui
319
+ backup_paradise --gtk # This variant now defaults to ruby-gtk3.
320
+
321
+ Or more specifically:
322
+
323
+ backup_paradise --gtk3
324
+
325
+ There used to be gtk2-bindings, but they currently (**May 2021**)
326
+ do not work very well. In **August 2021** I abandoned the ruby-gtk2
327
+ code completely - new GUI code will be written either in ruby-gtk3
328
+ and/or in ruby-libui. ruby-gtk2 is still nice, but ruby-gtk3 allows
329
+ for more flexibility, in particular in regards to **CSS**.
330
+
331
+ In **September 2021** I rewrote the old ruby-gtk3 code. The current
332
+ iteration now looks like this:
333
+
334
+ <img src="https://i.imgur.com/g1dxzAb.png" style="margin-left: 2em">
335
+
336
+ The code base for that class is now largely a module, which I use
337
+ for libui-bindings too. In the long run I would like to have
338
+ ruby-tk and fxruby support as well as for the www (via sinatra
339
+ and .cgi files). Stay tuned in this regard, but don't expect this
340
+ to come too soon.
341
+
342
+ ## Licence
343
+
344
+ Since as of **August 2021** the MIT licence is used for new releases of
345
+ this gem. While the GPL is a fine licence, I simply do not have the time
346
+ or willingness to want to enforce it for such a simple project like
347
+ **backup_paradise**. MIT is much simpler to adhere to as well, so
348
+ there we go.
349
+
350
+
351
+ ## Contact information and mandatory 2FA coming up in 2022
352
+
353
+ If your creative mind has ideas and specific suggestions to make this gem
354
+ more useful in general, feel free to drop me an email at any time, via:
355
+
356
+ shevy@inbox.lt
357
+
358
+ Before that email I used an email account at Google gmail, but in **2021** I
359
+ decided to slowly abandon gmail for various reasons. In order to limit this
360
+ explanation here, allow me to just briefly state that I do not feel as if I
361
+ want to promote any Google service anymore, for various reasons.
362
+
363
+ Do keep in mind that responding to emails may take some time, depending on
364
+ the amount of work I may have at that moment.
365
+
366
+ In 2022 rubygems.org decided to make 2FA mandatory for every gem owner:
367
+ see https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
368
+
369
+ As I can not use 2FA, for reasons I will skip explaining here (see
370
+ various github issue discussions in the past), this effectively means that
371
+ Betty Li and others who run the show at rubygems.org will perma-ban me
372
+ from using rubygems as a developer.
373
+
374
+ As I disagree with that decision completely, this will mean that all my
375
+ gems will be removed from rubygems.org prior to that sunset date, e. g.
376
+ before they permanently lock me out from the code that I used
377
+ to maintain. It is pointless to want to discuss this with them anymore -
378
+ they have made up their minds and decided that you can only use
379
+ the code if 2FA is in place, even though the code itself works just
380
+ fine. If you don't use 2FA you are effectively locked out from your
381
+ own code; I consider this a malicious attack. See also how they limited
382
+ discussions to people with mandatory 2FA on the ruby-bugtracker, thus
383
+ banning everyone permanently without 2FA:
384
+
385
+ https://bugs.ruby-lang.org/issues/18800
386
+
387
+ Guess it may indeed be time to finally abandon ruby - not because
388
+ ruby is a bad language, but there are people now in charge who
389
+ really should not be part of ruby in the first place.
390
+
@@ -0,0 +1,50 @@
1
+ # =========================================================================== #
2
+ # Gemspec for Project BackupParadise.
3
+ # =========================================================================== #
4
+ require 'backup_paradise/version/version.rb'
5
+ require 'roebe'
6
+
7
+ Gem::Specification.new { |s|
8
+
9
+ s.name = 'backup_paradise'
10
+ s.version = BackupParadise::VERSION
11
+ s.date = Time.now.strftime('%Y-%m-%d')
12
+
13
+ DESCRIPTION = <<-EOF
14
+
15
+ This project can be used for backup-related tasks, although it is
16
+ primarily adjusted to my own personal use cases, so it may not
17
+ be of much use to other ruby users. Still - in the event that someone
18
+ wants to give it a try or re-use existing ideas for inspiration,
19
+ feel free to have a look at it.
20
+
21
+ For more documentation have a look at the official
22
+ homepage, at:
23
+
24
+ https://www.rubydoc.info/gems/backup_paradise/
25
+
26
+ EOF
27
+
28
+ s.summary = DESCRIPTION
29
+ s.description = DESCRIPTION
30
+
31
+ s.executables = Dir['bin/*'].map { |f| File.basename(f) }
32
+
33
+ s.authors = ['Robert A. Heiler']
34
+ s.email = Roebe.email?
35
+ s.files = Dir['**/*']
36
+ s.license = 'MIT'
37
+ s.homepage = 'https://rubygems.org/gems/backup_paradise'
38
+
39
+ s.required_ruby_version = '>= '+Roebe.third_most_stable_version_of_ruby
40
+ s.required_rubygems_version = '>= '+Gem::VERSION
41
+ s.rubygems_version = '>= '+Gem::VERSION
42
+
43
+ s.add_dependency 'colours'
44
+ s.add_dependency 'convert_global_env'
45
+ s.add_dependency 'mountpoints'
46
+ s.add_dependency 'opn'
47
+ s.add_dependency 'roebe'
48
+ s.add_dependency 'save_file'
49
+
50
+ }
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # This file is only for a certain person; it will not be hugely useful
6
+ # for other ruby users of this gem.
7
+ # =========================================================================== #
8
+ require 'backup_paradise/gui/libui/backup_for_ingrid/backup_for_ingrid.rb'
9
+
10
+ BackupParadise::GUI::LibUI::BackupForIngrid.new
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'backup_paradise'
6
+
7
+ BackupParadise::Backup.new(ARGV)
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # This is the variant that should specifically work on windows.
6
+ # =========================================================================== #
7
+ require 'backup_paradise'
8
+
9
+ BackupParadise::Backup.new(ARGV) { :we_are_on_windows }