Commit f7c0dce2 authored by Scott Hain's avatar Scott Hain
Browse files

Add ability to create a cache suffix



Signed-off-by: default avatarScott Hain <shain@chef.io>
parent f6f9973b
......@@ -101,9 +101,9 @@ module Omnibus
# @return [String]
default(:base_dir) do
if Ohai["platform"] == "windows"
"C:/omnibus-ruby"
File.join(*["C:/omnibus-ruby", cache_suffix].compact)
else
"/var/cache/omnibus"
File.join(*["/var/cache/omnibus", cache_suffix].compact)
end
end
......@@ -113,6 +113,12 @@ module Omnibus
# @return [String]
default(:cache_dir) { File.join(base_dir, "cache") }
# The suffix added (typically the software name) to create a wholly
# separate base cache directory for the software.
#
# @return [String]
default(:cache_suffix, nil)
# The absolute path to the directory on the virtual machine where
# git caching will occur and software's will be progressively cached.
#
......
......@@ -93,5 +93,15 @@ module Omnibus
include_examples "a configurable", :build_dir, "/foo/bar/build"
include_examples "a configurable", :package_dir, "/foo/bar/pkg"
end
context "when cache_suffix is specified" do
before { described_class.cache_suffix("projecto") }
include_examples "a configurable", :cache_dir, "/var/cache/omnibus/projecto/cache"
include_examples "a configurable", :git_cache_dir, "/var/cache/omnibus/projecto/cache/git_cache"
include_examples "a configurable", :source_dir, "/var/cache/omnibus/projecto/src"
include_examples "a configurable", :build_dir, "/var/cache/omnibus/projecto/build"
include_examples "a configurable", :package_dir, "/var/cache/omnibus/projecto/pkg"
end
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment