cloud-templates 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +4 -0
  3. data/.rubocop.yml +1 -0
  4. data/Rakefile +1 -1
  5. data/bin/cloud-templates-runner.rb +5 -0
  6. data/cloud-templates.gemspec +9 -4
  7. data/examples/lib/user_directory.rb +0 -10
  8. data/examples/lib/user_directory/artifacts.rb +8 -0
  9. data/examples/lib/user_directory/artifacts/catalogized.rb +8 -7
  10. data/examples/lib/user_directory/artifacts/group.rb +27 -30
  11. data/examples/lib/user_directory/artifacts/ided.rb +8 -7
  12. data/examples/lib/user_directory/artifacts/organization.rb +10 -11
  13. data/examples/lib/user_directory/artifacts/pathed.rb +17 -17
  14. data/examples/lib/user_directory/artifacts/person.rb +20 -15
  15. data/examples/lib/user_directory/artifacts/team.rb +26 -21
  16. data/examples/lib/user_directory/artifacts/unit.rb +15 -17
  17. data/examples/lib/user_directory/artifacts/user.rb +26 -23
  18. data/examples/lib/user_directory/render.rb +8 -0
  19. data/examples/lib/user_directory/render/etc.rb +2 -0
  20. data/examples/lib/user_directory/render/etc/artifact_view.rb +2 -2
  21. data/examples/lib/user_directory/render/etc/composite_view.rb +1 -2
  22. data/examples/lib/user_directory/render/etc/group_view.rb +3 -3
  23. data/examples/lib/user_directory/render/etc/person_view.rb +2 -2
  24. data/examples/lib/user_directory/render/etc/registry.rb +4 -6
  25. data/examples/lib/user_directory/render/etc/user_view.rb +2 -3
  26. data/examples/lib/user_directory/render/ldap.rb +2 -0
  27. data/examples/lib/user_directory/render/ldap/artifact_view.rb +3 -4
  28. data/examples/lib/user_directory/render/ldap/composite_view.rb +3 -4
  29. data/examples/lib/user_directory/render/ldap/group_view.rb +3 -4
  30. data/examples/lib/user_directory/render/ldap/organization_view.rb +3 -4
  31. data/examples/lib/user_directory/render/ldap/person_view.rb +3 -4
  32. data/examples/lib/user_directory/render/ldap/registry.rb +3 -4
  33. data/examples/lib/user_directory/render/ldap/unit_view.rb +3 -4
  34. data/examples/lib/user_directory/render/ldap/user_view.rb +3 -4
  35. data/examples/lib/user_directory/utils.rb +1 -1
  36. data/examples/spec/user_directory_spec.rb +24 -25
  37. data/lib/aws/templates.rb +0 -8
  38. data/lib/aws/templates/artifact.rb +20 -12
  39. data/lib/aws/templates/cli.rb +14 -0
  40. data/lib/aws/templates/cli/formatter.rb +21 -0
  41. data/lib/aws/templates/cli/formatter/json.rb +20 -0
  42. data/lib/aws/templates/cli/interface.rb +92 -0
  43. data/lib/aws/templates/composite.rb +6 -9
  44. data/lib/aws/templates/exception.rb +8 -0
  45. data/lib/aws/templates/exception/nested_parameter_exception.rb +19 -0
  46. data/lib/aws/templates/exception/option_error.rb +14 -0
  47. data/lib/aws/templates/exception/option_scalar_on_the_way.rb +26 -0
  48. data/lib/aws/templates/exception/option_should_be_recursive.rb +20 -0
  49. data/lib/aws/templates/exception/option_value_deleted.rb +22 -0
  50. data/lib/aws/templates/exception/parameter_already_exist.rb +26 -0
  51. data/lib/aws/templates/exception/parameter_exception.rb +26 -0
  52. data/lib/aws/templates/exception/parameter_getter_is_not_defined.rb +23 -0
  53. data/lib/aws/templates/exception/parameter_method_name_conflict.rb +26 -0
  54. data/lib/aws/templates/exception/parameter_specification_is_invalid.rb +30 -0
  55. data/lib/aws/templates/exception/parameter_value_invalid.rb +37 -0
  56. data/lib/aws/templates/exception/parametrized_dsl_error.rb +14 -0
  57. data/lib/aws/templates/exception/view_not_found.rb +26 -0
  58. data/lib/aws/templates/help.rb +43 -0
  59. data/lib/aws/templates/help/aggregate.rb +74 -0
  60. data/lib/aws/templates/help/dsl.rb +30 -0
  61. data/lib/aws/templates/help/provider.rb +15 -0
  62. data/lib/aws/templates/help/rdoc.rb +105 -0
  63. data/lib/aws/templates/help/rdoc/artifact.rb +50 -0
  64. data/lib/aws/templates/help/rdoc/composite.rb +20 -0
  65. data/lib/aws/templates/help/rdoc/contextualized.rb +12 -0
  66. data/lib/aws/templates/help/rdoc/contextualized/filter.rb +19 -0
  67. data/lib/aws/templates/help/rdoc/contextualized/filters.rb +14 -0
  68. data/lib/aws/templates/help/rdoc/contextualized/filters/add.rb +21 -0
  69. data/lib/aws/templates/help/rdoc/contextualized/filters/chain.rb +33 -0
  70. data/lib/aws/templates/help/rdoc/contextualized/filters/copy.rb +23 -0
  71. data/lib/aws/templates/help/rdoc/contextualized/filters/identity.rb +23 -0
  72. data/lib/aws/templates/help/rdoc/contextualized/filters/override.rb +29 -0
  73. data/lib/aws/templates/help/rdoc/contextualized/filters/proxy.rb +28 -0
  74. data/lib/aws/templates/help/rdoc/contextualized/filters/recursive_schema_filter.rb +28 -0
  75. data/lib/aws/templates/help/rdoc/contextualized/filters/remove.rb +21 -0
  76. data/lib/aws/templates/help/rdoc/contextualized/filters/scoped.rb +29 -0
  77. data/lib/aws/templates/help/rdoc/contextualized/provider.rb +28 -0
  78. data/lib/aws/templates/help/rdoc/default.rb +12 -0
  79. data/lib/aws/templates/help/rdoc/default/definition.rb +89 -0
  80. data/lib/aws/templates/help/rdoc/default/provider.rb +25 -0
  81. data/lib/aws/templates/help/rdoc/dsl.rb +20 -0
  82. data/lib/aws/templates/help/rdoc/inheritable.rb +48 -0
  83. data/lib/aws/templates/help/rdoc/parametrized.rb +12 -0
  84. data/lib/aws/templates/help/rdoc/parametrized/constraint.rb +31 -0
  85. data/lib/aws/templates/help/rdoc/parametrized/constraints.rb +14 -0
  86. data/lib/aws/templates/help/rdoc/parametrized/constraints/all_of.rb +39 -0
  87. data/lib/aws/templates/help/rdoc/parametrized/constraints/condition.rb +44 -0
  88. data/lib/aws/templates/help/rdoc/parametrized/constraints/depends_on_value.rb +41 -0
  89. data/lib/aws/templates/help/rdoc/parametrized/constraints/enum.rb +33 -0
  90. data/lib/aws/templates/help/rdoc/parametrized/constraints/matches.rb +27 -0
  91. data/lib/aws/templates/help/rdoc/parametrized/constraints/not_nil.rb +27 -0
  92. data/lib/aws/templates/help/rdoc/parametrized/constraints/requires.rb +33 -0
  93. data/lib/aws/templates/help/rdoc/parametrized/constraints/satisfies_condition.rb +28 -0
  94. data/lib/aws/templates/help/rdoc/parametrized/getter.rb +17 -0
  95. data/lib/aws/templates/help/rdoc/parametrized/getters.rb +14 -0
  96. data/lib/aws/templates/help/rdoc/parametrized/nested.rb +32 -0
  97. data/lib/aws/templates/help/rdoc/parametrized/parameter.rb +55 -0
  98. data/lib/aws/templates/help/rdoc/parametrized/provider.rb +32 -0
  99. data/lib/aws/templates/help/rdoc/parametrized/transformation.rb +17 -0
  100. data/lib/aws/templates/help/rdoc/parametrized/transformations.rb +14 -0
  101. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_boolean.rb +25 -0
  102. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_chain.rb +34 -0
  103. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_hash.rb +40 -0
  104. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_integer.rb +26 -0
  105. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_list.rb +32 -0
  106. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_module.rb +25 -0
  107. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_object.rb +32 -0
  108. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_rendered.rb +28 -0
  109. data/lib/aws/templates/help/rdoc/parametrized/transformations/as_string.rb +25 -0
  110. data/lib/aws/templates/help/rdoc/provider.rb +20 -0
  111. data/lib/aws/templates/help/rdoc/routing.rb +104 -0
  112. data/lib/aws/templates/help/rdoc/texting.rb +42 -0
  113. data/lib/aws/templates/processor.rb +53 -0
  114. data/lib/aws/templates/processor/handler.rb +104 -0
  115. data/lib/aws/templates/processor/registry.rb +74 -0
  116. data/lib/aws/templates/processor/routing.rb +27 -0
  117. data/lib/aws/templates/render.rb +27 -25
  118. data/lib/aws/templates/render/basic_view.rb +47 -0
  119. data/lib/aws/templates/render/utils.rb +14 -0
  120. data/lib/aws/templates/render/utils/base_type_views.rb +12 -19
  121. data/lib/aws/templates/render/utils/inspect.rb +2 -4
  122. data/lib/aws/templates/render/utils/stringify.rb +2 -5
  123. data/lib/aws/templates/render/view.rb +3 -100
  124. data/lib/aws/templates/utils.rb +39 -15
  125. data/lib/aws/templates/utils/artifact_storage.rb +2 -3
  126. data/lib/aws/templates/utils/{named.rb → as_named.rb} +2 -3
  127. data/lib/aws/templates/utils/autoload.rb +224 -0
  128. data/lib/aws/templates/utils/contextualized.rb +8 -17
  129. data/lib/aws/templates/utils/contextualized/filter.rb +62 -0
  130. data/lib/aws/templates/utils/contextualized/filter/add.rb +67 -0
  131. data/lib/aws/templates/utils/contextualized/filter/chain.rb +56 -0
  132. data/lib/aws/templates/utils/contextualized/filter/copy.rb +38 -0
  133. data/lib/aws/templates/utils/contextualized/filter/dsl.rb +50 -0
  134. data/lib/aws/templates/utils/contextualized/filter/identity.rb +45 -0
  135. data/lib/aws/templates/utils/contextualized/filter/override.rb +62 -0
  136. data/lib/aws/templates/utils/contextualized/filter/proxy.rb +29 -0
  137. data/lib/aws/templates/utils/contextualized/filter/recursive_schema_filter.rb +46 -0
  138. data/lib/aws/templates/utils/contextualized/filter/remove.rb +66 -0
  139. data/lib/aws/templates/utils/contextualized/filter/scoped.rb +42 -0
  140. data/lib/aws/templates/utils/contextualized/refinements.rb +51 -0
  141. data/lib/aws/templates/utils/default.rb +258 -50
  142. data/lib/aws/templates/utils/dependency.rb +7 -6
  143. data/lib/aws/templates/utils/dependency/refinements.rb +80 -0
  144. data/lib/aws/templates/utils/dependent.rb +6 -3
  145. data/lib/aws/templates/utils/guarded.rb +30 -0
  146. data/lib/aws/templates/utils/inheritable.rb +21 -16
  147. data/lib/aws/templates/utils/inspectable.rb +4 -4
  148. data/lib/aws/templates/utils/late_bound.rb +2 -2
  149. data/lib/aws/templates/utils/memoized.rb +2 -0
  150. data/lib/aws/templates/utils/options.rb +49 -35
  151. data/lib/aws/templates/utils/parametrized.rb +32 -25
  152. data/lib/aws/templates/utils/parametrized/constraint.rb +95 -0
  153. data/lib/aws/templates/utils/parametrized/constraint/all_of.rb +51 -0
  154. data/lib/aws/templates/utils/parametrized/constraint/condition.rb +93 -0
  155. data/lib/aws/templates/utils/parametrized/constraint/depends_on_value.rb +60 -0
  156. data/lib/aws/templates/utils/parametrized/constraint/dsl.rb +86 -0
  157. data/lib/aws/templates/utils/parametrized/constraint/enum.rb +45 -0
  158. data/lib/aws/templates/utils/parametrized/constraint/matches.rb +44 -0
  159. data/lib/aws/templates/utils/parametrized/constraint/not_nil.rb +38 -0
  160. data/lib/aws/templates/utils/parametrized/constraint/requires.rb +54 -0
  161. data/lib/aws/templates/utils/parametrized/constraint/satisfies_condition.rb +55 -0
  162. data/lib/aws/templates/utils/parametrized/getter.rb +67 -0
  163. data/lib/aws/templates/utils/parametrized/getter/as_instance_variable.rb +41 -0
  164. data/lib/aws/templates/utils/parametrized/getter/as_is.rb +37 -0
  165. data/lib/aws/templates/utils/parametrized/getter/dsl.rb +62 -0
  166. data/lib/aws/templates/utils/parametrized/getter/one_of.rb +48 -0
  167. data/lib/aws/templates/utils/parametrized/getter/path.rb +53 -0
  168. data/lib/aws/templates/utils/parametrized/getter/value.rb +50 -0
  169. data/lib/aws/templates/utils/parametrized/nested.rb +9 -16
  170. data/lib/aws/templates/utils/parametrized/transformation.rb +74 -0
  171. data/lib/aws/templates/utils/parametrized/transformation/as_boolean.rb +42 -0
  172. data/lib/aws/templates/utils/parametrized/transformation/as_chain.rb +57 -0
  173. data/lib/aws/templates/utils/parametrized/transformation/as_hash.rb +89 -0
  174. data/lib/aws/templates/utils/parametrized/transformation/as_integer.rb +39 -0
  175. data/lib/aws/templates/utils/parametrized/transformation/as_list.rb +97 -0
  176. data/lib/aws/templates/utils/parametrized/transformation/as_module.rb +42 -0
  177. data/lib/aws/templates/utils/parametrized/transformation/as_object.rb +76 -0
  178. data/lib/aws/templates/utils/parametrized/transformation/as_rendered.rb +100 -0
  179. data/lib/aws/templates/utils/parametrized/transformation/as_string.rb +39 -0
  180. data/lib/aws/templates/utils/parametrized/transformation/dsl.rb +94 -0
  181. data/lib/aws/templates/utils/recursive.rb +22 -0
  182. data/spec/aws/templates/artifact_spec.rb +10 -10
  183. data/spec/aws/templates/cli_spec.rb +83 -0
  184. data/spec/aws/templates/composite_spec.rb +6 -4
  185. data/spec/aws/templates/help/rdoc/artifact_spec.rb +94 -0
  186. data/spec/aws/templates/help/rdoc/composite_spec.rb +53 -0
  187. data/spec/aws/templates/help/rdoc/parametrized/constraints/all_of_spec.rb +17 -0
  188. data/spec/aws/templates/help/rdoc/parametrized/constraints/depends_on_value_spec.rb +21 -0
  189. data/spec/aws/templates/help/rdoc/parametrized/constraints/enum_spec.rb +17 -0
  190. data/spec/aws/templates/help/rdoc/parametrized/constraints/matches_spec.rb +17 -0
  191. data/spec/aws/templates/help/rdoc/parametrized/constraints/satisfies_condition_spec.rb +17 -0
  192. data/spec/aws/templates/help/rdoc/parametrized/transformations/as_boolean_spec.rb +17 -0
  193. data/spec/aws/templates/help/rdoc/parametrized/transformations/as_chain_spec.rb +17 -0
  194. data/spec/aws/templates/help/rdoc/parametrized/transformations/as_hash_spec.rb +72 -0
  195. data/spec/aws/templates/help/rdoc/parametrized/transformations/as_integer_spec.rb +17 -0
  196. data/spec/aws/templates/help/rdoc/parametrized/transformations/as_list_spec.rb +39 -0
  197. data/spec/aws/templates/help/rdoc/parametrized/transformations/as_module_spec.rb +17 -0
  198. data/spec/aws/templates/help/rdoc/parametrized/transformations/as_object_spec.rb +38 -0
  199. data/spec/aws/templates/help/rdoc/parametrized/transformations/as_rendered_spec.rb +17 -0
  200. data/spec/aws/templates/render/utils/base_type_views_spec.rb +9 -11
  201. data/spec/aws/templates/render_spec.rb +1 -1
  202. data/spec/aws/templates/utils/as_named_spec.rb +0 -2
  203. data/spec/aws/templates/utils/autoload_spec.rb +14 -0
  204. data/spec/aws/templates/utils/contextualized_spec.rb +5 -5
  205. data/spec/aws/templates/utils/late_bound_spec.rb +2 -2
  206. data/spec/aws/templates/utils/parametrized/constraint_spec.rb +8 -10
  207. data/spec/aws/templates/utils/parametrized/getters_spec.rb +6 -7
  208. data/spec/aws/templates/utils/parametrized/transformation_spec.rb +3 -6
  209. data/spec/aws/templates/utils/parametrized_spec.rb +9 -10
  210. data/spec/aws/templates/utils_spec.rb +18 -0
  211. data/spec/test_empty/stuff.rb +4 -0
  212. data/spec/test_empty/stuff/here/test.rb +9 -0
  213. metadata +235 -19
  214. data/lib/aws/templates/exceptions.rb +0 -221
  215. data/lib/aws/templates/render/registry.rb +0 -60
  216. data/lib/aws/templates/utils/contextualized/filters.rb +0 -437
  217. data/lib/aws/templates/utils/contextualized/hash.rb +0 -13
  218. data/lib/aws/templates/utils/contextualized/nil.rb +0 -13
  219. data/lib/aws/templates/utils/contextualized/proc.rb +0 -13
  220. data/lib/aws/templates/utils/dependency/enumerable.rb +0 -13
  221. data/lib/aws/templates/utils/dependency/object.rb +0 -46
  222. data/lib/aws/templates/utils/parametrized/constraints.rb +0 -423
  223. data/lib/aws/templates/utils/parametrized/getters.rb +0 -293
  224. data/lib/aws/templates/utils/parametrized/guarded.rb +0 -32
  225. data/lib/aws/templates/utils/parametrized/transformations.rb +0 -652
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 836e106f34778808188ac4200dd45f36a91f675d
4
- data.tar.gz: 505466ae879f3544b9a9577e57798691c9f5131a
3
+ metadata.gz: 2e79b5e16e0041b5dc5ce674b487ad99077202e3
4
+ data.tar.gz: 1a54e4739bcda03d6177f985825cb2d437bdd2a0
5
5
  SHA512:
