lono 7.5.2 → 8.0.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/README.md +5 -15
- data/.cody/acceptance/bin/build.sh +52 -0
- data/.cody/acceptance/buildspec.yml +10 -0
- data/.cody/acceptance/project.rb +6 -0
- data/.cody/{role.rb → acceptance/role.rb} +0 -0
- data/.cody/shared/script/install/lono.sh +40 -0
- data/.cody/shared/script/install.sh +5 -0
- data/CHANGELOG.md +21 -4
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +5 -1
- data/LICENSE.txt +201 -1
- data/README.md +4 -4
- data/lib/lono/api/client.rb +3 -2
- data/lib/lono/app/inits.rb +13 -0
- data/lib/lono/app.rb +71 -0
- data/lib/lono/app_file/base.rb +1 -1
- data/lib/lono/app_file/build/lambda_layer/ruby_packager.rb +9 -9
- data/lib/lono/app_file/build/lambda_layer.rb +3 -3
- data/lib/lono/app_file/build.rb +9 -14
- data/lib/lono/app_file/registry/item.rb +4 -4
- data/lib/lono/app_file/upload.rb +1 -1
- data/lib/lono/autoloader.rb +2 -2
- data/lib/lono/aws_services/helper.rb +43 -6
- data/lib/lono/aws_services.rb +37 -6
- data/lib/lono/blueprint.rb +18 -9
- data/lib/lono/booter.rb +28 -0
- data/lib/lono/{template → builder}/context/helpers.rb +1 -1
- data/lib/lono/{template → builder}/context/loader/load_files.rb +5 -6
- data/lib/lono/builder/context/loader.rb +35 -0
- data/lib/lono/builder/context/params.rb +7 -0
- data/lib/lono/{template → builder}/context/ssm_fetcher.rb +1 -1
- data/lib/lono/{template → builder}/context.rb +5 -9
- data/lib/lono/{param/generator.rb → builder/param.rb} +21 -22
- data/lib/lono/builder/template/aws_service.rb +15 -0
- data/lib/lono/builder/template/bashify.rb +43 -0
- data/lib/lono/{template → builder/template}/configset_injector.rb +4 -4
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/fn.rb +2 -2
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/core_helper.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/ec2_helper.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/file_helper.rb +8 -12
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/s3_helper.rb +2 -2
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/stack_helper.rb +11 -8
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/tags_helper.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers.rb +2 -2
- data/lib/lono/builder/template/dsl/evaluator/section/base.rb +23 -0
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/condition.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/mapping.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/methods.rb +7 -7
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/output.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/parameter.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/resource/property_mover.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/resource.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/section.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/squeezer.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/stringify.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/syntax/extend_with.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/syntax/parameter_group.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/syntax.rb +3 -3
- data/lib/lono/builder/template/dsl/evaluator.rb +45 -0
- data/lib/lono/{template/strategy → builder/template}/dsl/finalizer/parameter_groups.rb +2 -2
- data/lib/lono/{template/strategy → builder/template}/dsl/finalizer.rb +1 -1
- data/lib/lono/builder/template/dsl.rb +14 -0
- data/lib/lono/{template → builder/template}/evaluate.rb +18 -6
- data/lib/lono/builder/template/helpers.rb +149 -0
- data/lib/lono/{output/template.rb → builder/template/output.rb} +14 -7
- data/lib/lono/{template → builder/template}/post_processor.rb +4 -4
- data/lib/lono/{template → builder/template}/upload.rb +3 -5
- data/lib/lono/builder/template.rb +55 -0
- data/lib/lono/bundler/cli/base.rb +10 -0
- data/lib/lono/bundler/cli/bundle.rb +44 -0
- data/lib/lono/bundler/cli/clean.rb +27 -0
- data/lib/lono/bundler/cli/help/bundle.md +3 -0
- data/lib/lono/bundler/cli/help.rb +11 -0
- data/lib/lono/bundler/cli.rb +7 -0
- data/lib/lono/bundler/component/concerns/local_concern.rb +10 -0
- data/lib/lono/bundler/component/concerns/notation_concern.rb +59 -0
- data/lib/lono/bundler/component/concerns/path_concern.rb +68 -0
- data/lib/lono/bundler/component/concerns/stack_concern.rb +60 -0
- data/lib/lono/bundler/component/fetcher/base.rb +27 -0
- data/lib/lono/bundler/component/fetcher/gcs.rb +69 -0
- data/lib/lono/bundler/component/fetcher/git.rb +69 -0
- data/lib/lono/bundler/component/fetcher/local.rb +15 -0
- data/lib/lono/bundler/component/fetcher/s3.rb +66 -0
- data/lib/lono/bundler/component/fetcher.rb +18 -0
- data/lib/lono/bundler/component/http/concern.rb +45 -0
- data/lib/lono/bundler/component/http/source.rb +19 -0
- data/lib/lono/bundler/component/org_repo.rb +65 -0
- data/lib/lono/bundler/component/props/extension.rb +19 -0
- data/lib/lono/bundler/component/props/typer.rb +41 -0
- data/lib/lono/bundler/component/props.rb +122 -0
- data/lib/lono/bundler/component/registry.rb +136 -0
- data/lib/lono/bundler/component.rb +52 -0
- data/lib/lono/bundler/config.rb +18 -0
- data/lib/lono/bundler/dsl/syntax.rb +46 -0
- data/lib/lono/bundler/dsl.rb +21 -0
- data/lib/lono/bundler/exporter/base.rb +6 -0
- data/lib/lono/bundler/exporter/copy.rb +22 -0
- data/lib/lono/bundler/exporter.rb +50 -0
- data/lib/lono/bundler/extract/tar.rb +34 -0
- data/lib/lono/bundler/extract/zip.rb +16 -0
- data/lib/lono/bundler/info.rb +39 -0
- data/lib/lono/bundler/list.rb +26 -0
- data/lib/lono/bundler/lockfile/version_comparer.rb +56 -0
- data/lib/lono/bundler/lockfile/yamler.rb +36 -0
- data/lib/lono/bundler/lockfile.rb +66 -0
- data/lib/lono/bundler/lonofile.rb +32 -0
- data/lib/lono/bundler/runner.rb +27 -0
- data/lib/lono/bundler/syncer.rb +70 -0
- data/lib/lono/bundler/util/git.rb +37 -0
- data/lib/lono/bundler/util/logging.rb +7 -0
- data/lib/lono/bundler/util/sure.rb +5 -0
- data/lib/lono/{bundle.rb → bundler.rb} +38 -4
- data/lib/lono/cfn/base.rb +9 -195
- data/lib/lono/cfn/cancel.rb +9 -26
- data/lib/lono/cfn/concerns/build.rb +10 -0
- data/lib/lono/cfn/concerns/template_output.rb +10 -0
- data/lib/lono/cfn/concerns.rb +43 -0
- data/lib/lono/cfn/delete.rb +8 -32
- data/lib/lono/cfn/deploy/base.rb +4 -0
- data/lib/lono/cfn/deploy/iam.rb +49 -0
- data/lib/lono/cfn/deploy/notification.rb +8 -0
- data/lib/lono/cfn/deploy/operable.rb +18 -0
- data/lib/lono/cfn/deploy/opts.rb +49 -0
- data/lib/lono/cfn/deploy/rollback.rb +46 -0
- data/lib/lono/cfn/deploy/tags.rb +18 -0
- data/lib/lono/cfn/deploy.rb +71 -5
- data/lib/lono/cfn/download.rb +5 -7
- data/lib/lono/cfn/output.rb +49 -0
- data/lib/lono/cfn/plan/base.rb +19 -0
- data/lib/lono/cfn/plan/changeset/base.rb +19 -0
- data/lib/lono/cfn/plan/changeset/notifications.rb +24 -0
- data/lib/lono/cfn/plan/changeset/outputs.rb +25 -0
- data/lib/lono/cfn/plan/changeset/resources.rb +48 -0
- data/lib/lono/cfn/plan/changeset/tags.rb +16 -0
- data/lib/lono/cfn/plan/changeset.rb +136 -0
- data/lib/lono/cfn/plan/concerns.rb +10 -0
- data/lib/lono/cfn/plan/delete.rb +16 -0
- data/lib/lono/cfn/plan/diff/base.rb +10 -0
- data/lib/lono/cfn/plan/diff/data.rb +52 -0
- data/lib/lono/cfn/plan/diff/file.rb +56 -0
- data/lib/lono/cfn/plan/new.rb +26 -0
- data/lib/lono/cfn/{preview → plan}/param.rb +26 -34
- data/lib/lono/cfn/plan/summary.rb +16 -0
- data/lib/lono/cfn/plan/template.rb +28 -0
- data/lib/lono/cfn/plan.rb +33 -0
- data/lib/lono/cfn/show.rb +30 -0
- data/lib/lono/cfn/status.rb +1 -1
- data/lib/lono/cli/abstract.rb +17 -0
- data/lib/lono/cli/base.rb +9 -0
- data/lib/lono/cli/build.rb +101 -0
- data/lib/lono/cli/bundle.rb +21 -0
- data/lib/lono/cli/cfn/opts.rb +59 -0
- data/lib/lono/cli/cfn.rb +19 -0
- data/lib/lono/cli/clean.rb +22 -0
- data/lib/lono/{code.rb → cli/code.rb} +2 -2
- data/lib/lono/{completion.rb → cli/completion.rb} +2 -2
- data/lib/lono/{help → cli/help}/blueprint/new.md +4 -4
- data/lib/lono/{help/generate.md → cli/help/build.md} +6 -6
- data/lib/lono/{help → cli/help}/cfn/cancel.md +0 -0
- data/lib/lono/cli/help/cfn/download.md +3 -0
- data/lib/lono/{help → cli/help}/cfn/preview.md +9 -8
- data/lib/lono/{help → cli/help}/cfn/status.md +0 -0
- data/lib/lono/cli/help/cfn.md +4 -0
- data/lib/lono/{help → cli/help}/code/convert.md +0 -0
- data/lib/lono/{help → cli/help}/code/import.md +2 -2
- data/lib/lono/{help → cli/help}/completion.md +3 -3
- data/lib/lono/{help → cli/help}/completion_script.md +0 -0
- data/lib/lono/{help → cli/help}/configsets.md +0 -0
- data/lib/lono/cli/help/down.md +13 -0
- data/lib/lono/cli/help/new/project.md +34 -0
- data/lib/lono/{help → cli/help}/param/generate.md +0 -0
- data/lib/lono/cli/help/param.md +6 -0
- data/lib/lono/{help → cli/help}/pro/blueprints.md +0 -0
- data/lib/lono/{help → cli/help}/pro/configsets.md +0 -0
- data/lib/lono/{help → cli/help}/script/build.md +0 -0
- data/lib/lono/{help → cli/help}/script/upload.md +0 -0
- data/lib/lono/{help → cli/help}/seed.md +2 -2
- data/lib/lono/cli/help/summary.md +33 -0
- data/lib/lono/{help → cli/help}/template/bashify.md +0 -0
- data/lib/lono/cli/help/template/generate.md +7 -0
- data/lib/lono/{help → cli/help}/template.md +0 -0
- data/lib/lono/cli/help/up.md +30 -0
- data/lib/lono/{help → cli/help}/user_data.md +3 -3
- data/lib/lono/cli/help.rb +56 -0
- data/lib/lono/cli/list.rb +28 -0
- data/lib/lono/cli/new/blueprint.rb +33 -0
- data/lib/lono/cli/new/concerns.rb +16 -0
- data/lib/lono/{configset/new.rb → cli/new/configset.rb} +2 -9
- data/lib/lono/{extension/new.rb → cli/new/extension.rb} +2 -10
- data/lib/lono/cli/new/helper.rb +32 -0
- data/lib/lono/cli/new/project.rb +77 -0
- data/lib/lono/cli/new/sequence.rb +51 -0
- data/lib/lono/cli/new/shim.rb +59 -0
- data/lib/lono/cli/new/test/blueprint.rb +23 -0
- data/lib/lono/cli/new/test/sequence.rb +10 -0
- data/lib/lono/cli/new/test.rb +8 -0
- data/lib/lono/cli/new.rb +31 -0
- data/lib/lono/{opts.rb → cli/opts.rb} +9 -12
- data/lib/lono/{s3.rb → cli/s3.rb} +9 -7
- data/lib/lono/cli/script/base.rb +5 -0
- data/lib/lono/cli/script/build.rb +72 -0
- data/lib/lono/cli/script/upload.rb +49 -0
- data/lib/lono/{script.rb → cli/script.rb} +2 -2
- data/lib/lono/cli/seed.rb +9 -0
- data/lib/lono/cli/test.rb +35 -0
- data/lib/lono/cli.rb +80 -109
- data/lib/lono/command.rb +27 -0
- data/lib/lono/configset/{generator.rb → builder.rb} +9 -7
- data/lib/lono/configset/combiner.rb +8 -6
- data/lib/lono/configset/evaluate_file.rb +1 -1
- data/lib/lono/configset/meta.rb +1 -1
- data/lib/lono/configset/s3_file/build.rb +5 -4
- data/lib/lono/configset/s3_file/item.rb +1 -1
- data/lib/lono/configset/s3_file/upload.rb +2 -2
- data/lib/lono/configset/strategy/base.rb +6 -6
- data/lib/lono/configset/strategy/helpers/dsl/core.rb +1 -1
- data/lib/lono/core.rb +25 -54
- data/lib/lono/extensions/dsl.rb +2 -5
- data/lib/lono/extensions/loader.rb +1 -12
- data/lib/lono/extensions.rb +2 -2
- data/lib/lono/importer/base.rb +5 -5
- data/lib/lono/importer/download.rb +7 -7
- data/lib/lono/importer/dsl.rb +3 -3
- data/lib/lono/importer/service/coder.rb +10 -10
- data/lib/lono/importer.rb +1 -10
- data/lib/lono/inspector/base.rb +7 -7
- data/lib/lono/inspector/summary.rb +19 -17
- data/lib/lono/layering/layer.rb +126 -0
- data/lib/lono/layering.rb +13 -55
- data/lib/lono/logger/formatter.rb +13 -0
- data/lib/lono/logger.rb +33 -0
- data/lib/lono/lookup.rb +12 -0
- data/lib/lono/names.rb +50 -0
- data/lib/lono/plugin/meta.rb +30 -0
- data/lib/lono/plugin/tester.rb +13 -0
- data/lib/lono/plugin.rb +10 -0
- data/lib/lono/s3/aws_setup.rb +4 -3
- data/lib/lono/s3/bucket.rb +19 -19
- data/lib/lono/s3/uploader.rb +10 -12
- data/lib/lono/script/base.rb +3 -3
- data/lib/lono/script/build.rb +11 -12
- data/lib/lono/script/upload.rb +7 -7
- data/lib/lono/{seed → seeder}/service_role.rb +1 -1
- data/lib/lono/{seed/base.rb → seeder.rb} +21 -36
- data/lib/lono/user_data.rb +8 -13
- data/lib/lono/utils/context.rb +15 -0
- data/lib/lono/utils/item/zip.rb +5 -5
- data/lib/lono/utils/logging.rb +7 -0
- data/lib/lono/utils/{pretty_time.rb → pretty.rb} +6 -2
- data/lib/lono/utils/quit.rb +7 -0
- data/lib/lono/utils/rsync.rb +4 -2
- data/lib/lono/utils/sure.rb +4 -4
- data/lib/lono/version.rb +1 -1
- data/lib/lono.rb +7 -12
- data/lib/templates/blueprint/template.rb +2 -0
- data/lib/templates/configset/{lib/configset.rb → configset.rb} +0 -0
- data/lib/templates/examples/blueprint/template.rb +9 -0
- data/lib/templates/helper/%underscore_name%_helper.rb.tt +6 -0
- data/lib/templates/{skeleton → project}/.gitignore +1 -2
- data/lib/templates/project/Gemfile.tt +11 -0
- data/lib/templates/project/README.md +9 -0
- data/lib/templates/project/config/app.rb +3 -0
- data/lib/templates/shim/lono +7 -0
- data/lono.gemspec +51 -44
- metadata +246 -269
- data/.circleci/README.md +0 -3
- data/.circleci/config.yml +0 -58
- data/.cody/acceptance.sh +0 -49
- data/.cody/buildspec.yml +0 -9
- data/.cody/demo.rb +0 -38
- data/.cody/project.rb +0 -6
- data/.gitmodules +0 -3
- data/lib/lono/abstract_base.rb +0 -25
- data/lib/lono/aws_services/stack.rb +0 -41
- data/lib/lono/aws_services/stack_set.rb +0 -41
- data/lib/lono/blueprint/configset/loader.rb +0 -7
- data/lib/lono/blueprint/helper.rb +0 -24
- data/lib/lono/blueprint/meta.rb +0 -30
- data/lib/lono/blueprint/new.rb +0 -127
- data/lib/lono/blueprint/root.rb +0 -25
- data/lib/lono/cfn/create.rb +0 -41
- data/lib/lono/cfn/opts.rb +0 -88
- data/lib/lono/cfn/preview/changeset.rb +0 -168
- data/lib/lono/cfn/preview/codediff.rb +0 -41
- data/lib/lono/cfn/preview/diff_viewer.rb +0 -23
- data/lib/lono/cfn/rollback.rb +0 -26
- data/lib/lono/cfn/update.rb +0 -71
- data/lib/lono/cfn.rb +0 -75
- data/lib/lono/clean.rb +0 -14
- data/lib/lono/configset/list.rb +0 -67
- data/lib/lono/configset/preparer.rb +0 -44
- data/lib/lono/configset/register/base.rb +0 -122
- data/lib/lono/configset/register/blueprint.rb +0 -16
- data/lib/lono/configset/register/dsl.rb +0 -14
- data/lib/lono/configset/register/project.rb +0 -13
- data/lib/lono/configset/resolver.rb +0 -47
- data/lib/lono/configset.rb +0 -16
- data/lib/lono/conventions.rb +0 -23
- data/lib/lono/core/config.rb +0 -22
- data/lib/lono/default/settings.yml +0 -21
- data/lib/lono/ext/bundler.rb +0 -7
- data/lib/lono/extension/helper.rb +0 -13
- data/lib/lono/extension/list.rb +0 -40
- data/lib/lono/extension.rb +0 -9
- data/lib/lono/extensions/preparer.rb +0 -26
- data/lib/lono/extensions/register.rb +0 -15
- data/lib/lono/file_uploader.rb +0 -21
- data/lib/lono/finder/base.rb +0 -152
- data/lib/lono/finder/blueprint/configset.rb +0 -17
- data/lib/lono/finder/blueprint.rb +0 -11
- data/lib/lono/finder/configset.rb +0 -11
- data/lib/lono/finder/extension.rb +0 -11
- data/lib/lono/generate.rb +0 -111
- data/lib/lono/help/cfn/create.md +0 -26
- data/lib/lono/help/cfn/delete.md +0 -13
- data/lib/lono/help/cfn/deploy.md +0 -21
- data/lib/lono/help/cfn/download.md +0 -3
- data/lib/lono/help/cfn/update.md +0 -49
- data/lib/lono/help/cfn.md +0 -7
- data/lib/lono/help/new.md +0 -57
- data/lib/lono/help/param.md +0 -6
- data/lib/lono/help/set_instances/delete.md +0 -21
- data/lib/lono/help/set_instances/deploy.md +0 -31
- data/lib/lono/help/set_instances/list.md +0 -14
- data/lib/lono/help/set_instances/status.md +0 -15
- data/lib/lono/help/set_instances/sync.md +0 -92
- data/lib/lono/help/sets/delete.md +0 -8
- data/lib/lono/help/sets/deploy.md +0 -76
- data/lib/lono/help/sets/status.md +0 -23
- data/lib/lono/help/summary.md +0 -33
- data/lib/lono/help/template/generate.md +0 -7
- data/lib/lono/help/upgrade.md +0 -1
- data/lib/lono/help/xgraph.md +0 -16
- data/lib/lono/help.rb +0 -15
- data/lib/lono/importer/erb.rb +0 -31
- data/lib/lono/inspector/graph.rb +0 -125
- data/lib/lono/jade/circular.rb +0 -26
- data/lib/lono/jade/materializer/final.rb +0 -10
- data/lib/lono/jade/materializer/gems_builder.rb +0 -81
- data/lib/lono/jade/materializer/source.rb +0 -54
- data/lib/lono/jade/materializer.rb +0 -15
- data/lib/lono/jade/registry.rb +0 -64
- data/lib/lono/jade.rb +0 -110
- data/lib/lono/jadespec.rb +0 -68
- data/lib/lono/new/helper.rb +0 -15
- data/lib/lono/new.rb +0 -95
- data/lib/lono/param.rb +0 -14
- data/lib/lono/pro/base.rb +0 -16
- data/lib/lono/pro/repo.rb +0 -28
- data/lib/lono/pro.rb +0 -15
- data/lib/lono/project_checker.rb +0 -35
- data/lib/lono/registration/base.rb +0 -37
- data/lib/lono/registration/check.rb +0 -15
- data/lib/lono/registration/temp.rb +0 -53
- data/lib/lono/registration/user.rb +0 -60
- data/lib/lono/seed.rb +0 -39
- data/lib/lono/sequence.rb +0 -35
- data/lib/lono/set_instances/base.rb +0 -30
- data/lib/lono/set_instances/changeable.rb +0 -53
- data/lib/lono/set_instances/create.rb +0 -7
- data/lib/lono/set_instances/delete.rb +0 -47
- data/lib/lono/set_instances/deploy.rb +0 -52
- data/lib/lono/set_instances/list.rb +0 -13
- data/lib/lono/set_instances/opts.rb +0 -37
- data/lib/lono/set_instances/status.rb +0 -12
- data/lib/lono/set_instances/sync.rb +0 -181
- data/lib/lono/set_instances/update.rb +0 -15
- data/lib/lono/set_instances.rb +0 -54
- data/lib/lono/sets/base.rb +0 -50
- data/lib/lono/sets/create.rb +0 -27
- data/lib/lono/sets/delete.rb +0 -43
- data/lib/lono/sets/deploy.rb +0 -11
- data/lib/lono/sets/list.rb +0 -35
- data/lib/lono/sets/opts.rb +0 -18
- data/lib/lono/sets/preview/codediff.rb +0 -35
- data/lib/lono/sets/preview/param.rb +0 -32
- data/lib/lono/sets/status/instance/base.rb +0 -120
- data/lib/lono/sets/status/instance/completed.rb +0 -35
- data/lib/lono/sets/status/instance/deleted.rb +0 -32
- data/lib/lono/sets/status/instance/show.rb +0 -7
- data/lib/lono/sets/status/instance.rb +0 -20
- data/lib/lono/sets/status/instances.rb +0 -136
- data/lib/lono/sets/status.rb +0 -128
- data/lib/lono/sets/summarize.rb +0 -22
- data/lib/lono/sets/time_spent.rb +0 -11
- data/lib/lono/sets/update.rb +0 -74
- data/lib/lono/sets/waiter.rb +0 -23
- data/lib/lono/sets.rb +0 -34
- data/lib/lono/setting.rb +0 -75
- data/lib/lono/template/aws_service.rb +0 -20
- data/lib/lono/template/bashify.rb +0 -39
- data/lib/lono/template/context/loader.rb +0 -52
- data/lib/lono/template/generator.rb +0 -23
- data/lib/lono/template/helper.rb +0 -152
- data/lib/lono/template/strategy/base.rb +0 -4
- data/lib/lono/template/strategy/common/helpers.rb +0 -44
- data/lib/lono/template/strategy/dsl/builder/section/base.rb +0 -30
- data/lib/lono/template/strategy/dsl/builder.rb +0 -59
- data/lib/lono/template/strategy/dsl.rb +0 -14
- data/lib/lono/template/strategy/erb.rb +0 -82
- data/lib/lono/template/strategy/source.rb +0 -8
- data/lib/lono/template/template.rb +0 -54
- data/lib/lono/template/util.rb +0 -8
- data/lib/lono/template.rb +0 -24
- data/lib/lono/upgrade.rb +0 -20
- data/lib/lono/utils/generators/tree.rb +0 -18
- data/lib/templates/blueprint/%blueprint_name%.gemspec.tt +0 -45
- data/lib/templates/blueprint/.gitignore +0 -11
- data/lib/templates/blueprint/CHANGELOG.md +0 -7
- data/lib/templates/blueprint/Gemfile +0 -4
- data/lib/templates/blueprint/README.md.tt +0 -33
- data/lib/templates/blueprint/Rakefile.tt +0 -9
- data/lib/templates/blueprint/seed/configs.rb +0 -28
- data/lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb +0 -36
- data/lib/templates/blueprint_types/dsl/app/user_data/bootstrap.sh +0 -2
- data/lib/templates/blueprint_types/erb/app/definitions/base.rb.tt +0 -1
- data/lib/templates/blueprint_types/erb/app/templates/%blueprint_name%.yml +0 -67
- data/lib/templates/configset/%configset_name%.gemspec.tt +0 -42
- data/lib/templates/configset/.gitignore +0 -10
- data/lib/templates/configset/CHANGELOG.md +0 -7
- data/lib/templates/configset/Gemfile +0 -4
- data/lib/templates/configset/README.md.tt +0 -3
- data/lib/templates/configset/Rakefile.tt +0 -9
- data/lib/templates/extension/%extension_name%.gemspec.tt +0 -46
- data/lib/templates/extension/.gitignore +0 -11
- data/lib/templates/extension/.rspec +0 -3
- data/lib/templates/extension/CHANGELOG.md +0 -7
- data/lib/templates/extension/Gemfile.tt +0 -4
- data/lib/templates/extension/Rakefile.tt +0 -9
- data/lib/templates/extension/spec/spec_helper.rb.tt +0 -29
- data/lib/templates/skeleton/Gemfile +0 -3
- data/lib/templates/skeleton/README.md +0 -58
- data/lib/templates/skeleton/configs/settings.yml +0 -13
- data/vendor/cfn-status/CHANGELOG.md +0 -14
- data/vendor/cfn-status/Gemfile +0 -4
- data/vendor/cfn-status/Gemfile.lock +0 -49
- data/vendor/cfn-status/LICENSE.txt +0 -21
- data/vendor/cfn-status/README.md +0 -58
- data/vendor/cfn-status/Rakefile +0 -6
- data/vendor/cfn-status/bin/console +0 -14
- data/vendor/cfn-status/bin/setup +0 -8
- data/vendor/cfn-status/cfn-status.gemspec +0 -30
- data/vendor/cfn-status/lib/cfn-status.rb +0 -1
- data/vendor/cfn-status/lib/cfn_status/aws_service.rb +0 -51
- data/vendor/cfn-status/lib/cfn_status/version.rb +0 -3
- data/vendor/cfn-status/lib/cfn_status.rb +0 -245
- data/vendor/cfn-status/spec/fixtures/cfn/pages/fresh/describe_stack_events-1.json +0 -1103
- data/vendor/cfn-status/spec/fixtures/cfn/pages/fresh/describe_stack_events-2.json +0 -1104
- data/vendor/cfn-status/spec/fixtures/cfn/pages/fresh/describe_stack_events-3.json +0 -1103
- data/vendor/cfn-status/spec/fixtures/cfn/pages/updating/describe_stack_events-1.json +0 -1103
- data/vendor/cfn-status/spec/fixtures/cfn/pages/updating/describe_stack_events-2.json +0 -1104
- data/vendor/cfn-status/spec/fixtures/cfn/pages/updating/describe_stack_events-3.json +0 -1103
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +0 -1080
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +0 -1080
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +0 -1086
- data/vendor/cfn-status/spec/lib/cfn_status_spec.rb +0 -153
- data/vendor/cfn-status/spec/spec_helper.rb +0 -14
data/lib/lono/sets/status.rb
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
class Status
|
3
|
-
extend Memoist
|
4
|
-
include Lono::AwsServices
|
5
|
-
include Summarize
|
6
|
-
include TimeSpent
|
7
|
-
|
8
|
-
attr_reader :operation_id
|
9
|
-
def initialize(options={})
|
10
|
-
@options = options
|
11
|
-
@stack, @operation_id = options[:stack], options[:operation_id]
|
12
|
-
@shown = []
|
13
|
-
@output = "" # for say method and specs
|
14
|
-
end
|
15
|
-
|
16
|
-
def wait
|
17
|
-
Lono::Sets::Status::Instance::Base.show_time_progress = true
|
18
|
-
Lono::Sets::Status::Instance::Base.delay_factor = stack_instances.size
|
19
|
-
|
20
|
-
status = nil
|
21
|
-
until completed?(status)
|
22
|
-
resp = display_one
|
23
|
-
stack_set_operation = resp.stack_set_operation
|
24
|
-
status = stack_set_operation.status
|
25
|
-
# always sleep delay even if completed to provide start_instances_status_waiter some extra time to complete
|
26
|
-
sleep 5
|
27
|
-
if completed?(status)
|
28
|
-
show_time_spent(stack_set_operation)
|
29
|
-
else
|
30
|
-
start_instances_status_waiter
|
31
|
-
end
|
32
|
-
end
|
33
|
-
status == "SUCCEEDED"
|
34
|
-
end
|
35
|
-
|
36
|
-
def display_one
|
37
|
-
resp = cfn.describe_stack_set_operation(
|
38
|
-
stack_set_name: @stack,
|
39
|
-
operation_id: operation_id,
|
40
|
-
)
|
41
|
-
stack_set_operation = resp.stack_set_operation
|
42
|
-
show_stack_set_operation(stack_set_operation)
|
43
|
-
@shown << stack_set_operation
|
44
|
-
resp
|
45
|
-
end
|
46
|
-
|
47
|
-
def show
|
48
|
-
if summaries.empty?
|
49
|
-
puts "No stack operations have been done with this stack set. So there is no status to report."
|
50
|
-
return
|
51
|
-
end
|
52
|
-
|
53
|
-
display_one
|
54
|
-
o = @options.merge(show_time_spent: false)
|
55
|
-
instances_status = Lono::SetInstances::Status.new(o)
|
56
|
-
instances_status.run
|
57
|
-
summarize(operation_id)
|
58
|
-
end
|
59
|
-
|
60
|
-
@@instances_status_waiter_started = false
|
61
|
-
def start_instances_status_waiter
|
62
|
-
return if @@instances_status_waiter_started
|
63
|
-
if stack_instances.empty?
|
64
|
-
@@instances_status_waiter_started = true
|
65
|
-
return
|
66
|
-
end
|
67
|
-
|
68
|
-
Thread.new do
|
69
|
-
# show_time_spent because we already show it in this status class. Dont want it to show twice.
|
70
|
-
o = @options.merge(start_on_outdated: true, show_time_spent: false)
|
71
|
-
instances_status = Lono::SetInstances::Status.new(o)
|
72
|
-
instances_status.run
|
73
|
-
end
|
74
|
-
@@instances_status_waiter_started = true
|
75
|
-
end
|
76
|
-
|
77
|
-
def show_stack_set_operation(stack_set_operation)
|
78
|
-
already_shown = @shown.detect do |o|
|
79
|
-
o[:status] == stack_set_operation[:status]
|
80
|
-
end
|
81
|
-
return if already_shown
|
82
|
-
|
83
|
-
say "Stack Set Operation Status: #{stack_set_operation.status}"
|
84
|
-
end
|
85
|
-
|
86
|
-
def say(text)
|
87
|
-
ENV["LONO_TEST"] ? @output << "#{text}\n" : puts(text)
|
88
|
-
end
|
89
|
-
|
90
|
-
# describe_stack_set_operation stack_set_operation.status is
|
91
|
-
# one of RUNNING, SUCCEEDED, FAILED, STOPPING, STOPPED
|
92
|
-
def completed?(status)
|
93
|
-
completed_statuses = %w[SUCCEEDED FAILED STOPPED]
|
94
|
-
completed_statuses.include?(status)
|
95
|
-
end
|
96
|
-
|
97
|
-
def stack_set_status
|
98
|
-
resp = cfn.describe_stack_set_operation(
|
99
|
-
stack_set_name: @stack,
|
100
|
-
operation_id: operation_id,
|
101
|
-
)
|
102
|
-
# describe_stack_set_operation stack_set_operation.status is
|
103
|
-
# status one of RUNNING, SUCCEEDED, FAILED, STOPPING, STOPPED
|
104
|
-
resp.stack_set_operation.status
|
105
|
-
end
|
106
|
-
|
107
|
-
def operation_id
|
108
|
-
@operation_id ||= latest_operation_id
|
109
|
-
end
|
110
|
-
|
111
|
-
def latest_operation_id
|
112
|
-
summaries.first.operation_id
|
113
|
-
end
|
114
|
-
|
115
|
-
def summaries
|
116
|
-
resp = cfn.list_stack_set_operations(
|
117
|
-
stack_set_name: @stack,
|
118
|
-
max_results: 1,
|
119
|
-
)
|
120
|
-
resp.summaries
|
121
|
-
end
|
122
|
-
|
123
|
-
def stack_instances
|
124
|
-
Lono::Sets::Status::Instances.new(@options).stack_instances
|
125
|
-
end
|
126
|
-
memoize :stack_instances
|
127
|
-
end
|
128
|
-
end
|
data/lib/lono/sets/summarize.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
module Summarize
|
3
|
-
include Lono::AwsServices
|
4
|
-
|
5
|
-
def summarize(operation_id)
|
6
|
-
puts "Stack Set Operation Summary:"
|
7
|
-
resp = cfn.list_stack_set_operation_results(stack_set_name: @stack, operation_id: operation_id)
|
8
|
-
resp.summaries.each do |s|
|
9
|
-
data = {
|
10
|
-
account: s.account,
|
11
|
-
region: s.region,
|
12
|
-
status: s.status,
|
13
|
-
}
|
14
|
-
data["status reason"] = s.status_reason if s.status_reason
|
15
|
-
message = data.inject("") do |text, (k,v)|
|
16
|
-
text += [k.to_s.color(:purple), v].join(" ") + " "
|
17
|
-
end
|
18
|
-
puts message
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/lono/sets/time_spent.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
module TimeSpent
|
3
|
-
include Lono::Utils::PrettyTime
|
4
|
-
|
5
|
-
def show_time_spent(stack_set_operation)
|
6
|
-
seconds = stack_set_operation.end_timestamp - stack_set_operation.creation_timestamp
|
7
|
-
time_took = pretty_time(seconds).color(:green)
|
8
|
-
puts "Time took to complete stack set operation: #{time_took}"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/lib/lono/sets/update.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
class Update < Base
|
3
|
-
include Summarize
|
4
|
-
|
5
|
-
def save
|
6
|
-
message = "Updating #{@stack} stack set"
|
7
|
-
if @options[:noop]
|
8
|
-
puts "NOOP #{message}"
|
9
|
-
return
|
10
|
-
end
|
11
|
-
|
12
|
-
unless stack_set_exists?(@stack)
|
13
|
-
puts "ERROR: Cannot update a stack set because #{@stack} does not exists.".color(:red)
|
14
|
-
return
|
15
|
-
end
|
16
|
-
exit_unless_updatable!
|
17
|
-
|
18
|
-
param_preview.run if @options[:param_preview]
|
19
|
-
codediff_preview.run if @options[:codediff_preview]
|
20
|
-
# changeset preview not supported for stack sets
|
21
|
-
|
22
|
-
options = build_options
|
23
|
-
show_options(options, "cfn.update_stack_set")
|
24
|
-
|
25
|
-
if stack_instances.empty?
|
26
|
-
puts <<~EOL
|
27
|
-
NOTE: There are 0 stack instances associated with the #{@stack} stack set.
|
28
|
-
Will update the stack set template but there no instances to be updated.
|
29
|
-
|
30
|
-
Use `lono set_instances deploy` to add stack instances. Example:
|
31
|
-
|
32
|
-
lono set_instances deploy #{@stack} --accounts 111 --regions us-west-2 us-east-2
|
33
|
-
|
34
|
-
EOL
|
35
|
-
else
|
36
|
-
sure?("Are you sure you want to update the #{@stack} stack set?", long_desc)
|
37
|
-
end
|
38
|
-
|
39
|
-
resp = cfn.update_stack_set(options)
|
40
|
-
|
41
|
-
Lono::Sets::Waiter.new(@options).run(resp[:operation_id])
|
42
|
-
end
|
43
|
-
|
44
|
-
def stack_instances
|
45
|
-
Lono::Sets::Status::Instances.new(@options).stack_instances
|
46
|
-
end
|
47
|
-
memoize :stack_instances
|
48
|
-
|
49
|
-
def long_desc
|
50
|
-
info = stack_instances.inject({}) do |result, instance|
|
51
|
-
result[instance.account] ||= []
|
52
|
-
result[instance.account] << instance.region
|
53
|
-
result
|
54
|
-
end
|
55
|
-
message = "Will deploy to:\n"
|
56
|
-
info.each do |account, regions|
|
57
|
-
message << " account: #{account}\n"
|
58
|
-
message << " regions: #{regions.join(",")}\n"
|
59
|
-
end
|
60
|
-
message << "\nNumber of stack instances to be updated: #{stack_instances.size}"
|
61
|
-
message
|
62
|
-
end
|
63
|
-
|
64
|
-
def codediff_preview
|
65
|
-
Lono::Sets::Preview::Codediff.new(@options.merge(mute_params: true, mute_using: true))
|
66
|
-
end
|
67
|
-
memoize :codediff_preview
|
68
|
-
|
69
|
-
def param_preview
|
70
|
-
Lono::Sets::Preview::Param.new(@options)
|
71
|
-
end
|
72
|
-
memoize :param_preview
|
73
|
-
end
|
74
|
-
end
|
data/lib/lono/sets/waiter.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
class Waiter
|
3
|
-
include Lono::Sets::Summarize
|
4
|
-
|
5
|
-
def initialize(options)
|
6
|
-
@options = options
|
7
|
-
@stack = options[:stack]
|
8
|
-
@wait = @options[:wait].nil? ? true : @options[:wait]
|
9
|
-
end
|
10
|
-
|
11
|
-
def run(operation_id)
|
12
|
-
message = "Deploying #{@stack} stack set"
|
13
|
-
puts message unless @options[:mute]
|
14
|
-
return unless @wait
|
15
|
-
|
16
|
-
status = Status.new(@options.merge(operation_id: operation_id))
|
17
|
-
success = status.wait
|
18
|
-
summarize(operation_id)
|
19
|
-
exit 1 unless success
|
20
|
-
success
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/lono/sets.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
module Lono
|
2
|
-
class Sets < Command
|
3
|
-
opts = Opts.new(self)
|
4
|
-
|
5
|
-
desc "deploy STACK_SET", "Deploy CloudFormation stack set."
|
6
|
-
long_desc Help.text("sets/deploy")
|
7
|
-
opts.deploy
|
8
|
-
def deploy(stack)
|
9
|
-
Deploy.new(options.merge(stack: stack)).run
|
10
|
-
end
|
11
|
-
|
12
|
-
desc "status STACK_SET", "Show current status of stack set."
|
13
|
-
long_desc Help.text("sets/status")
|
14
|
-
def status(stack)
|
15
|
-
status = Status.new(@options.merge(stack: stack, delay_for_threads: false))
|
16
|
-
success = status.show
|
17
|
-
exit 3 unless success
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "delete STACK_SET", "Delete CloudFormation stack set."
|
21
|
-
long_desc Lono::Help.text("sets/delete")
|
22
|
-
option :sure, type: :boolean, desc: "Skips are you sure prompt"
|
23
|
-
def delete(stack)
|
24
|
-
Delete.new(options.merge(stack: stack)).run
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "list", "List CloudFormation stack sets."
|
28
|
-
long_desc Lono::Help.text("sets/list")
|
29
|
-
option :status, default: "active", desc: "active, all or deleted"
|
30
|
-
def list
|
31
|
-
List.new(options).run
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/lib/lono/setting.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
module Lono
|
4
|
-
class Setting
|
5
|
-
def initialize(check_lono_project=true)
|
6
|
-
@check_lono_project = check_lono_project
|
7
|
-
end
|
8
|
-
|
9
|
-
# data contains the settings.yml config. The order or precedence for settings
|
10
|
-
# is the project lono/settings.yml and then the ~/.lono/settings.yml.
|
11
|
-
@@data = nil
|
12
|
-
def data
|
13
|
-
return @@data if @@data
|
14
|
-
|
15
|
-
project_settings_path = lookup_project_settings_path
|
16
|
-
|
17
|
-
# project based settings files
|
18
|
-
project = load_file(project_settings_path)
|
19
|
-
|
20
|
-
user_file = "#{ENV['HOME']}/.lono/settings.yml"
|
21
|
-
user = load_file(user_file)
|
22
|
-
|
23
|
-
default_file = File.expand_path("../default/settings.yml", __FILE__)
|
24
|
-
default = load_file(default_file)
|
25
|
-
|
26
|
-
all_envs = default.deep_merge(user.deep_merge(project))
|
27
|
-
all_envs = merge_base(all_envs)
|
28
|
-
@@data = all_envs[Lono.env] || all_envs["base"] || {}
|
29
|
-
end
|
30
|
-
|
31
|
-
def lookup_project_settings_path
|
32
|
-
standalone_path = "#{Lono.root}/config/settings.yml"
|
33
|
-
multimode_path = "#{Lono.root}/configs/settings.yml"
|
34
|
-
parent_multimode_path = "#{Lono.root}/../../configs/settings.yml"
|
35
|
-
|
36
|
-
settings_path = if File.exist?(standalone_path)
|
37
|
-
standalone_path
|
38
|
-
elsif File.exist?(multimode_path)
|
39
|
-
multimode_path
|
40
|
-
elsif File.exist?(parent_multimode_path)
|
41
|
-
parent_multimode_path
|
42
|
-
end
|
43
|
-
|
44
|
-
if @check_lono_project && !settings_path
|
45
|
-
puts "ERROR: No lono settings file found. Are you sure you are in a project with lono setup?".color(:red)
|
46
|
-
exit 1
|
47
|
-
end
|
48
|
-
|
49
|
-
settings_path
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
def load_file(path)
|
54
|
-
return Hash.new({}) unless File.exist?(path)
|
55
|
-
|
56
|
-
content = RenderMePretty.result(path)
|
57
|
-
data = YAML.load(content) || {}
|
58
|
-
# If key is is accidentally set to nil it screws up the merge_base later.
|
59
|
-
# So ensure that all keys with nil value are set to {}
|
60
|
-
data.each do |lono_env, _setting|
|
61
|
-
data[lono_env] ||= {}
|
62
|
-
end
|
63
|
-
data
|
64
|
-
end
|
65
|
-
|
66
|
-
# automatically add base settings to the rest of the environments
|
67
|
-
def merge_base(all_envs)
|
68
|
-
base = all_envs["base"] || {}
|
69
|
-
all_envs.each do |lono_env, env_settings|
|
70
|
-
all_envs[lono_env] = base.merge(env_settings) unless lono_env == "base"
|
71
|
-
end
|
72
|
-
all_envs
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require "aws-sdk-s3"
|
2
|
-
|
3
|
-
module Lono::Template::AwsService
|
4
|
-
def s3
|
5
|
-
return @s3 if @s3
|
6
|
-
|
7
|
-
options = {}
|
8
|
-
# allow override of region for s3 client to avoid warning:
|
9
|
-
# S3 client configured for "us-east-1" but the bucket "xxx" is in "us-west-2"; Please configure the proper region to avoid multiple unnecessary redirects and signing attempts
|
10
|
-
# Example: endpoint: 'https://s3.us-west-2.amazonaws.com'
|
11
|
-
settings = Lono::Setting.new.data
|
12
|
-
endpoint = settings["s3_endpoint"]
|
13
|
-
endpoint = ENV['S3_ENDPOINT'] if ENV['S3_ENDPOINT']
|
14
|
-
options[:endpoint] = endpoint if endpoint
|
15
|
-
if options[:endpoint]
|
16
|
-
options[:region] = options[:endpoint].split('.')[1]
|
17
|
-
end
|
18
|
-
@s3 = Aws::S3::Client.new(options)
|
19
|
-
end
|
20
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
|
3
|
-
class Lono::Template::Bashify
|
4
|
-
def initialize(options={})
|
5
|
-
@options = options
|
6
|
-
@path = options[:path]
|
7
|
-
end
|
8
|
-
|
9
|
-
def user_data_paths(data,path="")
|
10
|
-
paths = []
|
11
|
-
paths << path
|
12
|
-
data.each do |key,value|
|
13
|
-
if value.is_a?(Hash)
|
14
|
-
paths += user_data_paths(value,"#{path}/#{key}")
|
15
|
-
else
|
16
|
-
paths += ["#{path}/#{key}"]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
paths.select {|p| p =~ /UserData/ && p =~ /Fn::Join/ }
|
20
|
-
end
|
21
|
-
|
22
|
-
def run
|
23
|
-
raw = open(@path).read
|
24
|
-
json = JSON.load(raw)
|
25
|
-
paths = user_data_paths(json)
|
26
|
-
if paths.empty?
|
27
|
-
puts "No UserData script found"
|
28
|
-
return
|
29
|
-
end
|
30
|
-
paths.each do |path|
|
31
|
-
puts "UserData script for #{path}:"
|
32
|
-
key = path.sub('/','').split("/").map {|x| "['#{x}']"}.join('')
|
33
|
-
user_data = eval("json#{key}")
|
34
|
-
delimiter = user_data[0]
|
35
|
-
script = user_data[1]
|
36
|
-
puts script.join(delimiter)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
class Lono::Template::Context
|
2
|
-
module Loader
|
3
|
-
include LoadFiles
|
4
|
-
|
5
|
-
private
|
6
|
-
# Not using Lono::Template::Context because that works differently.
|
7
|
-
# That is used to load a context object that is passed to RenderMePretty's context.
|
8
|
-
# So that we can load context for params files and erb templates.
|
9
|
-
#
|
10
|
-
# In this case builder is actually the dsl context.
|
11
|
-
# We want to load variables and helpers into this builder context directly.
|
12
|
-
# This loads additional context. It looks very similar to Lono::Template::Context
|
13
|
-
def load_context
|
14
|
-
load_variables
|
15
|
-
load_helpers
|
16
|
-
end
|
17
|
-
|
18
|
-
# Variables in base.rb are overridden by their environment specific variables
|
19
|
-
# file. Example, file LONO_ENV=development:
|
20
|
-
#
|
21
|
-
# config/variables/base.rb
|
22
|
-
# config/variables/development.rb - will override any variables in base.rb
|
23
|
-
#
|
24
|
-
def load_variables
|
25
|
-
options = ActiveSupport::HashWithIndifferentAccess.new(@options.dup)
|
26
|
-
options[:blueprint] = @blueprint
|
27
|
-
options[:stack] ||= @blueprint
|
28
|
-
layering = Lono::Layering.new("variables", options, Lono.env)
|
29
|
-
layering.locations.each do |path|
|
30
|
-
evaluate_variables_file(path)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# Load the variables defined in config/variables/* to make available in lono scope.
|
35
|
-
#
|
36
|
-
# NOTE: Was only able to make instance variables avaialble with instance_eval, wasnt able to make local variables
|
37
|
-
# available.
|
38
|
-
def evaluate_variables_file(path)
|
39
|
-
return unless File.exist?(path)
|
40
|
-
instance_eval(IO.read(path), path)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Load custom helper methods from project
|
44
|
-
def load_helpers
|
45
|
-
load_project_helpers # project helpers will override extension helpers
|
46
|
-
end
|
47
|
-
|
48
|
-
def load_project_helpers
|
49
|
-
load_files(Lono.config.helpers_path)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
|
3
|
-
class Lono::Template
|
4
|
-
class Generator < Lono::AbstractBase
|
5
|
-
def run
|
6
|
-
# Examples:
|
7
|
-
# Erb.new(options).run
|
8
|
-
# Dsl.new(options).run
|
9
|
-
generator_class = "Lono::Template::Strategy::#{lono_strategy.camelize}"
|
10
|
-
generator_class = Object.const_get(generator_class)
|
11
|
-
generator_class.new(@options).run # The generator strategy classes write templates to disk
|
12
|
-
end
|
13
|
-
|
14
|
-
def lono_strategy
|
15
|
-
if @options[:source]
|
16
|
-
"source"
|
17
|
-
else
|
18
|
-
jadespec = Lono::Jadespec.new(Lono.blueprint_root, "unknown") # abusing Jadespec to get lono_strategy
|
19
|
-
jadespec.lono_strategy
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/lono/template/helper.rb
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
require "aws-sdk-core"
|
2
|
-
|
3
|
-
# This is included into Lono::Template::Context.
|
4
|
-
# It has access to the original thor CLI options via @options.
|
5
|
-
#
|
6
|
-
# @options gets passed into:
|
7
|
-
#
|
8
|
-
# Lono::Template::Context.new(blueprint, @options)
|
9
|
-
module Lono::Template::Helper
|
10
|
-
def template_s3_path(template_name)
|
11
|
-
# hi-jacking Uploader for https_url
|
12
|
-
template_path = "output/#{@blueprint}/templates/#{template_name}.yml"
|
13
|
-
Lono::S3::Uploader.new(template_path).s3_https_url
|
14
|
-
end
|
15
|
-
|
16
|
-
def template_params(param_name)
|
17
|
-
o = {
|
18
|
-
allow_not_exists: true
|
19
|
-
}.merge(@options)
|
20
|
-
o["param"] = param_name
|
21
|
-
generator = Lono::Param::Generator.new(o)
|
22
|
-
# do not generate because lono cfn calling logic already generated it we only need the values
|
23
|
-
parameters = generator.parameters # Returns Array in underscore keys format
|
24
|
-
# convert Array to simplified hash structure
|
25
|
-
parameters.inject({}) do |h, param|
|
26
|
-
h.merge(param[:parameter_key] => param[:parameter_value])
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Adjust the partial path so that it will use app/user_data
|
31
|
-
def user_data(path,vars={}, options={})
|
32
|
-
options.merge!(user_data: true)
|
33
|
-
partial(path,vars, options)
|
34
|
-
end
|
35
|
-
|
36
|
-
# The partial's path is a relative path.
|
37
|
-
#
|
38
|
-
# Example:
|
39
|
-
# Given file in app/partials/iam/docker.yml
|
40
|
-
#
|
41
|
-
# <%= partial("iam/docker", {}, indent: 10) %>
|
42
|
-
# <%= partial("iam/docker.yml", {}, indent: 10) %>
|
43
|
-
#
|
44
|
-
# If the user specifies the extension then use that instead of auto-adding
|
45
|
-
# the detected format.
|
46
|
-
def partial(path,vars={}, options={})
|
47
|
-
path = options[:user_data] ?
|
48
|
-
user_data_path_for(path) :
|
49
|
-
partial_path_for(path)
|
50
|
-
path = auto_add_format(path)
|
51
|
-
|
52
|
-
instance_variables!(vars)
|
53
|
-
result = render_path(path)
|
54
|
-
|
55
|
-
result = indent(result, options[:indent]) if options[:indent]
|
56
|
-
result + "\n"
|
57
|
-
end
|
58
|
-
|
59
|
-
# add indentation
|
60
|
-
def indent(text, indentation_amount)
|
61
|
-
text.split("\n").map do |line|
|
62
|
-
" " * indentation_amount + line
|
63
|
-
end.join("\n")
|
64
|
-
end
|
65
|
-
|
66
|
-
def partial_exist?(path)
|
67
|
-
path = partial_path_for(path)
|
68
|
-
path = auto_add_format(path)
|
69
|
-
path && File.exist?(path)
|
70
|
-
end
|
71
|
-
|
72
|
-
def current_region
|
73
|
-
region = Aws.config[:region]
|
74
|
-
region ||= ENV['AWS_REGION']
|
75
|
-
return region if region
|
76
|
-
|
77
|
-
default_region = 'us-east-1' # fallback if default not found in ~/.aws/config
|
78
|
-
if ENV['AWS_PROFILE']
|
79
|
-
path = "#{ENV['HOME']}/.aws/config"
|
80
|
-
if File.exist?(path)
|
81
|
-
lines = IO.readlines(path)
|
82
|
-
capture_default, capture_current = false, false
|
83
|
-
lines.each do | line|
|
84
|
-
if line.include?('[default]')
|
85
|
-
capture_default = true # next line
|
86
|
-
next
|
87
|
-
end
|
88
|
-
if capture_default && line.match(/region = /)
|
89
|
-
# over default from above
|
90
|
-
default_region = line.split(' = ').last.strip
|
91
|
-
capture_default = false
|
92
|
-
end
|
93
|
-
|
94
|
-
md = line.match(/\[profile (.*)\]/)
|
95
|
-
if md && md[1] == ENV['AWS_PROFILE']
|
96
|
-
capture_current = true
|
97
|
-
next
|
98
|
-
end
|
99
|
-
if capture_current && line.match(/region = /)
|
100
|
-
region = line.split(' = ').last.strip
|
101
|
-
capture_current = false
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
region ||= default_region
|
107
|
-
return region if region
|
108
|
-
end
|
109
|
-
|
110
|
-
'us-east-1' # default
|
111
|
-
end
|
112
|
-
|
113
|
-
private
|
114
|
-
def render_path(path)
|
115
|
-
RenderMePretty.result(path, context: self)
|
116
|
-
end
|
117
|
-
|
118
|
-
def user_data_path_for(path)
|
119
|
-
"#{Lono.config.user_data_path}/#{path}"
|
120
|
-
end
|
121
|
-
|
122
|
-
def partial_path_for(path)
|
123
|
-
"#{Lono.config.partials_path}/#{path}"
|
124
|
-
end
|
125
|
-
|
126
|
-
def auto_add_format(path)
|
127
|
-
# Return immediately if user provided explicit extension
|
128
|
-
extension = File.extname(path) # current extension
|
129
|
-
return path if !extension.empty?
|
130
|
-
|
131
|
-
# Else let's auto detect
|
132
|
-
paths = Dir.glob("#{path}.*")
|
133
|
-
|
134
|
-
if paths.size == 1 # non-ambiguous match
|
135
|
-
return paths.first
|
136
|
-
end
|
137
|
-
|
138
|
-
if paths.size > 1 # ambiguous match
|
139
|
-
puts "ERROR: Multiple possible partials found:".color(:red)
|
140
|
-
paths.each do |path|
|
141
|
-
puts " #{path}"
|
142
|
-
end
|
143
|
-
puts "Please specify an extension in the name to remove the ambiguity.".color(:green)
|
144
|
-
exit 1
|
145
|
-
end
|
146
|
-
|
147
|
-
# Account for case when user wants to include a file with no extension at all
|
148
|
-
return path if File.exist?(path) && !File.directory?(path)
|
149
|
-
|
150
|
-
path # original path if this point is reached
|
151
|
-
end
|
152
|
-
end
|