dry-config 1.1.4 → 1.1.5

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: 2e5ef4a6ae7ca95ba67b4727fe8137765874464f
4
- data.tar.gz: 90bf572de240fd4250dd88353fed2be01b4b6bde
3
+ metadata.gz: 57e17a37431eca1d416d3f705de04658b83af1e4
4
+ data.tar.gz: 7d3230539c67e2553b1d99ec3c024731343fe2b4
5
5
  SHA512:
6
- metadata.gz: db019775409ec7a2f0aa72a47f903c8dbe25d40a4f77b6af9af3b466c701ba73c2bb642c1eabfe96a9daf8be55061a7d4298eac7998de1c96591ae0d5570cbca
7
- data.tar.gz: 44db43c679ec43e5187f773fe90cbad3e76baeb0c4809d9737268894125bd1255fe284fd41ecf09d0ce3dcd105a6e10adef7cb822b6de728381fe35c7d4167ea
6
+ metadata.gz: 48353a58ebf50df00f8fa270b4677bd801db7e8e696ba732a0a55957e71a3df1a2dced1c0dfd054a85c83634c79f1753727d668d0c77908b75d4f157d33bf6da
7
+ data.tar.gz: 62d67cde7a472be113751c2bba1464b5fa570264fdae4934f88b954c289e603f94ebe6d1cfd0b0d3f30ac834345c3d5ca6ae0d9872377f52ed32ce5e3e5599f8
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 2.2.2
5
+ - ruby-head
6
+ - jruby-head
7
+
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: ruby-head
11
+ - rvm: jruby-head
12
+
13
+ script: rake
data/README.md CHANGED
@@ -1,10 +1,16 @@
1
1
  # dry-config
2
+ [![Gem Version](https://badge.fury.io/rb/elastic-beanstalk.svg)](https://rubygems.org/gems/dry-config)
3
+ [![Build Status](https://travis-ci.org/rosskevin/sms-spec.svg)](https://travis-ci.org/alienfast/dry-config)
4
+ [![Code Climate](https://codeclimate.com/github/rosskevin/sms-spec/badges/gpa.svg)](https://codeclimate.com/github/alienfast/dry-config)
2
5
 
3
- Simple base class for DRY configurations configurations that can be loaded from multiple overriding yml files.
6
+
7
+ Simple base class for DRY inheritable configurations that can be loaded from multiple overriding yml files.
4
8
 
5
9
  Sample uses include environment based e.g. `development, test, production` and multi-domain white label configurations.
6
10
 
7
11
  A programmatic seed configuration may be specified, as well as the ability to load one to many overriding configuration files.
12
+
13
+ Results may be re-written to an output file, useful for compiling static files for other processes such as `docker-compose.yml`.
8
14
 
9
15
  The [elastic-beanstalk gem](https://github.com/alienfast/elastic-beanstalk) is a real world example that utilized `Dry::Config::Base`.
10
16
 
@@ -22,7 +28,8 @@ Or install it yourself as:
22
28
 
23
29
  $ gem install dry-config
24
30
 
25
- ## Usage
31
+ ## Example 1: environment inheritance
32
+ The following example shows a single file where environments will override base level settings. `dry-config` is useful for simple, to multi-file, multi-environmet settings.
26
33
 
27
34
  ### Step 1. Write a config class
28
35
  Note this sample uses the `Singleton` pattern, which is useful but not required.
@@ -105,12 +112,15 @@ config.title # Acme Holdings, LLC
105
112
  config.strategy # :blue_green,
106
113
  config.options[:'aws:autoscaling:launchconfiguration'][:InstanceType] # t1.large
107
114
  ```
108
-
109
- ## Other options
110
- - Expected environments are `[:development, :test, :staging, :production]`. Expand or redefine `@potential_environments` these by overriding the `#initialize` or doing so in your optional `#seed_default_configuration`. This is used in the used in the overlay pruning process to prevent unused branches of configuration from showing up in the resolved configuration.
111
- - An optional `#seed_default_configuration` allows you to provide a configuration base
112
- - `#clear` will restore to the seed configuration, allowing you to `#load!` new settings.
115
+ ## Example 2: Multi-file White Label sample
113
116
 
117
+ ```ruby
118
+ class WhiteLabelConfig < Dry::Config::Base
119
+ end
120
+
121
+ config = WhiteLabelConfig.new
122
+ config.load!(nil, 'base.yml', 'acme.com.yml', 'scheduling.acme.com.yml')
123
+ ```
114
124
  ## ENV Interpolation/substitution/expansion
115
125
 
116
126
  ENV variable substitution is supported and enabled by default. It may be disabled by initializing with `{interpolation: false}`.
@@ -126,17 +136,12 @@ interpolations:
126
136
  # mixed example
127
137
  - ~/docker/mysql/${PROJECT_NAME}-${BUILD}:/var/lib/mysql:rw
128
138
  ```
139
+
140
+ ## Options
141
+ - Expected environments are `[:development, :test, :staging, :production]`. Expand or redefine `@potential_environments` these by overriding the `#initialize` or doing so in your optional `#seed_default_configuration`. This is used in the used in the overlay pruning process to prevent unused branches of configuration from showing up in the resolved configuration.
142
+ - An optional `#seed_default_configuration` allows you to provide a configuration base
143
+ - `#clear` will restore to the seed configuration, allowing you to `#load!` new settings.
129
144
 
130
- ## White Label sample
131
-
132
- ```ruby
133
- class WhiteLabelConfig < Dry::Config::Base
134
- end
135
-
136
- config = WhiteLabelConfig.new
137
- config.load!(nil, 'base.yml', 'acme.com.yml', 'scheduling.acme.com.yml')
138
- ```
139
-
140
145
  ## Contributing
141
146
 
142
147
  1. Fork it
@@ -18,7 +18,7 @@ module Dry
18
18
  attr_reader :filenames
19
19
 
20
20
  def initialize(options = {})
21
- @options = {interpolation: true}.merge options
21
+ @options = {interpolation: true, symbolize: true}.merge options
22
22
 
23
23
  seed_default_configuration
24
24
 
@@ -105,7 +105,7 @@ module Dry
105
105
  config = Psych.load(contents, filename)
106
106
 
107
107
  raise "Failed to load #{filename}" if config.nil?
108
- config.deep_symbolize
108
+ config.deep_symbolize if @options[:symbolize]
109
109
  end
110
110
 
111
111
  def write_yaml_file(filename)
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Config
3
- VERSION = '1.1.4'
3
+ VERSION = '1.1.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ross
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-07 00:00:00.000000000 Z
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,6 +63,7 @@ files:
63
63
  - ".rspec"
64
64
  - ".ruby-gemset"
65
65
  - ".ruby-version"
66
+ - ".travis.yml"
66
67
  - Gemfile
67
68
  - LICENSE.txt
68
69
  - README.md