6
- metadata.gz: ae62c2f030a6f5262f565953dd0f4329cddfe70f53e7ac882061bd6ed10074741b397325d89053f13e30b9cf73712d20e4d8b1d6878c1ca65338c5718cb56f37
7
- data.tar.gz: c8c4f1f13b841e2d0c597875349c60d149bc1227f7a13ee838dbc263ad59226c0406843aafe4a2d60bd29dd863e999d8f604b447a8ab624b00553a2447da8a47
6
+ metadata.gz: b1577a1a9cf08220075c7ca19a6369344247c11a020245a12c03043376d630ed53e3ca12707e39015b747c5aab8dad1efdd6afe60d61f34678019822fe34b89e
7
+ data.tar.gz: c31af02860e9fa33552136daf75787ccbdbb932a50f3df72b6c1ff6ac38fa80dc7469207909a455db3ae21d5336b813d7e89a205574dc086d1de1290c90add7c
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format progress
3
+ -r spec_helper
4
+ -I./lib
data/.rubocop.yml CHANGED
@@ -13,6 +13,7 @@ Style/Documentation:
13
13
  Exclude:
14
14
  - 'spec/**/*'
15
15
  - 'test/**/*'
16
+
16
17
  Metrics/BlockLength:
17
18
  ExcludedMethods:
