backup_paradise 1.2.37

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 (54) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +375 -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 +1389 -0
  43. data/lib/backup_paradise/utility_scripts/backup/constants.rb +34 -0
  44. data/lib/backup_paradise/utility_scripts/backup/initialize.rb +71 -0
  45. data/lib/backup_paradise/utility_scripts/backup/menu.rb +360 -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
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/misc.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ require 'backup_paradise/toplevel_methods/files_and_directories.rb'
10
+ require 'backup_paradise/toplevel_methods/mountpoint.rb'
11
+ require 'backup_paradise/tab/tab.rb'
12
+
13
+ require 'backup_paradise/colours/colours.rb'
14
+ # ========================================================================= #
15
+ # === report_current_dir
16
+ #
17
+ # This method will tell us about the current directory.
18
+ # ========================================================================= #
19
+ def self.report_current_dir
20
+ e "Current location is: #{sdir(Dir.pwd)}"
21
+ end; self.instance_eval { alias report_pwd report_current_dir } # === BackupParadise.report_pwd
22
+ self.instance_eval { alias report_current_directory report_current_dir } # === BackupParadise.report_current_directory
23
+
24
+ # ========================================================================= #
25
+ # === debug (debug tag)
26
+ #
27
+ # This is just "quick" debug output.
28
+ # ========================================================================= #
29
+ def debug
30
+ e
31
+ e ' Data directory: '+sfancy(data_directory?)
32
+ e " Main mount point: #{sfancy(mount_point?.to_s)}"
33
+ e
34
+ end
35
+
36
+ # ========================================================================= #
37
+ # === BackupParadise.tab_title
38
+ # ========================================================================= #
39
+ def self.tab_title(
40
+ use_this_title = ''
41
+ )
42
+ BackupParadise::Tab.rename_tab(:default, use_this_title)
43
+ end
44
+
45
+ # ========================================================================= #
46
+ # === BackupParadise.rds
47
+ # ========================================================================= #
48
+ def self.rds(i)
49
+ i.to_s.squeeze '/'
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === BackupParadise.is_on_roebe?
54
+ # ========================================================================= #
55
+ def self.is_on_roebe?
56
+ ENV['IS_ROEBE'].to_s == '1'
57
+ end
58
+
59
+ # ========================================================================= #
60
+ # === BackupParadise.are_we_on_windows?
61
+ #
62
+ # Query whether the underlying operating system is windows or whether
63
+ # it is not.
64
+ # ========================================================================= #
65
+ def self.are_we_on_windows?
66
+ Gem.win_platform?
67
+ end
68
+
69
+ # ========================================================================= #
70
+ # === BackupParadise.are_we_on_linux?
71
+ # ========================================================================= #
72
+ def self.are_we_on_linux?
73
+ RbConfig::CONFIG['host_os'].include? 'linux'
74
+ end
75
+
76
+ # ========================================================================= #
77
+ # === BackupParadise.simple_backup
78
+ #
79
+ # Use this toplevel-method to backup something individually. This will
80
+ # deliberately NOT make use of class BackupParadise::Backup, to keep
81
+ # things as simple as possible in this regard.
82
+ #
83
+ # To invoke this method, try any of the following:
84
+ #
85
+ # BackupParadise.simple_backup(:audio, '/Mount/HDD1/')
86
+ # BackupParadise.simple_backup(:audio_dir, '/Mount/HDD1/')
87
+ # BackupParadise.simple_backup(:system_dir, '/Mount/HDD1/')
88
+ # BackupParadise.simple_backup(:audio, :usb1)
89
+ #
90
+ # ========================================================================= #
91
+ def self.simple_backup(
92
+ this_directory_or_file = '/home/x/songs/',
93
+ target_location = '/Mount/USB1/', # '/Mount/HDD1/',
94
+ be_verbose = true
95
+ )
96
+ if this_directory_or_file.is_a? Array
97
+ this_directory_or_file.each {|entry|
98
+ Backup.simple_backup(entry, target_location, be_verbose)
99
+ }
100
+ else
101
+ # ===================================================================== #
102
+ # First, handle some special Symbols. This must come before rds().
103
+ # ===================================================================== #
104
+ case this_directory_or_file
105
+ # ===================================================================== #
106
+ # === :audio
107
+ # ===================================================================== #
108
+ when :audio,
109
+ :audio_dir, :songs, :songs_dir, :default,
110
+ :audio_directory
111
+ this_directory_or_file = DIRECTORY_CONTAINING_ALL_SONGS
112
+ # ===================================================================== #
113
+ # === :pkg_dir
114
+ # ===================================================================== #
115
+ when :pkg_dir
116
+ this_directory_or_file = '/Depot/Packages/'
117
+ # ===================================================================== #
118
+ # === :system_dir
119
+ # ===================================================================== #
120
+ when :system_dir, :sys_dir
121
+ this_directory_or_file = '/System/'
122
+ end
123
+ this_directory_or_file = rds(this_directory_or_file)
124
+ if target_location.is_a? Symbol
125
+ # =================================================================== #
126
+ # Symbols are treated in a special manner.
127
+ # =================================================================== #
128
+ if BackupParadise.is_this_a_shortcut?(target_location.to_s)
129
+ target_location =
130
+ BackupParadise.return_the_assumed_mountpoint_from_this_input(target_location.to_s)
131
+ end
132
+ end
133
+ this_directory_or_file = this_directory_or_file.dup if this_directory_or_file.frozen?
134
+ if this_directory_or_file.end_with?('/.')
135
+ # =================================================================== #
136
+ # The next line was added because it was noticed that windows, for
137
+ # some odd reason, may append a '.' character to a directory.
138
+ # =================================================================== #
139
+ this_directory_or_file.chop! # Remove the last char, which is '.' in this case.
140
+ end
141
+ target_location = target_location.to_s
142
+ e "Now backing up directory `#{sdir(this_directory_or_file)}"\
143
+ "` to `#{sdir(target_location)}`."
144
+ cpr(
145
+ this_directory_or_file,
146
+ target_location,
147
+ be_verbose
148
+ )
149
+ tab_title 'Backing up now ...' unless are_we_on_windows?
150
+ end
151
+ end
152
+
153
+ end
@@ -0,0 +1,185 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/mountpoint.rb'
6
+ # BackupParadise.target_mountpoint=
7
+ # =========================================================================== #
8
+ module BackupParadise
9
+
10
+ require 'backup_paradise/toplevel_methods/config.rb'
11
+
12
+ # ========================================================================= #
13
+ # === @target_mountpoint
14
+ # ========================================================================= #
15
+ @target_mountpoint = '/Mount/USB1/'
16
+
17
+ # ========================================================================= #
18
+ # === BackupParadise.is_this_a_shortcut?
19
+ # ========================================================================= #
20
+ def self.is_this_a_shortcut?(i)
21
+ returned_value = return_the_assumed_mountpoint_from_this_input(i)
22
+ # ======================================================================= #
23
+ # It is a shortcut when we have replaced it.
24
+ # ======================================================================= #
25
+ !(returned_value == i)
26
+ end
27
+
28
+ # ========================================================================= #
29
+ # === BackupParadise.return_the_assumed_mountpoint_from_this_input
30
+ #
31
+ # This method will replace e. g. "usb1" with ENV['USB1'] or the
32
+ # config-setting. The config setting takes priority over the ENV
33
+ # setting.
34
+ # ========================================================================= #
35
+ def self.return_the_assumed_mountpoint_from_this_input(i)
36
+ case i # case tag
37
+ # ======================================================================= #
38
+ # === :pwd
39
+ # ======================================================================= #
40
+ when 'pwd',
41
+ :pwd,
42
+ :""
43
+ i = Dir.pwd
44
+ # ======================================================================= #
45
+ # === :usb1
46
+ #
47
+ # Note that nil also defaults to :usb1.
48
+ # ======================================================================= #
49
+ when :usb1,
50
+ :default,
51
+ 'usb1',
52
+ 'usb',
53
+ 'tousb',
54
+ /^-?-?to(-|_)?usb1/,
55
+ '1',
56
+ /^-?-?usb1/,
57
+ nil
58
+ if CONFIG and CONFIG.has_key?('usb1')
59
+ i = CONFIG['usb1'].to_s
60
+ else
61
+ i = ENV['USB1']
62
+ end
63
+ # ======================================================================= #
64
+ # === :usb2
65
+ # ======================================================================= #
66
+ when :usb2,
67
+ 'usb2',
68
+ /^-?-?to(-|_)?usb2/,
69
+ '2',
70
+ /^-?-?usb2/
71
+ if CONFIG and CONFIG.has_key?('usb2')
72
+ i = CONFIG['usb2'].to_s
73
+ else
74
+ i = ENV['USB2']
75
+ end
76
+ # ======================================================================= #
77
+ # === :usb3
78
+ # ======================================================================= #
79
+ when 'usb3',
80
+ 'tousb3',
81
+ '3',
82
+ /^-?-?usb3/,
83
+ /^-?-?to(-|_)?usb3/,
84
+ :usb3
85
+ if CONFIG and CONFIG.has_key?('usb3')
86
+ i = CONFIG['usb3'].to_s
87
+ else
88
+ i = ENV['USB3']
89
+ end
90
+ # ======================================================================= #
91
+ # === :usb4
92
+ # ======================================================================= #
93
+ when 'usb4',
94
+ 'tousb4',
95
+ '4',
96
+ :usb4,
97
+ /^-?-?usb4/
98
+ if CONFIG and CONFIG.has_key?('usb4')
99
+ i = CONFIG['usb4'].to_s
100
+ else
101
+ i = ENV['USB4']
102
+ end
103
+ # ======================================================================= #
104
+ # === :usb5
105
+ # ======================================================================= #
106
+ when 'usb5',
107
+ /^-?-?usb5/,
108
+ /^-?-?to(-|_)?usb5/,
109
+ '5',
110
+ :usb5
111
+ if CONFIG and CONFIG.has_key?('usb5')
112
+ i = CONFIG['usb5'].to_s
113
+ else
114
+ i = ENV['USB5']
115
+ end
116
+ # ======================================================================= #
117
+ # === :chroot
118
+ # ======================================================================= #
119
+ when :chroot,
120
+ 'chroot'
121
+ i = ENV['CHROOT_TARGET']
122
+ if i.nil?
123
+ i = '/Depot/Chroot/' # Hardcoded target in this case.
124
+ end
125
+ # ======================================================================= #
126
+ # === :to_hdd
127
+ # ======================================================================= #
128
+ when 'tohdd1',
129
+ 'tohd',
130
+ 'hdd1',
131
+ :to_hdd,
132
+ /^-?-?to(-|_)?hdd/i
133
+ i = ENV['FESTPLATTE1'].to_s.dup
134
+ end
135
+ # ======================================================================= #
136
+ # The input could still be a Symbol, so the next line exists to protect
137
+ # us against this.
138
+ # ======================================================================= #
139
+ i = i.to_s unless i.is_a?(String)
140
+ if i and File.directory?(i) and !i.end_with?('/')
141
+ i = i.dup if i.frozen?
142
+ i << '/' # Ensure a trailing '/'.
143
+ end
144
+ return i # Always return it.
145
+ end
146
+
147
+ # ========================================================================= #
148
+ # === BackupParadise.target_mountpoint= (target tag)
149
+ #
150
+ # Use this method to determine the main target mountpoint that is
151
+ # to be used. This must be the base directory, not a subdirectory.
152
+ #
153
+ # An example for this, on my home system, would be /Mount/USB1/.
154
+ # ========================================================================= #
155
+ def self.target_mountpoint=(i = :usb1)
156
+ if i.is_a? String
157
+ i = i.dup if i.frozen?
158
+ i.squeeze!('/')
159
+ end
160
+ if BackupParadise.is_this_a_shortcut?(i)
161
+ i = return_the_assumed_mountpoint_from_this_input(i)
162
+ end
163
+ # ======================================================================= #
164
+ # Ensure that a trailing '/' is used.
165
+ # ======================================================================= #
166
+ unless i.end_with? '/'
167
+ i = i.dup if i.frozen?
168
+ i << '/'
169
+ end
170
+ @target_mountpoint = i
171
+ end; self.instance_eval { alias set_mounted_path target_mountpoint= } # === BackupParadise.set_mounted_path
172
+ self.instance_eval { alias set_target_device target_mountpoint= } # === BackupParadise.set_target_device
173
+ self.instance_eval { alias set_backup_to_this_directory target_mountpoint= } # === BackupParadise.set_backup_to_this_directory
174
+ self.instance_eval { alias set_target target_mountpoint= } # === BackupParadise.set_target
175
+ self.instance_eval { alias set_target_mountpoint target_mountpoint= } # === BackupParadise.set_target_mountpoint
176
+ self.instance_eval { alias set_main_target target_mountpoint= } # === BackupParadise.set_main_target
177
+
178
+ # ========================================================================= #
179
+ # === BackupParadise.target_mountpoint?
180
+ # ========================================================================= #
181
+ def self.target_mountpoint?
182
+ @target_mountpoint
183
+ end
184
+
185
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/opnn.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ begin
10
+ require 'opn'
11
+ rescue LoadError; end
12
+
13
+ # ========================================================================= #
14
+ # === BackupParadise.opnn
15
+ # ========================================================================= #
16
+ def self.opnn(
17
+ i = { namespace: NAMESPACE }
18
+ )
19
+ if i.is_a? String
20
+ i = { namespace: i }
21
+ end
22
+ Opn.opn(i)
23
+ end; self.instance_eval { alias opn opnn } # === BackupParadise.opnn
24
+
25
+ end