skn_utils 4.0.1 → 4.0.3
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/.ruby-version +1 -1
- data/README.md +3 -0
- data/bin/configs/settings/development.yml +4 -0
- data/bin/configs/settings/production.yml +4 -0
- data/bin/configs/settings/stage.yml +4 -0
- data/bin/configs/settings/test.local.yml +3 -0
- data/bin/configs/settings/test.yml +4 -0
- data/bin/configs/settings.yml +14 -0
- data/bin/console +1 -0
- data/bin/install +25 -0
- data/lib/skn_utils/env_string_handler.rb +9 -1
- data/lib/skn_utils/nested_result.rb +5 -4
- data/lib/skn_utils/version.rb +1 -1
- data/skn_utils.gemspec +1 -0
- data/spec/factories/settings.yml +1 -1
- data/spec/lib/skn_utils/nested_result_spec.rb +2 -1
- metadata +24 -4
- data/.ruby-gemset +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b781eb4f6fba46c539596b6c1b6a680406c45e2
|
4
|
+
data.tar.gz: 982c1dc1cb0537726c1869787ed9253cd0183fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9530d15532ebf9018bef8efc1969bef703f554be3095ef6acb2c9b90290f852ee6b5501084ca70b853d650055af50b1702f5977e7c926839bf26172cc61cf611
|
7
|
+
data.tar.gz: 19785e5090992c7baa117d3835b6fcf161b30ebd67e04c192aabe9511283d034d66508abeb78909291dc7bc28fcdaa7048d4b5ae20ca1b68e396db6c9ef0f499
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.4.
|
1
|
+
ruby-2.4.2
|
data/README.md
CHANGED
@@ -55,6 +55,9 @@ There are many more use cases for Ruby's Hash that this gem just makes easier to
|
|
55
55
|
* SknUtils::CoreObjectExtensions
|
56
56
|
|
57
57
|
## History
|
58
|
+
02/04/2018 V4.0.2
|
59
|
+
Added `bin/install` to copy default settings.yml files to the project's config directory
|
60
|
+
|
58
61
|
02/04/2018 V4.0.0
|
59
62
|
Added SknUtils::CoreObjectExtensions, this module contains those popular Rails ActiveSupport extensions like `:present?`.
|
60
63
|
- However, it is contructed with the Ruby `:refine` and `using SknUtils::CoreObjectExtensions` constraints, so as not to intefer with existing monkey-patches.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
Packaging:
|
3
|
+
pomVersion: 1.0.0
|
4
|
+
isTest: false
|
5
|
+
isDevelopment: false
|
6
|
+
isStaging: false
|
7
|
+
isProduction: false
|
8
|
+
configName: default
|
9
|
+
short_name: skn
|
10
|
+
|
11
|
+
# Create a EnvStringHandler to support: SknSettings.env.development?
|
12
|
+
# Yes, its YAML trick
|
13
|
+
env: !ruby/string:SknUtils::EnvStringHandler <%= ENV['RACK_ENV'] %>
|
14
|
+
root: <%= Dir.pwd %>
|
data/bin/console
CHANGED
data/bin/install
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'thor'
|
5
|
+
require 'thor/group'
|
6
|
+
|
7
|
+
class InstallCommand < Thor::Group
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
# Define arguments and options
|
11
|
+
argument :dir_name, :default => 'config'
|
12
|
+
|
13
|
+
desc "Install SknSettings YAML files."
|
14
|
+
|
15
|
+
def self.source_root
|
16
|
+
File.expand_path('bin', Dir.pwd)
|
17
|
+
end
|
18
|
+
|
19
|
+
def copy_app_settings_directory
|
20
|
+
directory 'configs', "#{dir_name}/", :verbose => true
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
InstallCommand.start
|
@@ -17,6 +17,7 @@
|
|
17
17
|
# in config/settings.yml
|
18
18
|
# ...
|
19
19
|
# env: !ruby/string:SknUtils::EnvStringHandler <%= ENV['RACK_ENV'] %>
|
20
|
+
# root: !ruby/string:SknUtils::EnvStringHandler <%= Dir.pwd %>
|
20
21
|
# ...
|
21
22
|
# #
|
22
23
|
module SknUtils
|
@@ -24,15 +25,22 @@ module SknUtils
|
|
24
25
|
private
|
25
26
|
|
26
27
|
def respond_to_missing?(method_name, _include_private = false)
|
27
|
-
method_name[-1] == '?'
|
28
|
+
method_name[-1] == '?' || method_name.to_s.eql?('join') || super
|
28
29
|
end
|
29
30
|
|
30
31
|
def method_missing(method_name, *arguments)
|
31
32
|
if method_name[-1] == '?'
|
32
33
|
self == method_name[0..-2]
|
34
|
+
|
35
|
+
# Only handle the :join method, else to super
|
36
|
+
elsif Pathname.public_instance_methods(false).include?(method_name)
|
37
|
+
method_name.to_s.eql?('join') ?
|
38
|
+
Pathname(self).send(method_name, *arguments).realdirpath.to_s : super
|
39
|
+
|
33
40
|
else
|
34
41
|
super
|
35
42
|
end
|
36
43
|
end
|
44
|
+
|
37
45
|
end
|
38
46
|
end
|
@@ -338,10 +338,11 @@ module SknUtils
|
|
338
338
|
elsif method.to_s.end_with?('?') # order of tests is significant,
|
339
339
|
attribute?(method_nsym)
|
340
340
|
|
341
|
-
else # TODO: replace following with nil to match OpenStruct behavior when key not found
|
342
|
-
|
343
|
-
e.
|
344
|
-
|
341
|
+
else # TODO: replace following with nil to match OpenStruct or Hash behavior when key not found
|
342
|
+
nil
|
343
|
+
# e = NoMethodError.new "undefined method `#{method}' for #{self.class.name}", method, args
|
344
|
+
# e.set_backtrace caller(1)
|
345
|
+
# raise e
|
345
346
|
|
346
347
|
end
|
347
348
|
end # end method_missing: errors from enable_dot..., initialize_hash..., and attribute? are possible
|
data/lib/skn_utils/version.rb
CHANGED
data/skn_utils.gemspec
CHANGED
@@ -32,6 +32,7 @@ EOF
|
|
32
32
|
|
33
33
|
spec.add_runtime_dependency 'deep_merge', '~> 1'
|
34
34
|
spec.add_runtime_dependency 'concurrent-ruby', '~> 1'
|
35
|
+
spec.add_runtime_dependency 'thor', '~> 0'
|
35
36
|
|
36
37
|
spec.add_development_dependency "bundler", "~> 1"
|
37
38
|
spec.add_development_dependency "rake", "~> 10"
|
data/spec/factories/settings.yml
CHANGED
@@ -11,5 +11,5 @@ Packaging:
|
|
11
11
|
# Create a EnvStringHandler to support: SknSettings.env.development?
|
12
12
|
# Yes, its YAML trick
|
13
13
|
env: !ruby/string:SknUtils::EnvStringHandler <%= ENV['RACK_ENV'] %>
|
14
|
-
root: <%= Dir.pwd %>
|
14
|
+
root: !ruby/string:SknUtils::EnvStringHandler <%= Dir.pwd %>
|
15
15
|
|
@@ -110,7 +110,8 @@ RSpec.shared_examples 'plain old ruby object' do
|
|
110
110
|
end
|
111
111
|
|
112
112
|
it 'Raises NoMethodError in response to invalid key access' do
|
113
|
-
expect{object.sixty_two}.
|
113
|
+
expect{object.sixty_two}.not_to raise_exception
|
114
|
+
expect(object.sixty_two).to be_nil
|
114
115
|
end
|
115
116
|
|
116
117
|
context '#attribute? present? like feature operates as expected' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skn_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Scott Jr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +147,6 @@ extra_rdoc_files: []
|
|
133
147
|
files:
|
134
148
|
- ".gitignore"
|
135
149
|
- ".rspec"
|
136
|
-
- ".ruby-gemset"
|
137
150
|
- ".ruby-version"
|
138
151
|
- CODE_OF_CONDUCT.md
|
139
152
|
- Gemfile
|
@@ -143,7 +156,14 @@ files:
|
|
143
156
|
- Rakefile
|
144
157
|
- _config.yml
|
145
158
|
- bin/bench_nested_result.rb
|
159
|
+
- bin/configs/settings.yml
|
160
|
+
- bin/configs/settings/development.yml
|
161
|
+
- bin/configs/settings/production.yml
|
162
|
+
- bin/configs/settings/stage.yml
|
163
|
+
- bin/configs/settings/test.local.yml
|
164
|
+
- bin/configs/settings/test.yml
|
146
165
|
- bin/console
|
166
|
+
- bin/install
|
147
167
|
- lib/skn_container.rb
|
148
168
|
- lib/skn_hash.rb
|
149
169
|
- lib/skn_settings.rb
|
@@ -191,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
211
|
version: '0'
|
192
212
|
requirements: []
|
193
213
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.6.
|
214
|
+
rubygems_version: 2.6.14
|
195
215
|
signing_key:
|
196
216
|
specification_version: 4
|
197
217
|
summary: SknUtils contains a small collection of Ruby utilities, the first being a
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
SknUtils
|