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
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/project/project.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ # ========================================================================= #
10
+ # === PROJECT_BASE_DIRECTORY
11
+ # ========================================================================= #
12
+ PROJECT_BASE_DIRECTORY =
13
+ File.absolute_path("#{__dir__}/..")+'/'
14
+
15
+ # ========================================================================= #
16
+ # === BackupParadise.project_base_dir?
17
+ # ========================================================================= #
18
+ def self.project_base_dir?
19
+ BackupParadise::PROJECT_BASE_DIRECTORY
20
+ end; self.instance_eval { alias project_base_directory? project_base_dir? } # === BackupParadise.project_base_directory?
21
+
22
+ # ========================================================================= #
23
+ # === BackupParadise.project_yaml_dir?
24
+ # ========================================================================= #
25
+ def self.project_yaml_dir?
26
+ "#{BackupParadise::PROJECT_BASE_DIRECTORY}yaml/"
27
+ end
28
+
29
+ # ========================================================================= #
30
+ # === BackupParadise.file_config_yaml
31
+ #
32
+ # This method will return the proper path to the config.yml file
33
+ # in use.
34
+ # ========================================================================= #
35
+ def self.file_config_yaml
36
+ "#{BackupParadise.project_yaml_dir?}config.yml"
37
+ end; self.instance_eval { alias file_config file_config_yaml } # === BackupParadise.file_config
38
+ self.instance_eval { alias file_config? file_config_yaml } # === BackupParadise.file_config?
39
+
40
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # When you wish to require the whole project, this is the file to go for.
6
+ # =========================================================================== #
7
+ # require 'backup_paradise/requires/require_the_backup_paradise_project.rb'
8
+ # =========================================================================== #
9
+ require 'backup_paradise/project/project.rb'
10
+ require 'backup_paradise/requires/require_yaml.rb'
11
+ require 'backup_paradise/actions/backup.rb'
12
+ require 'backup_paradise/colours/colours.rb'
13
+ require 'backup_paradise/constants/constants.rb'
14
+ require 'backup_paradise/toplevel_methods/e.rb'
15
+ require 'backup_paradise/toplevel_methods/cliner.rb'
16
+ require 'backup_paradise/utility_scripts/backup/backup.rb'
17
+ require 'backup_paradise/tab/tab.rb'
18
+ require 'backup_paradise/windows/windows.rb'
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/requires/require_yaml.rb'
6
+ # =========================================================================== #
7
+ require 'yaml'
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === BackupParadise::Tab
6
+ #
7
+ # This file handles tab-related activities, most normally renaming a tab.
8
+ #
9
+ # Right now we have only some support for KDE tabs and mrxvt tabs.
10
+ # =========================================================================== #
11
+ # require 'backup_paradise/tab/tab.rb'
12
+ # =========================================================================== #
13
+ module BackupParadise
14
+
15
+ module Tab # === BackupParadise::Tab
16
+
17
+ begin
18
+ require 'roebe/classes/mrxvt_options.rb'
19
+ rescue LoadError; end
20
+
21
+ # ========================================================================= #
22
+ # === BackupParadise::Tab.rename_tab
23
+ #
24
+ # This method does some additional checks before invoking the method
25
+ # set_mrxvt_tab_title. set_konsole_tab_title() may work, if the
26
+ # user at hand has the roebe gem installed (aka, on my home system).
27
+ # ========================================================================= #
28
+ def self.rename_tab(
29
+ i = :mrxvt,
30
+ optional_title = 'Backup', # <- This is the new title.
31
+ use_this_program_to_rename_tabs = :mrxvt
32
+ )
33
+ case i.to_sym # case tag
34
+ # ======================================================================= #
35
+ # === :konsole
36
+ #
37
+ # This is the default.
38
+ # ======================================================================= #
39
+ when :konsole,
40
+ :default
41
+ set_konsole_tab_title(optional_title)
42
+ # ======================================================================= #
43
+ # === :mrxvt
44
+ # ======================================================================= #
45
+ when :mrxvt
46
+ set_mrxvt_tab_title(optional_title) # Defined in this module here.
47
+ # ======================================================================= #
48
+ # === :blank
49
+ #
50
+ # This entry point re-sets the title of the terminal tab again to
51
+ # empty.
52
+ # ======================================================================= #
53
+ when :blank
54
+ case use_this_program_to_rename_tabs
55
+ when :konsole
56
+ set_konsole_tab_title(optional_title)
57
+ when :mrxvt
58
+ set_mrxvt_tab_title(optional_title)
59
+ end
60
+ end
61
+ end
62
+
63
+ # ========================================================================= #
64
+ # === BackupParadise::Tab.set_mrxvt_tab_title
65
+ # ========================================================================= #
66
+ def self.set_mrxvt_tab_title(i)
67
+ if Object.const_defined? :Roebe
68
+ begin
69
+ require 'roebe/classes/mrxvt_options.rb'
70
+ rescue LoadError; end
71
+ Roebe::MrxvtOptions.set_title(i)
72
+ end
73
+ end
74
+
75
+ # ========================================================================= #
76
+ # === BackupParadise::Tab.set_konsole_tab_title
77
+ # ========================================================================= #
78
+ def self.set_konsole_tab_title(i)
79
+ if Object.const_defined? :Roebe
80
+ begin
81
+ require 'roebe/classes/kde/kde_konsole.rb'
82
+ rescue LoadError; end
83
+ Roebe.rename_konsole_title_to(i, :be_quiet)
84
+ end
85
+ end
86
+
87
+ end; end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/cliner.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ # ========================================================================= #
10
+ # === BackupParadise.cliner
11
+ # ========================================================================= #
12
+ def self.cliner
13
+ puts '=' * 80
14
+ end
15
+
16
+ end
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/config.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ require 'yaml'
10
+
11
+ require 'backup_paradise/project/project.rb'
12
+
13
+ _ = BackupParadise.file_config_yaml # bl $RUBY_BACKUP/YAML/config.yml
14
+
15
+ # ========================================================================= #
16
+ # === CONFIG
17
+ #
18
+ # Keep track of the configuration of the backup-paradise project.
19
+ # ========================================================================= #
20
+ if File.exist? _
21
+ CONFIG = YAML.load_file(_) # This will be a Hash.
22
+ else
23
+ CONFIG = {}
24
+ end
25
+
26
+ # ========================================================================= #
27
+ # === BackupParadise.use_this_program_to_rename_tabs?
28
+ # ========================================================================= #
29
+ def self.use_this_program_to_rename_tabs?
30
+ if CONFIG.has_key?('use_this_program_to_rename_tabs')
31
+ # ===================================================================== #
32
+ # Obtain the program that we will use for renaming the tab.
33
+ # ===================================================================== #
34
+ CONFIG['use_this_program_to_rename_tabs'].to_sym
35
+ else
36
+ :konsole # Default.
37
+ end
38
+ end
39
+
40
+ # ========================================================================= #
41
+ # === BackupParadise.use_system_cp?
42
+ # ========================================================================= #
43
+ def self.use_system_cp?
44
+ if CONFIG.has_key?('use_system_cp')
45
+ return CONFIG['use_system_cp']
46
+ else
47
+ return true
48
+ end
49
+ end
50
+
51
+ # ========================================================================= #
52
+ # === BackupParadise.show_popup_notification?
53
+ # ========================================================================= #
54
+ def self.show_popup_notification?
55
+ if CONFIG.has_key?('show_popup_notification')
56
+ if (CONFIG['show_popup_notification'] == true)
57
+ return true
58
+ else
59
+ return false
60
+ end
61
+ else
62
+ return true
63
+ end
64
+ end
65
+
66
+ # ========================================================================= #
67
+ # === BackupParadise.backup_these_directories?
68
+ # ========================================================================= #
69
+ def self.backup_these_directories?
70
+ if CONFIG.has_key?('backup_these_directories')
71
+ return CONFIG['backup_these_directories']
72
+ else
73
+ return []
74
+ end
75
+ end
76
+
77
+ end
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/create_and_remove.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ require 'fileutils'
10
+ require 'backup_paradise/toplevel_methods/e.rb'
11
+ require 'backup_paradise/colours/colours.rb'
12
+
13
+ # ========================================================================= #
14
+ # === BackupParadise.remove_directory
15
+ # ========================================================================= #
16
+ def self.remove_directory(i)
17
+ i = rds(i).strip
18
+ unless i == '/' # Tiny "safeguard".
19
+ FileUtils.rm_rf(i) if File.directory?(i)
20
+ end
21
+ end
22
+
23
+ # ========================================================================= #
24
+ # === BackupParadise.remove_this_file
25
+ #
26
+ # Use this method to remove a file.
27
+ # ========================================================================= #
28
+ def self.remove_this_file(this_file)
29
+ e "Removing the file `#{sfile(this_file)}` now."
30
+ FileUtils.rm(this_file)
31
+ end
32
+
33
+ # ========================================================================= #
34
+ # === BackupParadise.remove
35
+ #
36
+ # Easier wrapper when we need to remove something, be it a directory
37
+ # or a file or a symlink.
38
+ # ========================================================================= #
39
+ def self.remove(i)
40
+ if i.is_a? Array
41
+ i.each {|entry| remove(entry) }
42
+ else
43
+ i = rds(i)
44
+ _ = i.dup
45
+ if File.directory? i
46
+ _ = sdir(i)
47
+ elsif File.file?(i)
48
+ _ = sfile(i)
49
+ else # else it will just be fancy.
50
+ _ = sfancy(i)
51
+ end
52
+ e "Trying to remove `#{_}` next."
53
+ if File.directory?(i)
54
+ remove_directory(i)
55
+ elsif File.file?(i)
56
+ remove_this_file(i) # Defined in this file here.
57
+ else
58
+ e 'Not found the action: "'+sfancy(i)+'"'
59
+ end
60
+ end
61
+ end
62
+
63
+ end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/e.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ # ========================================================================= #
10
+ # === BackupParadise.e
11
+ # ========================================================================= #
12
+ def self.e(i = '')
13
+ puts i
14
+ end
15
+
16
+ end
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/esystem.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ require 'backup_paradise/toplevel_methods/e.rb'
10
+
11
+ # ========================================================================= #
12
+ # === BackupParadise.esystem
13
+ # ========================================================================= #
14
+ def self.esystem(i = '')
15
+ e i
16
+ system i
17
+ end
18
+
19
+ end
@@ -0,0 +1,181 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # This file guarantees to require fileutils, so other .rb files do not
6
+ # have to do so.
7
+ # =========================================================================== #
8
+ # require 'backup_paradise/toplevel_methods/files_and_directories.rb'
9
+ # =========================================================================== #
10
+ module BackupParadise
11
+
12
+ require 'fileutils'
13
+ require 'backup_paradise/constants/constants.rb'
14
+ require 'backup_paradise/toplevel_methods/esystem.rb'
15
+ require 'backup_paradise/toplevel_methods/opnn.rb'
16
+
17
+ # ========================================================================= #
18
+ # === BackupParadise.copy_recursively
19
+ #
20
+ # This method can be used to copy the source to the target in a
21
+ # recursive manner.
22
+ #
23
+ # The third argument to this method, called `be_verbose`, will
24
+ # feedback what is done, to the user, if it has a value of true.
25
+ # Symbols such as :be_verbose can be used as an "alias" to true.
26
+ # If it is set to false, or :be_silent, then no output will be
27
+ # issued to the user.
28
+ # ========================================================================= #
29
+ def self.copy_recursively(
30
+ this_directory, # from (also called source)
31
+ backup_to_this_target, # to (also called target)
32
+ be_verbose = :be_verbose
33
+ )
34
+ this_directory = this_directory.dup if this_directory.frozen?
35
+ if this_directory.include? '*'
36
+ require 'convert_global_env'
37
+ this_directory = ConvertGlobalEnv[this_directory].dup
38
+ end
39
+ this_directory = rds(this_directory)
40
+ backup_to_this_target = rds(backup_to_this_target)
41
+ use_system_cp = use_system_cp?
42
+ case be_verbose
43
+ when :be_verbose
44
+ be_verbose = true
45
+ end
46
+ begin
47
+ raw_file_check = this_directory.dup.delete('*') # No '*' here.
48
+ if File.directory?(raw_file_check)
49
+ if use_system_cp
50
+ # ================================================================= #
51
+ # In that case we will simply use system cp.
52
+ # ================================================================= #
53
+ esystem "cp --recursive --verbose #{this_directory} #{backup_to_this_target}"
54
+ else
55
+ FileUtils.cp_r(
56
+ this_directory,
57
+ backup_to_this_target,
58
+ verbose: be_verbose
59
+ )
60
+ end
61
+ else
62
+ e 'No directory exists at the path '+sdir(this_directory)+'.'
63
+ end
64
+ rescue Exception => error
65
+ opnn; e 'An error occurred in the method '+
66
+ __method__.to_s+'(): '+error.class.to_s
67
+ pp error
68
+ end
69
+ end; self.instance_eval { alias cpr copy_recursively } # === BackupParadise.cpr
70
+ self.instance_eval { alias backup_this_directory_if_it_exists copy_recursively } # === BackupParadise.backup_this_directory_if_it_exists
71
+
72
+ # ========================================================================= #
73
+ # === BackupParadise.size?
74
+ #
75
+ # Gives you the size of the given subdirectory.
76
+ #
77
+ # Usage Example:
78
+ #
79
+ # BackupParadise.size?(ENV['J']) # => 1_396_436_232
80
+ # BackupParadise.size?(BackupParadise::AUDIO_DIR) # => 1_396_436_232
81
+ #
82
+ # ========================================================================= #
83
+ def self.size?(subdir_part)
84
+ size = 0 # Default.
85
+ begin
86
+ subdir_part = "#{subdir_part}/**/*"
87
+ results = Dir[subdir_part]
88
+ size = results.inject(0) { |sum, entry|
89
+ result = 0
90
+ result = sum + File.size(entry) if File.exist? entry
91
+ result
92
+ }
93
+ rescue; end # Make it failsave.
94
+ return size.to_s
95
+ end
96
+
97
+ # ========================================================================= #
98
+ # === BackupParadise.copy_file
99
+ #
100
+ # Copy a file with this method consistently.
101
+ # ========================================================================= #
102
+ def self.copy_file(file, where_to)
103
+ begin
104
+ FileUtils.cp(file, where_to)
105
+ rescue Errno::ENOSPC # Not enough space on target device.
106
+ opnn; e 'We must exit now - there is not enough space left on the '
107
+ opnn; e 'target hdd.'
108
+ rescue Errno::EINVAL # Invalid argument @ rb_sysopen
109
+ opnn; e 'The file can not be copied, possibly because it '\
110
+ 'contains a german umlaut.'
111
+ opnn; e 'We will however continue nonetheless.'
112
+ rescue Errno::EISDIR
113
+ opnn; e 'We currently do not copy directories, only files.'
114
+ rescue Errno::EILSEQ => error
115
+ opnn; e "It seems that we have an invalid or incomplete multibyte "\
116
+ "or wide-character at file `#{sfile(file.to_s)}`."
117
+ opnn; e 'We thus can not copy this file.'
118
+ pp error
119
+ rescue Exception => error # In lucky days, we will never reach this here.
120
+ pp error
121
+ opnn; e 'The above error should be intercepted - please add it,'
122
+ opnn; e 'then press the ENTER key in order to continue.'
123
+ $stdin.gets.chomp # We will remove this line here eventually.
124
+ end
125
+ end; self.instance_eval { alias copy_this_file copy_file } # === BackupParadise.copy_this_file
126
+
127
+ # ========================================================================= #
128
+ # === BackupParadise.create_directory
129
+ #
130
+ # Dir.mkdir would be an alternative. We require DEFAULT_MODE to be set
131
+ # before we can use this method here - hence why we require the file
132
+ # constants.rb.
133
+ # ========================================================================= #
134
+ def self.create_directory(
135
+ i, mode = DEFAULT_MODE
136
+ )
137
+ mode = DEFAULT_MODE if mode.nil?
138
+ if i.count('/') > 1
139
+ # ===================================================================== #
140
+ # We delegate towards FileUtils.mkdir_p() next, but we have to be
141
+ # careful - there may be no space left on the external device, so
142
+ # we have to rescue this situation.
143
+ # ===================================================================== #
144
+ begin
145
+ FileUtils.mkdir_p(i) unless Dir.exist? i
146
+ return true
147
+ rescue Errno::ENOSPC => error
148
+ opnn; e 'It appears to be the case that there is no space left on'
149
+ opnn; e 'the target device.'
150
+ pp error # And show the exact error as well.
151
+ end
152
+ else
153
+ unless File.directory? i
154
+ Dir.mkdir(i, mode)
155
+ return true # Return true just in case we ever need this information.
156
+ end
157
+ end
158
+ false
159
+ end; self.instance_eval { alias mkdir create_directory } # === BackupParadise.mkdir (mkdir tag)
160
+
161
+ # ========================================================================= #
162
+ # === BackupParadise.size_in_gigabytes?
163
+ #
164
+ # This method will return the size of the target directory in gigabytes.
165
+ # ========================================================================= #
166
+ def self.size_in_gigabytes?(i = BackupParadise::AUDIO_DIR)
167
+ (
168
+ BackupParadise.size?(i).to_f / 1024.0 / 1024.0 / 1000.0
169
+ ).round(1).to_f
170
+ end
171
+
172
+ # ========================================================================= #
173
+ # === BackupParadise.change_directory (cd tag, chdir tag)
174
+ #
175
+ # This should no longer be required.
176
+ # ========================================================================= #
177
+ def self.change_directory(i)
178
+ Dir.chdir(i) if i and File.directory?(i)
179
+ end; self.instance_eval { alias cd change_directory } # === BackupParadise.cd
180
+
181
+ end
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'backup_paradise/toplevel_methods/help.rb'
6
+ # =========================================================================== #
7
+ module BackupParadise
8
+
9
+ require 'backup_paradise/toplevel_methods/cliner.rb'
10
+ require 'backup_paradise/colours/colours.rb'
11
+
12
+ # ========================================================================= #
13
+ # === BackupParadise.show_help (help tag)
14
+ #
15
+ # Here we register all help-related methods.
16
+ #
17
+ # Two hints are registered, "tohdd", and "no-gtk".
18
+ # To use this, do: Help.show_help
19
+ #
20
+ # Or, from the commandline:
21
+ #
22
+ # rbackup --help
23
+ #
24
+ # ========================================================================= #
25
+ def self.show_help
26
+ e
27
+ cliner
28
+ e ::Colours.rev+
29
+ ' - Please note that you can use any order for the arguments.'
30
+ e
31
+ e 'Documented help options are:'
32
+ e
33
+ e ' rbackup --programs-dir # Back up the /Programs/ directory quickly'
34
+ e ' rbackup --backup-to=/PATH # Back up into the PATH directory.'
35
+ e
36
+ e 'The following options are NOT yet tested!'
37
+ e
38
+ e " - Pass #{sfancy('tohdd')} to backup to the hdd (usually "\
39
+ "this is the second harddisc)."
40
+ e
41
+ e ' - Pass '+sfancy('tousb ')+'to backup to the (first) usb media.'
42
+ e ' (Aliases exist, such as '+sfancy('usb1')+sfancy(' usb2')+
43
+ sfancy(' usb3')+' and so forth)'
44
+ e
45
+ e ' - Pass '+sfancy('data_only ')+'to backup only the '+
46
+ sdir(HOME_DIRECTORY_OF_THE_USER_X+'DATA/')+' directory.'
47
+ e
48
+ e ' - In general you can backup individual directories as well.'
49
+ e
50
+ e ' Examples for this functionality:'
51
+ e
52
+ e sfancy(' rbackup audio')
53
+ e sfancy(' rbackup data')
54
+ e
55
+ e ' - You can also chain together commands.'
56
+ e
57
+ e ' Example for chaining together commands:'
58
+ e
59
+ e sfancy(' rbackup data_only usb1')
60
+ e sfancy(' rbackup audio_only usb1')
61
+ e
62
+ e ' - You can backup the /Programs directory.'
63
+ e
64
+ e ' Issue the following command here:'
65
+ e
66
+ e sfancy(' rbackup usb1 programs')
67
+ e sfancy(' rbackup usb1 /Programs')
68
+ e
69
+ e ' - If you do the following.'
70
+ e ' Examples:'
71
+ e sfancy(' rbackup no-mount1')
72
+ e ' Then we wont try to (re)mount the device again.'
73
+ e
74
+ e 'If you want to show the time it took to backup the last some'
75
+ e 'backup-jobs, use this commandline flag:'
76
+ e
77
+ e sfancy(' rbackup --logfile')
78
+ e
79
+ e 'To simply backup into the current working '\
80
+ 'directory (cwd, pwd)'
81
+ e 'use:'
82
+ e
83
+ e sfancy(' rbackup --pwd')
84
+ e
85
+ e 'To use the GTK3 GUI, you could try:'
86
+ e
87
+ e sfancy(' rbackup --gui')
88
+ e
89
+ cliner
90
+ e
91
+ end
92
+
93
+ end