From aa7baffb9fe701368d66724991731702971a6026 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Tue, 29 Oct 2013 16:53:58 +0100 Subject: [PATCH] use all roots for generating the version hash --- lib/travis/assets.rb | 2 +- lib/travis/assets/version.rb | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/travis/assets.rb b/lib/travis/assets.rb index 8f172e7d..27160a90 100644 --- a/lib/travis/assets.rb +++ b/lib/travis/assets.rb @@ -47,7 +47,7 @@ module Travis end def update_version - Travis::Assets::Version.new.update + Travis::Assets::Version.new(roots).update end TYPES.each { |type| define_method(type) { paths[type] } } diff --git a/lib/travis/assets/version.rb b/lib/travis/assets/version.rb index 616d1f81..af56ff6b 100644 --- a/lib/travis/assets/version.rb +++ b/lib/travis/assets/version.rb @@ -11,10 +11,10 @@ module Travis new.update end - attr_reader :root + attr_reader :roots - def initialize(root = nil) - @root = Pathname.new(root || File.expand_path('.')) + def initialize(roots = nil) + @roots = roots end def read @@ -29,8 +29,12 @@ module Travis protected + def cwd + Pathname.new(File.expand_path('.')) + end + def file - root.join(FILE_NAME) + cwd.join(FILE_NAME) end def write(version) @@ -42,14 +46,16 @@ module Travis end def digest - Digest::MD5.new << `ls -lAR #{sources.join(' ')} | awk '{print $5, $6, $7, $9}'` + Digest::MD5.new << `ls -lTAR #{sources.join(' ')} | awk '{ print $5, $6, $7, $8, $9, $10 }'` end def sources - SOURCES.map do |source| - source = root.join(source) - source.to_s if source.exist? - end.compact + roots.map do |root| + SOURCES.map do |source| + source = Pathname.new(root).join(source) + source.to_s if source.exist? + end + end.flatten.compact end end end