class RBT::BackupProgram
Public Class Methods
new( array_these_programs = [] )
click to toggle source
#¶ ↑
initialize¶ ↑
The first argument is an array, listing which programs to backup.
#¶ ↑
# File lib/rbt/utility_scripts/backup_program.rb, line 32 def initialize( array_these_programs = [] ) reset unless array_these_programs.empty? set_array_these_programs(array_these_programs) backup_these_programs end end
Public Instance Methods
backup_these_programs()
click to toggle source
#¶ ↑
backup_these_programs
¶ ↑
This is the actual powerhorse of the class.
#¶ ↑
# File lib/rbt/utility_scripts/backup_program.rb, line 65 def backup_these_programs # ======================================================================= # # Copy to new directory. # ======================================================================= # @target_dir = RBT.temp_directory?+'BackupProgram_'+@time_now+'/' remove(@target_dir) if File.exist? @target_dir # If it exists. create_directory @target_dir cd @target_dir e @target_dir @array_these_programs.each { |program| target = programs_directory?+program.capitalize @target_dir << program+'/' cmd = 'cp -rv '+target cmd << ' .' if File.exist? target esystem cmd else warn target+' does not exist.' end } create_log notify_user_of_task_being_finished end
Also aliased as: run
create_log()
click to toggle source
notify_user_of_task_being_finished()
click to toggle source
reset()
click to toggle source
set_array_these_programs(i)
click to toggle source