fedux_org-stdlib 0.6.25 → 0.6.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/fedux_org_stdlib/file_template.rb +11 -4
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/spec/template_file_spec.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 027d7fd79cc80909dcff5dbcdd14ba502834a342
|
4
|
+
data.tar.gz: 6b0b61ff9f97d806d3f44ad33e3cd96336ef7bb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dedf9c0a2c20c930b89ceb8cbf2ca6eebb8b810d0f9a17df1612c5a8c177cfbafb8eac6d02b882e2ba108eadd002c85083fd2005eabad0d9e9098626b1da07f3
|
7
|
+
data.tar.gz: 6992f8aab8f1b7741583e4b15928c7f5360e5333447d623a59b92e83b1e29b8116c1e073488a2f238c01e6d1570abf47e9dde52a86ef0fa90c9e5cd5d02a7160
|
data/Gemfile.lock
CHANGED
@@ -52,6 +52,9 @@ module FeduxOrgStdlib
|
|
52
52
|
# ---
|
53
53
|
# option1: 'data2'
|
54
54
|
class FileTemplate
|
55
|
+
|
56
|
+
attr_reader :working_directory, :logger
|
57
|
+
|
55
58
|
# Create a new instance of template
|
56
59
|
#
|
57
60
|
# It tries to find a suitable template file. If it doesn't find one
|
@@ -68,10 +71,14 @@ module FeduxOrgStdlib
|
|
68
71
|
# template_engine does not respond to `:[]` an empty template object will be
|
69
72
|
# created.
|
70
73
|
def initialize(
|
71
|
-
file:
|
72
|
-
logger: FeduxOrgStdlib::Logging::Logger.new
|
74
|
+
file: nil,
|
75
|
+
logger: FeduxOrgStdlib::Logging::Logger.new,
|
76
|
+
working_directory: Dir.getwd
|
73
77
|
)
|
74
|
-
@logger
|
78
|
+
@logger = logger
|
79
|
+
@working_directory = working_directory
|
80
|
+
|
81
|
+
file ||= _available_template_file
|
75
82
|
|
76
83
|
unless file
|
77
84
|
logger.debug "No template file found at #{_allowed_template_file_paths.to_list}, therefor I'm going to use an empty template object instead."
|
@@ -161,7 +168,7 @@ module FeduxOrgStdlib
|
|
161
168
|
# file.
|
162
169
|
def _allowed_template_file_paths
|
163
170
|
paths = []
|
164
|
-
paths << ::File.expand_path(::File.join(
|
171
|
+
paths << ::File.expand_path(::File.join(working_directory, 'templates', _template_file))
|
165
172
|
paths << ::File.expand_path(::File.join('~', '.config', _application_name, 'templates', _template_file))
|
166
173
|
paths << ::File.expand_path(::File.join('~', format('.%s', _application_name), 'templates', _template_file))
|
167
174
|
paths << ::File.expand_path(::File.join('/etc', _application_name, 'templates', _template_file))
|
data/spec/template_file_spec.rb
CHANGED