fedux_org-stdlib 0.8.0 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dba0a7408d790446d802807ca52a3f5ef8e3f81a
4
- data.tar.gz: 870ffc809e5ea3e9ff10c5950d2825b0a0245ee4
3
+ metadata.gz: cd43ee83a3e06f40712bd01aa5444e63bebc11f0
4
+ data.tar.gz: c61db9ef8692a90fc318a68150f4fb3b16ce1f7a
5
5
  SHA512:
6
- metadata.gz: 5a82ec771eaf3053241133c98b5a186096888b0b94d0e4f470800d310d2444faa6863db872d8f4112ec78e74c93c966b0b5b1074e4f536f6e20d68871bdfd01d
7
- data.tar.gz: 3f6e181070c4e31b9bf8953b44ddeebe91e3fbaa0057af16c04c71bd14383c590b92a90a6c911c7e62eef687e06c09d1b70865d053c2846758bcd8a67f19aa3d
6
+ metadata.gz: ece8ea8122b2581e43a7611415b9ab9e433e52910fc5f6deebe92b5c330461012167170c74dc5ec42e9e80955eb461bfa4fd2d585906c5fb02cfff9fca39d337
7
+ data.tar.gz: db43dacb6082617500e1028f804e7d03231afc0017ba92f548828ce87df8a273072261547a9065220ac762caf143ef23b0b508dcf3d505120f021bf39bad7cf5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fedux_org-stdlib (0.7.34)
4
+ fedux_org-stdlib (0.8.3)
5
5
  activesupport
6
6
 
7
7
  PATH
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module FeduxOrgStdlib
3
- class ExternalConfigDirectory
3
+ class DirectoryFinder
4
4
  module Exceptions
5
5
  # No allowed config file could be found
6
6
  class NoConfigDirectoryFound < StandardError; end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'fedux_org_stdlib/require_files'
3
- require 'fedux_org_stdlib/config_directory/exceptions'
3
+ require 'fedux_org_stdlib/directory_finder/exceptions'
4
4
  require 'fedux_org_stdlib/logging/logger'
5
5
  require_library %w(json active_support/core_ext/string/inflections set active_support/core_ext/hash/slice active_support/core_ext/object/blank active_support/core_ext/hash/keys)
6
6
 
@@ -17,8 +17,8 @@ module FeduxOrgStdlib
17
17
  #
18
18
  # * application_name: Module of your class, e.g. "MyApplication" becomes
19
19
  # "my_application"
20
- # * config_directory: Pluarized name of your class and "Config" strip
21
- # off, e.g "ClientConfig" becomes "clients.yaml" (mind the pluralized name)
20
+ # * config_directory: Name of your class and "Directory" strip
21
+ # off, e.g "ClientDirectory" becomes "client"
22
22
  #
23
23
  # Most conventions defined by me are implemented as separate methods. If one convention
24
24
  # is not suitable for your use case, just overwrite the method.
@@ -39,10 +39,10 @@ module FeduxOrgStdlib
39
39
  #
40
40
  # @example Create config with one writer and reader
41
41
  # module MyApplication
42
- # class ClientConfig < ConfigDirectory
42
+ # class ClientDirectory < DirectoryFinder
43
43
  # end
44
44
  # end
45
- class ConfigDirectory
45
+ class DirectoryFinder
46
46
  # Create a new instance of config
47
47
  #
48
48
  # It tries to find a suitable configuration file. If it doesn't find one
@@ -52,10 +52,10 @@ module FeduxOrgStdlib
52
52
  # Path where config file is stored. The file will be read by the
53
53
  # `config_engine`.
54
54
  #
55
- # @raise [Exceptions::ConfigFileNotReadable]
55
+ # @raise [Exceptions::DirectoryFileNotReadable]
56
56
  # If an avaiable config file could not be read by the config engine
57
57
  #
58
- # @return [ConfigDirectory]
58
+ # @return [DirectoryFinder]
59
59
  # The config instance. If the resulting data structure created by the
60
60
  # config_engine does not respond to `:[]` an empty config object will be
