Class: CSD::Application::Base
- Defined in:
- lib/csd/application/default/base.rb
Overview
This is the root class of all Applications
Direct Known Subclasses
Decklink::Base, Graphics::Base, I2conf::Base, Minisip::Base, Mslog::Base
Instance Method Summary collapse
- #cleanup_working_directory ⇒ Object
- #create_working_directory ⇒ Object
-
#define_working_directory ⇒ Object
This method chooses the working directory, which will contain downloads needed for various tasks, etc.
-
#initialize ⇒ Base
constructor
Running recommended actions for all Applications on initialization.
Constructor Details
#initialize ⇒ Base
Running recommended actions for all Applications on initialization. Simple applications might not have to call this via super.
15 16 17 |
# File 'lib/csd/application/default/base.rb', line 15 def initialize define_working_directory end |
Instance Method Details
#cleanup_working_directory ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/csd/application/default/base.rb', line 49 def cleanup_working_directory if !Options.work_dir and Options.temp and !Options.this_user and Path.work.directory? UI.info "Removing working directory".green.bold UI.debug "MILESTONE_deleting_work_dir" # TODO: Make this Windows working Cmd.run "sudo rm -Rf #{Path.work}", :announce_pwd => false end end |
#create_working_directory ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/csd/application/default/base.rb', line 39 def create_working_directory UI.debug "The working directory is demanded to be #{Path.work}" if Path.work.directory? UI.debug "The working directory already exists and will not be created" else UI.info "Creating working directory".green.bold Cmd.mkdir Path.work end end |
#define_working_directory ⇒ Object
This method chooses the working directory, which will contain downloads needed for various tasks, etc. Note that this directory is not removed by the AI in any case. The user has to make sure she knows the location of it (especially if it is a temporary directory which is physically created right here).
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/csd/application/default/base.rb', line 23 def define_working_directory if Options.work_dir # The user specified the working directory manually path = Options.work_dir elsif Options.temp and !Options.this_user # The user specified the working directory to be a system's temporary directory # Note that only with this option, the directory is actually created at this point path = Dir.mktmpdir else # Other than that, we create a subdirectory in the current directory and use that app_name = Applications.current ? Applications.current.name : 'application' path = File.join(Dir.pwd, "#{app_name}.ai") end Path.work = path.pathnamify. end |