class Pwrake::SharedDirectory
Public Class Methods
init(opts)
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 11 def self.init(opts) @@prefix = opts[:base_dir] @@work_dir = opts[:work_dir] @@log_dir = opts[:log_dir] end
new()
click to toggle source
instance methods
# File lib/pwrake/worker/shared_directory.rb, line 19 def initialize @log = LogExecutor.instance end
Public Instance Methods
cd(d='')
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 42 def cd(d='') if d=='' @current_path = home_path else pn = Pathname(d.sub(/^\$HOME\b/,ENV['HOME'])) if pn.relative? pn = @current_path + pn end if !Dir.exist?(pn) raise "Cannot chdir to #{pn}" end @current_path = pn.realpath end end
check_mountpoint()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 73 def check_mountpoint end
close()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 35 def close end
close_messages()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 38 def close_messages ["leave workdir: #{work_path}"] end
current()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 57 def current @current_path.to_s end
home_path()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 23 def home_path Pathname.new(ENV['HOME']) end
log_path()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 69 def log_path work_path + @@log_dir end
open()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 27 def open @current_path = work_path end
open_messages()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 31 def open_messages ["enter workdir: #{work_path}"] end
work_dir()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 65 def work_dir work_path.to_s end
work_path()
click to toggle source
# File lib/pwrake/worker/shared_directory.rb, line 61 def work_path home_path + @@work_dir end