class DEIS::Base
Constants
- NO
- YES
Attributes
cluster[RW]
environment[RW]
output[RW]
path[RW]
proxy[RW]
ssh[RW]
verbose[RW]
Public Instance Methods
local_profile()
click to toggle source
# File lib/rdeis/base.rb, line 27 def local_profile file = "#{ENV['HOME']}/.profile" `> #{file}` if ! File.exists?(file) file end
local_shell()
click to toggle source
# File lib/rdeis/base.rb, line 23 def local_shell `echo $SHELL | sed -E "s#/bin/##"`.strip end
local_shell_env_include(profile, file_to_include)
click to toggle source
# File lib/rdeis/base.rb, line 37 def local_shell_env_include(profile, file_to_include) content = File.open(profile, "r"){ |f| f.read }.gsub(". #{file_to_include}", "") + "\n. #{file_to_include}" File.open(profile, "w") { |f| f.write(content) } end
log(cmd)
click to toggle source
# File lib/rdeis/base.rb, line 9 def log(cmd) say "[#{@proxy} #{Time.now}] #{cmd}", :black if @verbose end
remote_profile()
click to toggle source
# File lib/rdeis/base.rb, line 33 def remote_profile "$HOME/.profile" end
run(command)
click to toggle source
run commands either locally or remotely
# File lib/rdeis/base.rb, line 14 def run(command) self.log(command) if @proxy return @ssh.exec!(command) else return `#{command}`.strip end end