config_templates 0.0.5 → 0.0.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: d0e8b0384a5b49145149a7a22c274deb6dfd7708
4
- data.tar.gz: 06abbbe1f0ddc1ad8b474a588abe7e4293c0d0fc
3
+ metadata.gz: '08ccd70861b7d8fd9590fd9d544e3f7daefdb1b0'
4
+ data.tar.gz: 3b7cca27e154893572af8a4229563906b2db97d4
5
5
  SHA512:
6
- metadata.gz: 954fddea3bcc0464add1a165797eea6d9da7eab41d245e0b77d64cabf32b0d518c3a55da3f8ab8e592f70c3e32469af7e718c6b3e03038fbaaa4a79702d40a2f
7
- data.tar.gz: c2fa906e27d3008b11de207023ac5ded0e2e202d7c9f1408e57f38f06ead004b03d45033674a42d4ec072ad94a8631c0d81c8f7ee80168c347fe11179c6b578e
6
+ metadata.gz: 28057f8fc95de5ae959ad65e781ed2f95796b0c5aeddc040b10d10287375bd518da235b4698a6330329e3dae8f662e95f5d78a057d65601dbed8841dc647de1e
7
+ data.tar.gz: 29ad9918306ff5043244c509b7185efa8cea73cdec468eb595213be0a562e377ec4e8da94fb64339eaefc8fdb46191e63207f60f36ac3935ac8ace349d45852f
@@ -1,5 +1,4 @@
1
1
  module ConfigTemplates::Errors
2
- class EngineNotFound < RuntimeError; end
3
2
  class StageNotFound < RuntimeError; end
4
3
  class InvalidTemplate < RuntimeError; end
5
4
  end
@@ -8,7 +8,9 @@ module ConfigTemplates::Models
8
8
  end
9
9
 
10
10
  def validate!
11
- @template.validator.validate! render
11
+ unless @template.validator.valid? render
12
+ raise ::ConfigTemplates::Errors::InvalidTemplate, @template.path
13
+ end
12
14
  end
13
15
 
14
16
  def render
@@ -1,5 +1,7 @@
1
1
  module ConfigTemplates::Models
2
2
  class Template
3
+ attr_reader :path
4
+
3
5
  def initialize(path)
4
6
  @path = path
5
7
  @config = ::ConfigTemplates.config
@@ -1,7 +1,6 @@
1
1
  module ConfigTemplates::Repositories
2
2
  class Validators
3
3
  def initialize
4
- @default = ::ConfigTemplates::Validators::Composite.new
5
4
  @validators = {}
6
5
  end
7
6
 
@@ -11,7 +10,7 @@ module ConfigTemplates::Repositories
11
10
 
12
11
  def find_by_file_name(file_name)
13
12
  ::ConfigTemplates::Validators::Composite.new(
14
- *find_all_by(::ConfigTemplates::Criteria::Name.new(file_name))
13
+ find_all_by ::ConfigTemplates::Criteria::Name.new file_name
15
14
  )
16
15
  end
17
16
 
@@ -1,11 +1,13 @@
1
1
  module ConfigTemplates::Validators
2
2
  class Composite
3
- def initialize(*validators)
3
+ def initialize(validators)
4
4
  @validators = validators
5
5
  end
6
6
 
7
- def validate!(result)
8
- @validators.each { |validator| validator.validate! result }
7
+ def valid?(view)
8
+ @validators.inject(true) do |result, validator|
9
+ result && validator.valid?(view)
10
+ end
9
11
  end
10
12
  end
11
13
  end
@@ -1,3 +1,3 @@
1
1
  module ConfigTemplates
2
- VERSION = '0.0.5'.freeze
2
+ VERSION = '0.0.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - g.ivanov