use all roots for generating the version hash

This commit is contained in:
Sven Fuchs 2013-10-29 16:53:58 +01:00
parent 0d062be3a0
commit aa7baffb9f
2 changed files with 16 additions and 10 deletions

View File

@ -47,7 +47,7 @@ module Travis
end end
def update_version def update_version
Travis::Assets::Version.new.update Travis::Assets::Version.new(roots).update
end end
TYPES.each { |type| define_method(type) { paths[type] } } TYPES.each { |type| define_method(type) { paths[type] } }

View File

@ -11,10 +11,10 @@ module Travis
new.update new.update
end end
attr_reader :root attr_reader :roots
def initialize(root = nil) def initialize(roots = nil)
@root = Pathname.new(root || File.expand_path('.')) @roots = roots
end end
def read def read
@ -29,8 +29,12 @@ module Travis
protected protected
def cwd
Pathname.new(File.expand_path('.'))
end
def file def file
root.join(FILE_NAME) cwd.join(FILE_NAME)
end end
def write(version) def write(version)
@ -42,14 +46,16 @@ module Travis
end end
def digest 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 end
def sources def sources
SOURCES.map do |source| roots.map do |root|
source = root.join(source) SOURCES.map do |source|
source.to_s if source.exist? source = Pathname.new(root).join(source)
end.compact source.to_s if source.exist?
end
end.flatten.compact
end end
end end
end end