lib/omnibus/fetchers/path_fetcher.rb in omnibus-3.1.1 vs lib/omnibus/fetchers/path_fetcher.rb in omnibus-3.2.0.rc.1
- old
+ new
@@ -15,10 +15,13 @@
#
module Omnibus
# Fetcher implementation for projects on the filesystem
class PathFetcher < Fetcher
+
+ include Digestable
+
def initialize(software)
@name = software.name
@source = software.source
@project_dir = software.project_dir
@version = software.version
@@ -31,11 +34,11 @@
local location: #{@project_dir}
EOH
end
def rsync
- if Ohai.platform == 'windows'
+ if Ohai['platform'] == 'windows'
# Robocopy's return code is 1 if it succesfully copies over the
# files and 0 if the files are already existing at the destination
sync_cmd = "robocopy #{@source[:path]}\\ #{@project_dir}\\ /MIR /S"
shellout!(sync_cmd, returns: [0, 1])
else
@@ -49,9 +52,13 @@
rsync
end
def fetch
rsync
+ end
+
+ def version_for_cache
+ @version_for_cache ||= digest_directory(@project_dir, :sha256)
end
def fetch_required?
true
end