Module: Vos::Helpers::Ubuntu
- Defined in:
- lib/vos/helpers/ubuntu.rb
Instance Method Summary collapse
- #default_env ⇒ Object
- #env_file ⇒ Object
-
#reload_env ⇒ Object
def append_to_environment file, reload = true raise “#file must be an Entry” unless file.is_a? Vfs::Entry.
- #wrap_cmd(env_str, cmd) ⇒ Object
Instance Method Details
#default_env ⇒ Object
4 5 6 |
# File 'lib/vos/helpers/ubuntu.rb', line 4 def default_env {:DEBIAN_FRONTEND => 'noninteractive'} end |
#env_file ⇒ Object
11 12 13 |
# File 'lib/vos/helpers/ubuntu.rb', line 11 def env_file file '/etc/profile' ## file '/etc/environment' end |
#reload_env ⇒ Object
def append_to_environment file, reload = true
raise "#{file} must be an Entry" unless file.is_a? Vfs::Entry
env_ext = dir '/etc/profile_ext'
remote_file = env_ext[file.name]
file.copy_to! remote_file
require_clause = "source #{remote_file.path}"
env_file.append "\n#{require_clause}\n" unless env_file.content.include? require_clause
reload_env if reload
end
29 30 31 |
# File 'lib/vos/helpers/ubuntu.rb', line 29 def reload_env bash ". #{env_file.path}" end |
#wrap_cmd(env_str, cmd) ⇒ Object
7 8 9 |
# File 'lib/vos/helpers/ubuntu.rb', line 7 def wrap_cmd env_str, cmd %(source #{env_file.path} && #{env_str}#{' && ' unless env_str.empty?}#{cmd}) end |