jeckyl 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.md +11 -7
- data/bin/jeckyl +1 -1
- data/lib/jeckyl.rb +11 -3
- data/lib/jeckyl/version.rb +10 -8
- metadata +4 -4
data/History.txt
CHANGED
@@ -4,6 +4,12 @@
|
|
4
4
|
|
5
5
|
== History
|
6
6
|
|
7
|
+
[jeckyl-0.2.4 25-Oct-2012]
|
8
|
+
|
9
|
+
Deprecate ConfigRoot constant in favour of Jeckyl.config_dir, which will pick up
|
10
|
+
the environment variable JECKYL_CONFIG_DIR if set or use '/etc/jeckyl'. This is a
|
11
|
+
change from the old, quirky default of '/etc/jermine'.
|
12
|
+
|
7
13
|
[jeckyl-0.2.3 21-Sep-2012]
|
8
14
|
|
9
15
|
Add references to online docs etc to usage.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#JECKYL
|
2
2
|
|
3
|
-
|
3
|
+
(a.k.a. Jumpin' Ermin's Configurator for Kwick and easY Linux services)
|
4
4
|
|
5
5
|
Jeckyl can be used to create a parameters hash from a simple config file written in Ruby, having run whatever checks you want
|
6
6
|
on the file to ensure the values passed in are valid. All you need to do is define a class inheriting from Jeckyl, methods for
|
@@ -16,7 +16,11 @@ Jeckyl comes as a gem. It can be installed in the usual way:
|
|
16
16
|
|
17
17
|
gem install jeckyl
|
18
18
|
|
19
|
-
That is all you need to do.
|
19
|
+
That is all you need to do. Type 'jeckyl' to see usage and references to documentation.
|
20
|
+
|
21
|
+
Jeckyl can be used to set the default location for the config files it processes. This will
|
22
|
+
be '/etc/jeckyl' unless you set the environment varibale 'JECKYL_CONFIG_DIR' to something else.
|
23
|
+
This could be done on a system-wide basis by include a file with this variable in /etc/env.d.
|
20
24
|
|
21
25
|
## Getting Started
|
22
26
|
|
@@ -71,12 +75,12 @@ And then, to use this config file to create the options hash:
|
|
71
75
|
|
72
76
|
### Example Parameter Methods
|
73
77
|
|
74
|
-
Some examples of different parameters are given here, taken from the
|
75
|
-
a jazzed-up ruby logger:
|
78
|
+
Some examples of different parameters are given here, taken from the Jellog::Config class, [Jellog](https://github.com/osburn-sharp/jellog)
|
79
|
+
being a jazzed-up ruby logger:
|
76
80
|
|
77
81
|
def configure_log_level(lvl)
|
78
82
|
default :system
|
79
|
-
comment "Controls the amount of logging done by
|
83
|
+
comment "Controls the amount of logging done by Jellog",
|
80
84
|
"",
|
81
85
|
" * :system - standard message, plus log to syslog",
|
82
86
|
" * :verbose - more generous logging to help resolve problems",
|
@@ -208,12 +212,12 @@ all of the parameters from a hash that belong to a given Jeckyl class, use Class
|
|
208
212
|
{Jeckyl::Config.intersection}). And to remove all of the parameters from one config hash in another,
|
209
213
|
use conf.complement(hash) ({Jeckyl::Config#complement}).
|
210
214
|
|
211
|
-
For example, the
|
215
|
+
For example, the Jellog logger defines a set of logging parameters in Jellog::Config. These may be inherited
|
212
216
|
by another service that adds its own parameters (such as Jerbil):
|
213
217
|
|
214
218
|
options = Jerbil::Config.new(my_conf)
|
215
219
|
|
216
|
-
log_opts =
|
220
|
+
log_opts = Jellog::Config.intersection(options)
|
217
221
|
|
218
222
|
jerb_opts = options.complement(log_opts)
|
219
223
|
|
data/bin/jeckyl
CHANGED
@@ -197,7 +197,7 @@ EOTXT
|
|
197
197
|
puts "The following parameters are defined in {#{my_class.name}} and should be used"
|
198
198
|
puts "in a configuration file. A default config file can be generated using:"
|
199
199
|
puts ""
|
200
|
-
puts " jeckyl config #{
|
200
|
+
puts " jeckyl config #{cfile}"
|
201
201
|
else
|
202
202
|
puts "## Additional Parameters from #{my_class.name}"
|
203
203
|
puts ""
|
data/lib/jeckyl.rb
CHANGED
@@ -20,7 +20,15 @@ require 'jeckyl/errors'
|
|
20
20
|
module Jeckyl
|
21
21
|
|
22
22
|
#default location for all config files
|
23
|
-
|
23
|
+
# @deprecated Use {Jeckyl.config_dir} instead
|
24
|
+
ConfigRoot = '/etc/jeckyl'
|
25
|
+
|
26
|
+
# the default system location for jeckyl config file
|
27
|
+
#
|
28
|
+
# This location can be set with the environment variable JECKYL_CONFIG_DIR
|
29
|
+
def Jeckyl.config_dir
|
30
|
+
ENV['JECKYL_CONFIG_DIR'] || '/etc/jeckyl'
|
31
|
+
end
|
24
32
|
|
25
33
|
# This is the main Jeckyl class from which to create specific application
|
26
34
|
# classes. For example, to create a new set of parameters, define a class as
|
@@ -178,7 +186,7 @@ module Jeckyl
|
|
178
186
|
# and it can be an instance of Jeckyl::Config or a hash
|
179
187
|
# @return [Hash] containing all of the intersecting parameters
|
180
188
|
#
|
181
|
-
#
|
189
|
+
# @note this returns a plain hash and not an instance of Jeckyl::Config
|
182
190
|
#
|
183
191
|
def self.intersection(full_config)
|
184
192
|
me = self.new # create the defaults for this class
|
@@ -236,7 +244,7 @@ module Jeckyl
|
|
236
244
|
|
237
245
|
self[:config_files] << conf_file
|
238
246
|
|
239
|
-
#
|
247
|
+
# get the values from the config file itself
|
240
248
|
self.instance_eval(File.read(conf_file), conf_file)
|
241
249
|
|
242
250
|
rescue SyntaxError => err
|
data/lib/jeckyl/version.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
# Created by Jevoom
|
2
2
|
#
|
3
|
-
#
|
4
|
-
#
|
3
|
+
# 25-Oct-2012
|
4
|
+
# Deprecate ConfigRoot constant in favour of Jeckyl.config_dir, which will pick up
|
5
|
+
# the environment variable JECKYL_CONFIG_DIR if set or use '/etc/jeckyl'. This is a
|
6
|
+
# change from the old, quirky default of '/etc/jermine'.
|
5
7
|
|
6
8
|
module Jeckyl
|
7
|
-
# version set to 0.2.
|
8
|
-
Version = '0.2.
|
9
|
-
# date set to
|
10
|
-
Version_Date = '
|
11
|
-
#ident string set to: jeckyl-0.2.
|
12
|
-
Ident = 'jeckyl-0.2.
|
9
|
+
# version set to 0.2.4
|
10
|
+
Version = '0.2.4'
|
11
|
+
# date set to 25-Oct-2012
|
12
|
+
Version_Date = '25-Oct-2012'
|
13
|
+
#ident string set to: jeckyl-0.2.4 25-Oct-2012
|
14
|
+
Ident = 'jeckyl-0.2.4 25-Oct-2012'
|
13
15
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jeckyl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dr Robert
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-10-25 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|