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.

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