confoog 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/README.md +3 -80
- data/Rakefile +1 -1
- data/confoog.gemspec +1 -0
- data/lib/confoog/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7ea32bbb44fdac4553d98301cf1746ad6a93173
|
4
|
+
data.tar.gz: 9d8a92d7ebbcabd06763d027227e6644bb5e1879
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e11b394f644facae1798e6225514b5a917efb571afa4a48595fe99093b1aaf3035aeaa6665102c837dff6a1e25ec60994e06265623e3cf09fbf99d25bf5f83a
|
7
|
+
data.tar.gz: acbe142409720d525055959bc01901bf957d704808d4a3b62299830467afe0cdfae38c428bfbe9d39a490bb67104e18aff49a12f207c8b6c831fd6ff0b04352b
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -29,9 +29,9 @@ Or install it yourself as:
|
|
29
29
|
$ gem install confoog
|
30
30
|
|
31
31
|
## Usage
|
32
|
-
|
32
|
+
Very basic usage is as below. For full documentation, see the [Confoog Web Site][confoog]
|
33
33
|
|
34
|
-
|
34
|
+
[confoog]: http://confoog.seapagan.net
|
35
35
|
|
36
36
|
```ruby
|
37
37
|
require 'confoog'
|
@@ -41,86 +41,8 @@ settings[:var] = value
|
|
41
41
|
settings[:array] = [1, 2, 3, 4]
|
42
42
|
settings[42] = "Meaning of life"
|
43
43
|
settings[:urls] = ["https://www.mywebsite.com", "https://www.anothersite.com/a/page.html"]
|
44
|
-
|
45
|
-
settings[:urls].each do |url|
|
46
|
-
puts url
|
47
|
-
end
|
48
|
-
# https://www.mywebsite.com
|
49
|
-
# https://www.anothersite.com/a/page.html
|
50
|
-
# => ["https://www.mywebsite.com", "https://www.anothersite.com/a/page.html"]
|
51
|
-
|
52
|
-
settings[:dont_exist]
|
53
|
-
# => nil
|
54
|
-
|
55
|
-
a_variable = 50
|
56
|
-
settings[a_variable] = {:one => "for the money", :two => "for the show", :three => "to get ready"}
|
57
|
-
settings[50]
|
58
|
-
# => {:one=>"for the money", :two=>"for the show", :three=>"to get ready"}
|
59
|
-
settings[50][:two]
|
60
|
-
# => "for the show"
|
61
|
-
|
62
|
-
settings.quiet = true # squelch any error or status messages to console
|
63
|
-
|
64
|
-
settings.autosave = false # disable autosave if it has been enabled with #new or #autosave
|
65
|
-
|
66
|
-
settings.save # save all current parameters to the YAML file
|
67
|
-
|
68
|
-
settings.load # load the settings from YAML file.
|
69
44
|
```
|
70
45
|
|
71
|
-
Confoog will take several parameters on creation, to specify the default config file and location. For example :
|
72
|
-
|
73
|
-
```ruby
|
74
|
-
settings = Confoog::Settings.new(location: '/home/myuser', filename: '.foo-settings')
|
75
|
-
```
|
76
|
-
|
77
|
-
There are other optional flags or variables that can be passed on creation:
|
78
|
-
|
79
|
-
```ruby
|
80
|
-
# Should a missing configuration file be created or not
|
81
|
-
create_file: true | false
|
82
|
-
|
83
|
-
# Specify an optional prefix before any error messages
|
84
|
-
prefix: 'My Application'
|
85
|
-
|
86
|
-
# Should we avoid outputting errors to the console? (ie in a GUI app)
|
87
|
-
quiet: true | false
|
88
|
-
|
89
|
-
# Should we automatically load the configuration file when the class is created?
|
90
|
-
autoload: true | false
|
91
|
-
|
92
|
-
# Should we automatically save the configuration file when a variable is created or changed?
|
93
|
-
autosave: true | false
|
94
|
-
```
|
95
|
-
If any of these are not specified, Confoog will use the following defaults :
|
96
|
-
|
97
|
-
```ruby
|
98
|
-
location: '~/'
|
99
|
-
filename: '.confoog'
|
100
|
-
create_file: false
|
101
|
-
prefix: 'Configuration'
|
102
|
-
quiet: false
|
103
|
-
autoload: false
|
104
|
-
autosave: true
|
105
|
-
```
|
106
|
-
|
107
|
-
Confoog will set the following error constants which will be returned in the `.status['errors']` variable as needed :
|
108
|
-
|
109
|
-
```ruby
|
110
|
-
ERR_NO_ERROR = 0 # no error condition, command was succesfull
|
111
|
-
ERR_FILE_NOT_EXIST = 1 # specified configuration file does not exist
|
112
|
-
ERR_CANT_CREATE_FILE = 2 # cannot create the requested configuration file
|
113
|
-
ERR_NOT_WRITING_EMPTY_FILE = 4 # not attempting to save an empty configuration
|
114
|
-
ERR_CANT_SAVE_CONFIGURATION = 8 # Failed to save the configuration file
|
115
|
-
ERR_NOT_LOADING_EMPTY_FILE = 16 # not atempting to load an empty config file
|
116
|
-
ERR_CANT_LOAD = 32 # Cannot load configuration data from file.
|
117
|
-
|
118
|
-
INFO_FILE_CREATED = 256 # Information - specified file was created
|
119
|
-
INFO_FILE_LOADED = 512 # Information - Config file was loaded successfully
|
120
|
-
```
|
121
|
-
|
122
|
-
These are generally to do with existence and creation of configuration files.
|
123
|
-
|
124
46
|
## To Do
|
125
47
|
|
126
48
|
Thoughts in no particular order.
|
@@ -131,6 +53,7 @@ Thoughts in no particular order.
|
|
131
53
|
- Check Windows compatibility, certainly at least the tests will fail since there are issue with FakeFS on Window. Should be ok as a production Gem though (TBC)
|
132
54
|
- Add other file formats for storing config - XML? (Yuk!)
|
133
55
|
- Document properly on a dedicated website with full example usage and help.
|
56
|
+
- Add an option to use a config file stored in the script directory, if existing, instead of the specified one. Will make developing of Gems and Apps using this a bit easier.
|
134
57
|
|
135
58
|
## Development
|
136
59
|
|
data/Rakefile
CHANGED
data/confoog.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency 'inch'
|
32
32
|
spec.add_development_dependency 'simplecov', '~> 0.10'
|
33
33
|
spec.add_development_dependency 'pullreview-coverage'
|
34
|
+
spec.add_development_dependency 'should_not'
|
34
35
|
|
35
36
|
# Depend on Ruby version
|
36
37
|
spec.add_development_dependency 'reek', '~> 3.3' if RUBY_VERSION > '2.0'
|
data/lib/confoog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confoog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seapagan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: should_not
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: reek
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|