[DRE-commits] [ruby-foreman] 01/04: Look for data in /usr/share/foreman
Antonio Terceiro
terceiro at moszumanska.debian.org
Wed Feb 4 17:29:52 UTC 2015
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch patch-queue/master
in repository ruby-foreman.
commit 020f71b02544aef8fd97e2485a15a46a93784aef
Author: Antonio Terceiro <terceiro at softwarelivre.org>
Date: Wed Feb 4 10:38:51 2015 -0200
Look for data in /usr/share/foreman
---
lib/foreman/export/base.rb | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/foreman/export/base.rb b/lib/foreman/export/base.rb
index f8b8a6f..76939d8 100644
--- a/lib/foreman/export/base.rb
+++ b/lib/foreman/export/base.rb
@@ -111,7 +111,7 @@ private ######################################################################
elsif File.exist?(file_path = File.expand_path(File.join("~/.foreman/templates", file)))
File.read(file_path)
else
- File.read(File.expand_path("../../../../data/export/#{exporter}/#{file}", __FILE__))
+ File.read(data_file("export/#{exporter}/#{file}"))
end
end
@@ -123,7 +123,7 @@ private ######################################################################
matchers = []
matchers << File.join(options[:template], name_without_first) if options[:template]
matchers << File.expand_path("~/.foreman/templates/#{name}")
- matchers << File.expand_path("../../../../data/export/#{name}", __FILE__)
+ matchers << data_file("export/#{name}")
File.read(matchers.detect { |m| File.exists?(m) })
end
end
@@ -153,4 +153,13 @@ private ######################################################################
end
end
+ private
+
+ def data_file(path)
+ [
+ File.expand_path("../../../../data/#{path}", __FILE__),
+ "/usr/share/foreman/data/#{path}"
+ ].find { |f| File.exist?(f) }
+ end
+
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-foreman.git
More information about the Pkg-ruby-extras-commits
mailing list