lib/kameleon/shell.rb in kameleon-builder-2.6.3 vs lib/kameleon/shell.rb in kameleon-builder-2.6.5

- old
+ new

@@ -15,11 +15,11 @@ def initialize(context) @cmd = context.cmd.chomp @context_name = context.name @local_workdir = context.local_workdir @shell_workdir = context.workdir - @proxy_cache = context.proxy_cache + @proxy = context.proxy @env_files = context.env_files @bash_scripts_dir = File.join("kameleon_scripts", @context_name) @bashrc_file = File.join(@bash_scripts_dir, "bash_rc") @bash_history_file = File.join(@bash_scripts_dir, "bash_history") @bash_env_file = File.join(@bash_scripts_dir, "bash_env") @@ -101,17 +101,13 @@ Kameleon.ui.info(init_stdout) unless init_stdout.empty? bashrc_content = "" if File.file?(@default_bashrc_file) tpl = ERB.new(File.read(@default_bashrc_file)) bashrc_content = tpl.result(binding) - if @cache.activated? then - if @proxy_cache.nil? then - Kameleon.ui.warn("Variable 'proxy_cache' not defined for this context, persistent cache will not be generated") - else - tpl = ERB.new(File.read(@cache.polipo_env)) - bashrc_content << "\n" + ERB.new(File.read(@cache.polipo_env)).result(binding) - end + if @proxy != "" then + tpl = ERB.new(File.read(File.join(Kameleon.source_root, "contrib", "proxy_env.sh"))) + bashrc_content << "\n" + tpl.result(binding) end end # Inject sigint handler bashrc_content << <<-SCRIPT function save_state_handler { @@ -134,14 +130,15 @@ unless change_dir_cmd.nil? shell_cmd << "echo #{change_dir_cmd} >> #{@bashrc_file}\n" end shell_cmd << "export KAMELEON_WORKDIR=$PWD\n" @env_files.each do |env_file| + resolved_erb = "\n" + ERB.new(File.read(env_file)).result(binding) env_content = <<-SCRIPT #==================================================== # Begin content of user script '#{env_file.basename}' #==================================================== -#{File.read(env_file)} +#{resolved_erb} #==================================================== # End content of user script '#{env_file.basename}' #==================================================== SCRIPT env_escaped_content = Shellwords.escape(env_content)