configstruct 0.0.3 → 0.0.4

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: 6b3f5a41063b4236fde2d985b2c2b539a402af1f
4
- data.tar.gz: a58aece0b159e578e5a6086a608e0dea0069c159
3
+ metadata.gz: d65d2c8e268ef10541747c3aefaf9cc24d750e54
4
+ data.tar.gz: 37d8459de43f1f92e99b19ff502b07f837e6e9e2
5
5
  SHA512:
6
- metadata.gz: fc7749c11156bfe3fb8f2bb2d5cb40e65ffed089805b2d6491e8997790f8dfeb1874cb5d5ae8c72298c65d96a55b1611488e6948e2cb11d185e6e31c6dedc23f
7
- data.tar.gz: 273c166288cffa59f75b1f9cc1b0475cb61d751efe45e9f8e9999622abe129c16e427f63a947c063fd9362c1a1cc5fd8d1afdfe99bcb49b6862c00190f0ff9f4
6
+ metadata.gz: fcfb7686bdaba07dee5bc8179d808e22279bbdd2b6fdf131ec6b366257deed5a1a35a4fb97a4600d4208c73e0fe8c6c518838990cdfb73833afbb2195de542b3
7
+ data.tar.gz: c5a5a5eb499e8fd56ff4295664708573c7620c7da1c01659ddd9d5adbc1baf4a68bc4c31f6f88f99733a83d89ca904139d93d84710482d8b960dc921c72996b2
data/CHANGELOG.md CHANGED
@@ -1,19 +1,20 @@
1
1
  ConfigStruct Changelog
2
2
  =======================
3
3
 
4
- v0.0.3 - 2014-06-01
4
+ v0.0.4 - 2014-08-19
5
5
  -----------------------
6
+ - add a furth params at init for conductig the behaviour of overriding values from options provided
6
7
 
8
+ v0.0.3 - 2014-06-01
9
+ -----------------------
7
10
  - add StringIO override for purpose of being used on setup and testing
8
11
 
9
12
  v0.0.2 - 2014-05-31
10
13
  -----------------------
11
-
12
14
  - fix the name of the lib file
13
15
 
14
16
  v0.0.1 - 2014-05-31
15
17
  -----------------------
16
-
17
18
  - basic test coverage
18
19
  - base structure
19
20
 
data/README.md CHANGED
@@ -2,6 +2,7 @@ Configstruct
2
2
  =============
3
3
 
4
4
  [![Gem Version](https://img.shields.io/gem/v/configstruct.svg)](http://rubygems.org/gems/configstruct)
5
+ [![Downloads](http://img.shields.io/gem/dt/configstruct.svg)](https://rubygems.org/gems/configstruct)
5
6
  [![Build Status](https://img.shields.io/travis/mose/configstruct.svg)](https://travis-ci.org/mose/configstruct)
6
7
  [![Coverage Status](https://img.shields.io/coveralls/mose/configstruct.svg)](https://coveralls.io/r/mose/configstruct?branch=master)
7
8
  [![Dependency Status](https://img.shields.io/gemnasium/mose/configstruct.svg)](https://gemnasium.com/mose/configstruct)
data/lib/configstruct.rb CHANGED
@@ -3,10 +3,11 @@ require 'yaml'
3
3
 
4
4
  class ConfigStruct < OpenStruct
5
5
 
6
- def initialize(options = nil, input = STDIN, output = STDOUT)
6
+ def initialize(options = nil, input = STDIN, output = STDOUT, unless_set = false)
7
7
  super(options)
8
8
  @input = input
9
9
  @output = output
10
+ @unless_set = unless_set
10
11
  set_defaults
11
12
  prepare_dirs
12
13
  addvalues
@@ -24,8 +25,10 @@ class ConfigStruct < OpenStruct
24
25
  def addvalues
25
26
  setup unless File.exist? self.basefile
26
27
  YAML.load_file(self.basefile).each do |k, v|
27
- new_ostruct_member(k)
28
- send("#{k}=", v)
28
+ unless @unless_set && defined? self[v]
29
+ new_ostruct_member(k)
30
+ send("#{k}=", v)
31
+ end
29
32
  end
30
33
  end
31
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configstruct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - mose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-31 00:00:00.000000000 Z
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler