configtoolkit 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/FAQ.txt +113 -25
  2. data/Hash.txt +128 -0
  3. data/History.txt +45 -2
  4. data/KeyValue.txt +235 -0
  5. data/Manifest.txt +66 -4
  6. data/README.txt +666 -202
  7. data/Rakefile +3 -5
  8. data/Ruby.txt +172 -0
  9. data/YAML.txt +188 -0
  10. data/examples/hash_example.rb +71 -0
  11. data/examples/key_value_example.dump.cfg +5 -0
  12. data/examples/key_value_example.normal1.cfg +20 -0
  13. data/examples/key_value_example.normal2.cfg +15 -0
  14. data/examples/key_value_example.rb +72 -0
  15. data/examples/key_value_example.wacky.cfg +13 -0
  16. data/examples/load_example.rb +32 -0
  17. data/examples/load_example.yaml +34 -0
  18. data/examples/load_group_example.rb +28 -0
  19. data/examples/load_group_example.yaml +33 -0
  20. data/examples/machineconfig.rb +77 -0
  21. data/examples/ruby_example.rb +32 -0
  22. data/examples/ruby_example.rcfg +52 -0
  23. data/examples/usage_example.rb +93 -0
  24. data/examples/yaml_example.dump.yaml +12 -0
  25. data/examples/yaml_example.rb +48 -0
  26. data/examples/yaml_example.yaml +59 -0
  27. data/lib/configtoolkit.rb +1 -1
  28. data/lib/configtoolkit/baseconfig.rb +522 -418
  29. data/lib/configtoolkit/hasharrayvisitor.rb +242 -0
  30. data/lib/configtoolkit/hashreader.rb +41 -0
  31. data/lib/configtoolkit/hashwriter.rb +45 -0
  32. data/lib/configtoolkit/keyvalueconfig.rb +105 -0
  33. data/lib/configtoolkit/keyvaluereader.rb +597 -0
  34. data/lib/configtoolkit/keyvaluewriter.rb +157 -0
  35. data/lib/configtoolkit/prettyprintwriter.rb +167 -0
  36. data/lib/configtoolkit/reader.rb +62 -0
  37. data/lib/configtoolkit/rubyreader.rb +270 -0
  38. data/lib/configtoolkit/types.rb +42 -26
  39. data/lib/configtoolkit/writer.rb +116 -0
  40. data/lib/configtoolkit/yamlreader.rb +10 -6
  41. data/lib/configtoolkit/yamlwriter.rb +113 -71
  42. data/test/bad_array_index.rcfg +1 -0
  43. data/test/bad_containing_object_assignment.rcfg +2 -0
  44. data/test/bad_directive.cfg +1 -0
  45. data/test/bad_include1.cfg +2 -0
  46. data/test/bad_include2.cfg +3 -0
  47. data/test/bad_parameter_reference.rcfg +1 -0
  48. data/test/contained_sample.cfg +10 -0
  49. data/test/contained_sample.pretty_print +30 -0
  50. data/test/contained_sample.rcfg +22 -0
  51. data/test/contained_sample.yaml +22 -21
  52. data/test/containers.cfg +6 -0
  53. data/test/exta_string_after_container.cfg +2 -0
  54. data/test/extra_container_closing.cfg +2 -0
  55. data/test/extra_string_after_container.cfg +2 -0
  56. data/test/extra_string_after_nested_container.cfg +1 -0
  57. data/test/missing_array_closing.cfg +2 -0
  58. data/test/missing_array_element.cfg +2 -0
  59. data/test/missing_directive.cfg +1 -0
  60. data/test/missing_hash_closing.cfg +2 -0
  61. data/test/missing_hash_element.cfg +2 -0
  62. data/test/missing_hash_value.cfg +1 -0
  63. data/test/missing_include_argument.cfg +1 -0
  64. data/test/missing_key_value_delimiter.cfg +1 -0
  65. data/test/readerwritertest.rb +28 -7
  66. data/test/sample.cfg +10 -0
  67. data/test/sample.pretty_print +30 -0
  68. data/test/sample.rcfg +26 -0
  69. data/test/test_baseconfig.rb +152 -38
  70. data/test/test_hash.rb +82 -0
  71. data/test/test_keyvalue.rb +185 -0
  72. data/test/test_prettyprint.rb +28 -0
  73. data/test/test_ruby.rb +50 -0
  74. data/test/test_yaml.rb +33 -26
  75. data/test/wacky_sample1.cfg +16 -0
  76. data/test/wacky_sample2.cfg +5 -0
  77. data/test/wacky_sample3.cfg +4 -0
  78. data/test/wacky_sample4.cfg +1 -0
  79. metadata +101 -10
  80. data/lib/configtoolkit/toolkit.rb +0 -20
  81. data/test/common.rb +0 -5