61
61
  # created.
@@ -91,11 +91,11 @@ module FeduxOrgStdlib
91
91
  #
92
92
  # @example Determine the base name of the config
93
93
  #
94
- # class ClientConfig; end
94
+ # class ClientDirectory; end
95
95
  #
96
96
  # This will result in `client` as base name for the config file.
97
97
  def _config_directory
98
- unless (name = _class_name.sub(/Config/, '').underscore.pluralize).blank?
98
+ unless (name = _class_name.sub(/Directory/, '').underscore).blank?
99
99
  return name
100
100
  end
101
101
 
@@ -110,7 +110,7 @@ module FeduxOrgStdlib
110
110
  #
111
111
  # @example Determine application name
112
112
  #
113
- # class MyApplication::MyConfig; end
113
+ # class MyApplication::MyDirectory; end
114
114
  #
115
115
  # This will be converted to
116
116
  #
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module FeduxOrgStdlib
3
- class ConfigFile
3
+ class FileFinder
4
4
  module Exceptions
5
5
  # No allowed config file could be found
6
6
  class NoConfigFileFound < StandardError; end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'fedux_org_stdlib/require_files'
3
- require 'fedux_org_stdlib/config_file/exceptions'
3
+ require 'fedux_org_stdlib/file_finder/exceptions'
4
4
  require 'fedux_org_stdlib/logging/logger'
5
5
  require_library %w(json active_support/core_ext/string/inflections set active_support/core_ext/hash/slice active_support/core_ext/object/blank active_support/core_ext/hash/keys)
6
6
 
@@ -18,8 +18,8 @@ module FeduxOrgStdlib
18
18
  #
19
19
  # * application_name: Module of your class, e.g. "MyApplication" becomes
20
20
  # "my_application"
21
- # * config_file: Pluarized name of your class and "Config" strip
22
- # off, e.g "ClientConfig" becomes "clients.yaml" (mind the pluralized name)
21
+ # * config_file: Pluarized name of your class and "File" strip
22
+ # off, e.g "ClientFile" becomes "client.yaml"
23
23
  #
24
24
  # Most conventions defined by me are implemented as separate methods. If one convention
25
25
  # is not suitable for your use case, just overwrite the method.
@@ -40,10 +40,10 @@ module FeduxOrgStdlib
40
40
  #
41
41
  # @example Create config with one writer and reader
42
42
  # module MyApplication
43
- # class ClientConfig < ConfigFile
43
+ # class ClientFile < FileFinder
44
44
  # end
45
45
  # end
46
- class ConfigFile
46
+ class FileFinder
47
47
  # Create a new instance of config
48
48
  #
49
49
  # It tries to find a suitable configuration file. If it doesn't find one
@@ -53,10 +53,10 @@ module FeduxOrgStdlib
53
53
  # Path where config file is stored. The file will be read by the
54
54
  # `config_engine`.
55
55
  #
56
- # @raise [Exceptions::ConfigFileNotReadable]
56
+ # @raise [Exceptions::FileFinderNotReadable]
57
57
  # If an avaiable config file could not be read by the config engine
58
58
  #
59
- # @return [ConfigFile]
59
+ # @return [FileFinder]
60
60
  # The config instance. If the resulting data structure created by the
61
61
  # config_engine does not respond to `:[]` an empty config object will be
62
62
  # created.
@@ -110,11 +110,11 @@ module FeduxOrgStdlib
110
110
  #
111
111
  # @example Determine the base name of the config
112
112
  #
113
- # class ClientConfig; end
113
+ # class ClientFile; end
114
114
  #
115
115
  # This will result in `client` as base name for the config file.
116
116
  def _config_name
117
- unless (name = _class_name.sub(/Config/, '').underscore.pluralize).blank?
117
+ unless (name = _class_name.sub(/File/, '').underscore).blank?
118
118
  return name
119
119
  end
120
120
 
@@ -129,7 +129,7 @@ module FeduxOrgStdlib
129
129
  #
130
130
  # @example Determine application name
131
131
  #
