fedux_org-stdlib 0.6.13 → 0.6.14
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 +4 -4
- data/lib/fedux_org_stdlib/app_config.rb +7 -0
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/spec/app_config_spec.rb +39 -0
- 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: 8b91278b5c856f0b5196c43ce4c6a1131194f32c
|
4
|
+
data.tar.gz: 4a7323abd7bf2c81361b76495013e4fd73c69d81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b38a4af025e8b6de93317956cf784142a0f3162280a24b0f31f054d226f1a7bfc442b334c5238b4fd44dcbe64d60117aa3d720d28da22627e947ac19a1c843a
|
7
|
+
data.tar.gz: d2c8d64fc7b4d711eabc9b52a74ae81c5b6a4e34cce7599e8feca279fe3c493d4f83aeae4f0e65d26f985c44ba334df6d0677ee4ccfb3affdce38d1821530a26
|
@@ -235,6 +235,13 @@ module FeduxOrgStdlib
|
|
235
235
|
result.join("\n")
|
236
236
|
end
|
237
237
|
|
238
|
+
# Return the path to the preferred configuration file
|
239
|
+
# @return [String]
|
240
|
+
# The path to the preferred configuration file
|
241
|
+
def preferred_configuration_file
|
242
|
+
_allowed_config_file_paths.first
|
243
|
+
end
|
244
|
+
|
238
245
|
private
|
239
246
|
|
240
247
|
# The name of the config file
|
data/spec/app_config_spec.rb
CHANGED
@@ -91,7 +91,46 @@ RSpec.describe AppConfig do
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
context '#preferred_configuration_file' do
|
95
|
+
it 'has a default configuration file which is the preferred place to store the configuration' do
|
96
|
+
with_environment 'HOME' => working_directory do
|
97
|
+
config_klass = Class.new(AppConfig) do
|
98
|
+
|
99
|
+
def _class_name
|
100
|
+
'TestConfig'
|
101
|
+
end
|
102
|
+
|
103
|
+
def _module_name
|
104
|
+
'MyApplication'
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
config = config_klass.new
|
109
|
+
expect(config.preferred_configuration_file).to eq File.expand_path('~/.config/my_application/tests.yaml')
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'works with nested module names' do
|
114
|
+
with_environment 'HOME' => working_directory do
|
115
|
+
config_klass = Class.new(AppConfig) do
|
116
|
+
|
117
|
+
def _class_name
|
118
|
+
'TestConfig'
|
119
|
+
end
|
120
|
+
|
121
|
+
def _module_name
|
122
|
+
'MyApplication::MySub'
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
config = config_klass.new
|
127
|
+
expect(config.preferred_configuration_file).to eq File.expand_path('~/.config/my_application/my_sub/tests.yaml')
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
94
132
|
context 'config files' do
|
133
|
+
|
95
134
|
it 'looks at ~/.test.yaml' do
|
96
135
|
with_environment 'HOME' => working_directory do
|
97
136
|
create_file '.tests.yaml', <<-EOS.strip_heredoc
|