lib/vos/helpers/ubuntu.rb in vos-0.1.0 vs lib/vos/helpers/ubuntu.rb in vos-0.1.1

- old
+ new

@@ -10,31 +10,40 @@ def env_file file '/etc/profile' ## file '/etc/environment' end - 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 + # 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 def reload_env bash ". #{env_file.path}" end end end end module Vfs class File - + def append_to_environment_of box, reload = true + raise "#{box} must be an Vos::Box" unless file.is_a? Vos::Box + + copy_to! box.dir('/etc/profile_ext').file(name) + + require_clause = "source #{remote_file.path}" + box.env_file.append "\n#{require_clause}\n" unless env_file.content.include? require_clause + + box.reload_env if reload + end end end \ No newline at end of file