18
19
  - class_scope
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  desc 'Check code notation'
12
12
  RuboCop::RakeTask.new(:lint) do |task|
13
- task.patterns = ['lib/**/*.rb', 'spec/**/*.rb', 'examples/lib/**/*.rb', 'examples/spec/**/*.rb']
13
+ task.patterns = ['lib/**/*.rb', 'spec/**/*.rb', 'examples/lib/**/*.rb', 'examples/spec/**/*.rb', 'bin/**/*.rb']
14
14
  task.formatters += ['html']
15
15
  task.options += [
16
16
  '--fail-level', 'convention',
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'aws/templates/utils'
4
+
5
+ Aws::Templates::Cli.start
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cloud-templates'
3
- s.version = '0.2.0'
3
+ s.version = '0.3.0'
4
4
  s.license = 'Apache 2.0'
5
5
  s.summary = 'Hierarchical data templates'
6
6
  s.description = 'MVC-based templating framework for hierarchical data structures. ' \
@@ -13,13 +13,18 @@ Gem::Specification.new do |s|
13
13
  Dir['examples/**/*'] +
14
14
  [
15
15
  'LICENSE', 'Gemfile', 'NOTICE', 'README.md', 'Rakefile',
16
- '.rubocop.yml', '.simplecov', 'cloud-templates.gemspec'
16
+ '.rubocop.yml', '.simplecov', 'cloud-templates.gemspec',
17
+ '.rspec'
17
18
  ]
19
+ s.executables << 'cloud-templates-runner.rb'
18
20
  s.test_files = Dir['spec/**/*'] + Dir['examples/spec/**/*']
19
21
  s.homepage = 'https://rubygems.org/gems/cloud-templates'
20
- s.required_ruby_version = Gem::Requirement.new(">= 2.1.0")
22
+ s.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
23
+ s.add_dependency('facets', '>=3.0', '~> 3')
24
+ s.add_dependency('concurrent-ruby', '>=1.0.4', '~>1.0')
25
+ s.add_dependency('thor', '>=0.20.0', '~>0.20')
21
26
  s.add_development_dependency('rspec', '>= 3.2', '~> 3')
22
- s.add_development_dependency('rubocop', '~> 0.46')
27
+ s.add_development_dependency('rubocop', '~> 0.50')
23
28
  s.add_development_dependency('rubocop-rspec', '~> 1.17')
24
29
  s.add_development_dependency('byebug', '>= 9.0.5', '~> 9')
25
30
  s.add_development_dependency('yard', '~> 0.9')
@@ -1,13 +1,3 @@
1
- require 'user_directory/artifacts/user'
2
- require 'user_directory/artifacts/person'
3
- require 'user_directory/artifacts/group'
4
- require 'user_directory/artifacts/unit'
5
- require 'user_directory/artifacts/team'
6
- require 'user_directory/artifacts/organization'
7
-
8
- require 'user_directory/render/etc'
9
- require 'user_directory/render/ldap'
10
-
11
1
  ##
12
2
  # Example implementation of catalog
13
3
  #
@@ -0,0 +1,8 @@
1
+ require 'aws/templates/utils'
2
+
3
+ module UserDirectory
4
+ ##
5
+ # Namespace for models of organization
6
+ module Artifacts
7
+ end
8
+ end
@@ -1,11 +1,12 @@
1
- require 'aws/templates/utils/parametrized'
2
- require 'aws/templates/utils/parametrized/constraints'
1
+ require 'aws/templates/utils'
3
2
 
4
3
  module UserDirectory
5
- ##
6
- # Parameter mixin containing universal catalog entry fields
7
- module Catalogized
8
- include Aws::Templates::Utils::Parametrized
9
- parameter :dn, description: 'Object distinguished name', constraint: not_nil
4
+ module Artifacts
5
+ ##
6
+ # Parameter mixin containing universal catalog entry fields
7
+ module Catalogized
8
+ include Aws::Templates::Utils::Parametrized
9
+ parameter :dn, description: 'Object distinguished name', constraint: not_nil
10
+ end
10
11
  end
11
12
  end
@@ -1,37 +1,34 @@
1
- require 'aws/templates/artifact'
2
- require 'aws/templates/utils/parametrized/constraints'
3
- require 'aws/templates/utils/parametrized/transformations'
4
- require 'user_directory/artifacts/ided'
5
- require 'user_directory/artifacts/catalogized'
6
- require 'user_directory/artifacts/pathed'
1
+ require 'aws/templates/utils'
7
2
 
8
3
  module UserDirectory
9
- ##
10
- # POSIX Group
11
- class Group < Aws::Templates::Artifact
12
- include IDed
13
- include Catalogized
4
+ module Artifacts
5
+ ##
6
+ # POSIX Group
7
+ class Group < Aws::Templates::Artifact
8
+ include Artifacts::Ided
9
+ include Artifacts::Catalogized
14
10
 
15
- default dn: proc { "cn=#{name},ou=System,#{organization.dn}" },
16
- cn: proc { name }
11
+ default dn: proc { "cn=#{name},ou=System,#{organization.dn}" },
12
+ cn: proc { name }
17
13
 
18
- parameter :cn, description: 'Group canonical name', constraint: not_nil
19
- parameter :name, description: 'Group name'
20
- parameter :organization,
21
- description: 'Organization object',
22
- constraint: not_nil,
23
- transform: as_object(Catalogized)
24
- parameter :members,
25
- description: 'Group members list',
26
- transform: as_list(
27
- name: :member,
28
- description: 'Member in the group',
14
+ parameter :cn, description: 'Group canonical name', constraint: not_nil
15
+ parameter :name, description: 'Group name'
16
+ parameter :organization,
17
+ description: 'Organization object',
29
18
  constraint: not_nil,
30
- transform: as_object do
31
- parameter :login,
32
- description: 'User login',
33
- constraint: not_nil
34
- end
35
- )
19
+ transform: as_object(Artifacts::Catalogized)
20
+ parameter :members,
21
+ description: 'Group members list',
22
+ transform: as_list(
23
+ name: :member,
24
+ description: 'Member in the group',
25
+ constraint: not_nil,
26
+ transform: as_object do
27
+ parameter :login,
28
+ description: 'User login',
29
+ constraint: not_nil
30
+ end
31
+ )
32
+ end
36
33
  end
37
34
  end
@@ -1,11 +1,12 @@
1
- require 'aws/templates/utils/parametrized'
2
- require 'aws/templates/utils/parametrized/constraints'
1
+ require 'aws/templates/utils'
3
2
 
4
3
  module UserDirectory
5
- ##
6
- # Parameter mixin containing universal parameters for indexed objects
7
- module IDed
8
- include Aws::Templates::Utils::Parametrized
9
- parameter :id, description: 'Object ID', constraint: not_nil
4
+ module Artifacts
5
+ ##
6
+ # Parameter mixin containing universal parameters for indexed objects
7
+ module Ided
8
+ include Aws::Templates::Utils::Parametrized
9
+ parameter :id, description: 'Object ID', constraint: not_nil
10
+ end
10
11
  end
11
12
  end
@@ -1,17 +1,16 @@
1
- require 'aws/templates/composite'
2
- require 'aws/templates/utils/parametrized'
3
- require 'aws/templates/utils/parametrized/constraints'
4
- require 'user_directory/artifacts/catalogized'
1
+ require 'aws/templates/utils'
5
2
 
6
3
  module UserDirectory
7
- ##
8
- # Catalog's organization
9
- class Organization < Aws::Templates::Composite
10
- include Catalogized
4
+ module Artifacts
5
+ ##
6
+ # Catalog's organization
7
+ class Organization < Aws::Templates::Composite
8
+ include Artifacts::Catalogized
11
9
 
12
- default dn: proc { "o=#{name}" }
13
- parameter :name, description: 'Organization name', constraint: not_nil
10
+ default dn: proc { "o=#{name}" }
11
+ parameter :name, description: 'Organization name', constraint: not_nil
14
12
 
15
- contextualize filter(:override) { { organization: self, unit: self } }
13
+ contextualize filter(:override) { { organization: self, unit: self } }
14
+ end
16
15
  end
17
16
  end
@@ -1,22 +1,22 @@
1
- require 'aws/templates/utils/parametrized'
2
- require 'aws/templates/utils/parametrized/constraints'
3
- require 'pathname'
1
+ require 'aws/templates/utils'
4
2
 
5
3
  module UserDirectory
6
- ##
7
- # Parameter mixin containing universal fields for file objects
8
- #
9
- # It contains "path" field with constraint checking if the path
10
- # passed is absolute.
11
- module Pathed
12
- include Aws::Templates::Utils::Parametrized
4
+ module Artifacts
5
+ ##
6
+ # Parameter mixin containing universal fields for file objects
7
+ #
8
+ # It contains "path" field with constraint checking if the path
9
+ # passed is absolute.
10
+ module Pathed
11
+ include Aws::Templates::Utils::Parametrized
13
12
 
14
- parameter :path,
15
- description: 'Path',
16
- transform: ->(_, s) { Pathname.new(s) },
17
- constraint: all_of(
18
- not_nil,
19
- satisfies('The path is a valid absolute path', &:absolute?)
20
- )
13
+ parameter :path,
14
+ description: 'Path',
15
+ transform: ->(_, s) { ::Pathname.new(s) },
16
+ constraint: all_of(
17
+ not_nil,
18
+ satisfies('The path is a valid absolute path', &:absolute?)
19
+ )
20
+ end
21
21
  end
22
22
  end
@@ -1,20 +1,25 @@
1
- require 'user_directory/utils'
2
- require 'user_directory/artifacts/user'
1
+ require 'aws/templates/utils'
3
2
 
4
3
  module UserDirectory
5
- ##
6
- # Catalog's person
7
- #
8
- # Represents UNIX user who is a real person. Contains all related
9
- # attributes.
10
- class Person < User
11
- default cn: proc { "#{given_name} #{last_name} (#{login})" }
4
+ module Artifacts
5
+ ##
6
+ # Catalog's person
7
+ #
8
+ # Represents UNIX user who is a real person. Contains all related
9
+ # attributes.
10
+ class Person < User
11
+ default cn: proc { "#{given_name} #{last_name} (#{login})" }
12
12
 
13
- parameter :given_name, description: 'Person\'s given name', constraint: not_nil
14
- parameter :middle_name, description: 'Person\'s middle name'
15
- parameter :last_name, description: 'Person\'s last name', constraint: not_nil
16
- parameter :patronimic, description: 'Person\'s patronimic'
17
- parameter :phone, description: 'Desk phone number', constraint: Utils.phone_number
18
- parameter :manager, description: 'Person\'s manager', transform: as_object(Catalogized)
13
+ parameter :given_name, description: 'Person\'s given name', constraint: not_nil
14
+ parameter :middle_name, description: 'Person\'s middle name'
15
+ parameter :last_name, description: 'Person\'s last name', constraint: not_nil
16
+ parameter :patronimic, description: 'Person\'s patronimic'
17
+ parameter :phone,
18
+ description: 'Desk phone number',
19
+ constraint: UserDirectory::Utils.phone_number
20
+ parameter :manager,
21
+ description: 'Person\'s manager',
22
+ transform: as_object(Artifacts::Catalogized)
23
+ end
19
24
  end
20
25
  end
@@ -1,30 +1,35 @@
1
- require 'user_directory/artifacts/unit'
1
+ require 'aws/templates/utils'
2
2
 
3
3
  module UserDirectory
4
- ##
5
- # Team composite
6
- #
7
- # Each team has a POSIX group assigned to its members, a manager,
8
- # and subordinates. That's exactly what is represented here.
9
- class Team < Unit
10
- parameter :manager, description: 'Manager description hash', constraint: not_nil
11
- parameter :subordinates,
12
- description: 'List of subordinates\' descriptions',
13
- constraint: not_nil
14
- parameter :group_id, description: 'Team\'s group ID'
4
+ module Artifacts
5
+ ##
6
+ # Team composite
7
+ #
8
+ # Each team has a POSIX group assigned to its members, a manager,
9
+ # and subordinates. That's exactly what is represented here.
10
+ class Team < Unit
11
+ parameter :manager, description: 'Manager description hash', constraint: not_nil
12
+ parameter :subordinates,
13
+ description: 'List of subordinates\' descriptions',
14
+ constraint: not_nil
15
+ parameter :group_id, description: 'Team\'s group ID'
15
16
 
16
- components do
17
- group = artifact Group, label: 'group', name: name.downcase.tr(' ', '_'), id: group_id
17
+ components do
18
+ group = artifact Artifacts::Group,
19
+ label: 'group',
20
+ name: name.downcase.tr(' ', '_'),
21
+ id: group_id
18
22
 
19
- contextualize(group: group) do
20
- manager_artifact = artifact Person, manager.merge(label: 'manager')
23
+ contextualize(group: group) do
24
+ manager_artifact = artifact Artifacts::Person, manager.merge(label: 'manager')
21
25
 
22
- # Circular dependency between group and its members
23
- subordinates_artifacts = contextualize(manager: manager_artifact) do
24
- subordinates.map { |subordinate| artifact Person, subordinate }
25
- end
26
+ # Circular dependency between group and its members
27
+ subordinates_artifacts = contextualize(manager: manager_artifact) do
28
+ subordinates.map { |subordinate| artifact Artifacts::Person, subordinate }
29
+ end
26
30
 
27
- group.options[:members] = subordinates_artifacts << manager_artifact
31
+ group.options[:members] = subordinates_artifacts << manager_artifact
32
+ end
28
33
  end
29
34
  end
30
35
  end
@@ -1,24 +1,22 @@
1
- require 'aws/templates/composite'
2
- require 'aws/templates/utils/parametrized'
3
- require 'aws/templates/utils/parametrized/constraints'
4
- require 'user_directory/artifacts/user'
5
- require 'user_directory/artifacts/catalogized'
1
+ require 'aws/templates/utils'
6
2
 
7
3
  module UserDirectory
8
- ##
9
- # Catalog's organizational unit
10
- class Unit < Aws::Templates::Composite
11
- include Catalogized
4
+ module Artifacts
5
+ ##
6
+ # Catalog's organizational unit
7
+ class Unit < Aws::Templates::Composite
8
+ include Artifacts::Catalogized
12
9
 
13
- default label: proc { name },
14
- dn: proc { "ou=#{name},#{unit.dn}" }
10
+ default label: proc { name },
11
+ dn: proc { "ou=#{name},#{unit.dn}" }
15
12
 
16
- parameter :unit,
17
- description: 'Hierarchical parent of the unit',
18
- constraint: not_nil,
19
- transform: as_object(Catalogized)
20
- parameter :name, description: 'Organizational unit name', constraint: not_nil
13
+ parameter :unit,
14
+ description: 'Hierarchical parent of the unit',
15
+ constraint: not_nil,
16
+ transform: as_object(Artifacts::Catalogized)
17
+ parameter :name, description: 'Organizational unit name', constraint: not_nil
21
18
 
22
- contextualize filter(:add, :shell, :organization) & filter(:override) { { unit: self } }
19
+ contextualize filter(:add, :shell, :organization) & filter(:override) { { unit: self } }
20
+ end
23
21
  end
24
22
  end
@@ -1,29 +1,32 @@
1
- require 'aws/templates/artifact'
2
- require 'aws/templates/utils/parametrized/constraints'
3
- require 'aws/templates/utils/parametrized/transformations'
4
- require 'user_directory/artifacts/ided'
5
- require 'user_directory/artifacts/pathed'
6
- require 'user_directory/artifacts/catalogized'
1
+ require 'aws/templates/utils'
7
2
 
8
3
  module UserDirectory
9
- ##
10
- # POSIX user
11
- class User < Aws::Templates::Artifact
12
- include IDed
13
- include Catalogized
4
+ module Artifacts
5
+ ##
6
+ # POSIX user
7
+ class User < Aws::Templates::Artifact
8
+ include Artifacts::Ided
9
+ include Artifacts::Catalogized
14
10
 
15
- default dn: proc { "cn=#{cn},#{unit.dn}" },
16
- home_directory: proc { { path: "/home/#{login}" } },
17
- shell: { path: '/bin/sh' }
11
+ default dn: proc { "cn=#{cn},#{unit.dn}" },
12
+ home_directory: proc { { path: "/home/#{login}" } },
13
+ shell: { path: '/bin/sh' }
18
14
 
19
- parameter :cn, description: 'Object canonical name', constraint: not_nil
20
- parameter :login, description: 'User login', constraint: not_nil
21
- parameter :group,
22
- description: 'User main group',
23
- constraint: not_nil,
24
- transform: as_object(IDed)
25
- parameter :home_directory, description: 'Home directory', transform: as_object(Pathed)
26
- parameter :shell, description: 'Shell path', transform: as_object(Pathed)
27
- parameter :unit, description: 'User\'s organizational unit', transform: as_object(Catalogized)
15
+ parameter :cn, description: 'Object canonical name', constraint: not_nil
16
+ parameter :login, description: 'User login', constraint: not_nil
17
+ parameter :group,
18
+ description: 'User main group',
19
+ constraint: not_nil,
20
+ transform: as_object(Artifacts::Ided)
21
+ parameter :home_directory,
22
+ description: 'Home directory',
23
+ transform: as_object(Artifacts::Pathed)
24
+ parameter :shell,
25
+ description: 'Shell path',
26
+ transform: as_object(Artifacts::Pathed)
27
+ parameter :unit,
28
+ description: 'User\'s organizational unit',
29
+ transform: as_object(Artifacts::Catalogized)
30
+ end
28
31
  end
29
32
  end