aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/path.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-01-13 20:27:29 -0800
committerelijah <elijah@riseup.net>2013-01-13 20:27:29 -0800
commitba301b0c8d77ae2f455d3a2d736968c981b8c757 (patch)
treefac1c2f483732d158f106d8ad7917bfc7e07c239 /lib/leap_cli/path.rb
parentbea336480bf90f7c24737809e27b0bd224f42233 (diff)
downloadleap_cli-ba301b0c8d77ae2f455d3a2d736968c981b8c757.tar.gz
leap_cli-ba301b0c8d77ae2f455d3a2d736968c981b8c757.tar.bz2
added ability to sync support files along with hiera.yml. this way, files don't need to be embedded in hiera.yml. this is especially useful for binary files.
Diffstat (limited to 'lib/leap_cli/path.rb')
-rw-r--r--lib/leap_cli/path.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/leap_cli/path.rb b/lib/leap_cli/path.rb
index 43f2edc..e7626b5 100644
--- a/lib/leap_cli/path.rb
+++ b/lib/leap_cli/path.rb
@@ -87,13 +87,14 @@ module LeapCli; module Path
# tries to find a file somewhere
#
def self.find_file(arg)
- file_path = named_path(arg, Path.provider)
- return file_path if File.exists?(file_path)
-
- file_path = named_path(arg, Path.provider_base)
- return file_path if File.exists?(file_path)
-
- # give up
+ [Path.provider, Path.provider_base].each do |base|
+ file_path = named_path(arg, base)
+ return file_path if File.exists?(file_path)
+ if arg.is_a? String
+ file_path = base + '/files/' + arg
+ return file_path if File.exists?(file_path)
+ end
+ end
return nil
end