cloud-templates 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +4 -0
- data/.rubocop.yml +1 -0
- data/Rakefile +1 -1
- data/bin/cloud-templates-runner.rb +5 -0
- data/cloud-templates.gemspec +9 -4
- data/examples/lib/user_directory.rb +0 -10
- data/examples/lib/user_directory/artifacts.rb +8 -0
- data/examples/lib/user_directory/artifacts/catalogized.rb +8 -7
- data/examples/lib/user_directory/artifacts/group.rb +27 -30
- data/examples/lib/user_directory/artifacts/ided.rb +8 -7
- data/examples/lib/user_directory/artifacts/organization.rb +10 -11
- data/examples/lib/user_directory/artifacts/pathed.rb +17 -17
- data/examples/lib/user_directory/artifacts/person.rb +20 -15
- data/examples/lib/user_directory/artifacts/team.rb +26 -21
- data/examples/lib/user_directory/artifacts/unit.rb +15 -17
- data/examples/lib/user_directory/artifacts/user.rb +26 -23
- data/examples/lib/user_directory/render.rb +8 -0
- data/examples/lib/user_directory/render/etc.rb +2 -0
- data/examples/lib/user_directory/render/etc/artifact_view.rb +2 -2
- data/examples/lib/user_directory/render/etc/composite_view.rb +1 -2
- data/examples/lib/user_directory/render/etc/group_view.rb +3 -3
- data/examples/lib/user_directory/render/etc/person_view.rb +2 -2
- data/examples/lib/user_directory/render/etc/registry.rb +4 -6
- data/examples/lib/user_directory/render/etc/user_view.rb +2 -3
- data/examples/lib/user_directory/render/ldap.rb +2 -0
- data/examples/lib/user_directory/render/ldap/artifact_view.rb +3 -4
- data/examples/lib/user_directory/render/ldap/composite_view.rb +3 -4
- data/examples/lib/user_directory/render/ldap/group_view.rb +3 -4
- data/examples/lib/user_directory/render/ldap/organization_view.rb +3 -4
- data/examples/lib/user_directory/render/ldap/person_view.rb +3 -4
- data/examples/lib/user_directory/render/ldap/registry.rb +3 -4
- data/examples/lib/user_directory/render/ldap/unit_view.rb +3 -4
- data/examples/lib/user_directory/render/ldap/user_view.rb +3 -4
- data/examples/lib/user_directory/utils.rb +1 -1
- data/examples/spec/user_directory_spec.rb +24 -25
- data/lib/aws/templates.rb +0 -8
- data/lib/aws/templates/artifact.rb +20 -12
- data/lib/aws/templates/cli.rb +14 -0
- data/lib/aws/templates/cli/formatter.rb +21 -0
- data/lib/aws/templates/cli/formatter/json.rb +20 -0
- data/lib/aws/templates/cli/interface.rb +92 -0
- data/lib/aws/templates/composite.rb +6 -9
- data/lib/aws/templates/exception.rb +8 -0
- data/lib/aws/templates/exception/nested_parameter_exception.rb +19 -0
- data/lib/aws/templates/exception/option_error.rb +14 -0
- data/lib/aws/templates/exception/option_scalar_on_the_way.rb +26 -0
- data/lib/aws/templates/exception/option_should_be_recursive.rb +20 -0
- data/lib/aws/templates/exception/option_value_deleted.rb +22 -0
- data/lib/aws/templates/exception/parameter_already_exist.rb +26 -0
- data/lib/aws/templates/exception/parameter_exception.rb +26 -0
- data/lib/aws/templates/exception/parameter_getter_is_not_defined.rb +23 -0
- data/lib/aws/templates/exception/parameter_method_name_conflict.rb +26 -0
- data/lib/aws/templates/exception/parameter_specification_is_invalid.rb +30 -0
- data/lib/aws/templates/exception/parameter_value_invalid.rb +37 -0
- data/lib/aws/templates/exception/parametrized_dsl_error.rb +14 -0
- data/lib/aws/templates/exception/view_not_found.rb +26 -0
- data/lib/aws/templates/help.rb +43 -0
- data/lib/aws/templates/help/aggregate.rb +74 -0
- data/lib/aws/templates/help/dsl.rb +30 -0
- data/lib/aws/templates/help/provider.rb +15 -0
- data/lib/aws/templates/help/rdoc.rb +105 -0
- data/lib/aws/templates/help/rdoc/artifact.rb +50 -0
- data/lib/aws/templates/help/rdoc/composite.rb +20 -0
- data/lib/aws/templates/help/rdoc/contextualized.rb +12 -0
- data/lib/aws/templates/help/rdoc/contextualized/filter.rb +19 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters.rb +14 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/add.rb +21 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/chain.rb +33 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/copy.rb +23 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/identity.rb +23 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/override.rb +29 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/proxy.rb +28 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/recursive_schema_filter.rb +28 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/remove.rb +21 -0
- data/lib/aws/templates/help/rdoc/contextualized/filters/scoped.rb +29 -0
- data/lib/aws/templates/help/rdoc/contextualized/provider.rb +28 -0
- data/lib/aws/templates/help/rdoc/default.rb +12 -0
- data/lib/aws/templates/help/rdoc/default/definition.rb +89 -0
- data/lib/aws/templates/help/rdoc/default/provider.rb +25 -0
- data/lib/aws/templates/help/rdoc/dsl.rb +20 -0
- data/lib/aws/templates/help/rdoc/inheritable.rb +48 -0
- data/lib/aws/templates/help/rdoc/parametrized.rb +12 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraint.rb +31 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints.rb +14 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints/all_of.rb +39 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints/condition.rb +44 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints/depends_on_value.rb +41 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints/enum.rb +33 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints/matches.rb +27 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints/not_nil.rb +27 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints/requires.rb +33 -0
- data/lib/aws/templates/help/rdoc/parametrized/constraints/satisfies_condition.rb +28 -0
- data/lib/aws/templates/help/rdoc/parametrized/getter.rb +17 -0
- data/lib/aws/templates/help/rdoc/parametrized/getters.rb +14 -0
- data/lib/aws/templates/help/rdoc/parametrized/nested.rb +32 -0
- data/lib/aws/templates/help/rdoc/parametrized/parameter.rb +55 -0
- data/lib/aws/templates/help/rdoc/parametrized/provider.rb +32 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformation.rb +17 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations.rb +14 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_boolean.rb +25 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_chain.rb +34 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_hash.rb +40 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_integer.rb +26 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_list.rb +32 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_module.rb +25 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_object.rb +32 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_rendered.rb +28 -0
- data/lib/aws/templates/help/rdoc/parametrized/transformations/as_string.rb +25 -0
- data/lib/aws/templates/help/rdoc/provider.rb +20 -0
- data/lib/aws/templates/help/rdoc/routing.rb +104 -0
- data/lib/aws/templates/help/rdoc/texting.rb +42 -0
- data/lib/aws/templates/processor.rb +53 -0
- data/lib/aws/templates/processor/handler.rb +104 -0
- data/lib/aws/templates/processor/registry.rb +74 -0
- data/lib/aws/templates/processor/routing.rb +27 -0
- data/lib/aws/templates/render.rb +27 -25
- data/lib/aws/templates/render/basic_view.rb +47 -0
- data/lib/aws/templates/render/utils.rb +14 -0
- data/lib/aws/templates/render/utils/base_type_views.rb +12 -19
- data/lib/aws/templates/render/utils/inspect.rb +2 -4
- data/lib/aws/templates/render/utils/stringify.rb +2 -5
- data/lib/aws/templates/render/view.rb +3 -100
- data/lib/aws/templates/utils.rb +39 -15
- data/lib/aws/templates/utils/artifact_storage.rb +2 -3
- data/lib/aws/templates/utils/{named.rb → as_named.rb} +2 -3
- data/lib/aws/templates/utils/autoload.rb +224 -0
- data/lib/aws/templates/utils/contextualized.rb +8 -17
- data/lib/aws/templates/utils/contextualized/filter.rb +62 -0
- data/lib/aws/templates/utils/contextualized/filter/add.rb +67 -0
- data/lib/aws/templates/utils/contextualized/filter/chain.rb +56 -0
- data/lib/aws/templates/utils/contextualized/filter/copy.rb +38 -0
- data/lib/aws/templates/utils/contextualized/filter/dsl.rb +50 -0
- data/lib/aws/templates/utils/contextualized/filter/identity.rb +45 -0
- data/lib/aws/templates/utils/contextualized/filter/override.rb +62 -0
- data/lib/aws/templates/utils/contextualized/filter/proxy.rb +29 -0
- data/lib/aws/templates/utils/contextualized/filter/recursive_schema_filter.rb +46 -0
- data/lib/aws/templates/utils/contextualized/filter/remove.rb +66 -0
- data/lib/aws/templates/utils/contextualized/filter/scoped.rb +42 -0
- data/lib/aws/templates/utils/contextualized/refinements.rb +51 -0
- data/lib/aws/templates/utils/default.rb +258 -50
- data/lib/aws/templates/utils/dependency.rb +7 -6
- data/lib/aws/templates/utils/dependency/refinements.rb +80 -0
- data/lib/aws/templates/utils/dependent.rb +6 -3
- data/lib/aws/templates/utils/guarded.rb +30 -0
- data/lib/aws/templates/utils/inheritable.rb +21 -16
- data/lib/aws/templates/utils/inspectable.rb +4 -4
- data/lib/aws/templates/utils/late_bound.rb +2 -2
- data/lib/aws/templates/utils/memoized.rb +2 -0
- data/lib/aws/templates/utils/options.rb +49 -35
- data/lib/aws/templates/utils/parametrized.rb +32 -25
- data/lib/aws/templates/utils/parametrized/constraint.rb +95 -0
- data/lib/aws/templates/utils/parametrized/constraint/all_of.rb +51 -0
- data/lib/aws/templates/utils/parametrized/constraint/condition.rb +93 -0
- data/lib/aws/templates/utils/parametrized/constraint/depends_on_value.rb +60 -0
- data/lib/aws/templates/utils/parametrized/constraint/dsl.rb +86 -0
- data/lib/aws/templates/utils/parametrized/constraint/enum.rb +45 -0
- data/lib/aws/templates/utils/parametrized/constraint/matches.rb +44 -0
- data/lib/aws/templates/utils/parametrized/constraint/not_nil.rb +38 -0
- data/lib/aws/templates/utils/parametrized/constraint/requires.rb +54 -0
- data/lib/aws/templates/utils/parametrized/constraint/satisfies_condition.rb +55 -0
- data/lib/aws/templates/utils/parametrized/getter.rb +67 -0
- data/lib/aws/templates/utils/parametrized/getter/as_instance_variable.rb +41 -0
- data/lib/aws/templates/utils/parametrized/getter/as_is.rb +37 -0
- data/lib/aws/templates/utils/parametrized/getter/dsl.rb +62 -0
- data/lib/aws/templates/utils/parametrized/getter/one_of.rb +48 -0
- data/lib/aws/templates/utils/parametrized/getter/path.rb +53 -0
- data/lib/aws/templates/utils/parametrized/getter/value.rb +50 -0
- data/lib/aws/templates/utils/parametrized/nested.rb +9 -16
- data/lib/aws/templates/utils/parametrized/transformation.rb +74 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_boolean.rb +42 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_chain.rb +57 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_hash.rb +89 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_integer.rb +39 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_list.rb +97 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_module.rb +42 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_object.rb +76 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_rendered.rb +100 -0
- data/lib/aws/templates/utils/parametrized/transformation/as_string.rb +39 -0
- data/lib/aws/templates/utils/parametrized/transformation/dsl.rb +94 -0
- data/lib/aws/templates/utils/recursive.rb +22 -0
- data/spec/aws/templates/artifact_spec.rb +10 -10
- data/spec/aws/templates/cli_spec.rb +83 -0
- data/spec/aws/templates/composite_spec.rb +6 -4
- data/spec/aws/templates/help/rdoc/artifact_spec.rb +94 -0
- data/spec/aws/templates/help/rdoc/composite_spec.rb +53 -0
- data/spec/aws/templates/help/rdoc/parametrized/constraints/all_of_spec.rb +17 -0
- data/spec/aws/templates/help/rdoc/parametrized/constraints/depends_on_value_spec.rb +21 -0
- data/spec/aws/templates/help/rdoc/parametrized/constraints/enum_spec.rb +17 -0
- data/spec/aws/templates/help/rdoc/parametrized/constraints/matches_spec.rb +17 -0
- data/spec/aws/templates/help/rdoc/parametrized/constraints/satisfies_condition_spec.rb +17 -0
- data/spec/aws/templates/help/rdoc/parametrized/transformations/as_boolean_spec.rb +17 -0
- data/spec/aws/templates/help/rdoc/parametrized/transformations/as_chain_spec.rb +17 -0
- data/spec/aws/templates/help/rdoc/parametrized/transformations/as_hash_spec.rb +72 -0
- data/spec/aws/templates/help/rdoc/parametrized/transformations/as_integer_spec.rb +17 -0
- data/spec/aws/templates/help/rdoc/parametrized/transformations/as_list_spec.rb +39 -0
- data/spec/aws/templates/help/rdoc/parametrized/transformations/as_module_spec.rb +17 -0
- data/spec/aws/templates/help/rdoc/parametrized/transformations/as_object_spec.rb +38 -0
- data/spec/aws/templates/help/rdoc/parametrized/transformations/as_rendered_spec.rb +17 -0
- data/spec/aws/templates/render/utils/base_type_views_spec.rb +9 -11
- data/spec/aws/templates/render_spec.rb +1 -1
- data/spec/aws/templates/utils/as_named_spec.rb +0 -2
- data/spec/aws/templates/utils/autoload_spec.rb +14 -0
- data/spec/aws/templates/utils/contextualized_spec.rb +5 -5
- data/spec/aws/templates/utils/late_bound_spec.rb +2 -2
- data/spec/aws/templates/utils/parametrized/constraint_spec.rb +8 -10
- data/spec/aws/templates/utils/parametrized/getters_spec.rb +6 -7
- data/spec/aws/templates/utils/parametrized/transformation_spec.rb +3 -6
- data/spec/aws/templates/utils/parametrized_spec.rb +9 -10
- data/spec/aws/templates/utils_spec.rb +18 -0
- data/spec/test_empty/stuff.rb +4 -0
- data/spec/test_empty/stuff/here/test.rb +9 -0
- metadata +235 -19
- data/lib/aws/templates/exceptions.rb +0 -221
- data/lib/aws/templates/render/registry.rb +0 -60
- data/lib/aws/templates/utils/contextualized/filters.rb +0 -437
- data/lib/aws/templates/utils/contextualized/hash.rb +0 -13
- data/lib/aws/templates/utils/contextualized/nil.rb +0 -13
- data/lib/aws/templates/utils/contextualized/proc.rb +0 -13
- data/lib/aws/templates/utils/dependency/enumerable.rb +0 -13
- data/lib/aws/templates/utils/dependency/object.rb +0 -46
- data/lib/aws/templates/utils/parametrized/constraints.rb +0 -423
- data/lib/aws/templates/utils/parametrized/getters.rb +0 -293
- data/lib/aws/templates/utils/parametrized/guarded.rb +0 -32
- data/lib/aws/templates/utils/parametrized/transformations.rb +0 -652
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
##
|
|
8
|
+
# Common functionality for documenting inheritable properties.
|
|
9
|
+
#
|
|
10
|
+
# Examples of inheritable properties:
|
|
11
|
+
# * parameters
|
|
12
|
+
# * context filters
|
|
13
|
+
# Those have one thing in common: they are inherited from a parent class to any child and
|
|
14
|
+
# to generate full documentation you need to go over all of them respecting class/module
|
|
15
|
+
# hierarchy. The class implements utility methods and provides IoC stubs to define
|
|
16
|
+
# specific behaviors with ease.
|
|
17
|
+
class Inheritable < Rdoc::Provider
|
|
18
|
+
def self.header(header = nil)
|
|
19
|
+
return @header if header.nil?
|
|
20
|
+
@header = header
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def provide
|
|
24
|
+
desc = ancestors_description
|
|
25
|
+
sub(text(self.class.header.gsub(/(\S+)/, '_\1_')), desc) if desc
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
protected
|
|
29
|
+
|
|
30
|
+
def description_for(_mod)
|
|
31
|
+
raise Templates::Exception::NotImplementedError.new('The method should be overriden')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def ancestors_description
|
|
37
|
+
descriptions = context.ancestors_with(self.class.entity)
|
|
38
|
+
.map { |mod| description_for(mod) }
|
|
39
|
+
.reject(&:nil?)
|
|
40
|
+
.to_a
|
|
41
|
+
|
|
42
|
+
list(:BULLET, *descriptions) unless descriptions.empty?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
##
|
|
9
|
+
# Abstract constraint provider
|
|
10
|
+
#
|
|
11
|
+
# Prints constraint-specific description and constraint condition.
|
|
12
|
+
class Constraint < Rdoc::Provider
|
|
13
|
+
for_entity Templates::Utils::Parametrized::Constraint
|
|
14
|
+
|
|
15
|
+
def provide
|
|
16
|
+
sub do |s|
|
|
17
|
+
s << super unless add_description(s)
|
|
18
|
+
condition_description = processed_for(context.pre_condition)
|
|
19
|
+
s << condition_description if condition_description
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
protected
|
|
24
|
+
|
|
25
|
+
def add_description(_); end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
module Constraints
|
|
9
|
+
##
|
|
10
|
+
# Chained constraint provider
|
|
11
|
+
#
|
|
12
|
+
# Prints documentation blocks for all of the nexted constraints in the chain.
|
|
13
|
+
class AllOf < Parametrized::Constraint
|
|
14
|
+
for_entity Templates::Utils::Parametrized::Constraint::AllOf
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def add_description(item)
|
|
19
|
+
item << text('satisfies all of the following:')
|
|
20
|
+
item << members
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def members
|
|
26
|
+
list(:BULLET) do |l|
|
|
27
|
+
context.constraints
|
|
28
|
+
.lazy
|
|
29
|
+
.map { |constraint| processed_for(constraint) }
|
|
30
|
+
.each { |part| l << part }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
module Constraints
|
|
9
|
+
##
|
|
10
|
+
# Abstract condition documentation provider
|
|
11
|
+
class Condition < Rdoc::Provider
|
|
12
|
+
for_entity Templates::Utils::Parametrized::Constraint::Condition
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# Equality condition documentation provider
|
|
16
|
+
#
|
|
17
|
+
# Outputs text block with value description.
|
|
18
|
+
class Equal < Condition
|
|
19
|
+
for_entity Templates::Utils::Parametrized::Constraint::Condition::Equal
|
|
20
|
+
|
|
21
|
+
def provide
|
|
22
|
+
value = context.expected
|
|
23
|
+
text("_when_ value #{value.nil? ? 'is nil' : "== #{value.inspect}"}")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# Code-block condition documentation
|
|
29
|
+
class Conditional < Condition
|
|
30
|
+
for_entity Templates::Utils::Parametrized::Constraint::Condition::Conditional
|
|
31
|
+
|
|
32
|
+
def provide
|
|
33
|
+
text("_when_ #{context.condition.source_location.join(':')}")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def provide; end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
module Constraints
|
|
9
|
+
##
|
|
10
|
+
# Case-like constraint documentation provider
|
|
11
|
+
#
|
|
12
|
+
# Prints all handled value and respective constraints.
|
|
13
|
+
class DependsOnValue < Parametrized::Constraint
|
|
14
|
+
for_entity Templates::Utils::Parametrized::Constraint::DependsOnValue
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def add_description(item)
|
|
19
|
+
item << text('depends on value:')
|
|
20
|
+
item << _members
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def _members
|
|
26
|
+
context.selector
|
|
27
|
+
.lazy
|
|
28
|
+
.map { |value, constraint| _constraint_variant_for(value, constraint) }
|
|
29
|
+
.each_with_object(list) { |part, l| l << part }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def _constraint_variant_for(value, constraint)
|
|
33
|
+
sub(text("when _#{value}_ :"), processed_for(constraint))
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
module Constraints
|
|
9
|
+
##
|
|
10
|
+
# Enumerable constraint documentation provider
|
|
11
|
+
#
|
|
12
|
+
# Outputs a list of all possible values for the parameter.
|
|
13
|
+
class Enum < Parametrized::Constraint
|
|
14
|
+
for_entity Templates::Utils::Parametrized::Constraint::Enum
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def add_description(item)
|
|
19
|
+
item << text("one of: #{enumerate}")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def enumerate
|
|
25
|
+
context.set.map(&:inspect).join(',')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
module Constraints
|
|
9
|
+
##
|
|
10
|
+
# Regular expression constraint documentation provider
|
|
11
|
+
#
|
|
12
|
+
# Outputs regular expression.
|
|
13
|
+
class Matches < Parametrized::Constraint
|
|
14
|
+
for_entity Templates::Utils::Parametrized::Constraint::Matches
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def add_description(item)
|
|
19
|
+
item << text("matches regular expression #{context.expression.inspect}")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
module Constraints
|
|
9
|
+
##
|
|
10
|
+
# Not-nil constraint documentation
|
|
11
|
+
#
|
|
12
|
+
# Just prints the blurb
|
|
13
|
+
class NotNil < Parametrized::Constraint
|
|
14
|
+
for_entity Templates::Utils::Parametrized::Constraint::NotNil
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def add_description(item)
|
|
19
|
+
item << text('can\'t be nil')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
module Constraints
|
|
9
|
+
##
|
|
10
|
+
# Requires dependency provider
|
|
11
|
+
#
|
|
12
|
+
# Prints all requirements for the constraint.
|
|
13
|
+
class Requires < Parametrized::Constraint
|
|
14
|
+
for_entity Templates::Utils::Parametrized::Constraint::Requires
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def add_description(item)
|
|
19
|
+
item << text("requires the following parameters: #{requirements}")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def requirements
|
|
25
|
+
context.dependencies.map(&:to_s).join(',')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
module Constraints
|
|
9
|
+
##
|
|
10
|
+
# Condition constraint
|
|
11
|
+
#
|
|
12
|
+
# Just prints condition description.
|
|
13
|
+
class SatisfiesCondition < Parametrized::Constraint
|
|
14
|
+
register_in Rdoc
|
|
15
|
+
for_entity Templates::Utils::Parametrized::Constraint::SatisfiesCondition
|
|
16
|
+
|
|
17
|
+
protected
|
|
18
|
+
|
|
19
|
+
def add_description(item)
|
|
20
|
+
item << text(context.description)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
##
|
|
9
|
+
# Abstract getter documentation provider
|
|
10
|
+
class Getter < Rdoc::Provider
|
|
11
|
+
for_entity Templates::Utils::Parametrized::Getter
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'aws/templates/utils'
|
|
2
|
+
|
|
3
|
+
module Aws
|
|
4
|
+
module Templates
|
|
5
|
+
module Help
|
|
6
|
+
module Rdoc
|
|
7
|
+
module Parametrized
|
|
8
|
+
##
|
|
9
|
+
# Nested object definition documentation provider
|
|
10
|
+
#
|
|
11
|
+
# Very similar to Artifact provider except it doesn't have a few aspects.
|
|
12
|
+
class Nested < Help::Aggregate
|
|
13
|
+
include Rdoc::Texting
|
|
14
|
+
|
|
15
|
+
register_in Rdoc
|
|
16
|
+
for_entity Templates::Utils::Parametrized::Nested
|
|
17
|
+
|
|
18
|
+
after Templates::Utils::Parametrized, Templates::Utils::Default
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
def fragment; end
|
|
23
|
+
|
|
24
|
+
def compose(fragments)
|
|
25
|
+
list(:BULLET, *fragments)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|