lib/omnibus/fetchers/path_fetcher.rb in omnibus-5.0.0 vs lib/omnibus/fetchers/path_fetcher.rb in omnibus-5.1.0

- old
+ new

@@ -40,21 +40,18 @@ # # Clean the given path by removing the project directory. # # @return [true, false] - # true if the directory was cleaned, false otherwise + # true if the directory was cleaned, false otherwise. + # Since we do not currently use the cache to sync files and + # always fetch from source, there is no need to clean anything. + # The fetch step (which needs to be called before clean) would + # have already removed anything extraneous. # def clean - if File.exist?(project_dir) - log.info(log_key) { "Cleaning project directory `#{project_dir}'" } - FileUtils.rm_rf(project_dir) - fetch - true - else - false - end + return true end # # Fetch any new files by copying them to the +project_dir+. # @@ -72,14 +69,18 @@ # # The version for this item in the cache. The is the shasum of the directory # on disk. # + # This method is called *before* clean but *after* fetch. Since fetch + # automatically cleans, target vs. destination sha doesn't matter. Change this + # if that assumption changes. + # # @return [String] # def version_for_cache - "path:#{source_path}|shasum:#{target_shasum}" + "path:#{source_path}|shasum:#{destination_shasum}" end # # @return [String, nil] # @@ -115,18 +116,18 @@ # The shasum of the directory **inside** the project. # # @return [String] # def target_shasum - @target_shasum ||= digest_directory(project_dir, :sha256) + @target_shasum ||= digest_directory(project_dir, :sha256, source_options) end # # The shasum of the directory **outside** of the project. # # @return [String] # def destination_shasum - @destination_shasum ||= digest_directory(source_path, :sha256) + @destination_shasum ||= digest_directory(source_path, :sha256, source_options) end end end