jeckyl 0.2.7 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Bugs.rdoc +14 -2
- data/Gemfile +4 -2
- data/History.txt +36 -1
- data/bin/jeckyl +89 -57
- data/bin/jeckyl-old +259 -0
- data/lib/jeckyl/helpers.rb +316 -0
- data/lib/jeckyl/version.rb +9 -8
- data/lib/jeckyl.rb +178 -251
- data/spec/jeckyl_spec.rb +25 -1
- data/test/conf.d/jeckyl +11 -2
- data/test/conf.d/jeckyl_alt.rb +55 -0
- data/test/conf.d/merger.rb +1 -1
- data/test/conf.d/not_a_hash +1 -1
- data/test/conf.d/not_positive.rb +1 -0
- data/test/test_command +42 -0
- data/test/test_configurator.rb +39 -5
- metadata +58 -78
data/test/conf.d/not_a_hash
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
option_set "string"
|
@@ -0,0 +1 @@
|
|
1
|
+
offset -235
|
data/test/test_command
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby18
|
2
|
+
#
|
3
|
+
#
|
4
|
+
#
|
5
|
+
# = Test Jeckyl option parsing
|
6
|
+
#
|
7
|
+
# == SubTitle
|
8
|
+
#
|
9
|
+
# Author:: Robert Sharp
|
10
|
+
# Copyright:: Copyright (c) 2011 Robert Sharp
|
11
|
+
# License:: Open Software Licence v3.0
|
12
|
+
#
|
13
|
+
# This software is licensed for use under the Open Software Licence v. 3.0
|
14
|
+
# The terms of this licence can be found at http://www.opensource.org/licenses/osl-3.0.php
|
15
|
+
# and in the file copyright.txt. Under the terms of this licence, all derivative works
|
16
|
+
# must themselves be licensed under the Open Software Licence v. 3.0
|
17
|
+
#
|
18
|
+
#
|
19
|
+
#
|
20
|
+
|
21
|
+
$LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__))
|
22
|
+
|
23
|
+
require 'jeckyl'
|
24
|
+
require './test/test_configurator'
|
25
|
+
|
26
|
+
cdir = File.dirname(__FILE__)
|
27
|
+
conf_file = File.join(cdir, 'conf.d', 'jeckyl')
|
28
|
+
|
29
|
+
args, conf_file = TestJeckyl.get_config_opt(ARGV, conf_file)
|
30
|
+
|
31
|
+
options = TestJeckyl.new(conf_file)
|
32
|
+
|
33
|
+
# options._options.each do |key, opts|
|
34
|
+
# puts key.to_s + ':' + opts.join(', ')
|
35
|
+
# end
|
36
|
+
|
37
|
+
unless options.optparse(args)
|
38
|
+
exit 0
|
39
|
+
end
|
40
|
+
|
41
|
+
puts "Options are:"
|
42
|
+
options.to_s
|
data/test/test_configurator.rb
CHANGED
@@ -20,40 +20,74 @@ class TestJeckyl < Jeckyl::Options
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def set_log_dir(path)
|
23
|
+
describe 'Directory for log files'
|
23
24
|
default '/tmp'
|
24
|
-
comment "
|
25
|
+
comment "Writable directory where the app can keep log files"
|
26
|
+
|
27
|
+
option '-l', '--log-dir [PATH]', String
|
28
|
+
|
25
29
|
a_writable_dir(path)
|
26
30
|
end
|
27
31
|
|
28
32
|
def set_key_file(path)
|
29
|
-
|
33
|
+
describe "key file to be used to check secure commands"
|
34
|
+
|
35
|
+
option '-k', '--key-file [PATH]', String
|
30
36
|
a_readable_file(path)
|
31
37
|
end
|
32
38
|
|
33
39
|
def set_log_level(symb)
|
34
40
|
default :verbose
|
41
|
+
|
42
|
+
describe 'Applications logging level'
|
35
43
|
comment "Log level can one of the following:",
|
36
44
|
"",
|
37
45
|
" * :system - log all important messages and use syslog",
|
38
46
|
" * :verbose - be more generous with logging to help resolve problems"
|
47
|
+
|
39
48
|
symbol_set = [:system, :verbose, :debug]
|
49
|
+
|
50
|
+
option '-L', '--level [SYMBOL]', symbol_set
|
51
|
+
|
40
52
|
a_member_of(symb, symbol_set)
|
41
53
|
end
|
42
54
|
|
43
55
|
def set_log_rotation(val)
|
44
56
|
default 5
|
45
|
-
a_type_of(val, Integer)
|
46
|
-
|
57
|
+
a_number(val) && a_type_of(val, Integer) && in_range(val, 0, 20)
|
58
|
+
return val
|
47
59
|
end
|
48
60
|
|
49
61
|
def set_threshold(val)
|
62
|
+
describe "Threshold for things"
|
50
63
|
default 5.0
|
64
|
+
|
65
|
+
option '-T', '--threshold [NUMBER]', Numeric
|
66
|
+
|
51
67
|
# make sure it is a number
|
52
68
|
a_type_of(val, Numeric)
|
53
69
|
# now make sure it is a float
|
54
70
|
in_range(val.to_f, 0.0, 10.0)
|
55
71
|
|
56
72
|
end
|
73
|
+
|
74
|
+
def set_start_day(day)
|
75
|
+
describe "Day of the week to start from"
|
76
|
+
default 5
|
77
|
+
comment "Can be any number from 1 to 7"
|
78
|
+
|
79
|
+
a_number(day) && in_range(day, 1, 7)
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
def set_offset(ofs)
|
84
|
+
describe "Offset from today to previous record"
|
85
|
+
default 1
|
86
|
+
comment "days from today to study"
|
87
|
+
|
88
|
+
a_positive_number(ofs)
|
89
|
+
|
90
|
+
end
|
57
91
|
|
58
92
|
def set_pi(val)
|
59
93
|
default 3.14
|
@@ -80,7 +114,7 @@ class TestJeckyl < Jeckyl::Options
|
|
80
114
|
an_array_of(ary, Integer)
|
81
115
|
end
|
82
116
|
|
83
|
-
def
|
117
|
+
def set_option_set(opts)
|
84
118
|
default Hash.new
|
85
119
|
a_hash(opts)
|
86
120
|
end
|
metadata
CHANGED
@@ -1,72 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jeckyl
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 7
|
10
|
-
version: 0.2.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.7
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Dr Robert
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
11
|
+
date: 2013-09-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: !binary |-
|
15
|
+
b3B0cGx1cw==
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - !binary |-
|
19
|
+
Pj0=
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: !binary |-
|
22
|
+
MC4wLjY=
|
21
23
|
type: :runtime
|
22
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 3
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
31
|
-
name: thor
|
32
|
-
version_requirements: *id001
|
33
24
|
prerelease: false
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
from a simple config file written in Ruby, having run whatever checks you want on the file to ensure
|
51
|
-
the values passed in are valid. All you need to do is define a class inheriting from Jeckyl, methods for
|
52
|
-
each parameter, its default, whatever checking rules are appropriate and even a comment for generating templates etc.
|
53
|
-
This is then used to parse a Ruby config file and create the parameters hash. Jeckyl
|
54
|
-
comes complete with a utility to check a config file against a given class and to generate a default file for you to tailor.
|
55
|
-
Type 'jeckyl readme' for more information.
|
56
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - !binary |-
|
28
|
+
Pj0=
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: !binary |-
|
31
|
+
MC4wLjY=
|
32
|
+
description: ! "Create and manage configuration files in Ruby for Ruby. Jeckyl can
|
33
|
+
be used to create a parameters hash \nfrom a simple config file written in Ruby,
|
34
|
+
having run whatever checks you want on the file to ensure \nthe values passed in
|
35
|
+
are valid. All you need to do is define a class inheriting from Jeckyl, methods
|
36
|
+
for\neach parameter, its default, whatever checking rules are appropriate and even
|
37
|
+
a comment for generating templates etc.\nThis is then used to parse a Ruby config
|
38
|
+
file and create the parameters hash. Jeckyl \ncomes complete with a utility to check
|
39
|
+
a config file against a given class and to generate a default file for you to tailor.\nType
|
40
|
+
'jeckyl readme' for more information.\n"
|
57
41
|
email: robert@osburn-sharp.ath.cx
|
58
|
-
executables:
|
42
|
+
executables:
|
43
|
+
- jeckyl-old
|
59
44
|
- jeckyl
|
60
45
|
extensions: []
|
61
|
-
|
62
|
-
extra_rdoc_files:
|
46
|
+
extra_rdoc_files:
|
63
47
|
- History.txt
|
64
48
|
- Bugs.rdoc
|
65
49
|
- Intro.txt
|
66
50
|
- LICENCE.rdoc
|
67
51
|
- Gemfile
|
68
52
|
- README.md
|
69
|
-
files:
|
53
|
+
files:
|
70
54
|
- History.txt
|
71
55
|
- Bugs.rdoc
|
72
56
|
- Intro.txt
|
@@ -75,7 +59,9 @@ files:
|
|
75
59
|
- README.md
|
76
60
|
- lib/jeckyl/errors.rb
|
77
61
|
- lib/jeckyl/version.rb
|
62
|
+
- lib/jeckyl/helpers.rb
|
78
63
|
- lib/jeckyl.rb
|
64
|
+
- bin/jeckyl-old
|
79
65
|
- bin/jeckyl
|
80
66
|
- spec/check_config_spec.rb
|
81
67
|
- spec/jeckyl_spec.rb
|
@@ -105,44 +91,38 @@ files:
|
|
105
91
|
- test/conf.d/defaults.rb
|
106
92
|
- test/conf.d/bclass.rb
|
107
93
|
- test/conf.d/merger.rb
|
94
|
+
- test/conf.d/not_positive.rb
|
95
|
+
- test/conf.d/jeckyl_alt.rb
|
108
96
|
- test/reports/not_ok.txt
|
109
97
|
- test/reports/ok.txt
|
110
98
|
- test/test_configurator.rb
|
111
99
|
- test/test_configurator_errors.rb
|
112
100
|
- test/test_class.rb
|
113
101
|
- test/test_subclass.rb
|
114
|
-
|
115
|
-
|
102
|
+
- test/test_command
|
103
|
+
homepage: ''
|
104
|
+
licenses:
|
116
105
|
- Open Software Licence v3.0
|
106
|
+
metadata: {}
|
117
107
|
post_install_message: Jeckyl is now installed. Type 'jeckyl' for help
|
118
|
-
rdoc_options:
|
108
|
+
rdoc_options:
|
119
109
|
- --main=README.rdoc
|
120
|
-
require_paths:
|
110
|
+
require_paths:
|
121
111
|
- lib
|
122
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
none: false
|
133
|
-
requirements:
|
134
|
-
- - ">="
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
hash: 3
|
137
|
-
segments:
|
138
|
-
- 0
|
139
|
-
version: "0"
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
140
122
|
requirements: []
|
141
|
-
|
142
123
|
rubyforge_project:
|
143
|
-
rubygems_version:
|
124
|
+
rubygems_version: 2.0.7
|
144
125
|
signing_key:
|
145
|
-
specification_version:
|
126
|
+
specification_version: 4
|
146
127
|
summary: Create and manage configuration files in Ruby for Ruby.
|
147
128
|
test_files: []
|
148
|
-
|