132
- # class MyApplication::MyConfig; end
132
+ # class MyApplication::MyFile; end
133
133
  #
134
134
  # This will be converted to
135
135
  #
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.3'
5
5
  end
@@ -1,16 +1,15 @@
1
1
  # encoding: utf-8
2
2
  require 'spec_helper'
3
- require 'fedux_org_stdlib/config_directory'
3
+ require 'fedux_org_stdlib/directory_finder'
4
4
 
5
- RSpec.describe ConfigDirectory do
6
-
7
- context '#preferred_configuration_file' do
5
+ RSpec.describe DirectoryFinder do
6
+ context '#preferred_configuration_directory' do
8
7
  it 'has a default configuration file which is the preferred place to store the configuration' do
9
8
  with_env 'HOME' => absolute_path('.') do
10
- config_klass = Class.new(ConfigDirectory) do
9
+ config_klass = Class.new(DirectoryFinder) do
11
10
 
12
11
  def _class_name
13
- 'TestConfig'
12
+ 'TestDirectory'
14
13
  end
15
14
 
16
15
  def _module_name
@@ -19,16 +18,16 @@ RSpec.describe ConfigDirectory do
19
18
  end
20
19
 
21
20
  config = config_klass.new
22
- expect(config.preferred_configuration_directory).to eq File.expand_path('~/.config/my_application/tests')
21
+ expect(config.preferred_configuration_directory).to eq File.expand_path('~/.config/my_application/test')
23
22
  end
24
23
  end
25
24
 
26
25
  it 'works with nested module names' do
27
26
  with_env 'HOME' => absolute_path('.') do
28
- config_klass = Class.new(ConfigDirectory) do
27
+ config_klass = Class.new(DirectoryFinder) do
29
28
 
30
29
  def _class_name
31
- 'TestConfig'
30
+ 'TestDirectory'
32
31
  end
33
32
 
34
33
  def _module_name
@@ -37,7 +36,7 @@ RSpec.describe ConfigDirectory do
37
36
  end
38
37
 
39
38
  config = config_klass.new
40
- expect(config.preferred_configuration_directory).to eq File.expand_path('~/.config/my_application/my_sub/tests')
39
+ expect(config.preferred_configuration_directory).to eq File.expand_path('~/.config/my_application/my_sub/test')
41
40
  end
42
41
  end
43
42
  end
@@ -45,12 +44,12 @@ RSpec.describe ConfigDirectory do
45
44
  context 'config files' do
46
45
  it 'looks at ~/.test.yaml' do
47
46
  with_env 'HOME' => absolute_path('.') do
48
- create_dir '.tests'
47
+ create_dir '.test'
49
48
 
50
- config_klass = Class.new(ConfigDirectory) do
49
+ config_klass = Class.new(DirectoryFinder) do
51
50
 
52
51
  def _class_name
53
- 'TestConfig'
52
+ 'TestDirectory'
54
53
  end
55
54
 
56
55
  def _module_name
@@ -59,18 +58,18 @@ RSpec.describe ConfigDirectory do
59
58
  end
60
59
 
61
60
  config = config_klass.new
62
- expect(config.directory).to eq absolute_path('.tests')
61
+ expect(config.directory).to eq absolute_path('.test')
63
62
  end
64
63
  end
65
64
 
66
- it 'looks at ~/.config/my_application/tests.yaml' do
65
+ it 'looks at ~/.config/my_application/test.yaml' do
67
66
  with_env 'HOME' => absolute_path('.') do
68
- create_dir '.config/my_application/tests'
67
+ create_dir '.config/my_application/test'
69
68
 
70
- config_klass = Class.new(ConfigDirectory) do
69
+ config_klass = Class.new(DirectoryFinder) do
71
70
 
72
71
  def _class_name
73
- 'TestConfig'
72
+ 'TestDirectory'
74
73
  end
75
74
 
76
75
  def _module_name
@@ -79,18 +78,18 @@ RSpec.describe ConfigDirectory do
79
78
  end
80
79
 
81
80
  config = config_klass.new
82
- expect(config.directory).to eq absolute_path('.config/my_application/tests')
81
+ expect(config.directory).to eq absolute_path('.config/my_application/test')
83
82
  end
84
83
  end
85
84
 
86
- it 'looks at ~/.my_application/tests.yaml' do
85
+ it 'looks at ~/.my_application/test.yaml' do
87
86
  with_env 'HOME' => absolute_path('.') do
88
- create_dir '.my_application/tests'
87
+ create_dir '.my_application/test'
89
88
 
90
- config_klass = Class.new(ConfigDirectory) do
89
+ config_klass = Class.new(DirectoryFinder) do
91
90
 
92
91
  def _class_name
93
- 'TestConfig'
92
+ 'TestDirectory'
94
93
  end
95
94
 
96
95
  def _module_name
@@ -99,18 +98,18 @@ RSpec.describe ConfigDirectory do
99
98
  end
100
99
 
101
100
  config = config_klass.new
102
- expect(config.directory).to eq absolute_path('.my_application/tests')
101
+ expect(config.directory).to eq absolute_path('.my_application/test')
103
102
  end
104
103
  end
105
104
 
106
- it 'looks at ~/.tests' do
105
+ it 'looks at ~/.test' do
107
106
  with_env 'HOME' => absolute_path('.') do
108
- create_dir '.tests'
107
+ create_dir '.test'
109
108
 
110
- config_klass = Class.new(ConfigDirectory) do
109
+ config_klass = Class.new(DirectoryFinder) do
111
110
 
112
111
  def _class_name
113
- 'TestConfig'
112
+ 'TestDirectory'
114
113
  end
115
114
 
116
115
  def _module_name
@@ -119,7 +118,7 @@ RSpec.describe ConfigDirectory do
119
118
  end
120
119
 
121
120
  config = config_klass.new
122
- expect(config.directory).to eq absolute_path('.tests')
121
+ expect(config.directory).to eq absolute_path('.test')
123
122
  end
124
123
  end
125
124
  end
@@ -1,16 +1,15 @@
1
1
  # encoding: utf-8
2
2
  require 'spec_helper'
3
- require 'fedux_org_stdlib/config_file'
4
-
5
- RSpec.describe ConfigFile do
3
+ require 'fedux_org_stdlib/file_finder'
6
4
 
5
+ RSpec.describe FileFinder do
7
6
  context '#preferred_configuration_file' do
8
7
  it 'has a default configuration file which is the preferred place to store the configuration' do
9
8
  with_env 'HOME' => absolute_path('.') do
10
- config_klass = Class.new(ConfigFile) do
9
+ config_klass = Class.new(FileFinder) do
11
10
 
12
11
  def _class_name
13
- 'TestConfig'
12
+ 'TestFile'
14
13
  end
15
14
 
16
15
  def _module_name
@@ -19,16 +18,16 @@ RSpec.describe ConfigFile do
19
18
  end
20
19
 
21
20
  config = config_klass.new
22
- expect(config.preferred_configuration_file).to eq File.expand_path('~/.config/my_application/tests.yaml')
21
+ expect(config.preferred_configuration_file).to eq File.expand_path('~/.config/my_application/test.yaml')
23
22
  end
24
23
  end
25
24
 
26
25
  it 'works with nested module names' do
27
26
  with_env 'HOME' => absolute_path('.') do
28
- config_klass = Class.new(ConfigFile) do
27
+ config_klass = Class.new(FileFinder) do
29
28
 
30
29
  def _class_name
31
- 'TestConfig'
30
+ 'TestFile'
32
31
  end
33
32
 
34
33
  def _module_name
@@ -37,7 +36,7 @@ RSpec.describe ConfigFile do
37
36
  end
38
37
 
39
38
  config = config_klass.new
40
- expect(config.preferred_configuration_file).to eq File.expand_path('~/.config/my_application/my_sub/tests.yaml')
39
+ expect(config.preferred_configuration_file).to eq File.expand_path('~/.config/my_application/my_sub/test.yaml')
41
40
  end
42
41
  end
43
42
  end
@@ -45,12 +44,12 @@ RSpec.describe ConfigFile do
45
44
  context 'config files' do
46
45
  it 'looks at ~/.test.yaml' do
47
46
  with_env 'HOME' => absolute_path('.') do
48
- touch_file '.tests.yaml'
47
+ touch_file '.test.yaml'
49
48
 
50
- config_klass = Class.new(ConfigFile) do
49
+ config_klass = Class.new(FileFinder) do
51
50
 
52
51
  def _class_name
53
- 'TestConfig'
52
+ 'TestFile'
54
53
  end
55
54
 
56
55
  def _module_name
@@ -59,18 +58,18 @@ RSpec.describe ConfigFile do
59
58
  end
60
59
 
61
60
  config = config_klass.new
62
- expect(config.file).to eq absolute_path('.tests.yaml')
61
+ expect(config.file).to eq absolute_path('.test.yaml')
63
62
  end
64
63
  end
65
64
 
66
- it 'looks at ~/.config/my_application/tests.yaml' do
65
+ it 'looks at ~/.config/my_application/test.yaml' do
67
66
  with_env 'HOME' => absolute_path('.') do
68
- touch_file '.config/my_application/tests.yaml'
67
+ touch_file '.config/my_application/test.yaml'
69
68
 
70
- config_klass = Class.new(ConfigFile) do
69
+ config_klass = Class.new(FileFinder) do
71
70
 
72
71
  def _class_name
73
- 'TestConfig'
72
+ 'TestFile'
74
73
  end
75
74
 
76
75
  def _module_name
@@ -79,18 +78,18 @@ RSpec.describe ConfigFile do
79
78
  end
80
79
 
81
80
  config = config_klass.new
82
- expect(config.file).to eq absolute_path('.config/my_application/tests.yaml')
81
+ expect(config.file).to eq absolute_path('.config/my_application/test.yaml')
83
82
  end
84
83
  end
85
84
 
86
- it 'looks at ~/.my_application/tests.yaml' do
85
+ it 'looks at ~/.my_application/test.yaml' do
87
86
  with_env 'HOME' => absolute_path('.') do
88
- touch_file '.my_application/tests.yaml'
87
+ touch_file '.my_application/test.yaml'
89
88
 
90
- config_klass = Class.new(ConfigFile) do
89
+ config_klass = Class.new(FileFinder) do
91
90
 
92
91
  def _class_name
93
- 'TestConfig'
92
+ 'TestFile'
94
93
  end
95
94
 
96
95
  def _module_name
@@ -99,18 +98,18 @@ RSpec.describe ConfigFile do
99
98
  end
100
99
 
101
100
  config = config_klass.new
102
- expect(config.file).to eq absolute_path('.my_application/tests.yaml')
101
+ expect(config.file).to eq absolute_path('.my_application/test.yaml')
103
102
  end
104
103
  end
105
104
 
106
- it 'looks at ~/.testsrc' do
105
+ it 'looks at ~/.testrc' do
107
106
  with_env 'HOME' => absolute_path('.') do
108
- touch_file '.testsrc'
107
+ touch_file '.testrc'
109
108
 
110
- config_klass = Class.new(ConfigFile) do
109
+ config_klass = Class.new(FileFinder) do
111
110
 
112
111
  def _class_name
113
- 'TestConfig'
112
+ 'TestFile'
114
113
  end
115
114
 
116
115
  def _module_name
@@ -119,7 +118,7 @@ RSpec.describe ConfigFile do
119
118
  end
120
119
 
121
120
  config = config_klass.new
122
- expect(config.file).to eq absolute_path('.testsrc')
121
+ expect(config.file).to eq absolute_path('.testrc')
123
122
  end
124
123
  end
125
124
  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.8.0
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer
@@ -62,10 +62,6 @@ files:
62
62
  - lib/fedux_org_stdlib/command/command_result.rb
63
63
  - lib/fedux_org_stdlib/command/run_command.rb
64
64
  - lib/fedux_org_stdlib/command/which.rb
65
- - lib/fedux_org_stdlib/config_directory.rb
66
- - lib/fedux_org_stdlib/config_directory/exceptions.rb
67
- - lib/fedux_org_stdlib/config_file.rb
68
- - lib/fedux_org_stdlib/config_file/exceptions.rb
69
65
  - lib/fedux_org_stdlib/core_ext/array.rb
70
66
  - lib/fedux_org_stdlib/core_ext/array/list.rb
71
67
  - lib/fedux_org_stdlib/core_ext/hash.rb
@@ -75,7 +71,11 @@ files:
75
71
  - lib/fedux_org_stdlib/core_ext/shellwords/clean.rb
76
72
  - lib/fedux_org_stdlib/core_ext/string.rb
77
73
  - lib/fedux_org_stdlib/core_ext/string/underline.rb
74
+ - lib/fedux_org_stdlib/directory_finder.rb
75
+ - lib/fedux_org_stdlib/directory_finder/exceptions.rb
78
76
  - lib/fedux_org_stdlib/environment.rb
77
+ - lib/fedux_org_stdlib/file_finder.rb
78
+ - lib/fedux_org_stdlib/file_finder/exceptions.rb
79
79
  - lib/fedux_org_stdlib/file_template.rb
80
80
  - lib/fedux_org_stdlib/file_template/exceptions.rb
81
81
  - lib/fedux_org_stdlib/filesystem.rb
@@ -170,13 +170,12 @@ files:
170
170
  - spec/colors/html_color_spec.rb
171
171
  - spec/command/run_command_spec.rb
172
172
  - spec/command/which_spec.rb
173
- - spec/config_directory_spec.rb
174
- - spec/config_file_spec.rb
175
173
  - spec/core_ext/array/list_spec.rb
176
174
  - spec/core_ext/hash/list_spec.rb
177
175
  - spec/core_ext/hash/options_spec.rb
178
176
  - spec/core_ext/shellwords/clean_spec.rb
179
177
  - spec/core_ext/string/underline_spec.rb
178
+ - spec/directory_finder_spec.rb
180
179
  - spec/environment_spec.rb
181
180
  - spec/examples/models/class_based/forbidden_keyword.rb
182
181
  - spec/examples/models/class_based/ignore/ignored.rb
@@ -190,6 +189,7 @@ files:
190
189
  - spec/examples/models/filesystem_based/find_files/abc.rb.swp
191
190
  - spec/examples/models/filesystem_based/find_files/cde.rb
192
191
  - spec/examples/project/plan.tjp
192
+ - spec/file_finder_spec.rb
193
193
  - spec/fixtures_management/fixtures_manager_spec.rb
194
194
  - spec/gem_plugins/plugin_manager_spec.rb
195
195
  - spec/list_spec.rb
@@ -251,13 +251,12 @@ test_files:
251
251
  - spec/colors/html_color_spec.rb
252
252
  - spec/command/run_command_spec.rb
253
253
  - spec/command/which_spec.rb
254
- - spec/config_directory_spec.rb
255
- - spec/config_file_spec.rb
256
254
  - spec/core_ext/array/list_spec.rb
257
255
  - spec/core_ext/hash/list_spec.rb
258
256
  - spec/core_ext/hash/options_spec.rb
259
257
  - spec/core_ext/shellwords/clean_spec.rb
260
258
  - spec/core_ext/string/underline_spec.rb
259
+ - spec/directory_finder_spec.rb
261
260
  - spec/environment_spec.rb
262
261
  - spec/examples/models/class_based/forbidden_keyword.rb
263
262
  - spec/examples/models/class_based/ignore/ignored.rb
@@ -271,6 +270,7 @@ test_files:
271
270
  - spec/examples/models/filesystem_based/find_files/abc.rb.swp
272
271
  - spec/examples/models/filesystem_based/find_files/cde.rb
273
272
  - spec/examples/project/plan.tjp
273
+ - spec/file_finder_spec.rb
274
274
  - spec/fixtures_management/fixtures_manager_spec.rb
275
275
  - spec/gem_plugins/plugin_manager_spec.rb
276
276
  - spec/list_spec.rb