config_templates 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5de2246c3e82a63bc34895e45b8a985ff1150745
4
- data.tar.gz: 8282e90119c9857e119e8a0d73c3134f46a0171c
3
+ metadata.gz: 7c1b9ff19c62bfefb3c61fd89ef48b2ff3a5feb6
4
+ data.tar.gz: 7725b602720e3a34611bdc7b586c65951a6afa04
5
5
  SHA512:
6
- metadata.gz: 9b4e153ab13492fe3a75954fab318987d91ce2f23ceffddac93eabc22e2d4bf76ae1eee43052ee5188e67f0e7dcefc172843298e01fe922b405f5a8e592f1c33
7
- data.tar.gz: d973e1a75bdf5457420d68a0c5f6448e82709c1450d4d17c52b0a4f7e2a3a027ea141113158fecf3f00f924099013838d11c0907646bd0b4441de3020a5e97cf
6
+ metadata.gz: 94394e6eacd587051745ebd22e0c565f0239e00c2061b419e686c9723ae63f1e39db6f858476b01bed3ac7adaad3337827b97b7757917d14549ab0c7c80604e4
7
+ data.tar.gz: a93028e855f6bb058aec60e4b23da977ad106926eda030b531d35dbef45a76d31a423d069b74cb5f92a5285d7fa0f305e7d56a185d73e161f1d7ba062936c207
data/lib/autoload.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'erb'
1
2
  require 'yaml'
2
3
  require 'fileutils'
3
4
 
@@ -2,7 +2,8 @@ module ConfigTemplates
2
2
  class Config
3
3
  attr_accessor :templates_path, :destination_path
4
4
  attr_accessor :settings_path, :settings_file_basename
5
- attr_accessor :stage, :stages
5
+ attr_accessor :stages
6
+ attr_reader :stage
6
7
 
7
8
  def initialize
8
9
  @stages = []
@@ -11,6 +12,14 @@ module ConfigTemplates
11
12
  @validators = ::ConfigTemplates::Repositories::Validators.new
12
13
  end
13
14
 
15
+ def stage=(stage)
16
+ if stages.include? stage
17
+ @stage = stage
18
+ else
19
+ raise ConfigTemplates::Errors::StageNotFound, stage.to_s
20
+ end
21
+ end
22
+
14
23
  def output(name)
15
24
  @outputs.find_by_name name
16
25
  end
@@ -6,7 +6,7 @@ module ConfigTemplates::Repositories
6
6
 
7
7
  def find_all
8
8
  @find_all ||= @locator.settings.reduce({}) {
9
- |result, current| result.merge ::YAML.load_file current
9
+ |result, current| result.merge ::YAML.load_file current, Hash.new
10
10
  }
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module ConfigTemplates
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -7,8 +7,8 @@ RSpec.configure do |spec|
7
7
  config.destination_path = 'spec/fixtures/dest'
8
8
  config.settings_path = 'spec/fixtures/settings'
9
9
  config.settings_file_basename = 'settings'
10
- config.stage = :production
11
10
  config.stages = %i[production prerel staging]
11
+ config.stage = :production
12
12
  end
13
13
  end
14
14
  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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - g.ivanov