Class: Pakyow::Support::PathVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/pakyow/support/path_version.rb

Class Method Summary collapse

Class Method Details

.build(*paths) ⇒ Object

Builds a version based on content at local paths.



10
11
12
13
14
15
16
17
18
# File 'lib/pakyow/support/path_version.rb', line 10

def self.build(*paths)
  paths.each_with_object(Digest::SHA1.new) { |path, digest|
    Dir.glob(File.join(path, "/**/*")).sort.each do |fullpath|
      if File.file?(fullpath)
        digest.update(Digest::SHA1.file(fullpath).to_s)
      end
    end
  }.to_s
end