fedux_org-stdlib 0.6.25 → 0.6.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 052fbbd99ff53b1610a8ce3a38865133ebbe6ccb
4
- data.tar.gz: 9ab736dc5ec4123d0e55be0412a6b8258530519a
3
+ metadata.gz: 027d7fd79cc80909dcff5dbcdd14ba502834a342
4
+ data.tar.gz: 6b0b61ff9f97d806d3f44ad33e3cd96336ef7bb6
5
5
  SHA512:
6
- metadata.gz: 8cb094d70b952c326966b8b5405f71984e5fcd26bbe26054c43bf492ee7dfe2b6a23fd5255fba8875cf70febf2a71a92decfd96282a453a39e4735912db66d9a
7
- data.tar.gz: ed0568b688313b18b4472175b41b7321ae3002397bc07f6661b64b87db02cee1faa4ef8c6a352d82ce5373c641b19f72d1e23e7d0c2ff95b2fab56be8263f6dd
6
+ metadata.gz: dedf9c0a2c20c930b89ceb8cbf2ca6eebb8b810d0f9a17df1612c5a8c177cfbafb8eac6d02b882e2ba108eadd002c85083fd2005eabad0d9e9098626b1da07f3
7
+ data.tar.gz: 6992f8aab8f1b7741583e4b15928c7f5360e5333447d623a59b92e83b1e29b8116c1e073488a2f238c01e6d1570abf47e9dde52a86ef0fa90c9e5cd5d02a7160
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fedux_org-stdlib (0.6.24)
4
+ fedux_org-stdlib (0.6.25)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -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: _available_template_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 = 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(Dir.getwd, 'templates', _template_file))
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))
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.6.25'
4
+ VERSION = '0.6.26'
5
5
  end
@@ -8,7 +8,6 @@ RSpec.describe FileTemplate do
8
8
  it 'has a default template file which is the preferred place to store the template' do
9
9
  with_environment 'HOME' => working_directory do
10
10
  template_klass = Class.new(FileTemplate) do
11
-
12
11
  def _class_name
13
12
  'TestTemplate'
14
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fedux_org-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.25
4
+ version: 0.6.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer