fedux_org-stdlib 0.8.5 → 0.8.6

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: 6072d2ee52852b69d67004d425cce3c294e77e73
4
- data.tar.gz: 17112604482c98ef7b65824892a5388b29558111
3
+ metadata.gz: ba82feafa5550f36fd7ba991c3fd85ba99331b9e
4
+ data.tar.gz: 3df271871db5706484768718d5f3c32d935b9b24
5
5
  SHA512:
6
- metadata.gz: 0532c2ef208d17396ded1f68fe9eea9916c286c6c6abca81ba9eda8e40cc8a54607748386defd17bcc91a5bbb62de7a5e4e27f0976d24187ccaed5caded1798c
7
- data.tar.gz: 46854ae94ace7bd1950f2336601ae1a0412b40c608c9c848f7e2166847396cc7ef40bf2ba03bd55dfb172dc1ae569460280dc8a684fcc8b4127e89570755b102
6
+ metadata.gz: 653eb6a33b47bd9e1880a56957e8cde7e0b4e680a1da7e40f4edfef65c9b349f925411483267a8d3ea229845ddef10ee4083245801d91b6200ff39ab56e1ec2e
7
+ data.tar.gz: 833c25664b34a57fc52cc32f177e6928a995873de88b6ee3f71807e96747f706a3fb4d107cd51e75465083a4da5d9a9dd0c97547caa2a10d2ddbf43ba3c644ff
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fedux_org-stdlib (0.8.4)
4
+ fedux_org-stdlib (0.8.5)
5
5
  activesupport
6
6
 
7
7
  PATH
@@ -60,14 +60,16 @@ module FeduxOrgStdlib
60
60
  # config_engine does not respond to `:[]` an empty config object will be
61
61
  # created.
62
62
 
63
- attr_reader :directory, :logger
63
+ attr_reader :directory, :logger, :working_directory
64
64
 
65
65
  def initialize(
66
- logger: FeduxOrgStdlib::Logging::Logger.new,
67
- directory: _available_config_directory
66
+ directory: nil,
67
+ working_directory: Dir.getwd,
68
+ logger: FeduxOrgStdlib::Logging::Logger.new
68
69
  )
69
- @logger = logger
70
- @directory = directory
70
+ @logger = logger
71
+ @working_directory = working_directory
72
+ @directory ||= (directory || _available_config_directory)
71
73
 
72
74
  unless directory
73
75
  logger.debug "No configuration directory found at #{_allowed_config_directory_paths.to_list}, therefor I'm going to use an empty config object instead."
@@ -130,6 +132,7 @@ module FeduxOrgStdlib
130
132
  ::File.expand_path(::File.join('~', format('.%s', _application_name), _config_directory)),
131
133
  ::File.expand_path(::File.join('~', format('.%s', _config_directory))),
132
134
  ::File.expand_path(::File.join('/etc', _application_name, _config_directory)),
135
+ ::File.expand_path(::File.join(working_directory, _config_directory))
133
136
  ]
134
137
  end
135
138
 
@@ -61,14 +61,16 @@ module FeduxOrgStdlib
61
61
  # config_engine does not respond to `:[]` an empty config object will be
62
62
  # created.
63
63
 
64
- attr_reader :file, :logger
64
+ attr_reader :file, :logger, :working_directory
65
65
 
66
66
  def initialize(
67
- logger: FeduxOrgStdlib::Logging::Logger.new,
68
- file: _available_config_file
67
+ file: nil,
68
+ working_directory: Dir.getwd,
69
+ logger: FeduxOrgStdlib::Logging::Logger.new
69
70
  )
70
- @logger = logger
71
- @file = file
71
+ @logger = logger
72
+ @working_directory = working_directory
73
+ @file ||= (file || _available_config_file)
72
74
 
73
75
  unless file
74
76
  logger.debug "No configuration file found at #{_allowed_config_file_paths.to_list}, therefor I'm going to use an empty config object instead."
@@ -150,6 +152,7 @@ module FeduxOrgStdlib
150
152
  ::File.expand_path(::File.join('~', format('.%s', _config_file))),
151
153
  ::File.expand_path(::File.join('~', format('.%src', _config_name))),
152
154
  ::File.expand_path(::File.join('/etc', _application_name, _config_file)),
155
+ ::File.expand_path(::File.join(working_directory, _config_file))
153
156
  ]
154
157
  end
155
158
 
@@ -36,8 +36,8 @@ module FeduxOrgStdlib
36
36
  #
37
37
  # @param [Hash] options
38
38
  # Options which are supported by Hirb
39
- def to_s(max_width: ENV['COLUMNS'].to_i, **options)
40
- Hirb::Helpers::Table.render data, header_filter: proc(&:humanize), max_width: max_width, **options
39
+ def to_s(**options)
40
+ Hirb::Helpers::Table.render data, header_filter: proc(&:humanize), **options
41
41
  end
42
42
 
43
43
  # Data as array
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.8.5'
4
+ VERSION = '0.8.6'
5
5
  end
@@ -42,6 +42,28 @@ RSpec.describe FileFinder do
42
42
  end
43
43
 
44
44
  context 'config files' do
45
+ it 'looks at $PWD/test.yaml' do
46
+ touch_file 'test.yaml'
47
+
48
+ config = nil
49
+
50
+ in_current_dir do
51
+ config_klass = Class.new(FileFinder) do
52
+ def _class_name
53
+ 'TestFile'
54
+ end
55
+
56
+ def _module_name
57
+ 'MyApplication'
58
+ end
59
+ end
60
+
61
+ config = config_klass.new
62
+ end
63
+
64
+ expect(config.file).to eq absolute_path('test.yaml')
65
+ end
66
+
45
67
  it 'looks at ~/.test.yaml' do
46
68
  with_env 'HOME' => absolute_path('.') do
47
69
  touch_file '.test.yaml'
data/spec/list_spec.rb CHANGED
@@ -31,10 +31,7 @@ RSpec.describe List do
31
31
  it 'passes options to table helper' do
32
32
  list = List.new(name: 'user1', age: 30)
33
33
  expect_result = <<-EOS.strip_heredoc
34
- ****** 1. row ******
35
- Age: 30
36
- Name: user1
37
- 1 row in set
34
+ ****** 1. row ******
38
35
  EOS
39
36
 
40
37
  expect(list.to_s(style: :vertical)).to include expect_result
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.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer