lib/kameleon/engine.rb in kameleon-builder-2.2.3 vs lib/kameleon/engine.rb in kameleon-builder-2.2.4
- old
+ new
@@ -1,8 +1,9 @@
require 'kameleon/recipe'
require 'kameleon/context'
require 'kameleon/persistent_cache'
+# require 'pry'
module Kameleon
class Engine
attr_accessor :recipe
attr_accessor :cwd
@@ -36,11 +37,11 @@
@cache.cwd = @cwd
@cache.polipo_path = @options[:proxy_path]
@cache.name = @recipe.name
@cache.mode = @options[:cache] ? :build : :from
@cache.cache_path = @options[:from_cache]
- @cache.recipe_files = @recipe.files # I'm passing the Pathname objects
+ @cache.recipe_files = @recipe.files + @recipe.base_recipes_files# I'm passing the Pathname objects
@cache.recipe_path = @recipe.path
if @recipe.global["in_context"]["proxy_cache"].nil? then
raise BuildError, "Missing varible for in context 'proxy_cache' when using the option --cache"
end
@@ -149,10 +150,11 @@
end
def do_steps(section_name)
section = @recipe.sections.fetch(section_name)
section.sequence do |macrostep|
+ macrostep_time = Time.now.to_i
if @cache then
Kameleon.ui.info("Starting proxy cache server for macrostep '#{macrostep.name}'...")
# the following function start a polipo web proxy and stops a previous run
dir_cache = @cache.create_cache_directory(macrostep.name)
@cache.start_web_proxy_in(dir_cache)
@@ -184,10 +186,11 @@
microstep.commands.each do |cmd|
safe_exec_cmd(cmd)
end
end
end
+ Kameleon.ui.info("Step #{macrostep.name} took: #{Time.now.to_i-macrostep_time} secs")
end
@cleaned_sections.push(section.name)
end
def safe_exec_cmd(cmd, kwargs = {})
@@ -233,10 +236,10 @@
fail ExecError
end
end
first_context = map[first_cmd.key]
second_context = map[second_cmd.key]
- @cache.cache_cmd_id(cmd.identifier) if @cache
+ @cache.cache_cmd_raw(cmd.raw_cmd_id) if @cache
first_context.pipe(first_cmd.value, second_cmd.value, second_context)
when "rescue"
first_cmd, second_cmd = cmd.value
begin
exec_cmd(first_cmd)