conifer 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +9 -3
- data/Gemfile.lock +3 -3
- data/conifer.gemspec +1 -1
- data/lib/conifer.rb +2 -2
- data/lib/conifer/file.rb +14 -5
- data/lib/conifer/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 520bd98270d714e155b05def5414531da4568094fae4266bcea73327f29d8a2e
|
4
|
+
data.tar.gz: ffdb5f410b458f83d22dc6fbf450c46b056cd09532bf42059ab8391db4e0340c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d9b2b3f1c21db80010ea8ca424b44e859da81fefddf26be66a30aa91c96fe1f1ddcc65be465160dced4978e93932978545dafc3b4efd0a8313b9ee654e53eb0
|
7
|
+
data.tar.gz: fc9c43b0a7f6d89881e50a5e9e10c79f3864c2c5ceee1ddc19ca6153f72be811416d695782914b0f1c5564a581f7d8893c58dc82e91386f6189bc94cb0998430
|
data/.github/workflows/ruby.yml
CHANGED
@@ -7,12 +7,18 @@ jobs:
|
|
7
7
|
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby:
|
13
|
+
- 2.6.x
|
14
|
+
- 2.7.x
|
15
|
+
|
10
16
|
steps:
|
11
17
|
- uses: actions/checkout@v2
|
12
|
-
- name: Set up Ruby
|
18
|
+
- name: Set up Ruby
|
13
19
|
uses: actions/setup-ruby@v1
|
14
20
|
with:
|
15
|
-
ruby-version:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
16
22
|
- name: Configure Bundler
|
17
23
|
run: |
|
18
24
|
gem install bundler -v 1.17.3 --no-document
|
@@ -20,7 +26,7 @@ jobs:
|
|
20
26
|
- name: Run tests with RSpec
|
21
27
|
uses: paambaati/codeclimate-action@v2.5.3
|
22
28
|
env:
|
23
|
-
CC_TEST_REPORTER_ID:
|
29
|
+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
24
30
|
with:
|
25
31
|
coverageCommand: bundle exec rspec
|
26
32
|
debug: false
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
conifer (1.
|
4
|
+
conifer (1.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
parser (2.7.0.3)
|
17
17
|
ast (~> 2.4.0)
|
18
18
|
rainbow (3.0.0)
|
19
|
-
rake (
|
19
|
+
rake (13.0.1)
|
20
20
|
rexml (3.2.4)
|
21
21
|
rspec (3.8.0)
|
22
22
|
rspec-core (~> 3.8.0)
|
@@ -56,7 +56,7 @@ DEPENDENCIES
|
|
56
56
|
bundler (~> 1.17)
|
57
57
|
climate_control (~> 0.2)
|
58
58
|
conifer!
|
59
|
-
rake (~>
|
59
|
+
rake (~> 13.0)
|
60
60
|
rspec (~> 3.0)
|
61
61
|
rubocop (~> 0.80)
|
62
62
|
rubocop-rspec (~> 1.38)
|
data/conifer.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.add_development_dependency 'bundler', '~> 1.17'
|
28
28
|
spec.add_development_dependency 'climate_control', '~> 0.2'
|
29
|
-
spec.add_development_dependency 'rake', '~>
|
29
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
31
|
spec.add_development_dependency 'rubocop', '~> 0.80'
|
32
32
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.38'
|
data/lib/conifer.rb
CHANGED
@@ -10,8 +10,8 @@ module Conifer
|
|
10
10
|
|
11
11
|
# rubocop:disable Metrics/ParameterLists
|
12
12
|
module ClassMethods
|
13
|
-
def conifer(name, prefix: nil, dir: nil, method: ::File.basename(name.to_s,
|
14
|
-
allowed_classes: [])
|
13
|
+
def conifer(name, prefix: nil, dir: nil, format: :yml, method: ::File.basename(name.to_s, ".#{format}"),
|
14
|
+
singleton: false, allowed_classes: [])
|
15
15
|
dir ||= ::File.expand_path(::File.dirname(caller_locations.first.path))
|
16
16
|
|
17
17
|
body = proc do
|
data/lib/conifer/file.rb
CHANGED
@@ -6,13 +6,15 @@ require 'erb'
|
|
6
6
|
module Conifer
|
7
7
|
class File
|
8
8
|
NotFoundError = Class.new(StandardError)
|
9
|
+
UnsupportedFormatError = Class.new(StandardError)
|
9
10
|
|
10
|
-
attr_reader :name, :prefix, :
|
11
|
+
attr_reader :name, :dir, :prefix, :format, :allowed_classes
|
11
12
|
|
12
|
-
def initialize(name, dir:, prefix: nil, allowed_classes: [])
|
13
|
+
def initialize(name, dir:, prefix: nil, format: :yml, allowed_classes: [])
|
13
14
|
@name = name
|
14
|
-
@prefix = prefix
|
15
15
|
@dir = dir
|
16
|
+
@prefix = prefix
|
17
|
+
@format = format
|
16
18
|
@allowed_classes = allowed_classes
|
17
19
|
end
|
18
20
|
|
@@ -22,7 +24,14 @@ module Conifer
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def parsed
|
25
|
-
@parsed ||=
|
27
|
+
@parsed ||= case format
|
28
|
+
when :yml, :yaml
|
29
|
+
YAML.safe_load(ERB.new(::File.read(path)).result, allowed_classes)
|
30
|
+
when :json
|
31
|
+
JSON.parse(ERB.new(::File.read(path)).result)
|
32
|
+
else
|
33
|
+
raise UnsupportedFormatError, "Format '#{format}' is not supported"
|
34
|
+
end
|
26
35
|
end
|
27
36
|
|
28
37
|
def path
|
@@ -36,7 +45,7 @@ module Conifer
|
|
36
45
|
end
|
37
46
|
|
38
47
|
def filename
|
39
|
-
"#{::File.basename(name.to_s,
|
48
|
+
"#{::File.basename(name.to_s, ".#{format}")}.#{format}"
|
40
49
|
end
|
41
50
|
|
42
51
|
def validate!
|
data/lib/conifer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conifer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hamed Asghari
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|