lib/vx/builder/script_builder/cache.rb in vx-builder-0.5.0 vs lib/vx/builder/script_builder/cache.rb in vx-builder-0.5.1

- old
+ new

@@ -11,10 +11,11 @@ def call(env) rs = app.call env if env.task.cache_url_prefix && enabled?(env) + assign_url_to_env(env) prepare(env) fetch(env) add(env) push(env) @@ -24,13 +25,17 @@ end private def enabled?(env) - !env.cached_directories.empty? + env.source.cache.enabled? && !cached_directories(env).empty? end + def cached_directories(env) + env.cached_directories + env.source.cached_directories + end + def casher_cmd "test -f #{CASHER_BIN} && #{config.casher_ruby} #{CASHER_BIN}" end def assign_url_to_env(env) @@ -74,10 +79,10 @@ urls = env.cache_fetch_url.join(" ") env.init << "#{casher_cmd} fetch #{urls} || true" end def add(env) - env.cached_directories.each do |d| + cached_directories(env).each do |d| env.init << "#{casher_cmd} add #{d} || true" end env.init << "unset CASHER_DIR" end