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 33 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 69 def backup_these_programs # ======================================================================= # # Copy to new directory. # ======================================================================= # @target_dir = 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
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/backup_program.rb, line 46 def reset super() # ======================================================================= # # === @time_now # ======================================================================= # @time_now = ::Time.now.strftime '%d.%m.%Y' end
set_array_these_programs(i)
click to toggle source