@@ -0,0 +1,16 @@
1
+ ;;
2
+ ;; This file is meant to stress test the keyvaluereader's ability to
3
+ ;; deal with "odd" key-value formats. In particular, this file uses
4
+ ;; unusual strings to open and close arrays ( ( and |) and hashes (+ and -)
5
+ ;; and unusual key-value delimiter (:), and unusual comment prefix (;;),
6
+ ;; and an unusual directive prefix (#).
7
+ ;; Part of the configuration information alos
8
+ ;; is included. The contents, however, are identical to those of sample.cfg.
9
+ ;;
10
+
11
+ ##include wacky_sample2.cfg
12
+
13
+ req_symbol:> sample_symbol2
14
+ opt_integer :>56
15
+
16
+ ##include wacky_sample3.cfg
@@ -0,0 +1,5 @@
1
+ req_integer:> 6
2
+ req_big_integer:> 90000000000
3
+ req_float:> 3.14
4
+ req_string:> sample string2
5
+ req_boolean:> true
@@ -0,0 +1,4 @@
1
+ req_pathname:> /usr/designingpatterns/bin
2
+ req_uri:> http://blogs.designingpatterns.com
3
+
4
+ ##include wacky_sample4.cfg
@@ -0,0 +1 @@
1
+ nested_config:> +req_nested_integer >>>> 34, req_nested_array >>>> (+req_second_nested_pathname >>>> /usr/designingpatterns/Applications/pattmake, req_second_nested_array >>>> (6, 20|-, +req_second_nested_pathname >>>> /usr, req_second_nested_array >>>> (205, 206, |-|, -
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configtoolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DesigningPatterns
@@ -9,19 +9,40 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-21 00:00:00 -04:00
12
+ date: 2008-07-14 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: relative
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: assertions
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ version:
15
35
  - !ruby/object:Gem::Dependency
16
36
  name: hoe
37
+ type: :development
17
38
  version_requirement:
18
39
  version_requirements: !ruby/object:Gem::Requirement
19
40
  requirements:
20
41
  - - ">="
21
42
  - !ruby/object:Gem::Version
22
- version: 1.5.1
43
+ version: 1.7.0
23
44
  version:
24
- description: "This package makes sourcing information from configuration files robust and easy! It: * Allows programmers to specify the type of data that should be loaded from a configuration file. The toolkit automatically will validate the file's data against this specification when loading the file, ensuring that the specification always is obeyed and saving the programmer the tedious chore of writing validation code. * Automagically generates parameter accessor methods, an equality operator, and a to_s method from the configuration's specification. * Allows programmers to create configuration files, easily and programatically. * Provides classes that can load from and dump to different kinds of configuration files. * Is very extensible, allowing the engine to be used with custom format configuration files and with custom data validation rules."
45
+ description: "This package makes sourcing information from configuration files robust and easy! It: * Allows programmers to specify the type of data that should be loaded from a configuration file. The toolkit automatically will validate the file's data against this specification when loading the file, ensuring that the specification always is obeyed and saving the programmer the tedious chore of writing validation code. * Automagically generates parameter accessor methods (getters, setters, and predicates to test for presence), an equality operator, and a +to_s+ method from the configuration's specification. * Allows programmers to create configuration files, easily and programatically. * Provides a class that can load Ruby configuration files (allowing the full power of Ruby to be used within configuration files). * Provides classes that can load from and dump to YAML and key-value configuration files. * Provides classes that can load from and dump to Hashes. * Is very extensible, allowing the engine to be used with custom format configuration files and with custom data validation rules."
25
46
  email:
26
47
  - technical.inquiries@designingpatterns.com
27
48
  executables: []
@@ -30,25 +51,62 @@ extensions: []
30
51
 
31
52
  extra_rdoc_files:
32
53
  - Manifest.txt
33
- - README.txt
34
54
  - History.txt
35
55
  - FAQ.txt
56
+ - Hash.txt
57
+ - KeyValue.txt
58
+ - README.txt
59
+ - Ruby.txt
60
+ - YAML.txt
36
61
  files:
37
62
  - Manifest.txt
38
63
  - LICENSE
39
- - README.txt
40
64
  - History.txt
41
- - Rakefile
42
65
  - FAQ.txt
66
+ - Hash.txt
67
+ - KeyValue.txt
68
+ - README.txt
69
+ - Ruby.txt
70
+ - YAML.txt
71
+ - Rakefile
72
+ - examples/hash_example.rb
73
+ - examples/key_value_example.rb
74
+ - examples/load_example.rb
75
+ - examples/load_group_example.rb
76
+ - examples/machineconfig.rb
77
+ - examples/ruby_example.rb
78
+ - examples/usage_example.rb
79
+ - examples/yaml_example.rb
80
+ - examples/load_example.yaml
81
+ - examples/load_group_example.yaml
82
+ - examples/yaml_example.dump.yaml
83
+ - examples/yaml_example.yaml
84
+ - examples/key_value_example.dump.cfg
85
+ - examples/key_value_example.normal1.cfg
86
+ - examples/key_value_example.normal2.cfg
87
+ - examples/key_value_example.wacky.cfg
88
+ - examples/ruby_example.rcfg
43
89
  - lib/configtoolkit.rb
44
90
  - lib/configtoolkit/baseconfig.rb
45
- - lib/configtoolkit/toolkit.rb
91
+ - lib/configtoolkit/hasharrayvisitor.rb
92
+ - lib/configtoolkit/hashreader.rb
93
+ - lib/configtoolkit/hashwriter.rb
94
+ - lib/configtoolkit/keyvalueconfig.rb
95
+ - lib/configtoolkit/keyvaluereader.rb
96
+ - lib/configtoolkit/keyvaluewriter.rb
97
+ - lib/configtoolkit/prettyprintwriter.rb
98
+ - lib/configtoolkit/reader.rb
99
+ - lib/configtoolkit/rubyreader.rb
46
100
  - lib/configtoolkit/types.rb
101
+ - lib/configtoolkit/writer.rb
47
102
  - lib/configtoolkit/yamlreader.rb
48
103
  - lib/configtoolkit/yamlwriter.rb
49
- - test/common.rb
50
104
  - test/readerwritertest.rb
51
105
  - test/test_baseconfig.rb
106
+ - test/test_hash.rb
107
+ - test/test_keyvalue.rb
108
+ - test/test_prettyprint.rb
109
+ - test/test_ruby.rb
52
110
  - test/test_yaml.rb
53
111
  - test/bad_config.yaml
54
112
  - test/contained_sample.yaml
@@ -57,6 +115,35 @@ files:
57
115
  - test/sample.ruby_yaml_classes.yaml
58
116
  - test/sample.standard_yaml_classes.yaml
59
117
  - test/webserver.yaml
118
+ - test/bad_directive.cfg
119
+ - test/bad_include1.cfg
120
+ - test/bad_include2.cfg
121
+ - test/contained_sample.cfg
122
+ - test/containers.cfg
123
+ - test/exta_string_after_container.cfg
124
+ - test/extra_container_closing.cfg
125
+ - test/extra_string_after_container.cfg
126
+ - test/extra_string_after_nested_container.cfg
127
+ - test/missing_array_closing.cfg
128
+ - test/missing_array_element.cfg
129
+ - test/missing_directive.cfg
130
+ - test/missing_hash_closing.cfg
131
+ - test/missing_hash_element.cfg
132
+ - test/missing_hash_value.cfg
133
+ - test/missing_include_argument.cfg
134
+ - test/missing_key_value_delimiter.cfg
135
+ - test/sample.cfg
136
+ - test/wacky_sample1.cfg
137
+ - test/wacky_sample2.cfg
138
+ - test/wacky_sample3.cfg
139
+ - test/wacky_sample4.cfg
140
+ - test/contained_sample.pretty_print
141
+ - test/sample.pretty_print
142
+ - test/bad_array_index.rcfg
143
+ - test/bad_containing_object_assignment.rcfg
144
+ - test/bad_parameter_reference.rcfg
145
+ - test/contained_sample.rcfg
146
+ - test/sample.rcfg
60
147
  has_rdoc: true
61
148
  homepage: "Project Page: http://rubyforge.org/projects/configtoolkit/"
62
149
  post_install_message:
@@ -80,10 +167,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
167
  requirements: []
81
168
 
82
169
  rubyforge_project: configtoolkit
83
- rubygems_version: 1.0.1
170
+ rubygems_version: 1.2.0
84
171
  signing_key:
85
172
  specification_version: 2
86
173
  summary: "This package makes sourcing information from configuration files robust and easy! It: * Allows programmers to specify the type of data that should be loaded from a configuration file"
87
174
  test_files:
88
175
  - test/test_baseconfig.rb
176
+ - test/test_ruby.rb
89
177
  - test/test_yaml.rb
178
+ - test/test_keyvalue.rb
179
+ - test/test_prettyprint.rb
180
+ - test/test_hash.rb
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- module ConfigToolkit
3
-
4
- #
5
- # All exceptions thrown from the ConfigToolkit descend from
6
- # this one; while right now it is the only exception thrown
7
- # from the ConfigToolkit, at some point, an exception class hierarchy
8
- # rooted in this class might be developed.
9
- #
10
- class Error < RuntimeError; end
11
-
12
- end
13
-
14
- #
15
- # Load up the files necessary to specify a config.
16
- # Users will need to load explicitly whichever readers
17
- # and writers they wish to use.
18
- #
19
- require 'configtoolkit/types'
20
- require 'configtoolkit/baseconfig'
data/test/common.rb DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- def get_test_config_file_name(config_file_base_name)
4
- return (Pathname.new(__FILE__).dirname() + config_file_base_name).to_s()
5
- end