confoog 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/confoog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03e5600044abd0fc00bb781bee5878dcd6a21479
|
4
|
+
data.tar.gz: 78b2266b15d7044c203f131c40ca118898304a6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba228a7eeae514b5291843a859803250af10b66b65c7a0e22af137c134a028dc2467bc875d0edbb2d56889dbf99498124e31d5b1f1880f72902a541b1b767adf
|
7
|
+
data.tar.gz: 37ddcc921c41d06c2a64a8d5b1a02e187459fc17eb2d6cbebcdcf3bbd312e81839b01c60de546af511fdc34863ecf06e883141ef046154a834a942f22a5848b9
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Confoog
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/confoog.svg)](http://badge.fury.io/rb/confoog)
|
2
3
|
[![Build Status](https://travis-ci.org/seapagan/confoog.svg)](https://travis-ci.org/seapagan/confoog)
|
3
4
|
[![Dependency Status](https://gemnasium.com/seapagan/confoog.svg)](https://gemnasium.com/seapagan/confoog)
|
4
5
|
[![Coverage Status](https://coveralls.io/repos/seapagan/confoog/badge.svg?branch=master&service=github)](https://coveralls.io/github/seapagan/confoog?branch=master)
|
@@ -29,6 +30,7 @@ Or install it yourself as:
|
|
29
30
|
|
30
31
|
## Usage
|
31
32
|
Currently Confoog will not allow 'nested' configuration types, however each variable can be an array or hash so multiple settings can be recorded for each variable and accessed (for a hash) by `settings[variable][hash_key]` or array using `settings[array].each`. In other words, treat the return from `settings[var]` as the type it contains. See examples below.
|
33
|
+
|
32
34
|
```ruby
|
33
35
|
require 'confoog'
|
34
36
|
|
@@ -59,11 +61,14 @@ settings.save # save all current parameters to the YAML file
|
|
59
61
|
|
60
62
|
settings.load # load the settings from YAML file.
|
61
63
|
```
|
64
|
+
|
62
65
|
Confoog will take several parameters on creation, to specify the default config file and location. For example :
|
63
66
|
```ruby
|
64
67
|
settings = Confoog::Settings.new(location: '/home/myuser', filename: '.foo-settings')
|
65
68
|
```
|
69
|
+
|
66
70
|
There are other optional flags or variables that can be passed on creation:
|
71
|
+
|
67
72
|
```ruby
|
68
73
|
# Should a missing configuration file be created or not
|
69
74
|
create_file: true | false
|
@@ -75,6 +80,7 @@ prefix: 'My Application'
|
|
75
80
|
quiet: true | false
|
76
81
|
```
|
77
82
|
If these are not specified, Confoog will use the following defaults :
|
83
|
+
|
78
84
|
```ruby
|
79
85
|
location: '~/'
|
80
86
|
filename: '.confoog'
|
@@ -84,6 +90,7 @@ quiet: false
|
|
84
90
|
```
|
85
91
|
|
86
92
|
Confoog will set the following error constants which will be returned in the `.status['errors']` variable as needed :
|
93
|
+
|
87
94
|
```ruby
|
88
95
|
ERR_NO_ERROR = 0 # no error condition, command was succesfull
|
89
96
|
ERR_FILE_NOT_EXIST = 1 # specified configuration file does not exist
|
@@ -96,6 +103,7 @@ ERR_NOT_LOADING_EMPTY_FILE = 32 # not atempting to load an empty config file
|
|
96
103
|
INFO_FILE_CREATED = 256 # Information - specified file was created
|
97
104
|
INFO_FILE_LOADED = 512 # Information - Config file was loaded successfully
|
98
105
|
```
|
106
|
+
|
99
107
|
These are generally to do with existence and creation of configuration files.
|
100
108
|
|
101
109
|
## To Do
|
data/lib/confoog/version.rb
CHANGED