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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81ec77ff9a1cd8a233bb54f1efdfc75c71c71484
4
- data.tar.gz: 8bcdc84ef266ce9f9bd7cece30d98626ef8a6c34
3
+ metadata.gz: f7ea32bbb44fdac4553d98301cf1746ad6a93173
4
+ data.tar.gz: 9d8a92d7ebbcabd06763d027227e6644bb5e1879
5
5
  SHA512:
6
- metadata.gz: f1b469e7ab0fd62f7ef2b1c64371bacd282ce63ea88eb3e7cba171be0b34326390dcd4c1b8986ee1071e43e7d252abddb54971bbbc3385558f4d1c507ad32c14
7
- data.tar.gz: a7bb409ec43d023304c765ae9f069c36e4908bfbaad553a2857ff3bf72c0d4774cfcdee1c30b1f0404783c3e8412d3ccf5d94e14b5e3fc68ab282f56570a9c77
6
+ metadata.gz: 8e11b394f644facae1798e6225514b5a917efb571afa4a48595fe99093b1aaf3035aeaa6665102c837dff6a1e25ec60994e06265623e3cf09fbf99d25bf5f83a
7
+ data.tar.gz: acbe142409720d525055959bc01901bf957d704808d4a3b62299830467afe0cdfae38c428bfbe9d39a490bb67104e18aff49a12f207c8b6c831fd6ff0b04352b
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  .token
11
+ .remote-sync.json
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ - 2.1
4
5
  - 2.2.3
5
6
  before_install: gem install bundler -v 1.10.6
data/README.md CHANGED
@@ -29,9 +29,9 @@ Or install it yourself as:
29
29
  $ gem install confoog
30
30
 
31
31
  ## Usage
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.
32
+ Very basic usage is as below. For full documentation, see the [Confoog Web Site][confoog]
33
33
 
34
- By default, each time a configuration variable is created or changed the file on disk will be updated with this addition or change. If you intend to make a lot of consecutive changes or do not want the small performance hit of this, pass `autosave: false` as a parameter to #new, or set it false using the #autosave accessor.
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
@@ -28,4 +28,4 @@ else
28
28
  end
29
29
  end
30
30
 
31
- task default: [:rubocop, :inch, :reek, :spec]
31
+ task default: [:rubocop, :inch, :reek, :spec, :build]
@@ -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'
@@ -1,5 +1,5 @@
1
1
  # Define the Gem version string
2
2
  module Confoog
3
3
  # http://semver.org/
4
- VERSION = '0.4.5'
4
+ VERSION = '0.4.6'
5
5
  end
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.5
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-09-17 00:00:00.000000000 Z
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