lono 7.4.11 → 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 +33 -5
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +5 -1
- data/LICENSE.txt +201 -1
- data/README.md +6 -5
- 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 -196
- 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 -106
- 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 -11
- 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 -43
- metadata +261 -264
- 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 -107
- 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/sets/delete.md +0 -8
- data/lib/lono/help/sets/deploy.md +0 -76
- data/lib/lono/help/sets/instances/delete.md +0 -21
- data/lib/lono/help/sets/instances/list.md +0 -14
- data/lib/lono/help/sets/instances/status.md +0 -15
- data/lib/lono/help/sets/instances/sync.md +0 -90
- 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/sets/base.rb +0 -50
- data/lib/lono/sets/create.rb +0 -30
- data/lib/lono/sets/delete.rb +0 -52
- data/lib/lono/sets/deploy.rb +0 -11
- data/lib/lono/sets/instances/base.rb +0 -30
- data/lib/lono/sets/instances/delete.rb +0 -69
- data/lib/lono/sets/instances/list.rb +0 -13
- data/lib/lono/sets/instances/opts.rb +0 -29
- data/lib/lono/sets/instances/status.rb +0 -12
- data/lib/lono/sets/instances/sync.rb +0 -180
- data/lib/lono/sets/instances.rb +0 -33
- 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 -133
- data/lib/lono/sets/status.rb +0 -116
- data/lib/lono/sets/summarize.rb +0 -20
- data/lib/lono/sets/time_spent.rb +0 -11
- data/lib/lono/sets/update.rb +0 -81
- data/lib/lono/sets.rb +0 -38
- 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
@@ -4,10 +4,10 @@ class Lono::AppFile::Build::LambdaLayer
|
|
4
4
|
include Lono::Utils::Rsync
|
5
5
|
|
6
6
|
def initialize(blueprint, registry_item)
|
7
|
-
@blueprint, @registry_item = blueprint, registry_item
|
7
|
+
@blueprint.name, @registry_item = blueprint, registry_item
|
8
8
|
|
9
9
|
@registry_name = @registry_item.name.sub(/\/$/,'')
|
10
|
-
@app_root = "#{
|
10
|
+
@app_root = "#{@blueprint.root}/app/files/#{@registry_name}"
|
11
11
|
end
|
12
12
|
|
13
13
|
def build
|
@@ -42,7 +42,7 @@ class Lono::AppFile::Build::LambdaLayer
|
|
42
42
|
|
43
43
|
# create symlink in output path not the cache path
|
44
44
|
symlink_dest = "#{output_area}/vendor/gems/ruby/#{ruby_folder}"
|
45
|
-
|
45
|
+
logger.info "symlink_dest #{symlink_dest}"
|
46
46
|
FileUtils.rm_rf(symlink_dest) # blow away original 2.5.0 folder
|
47
47
|
|
48
48
|
# Create symlink that will point to the gems in the Lambda Layer:
|
@@ -68,7 +68,7 @@ class Lono::AppFile::Build::LambdaLayer
|
|
68
68
|
# project gets built again not all the gems from get installed from the
|
69
69
|
# beginning.
|
70
70
|
def bundle_install
|
71
|
-
|
71
|
+
logger.info "Bundling: running bundle install in cache area: #{cache_area}."
|
72
72
|
|
73
73
|
rsync(output_area, cache_area)
|
74
74
|
|
@@ -85,15 +85,15 @@ class Lono::AppFile::Build::LambdaLayer
|
|
85
85
|
FileUtils.rm_rf("#{cache_area}/.bundle")
|
86
86
|
require "bundler" # dynamically require bundler so user can use any bundler
|
87
87
|
setup_bundle_config(cache_area)
|
88
|
-
Bundler.with_unbundled_env do
|
88
|
+
::Bundler.with_unbundled_env do
|
89
89
|
sh "cd #{cache_area} && env bundle install"
|
90
90
|
end
|
91
91
|
|
92
92
|
remove_bundled_with("#{cache_area}/Gemfile.lock")
|
93
93
|
# Fixes really tricky bug where Gemfile and Gemfile.lock is out-of-sync. Details: https://gist.github.com/tongueroo/b5b0d0c924a4a1633eee514795e4b04b
|
94
|
-
FileUtils.cp("#{cache_area}/Gemfile.lock", "#{Lono.
|
94
|
+
FileUtils.cp("#{cache_area}/Gemfile.lock", "#{Lono.root}/output/#{@blueprint.name}/files/#{@registry_name}/Gemfile.lock")
|
95
95
|
|
96
|
-
|
96
|
+
logger.info 'Bundle install success.'
|
97
97
|
end
|
98
98
|
|
99
99
|
# Remove the BUNDLED WITH line since we don't control the bundler gem version on AWS Lambda
|
@@ -130,11 +130,11 @@ EOL
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def output_area
|
133
|
-
"#{Lono.
|
133
|
+
"#{Lono.root}/output/#{@blueprint.name}/files/#{@registry_name}"
|
134
134
|
end
|
135
135
|
|
136
136
|
def build_area
|
137
|
-
"#{Lono.
|
137
|
+
"#{Lono.root}/output/#{@blueprint.name}/lambda_layers/#{@registry_name}"
|
138
138
|
end
|
139
139
|
|
140
140
|
def cache_area
|
@@ -1,19 +1,19 @@
|
|
1
1
|
class Lono::AppFile::Build
|
2
2
|
class LambdaLayer
|
3
3
|
def initialize(blueprint, registry_item)
|
4
|
-
@blueprint, @registry_item = blueprint, registry_item
|
4
|
+
@blueprint.name, @registry_item = blueprint, registry_item
|
5
5
|
end
|
6
6
|
|
7
7
|
def build
|
8
8
|
lang = @registry_item.options[:lang]
|
9
9
|
unless lang =~ /ruby/
|
10
|
-
|
10
|
+
logger.info "WARN: Currently only support ruby lambda layers".color(:yellow)
|
11
11
|
return
|
12
12
|
end
|
13
13
|
|
14
14
|
klass_name = "Lono::AppFile::Build::LambdaLayer::#{lang.camelize}Packager"
|
15
15
|
klass = klass_name.constantize
|
16
|
-
packager = klass.new(@blueprint, @registry_item)
|
16
|
+
packager = klass.new(@blueprint.name, @registry_item)
|
17
17
|
packager.build
|
18
18
|
end
|
19
19
|
end
|
data/lib/lono/app_file/build.rb
CHANGED
@@ -5,12 +5,12 @@ module Lono::AppFile
|
|
5
5
|
include Lono::Utils::Item::Zip
|
6
6
|
|
7
7
|
def initialize_variables
|
8
|
-
@output_files_path = "#{Lono.
|
8
|
+
@output_files_path = "#{Lono.root}/output/#{@blueprint.name}/files"
|
9
9
|
end
|
10
10
|
|
11
11
|
def run
|
12
12
|
return unless detect_files?
|
13
|
-
|
13
|
+
logger.info "Building app/files"
|
14
14
|
build_all
|
15
15
|
end
|
16
16
|
|
@@ -29,11 +29,11 @@ module Lono::AppFile
|
|
29
29
|
end
|
30
30
|
missing_paths = missing.map { |item| item.src_path }.uniq
|
31
31
|
unless missing_paths.empty?
|
32
|
-
|
32
|
+
logger.info "ERROR: These app/files are missing were used by the s3_key method but are missing".color(:red)
|
33
33
|
missing_paths.each do |path|
|
34
|
-
|
34
|
+
logger.info " #{path}"
|
35
35
|
end
|
36
|
-
|
36
|
+
logger.info "Please double check that they exist."
|
37
37
|
exit 1
|
38
38
|
end
|
39
39
|
end
|
@@ -51,32 +51,27 @@ module Lono::AppFile
|
|
51
51
|
if item.type == "lambda_layer" || item.exist?
|
52
52
|
zip(item)
|
53
53
|
else
|
54
|
-
|
54
|
+
logger.info "WARN: #{item.src_path} does not exist. Double check that the path is correct in the s3_key call.".color(:yellow)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
def copy_to_output
|
60
|
-
override_source_paths("#{
|
60
|
+
override_source_paths("#{@blueprint.root}/app/files")
|
61
61
|
self.destination_root = @output_files_path
|
62
62
|
directory(".", verbose: false, context: context.get_binding) # Thor::Action
|
63
63
|
end
|
64
64
|
|
65
|
-
def context
|
66
|
-
Lono::Template::Context.new(@options)
|
67
|
-
end
|
68
|
-
memoize :context
|
69
|
-
|
70
65
|
def clean_output
|
71
66
|
FileUtils.rm_rf(@output_files_path)
|
72
67
|
end
|
73
68
|
|
74
69
|
def detect_files?
|
75
|
-
app_files = Dir["#{
|
70
|
+
app_files = Dir["#{@blueprint.root}/app/files/*"]
|
76
71
|
if app_files.empty?
|
77
72
|
false
|
78
73
|
else
|
79
|
-
|
74
|
+
logger.info "Detected app/files"
|
80
75
|
true
|
81
76
|
end
|
82
77
|
end
|
@@ -5,19 +5,19 @@ class Lono::AppFile::Registry
|
|
5
5
|
|
6
6
|
attr_reader :name, :options, :type
|
7
7
|
def initialize(name, blueprint, options={})
|
8
|
-
@name, @blueprint, @options = name, blueprint, options
|
8
|
+
@name, @blueprint.name, @options = name, blueprint, options
|
9
9
|
@type = options[:type] || "file"
|
10
10
|
end
|
11
11
|
|
12
12
|
def src_path
|
13
|
-
"#{
|
13
|
+
"#{@blueprint.root}/app/files/#{@name}"
|
14
14
|
end
|
15
15
|
|
16
16
|
def output_path
|
17
17
|
if @type == "file"
|
18
|
-
"#{Lono.root}/output/#{@blueprint}/files/#{@name}"
|
18
|
+
"#{Lono.root}/output/#{@blueprint.name}/files/#{@name}"
|
19
19
|
else
|
20
|
-
"#{Lono.root}/output/#{@blueprint}/lambda_layers/#{@name}/opt"
|
20
|
+
"#{Lono.root}/output/#{@blueprint.name}/lambda_layers/#{@name}/opt"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/lono/app_file/upload.rb
CHANGED
data/lib/lono/autoloader.rb
CHANGED
@@ -1,14 +1,51 @@
|
|
1
1
|
module Lono::AwsServices
|
2
2
|
module Helper
|
3
|
-
|
4
|
-
|
3
|
+
def stack_exists?(stack_name)
|
4
|
+
return false if ENV['LONO_NOOP']
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
exist = nil
|
7
|
+
begin
|
8
|
+
# When the stack does not exist an exception is raised. Example:
|
9
|
+
# Aws::CloudFormation::Errors::ValidationError: Stack with id blah does not exist
|
10
|
+
cfn.describe_stacks(stack_name: stack_name)
|
11
|
+
exist = true
|
12
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
13
|
+
if e.message =~ /does not exist/
|
14
|
+
exist = false
|
15
|
+
elsif e.message.include?("'stackName' failed to satisfy constraint")
|
16
|
+
# Example of e.message when describe_stack with invalid stack name
|
17
|
+
# "1 validation error detected: Value 'instance_and_route53' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*"
|
18
|
+
logger.info "Invalid stack name: #{stack_name}"
|
19
|
+
logger.info "Full error message: #{e.message}"
|
20
|
+
exit 1
|
21
|
+
else
|
22
|
+
raise # re-raise exception because unsure what other errors can happen
|
23
|
+
end
|
24
|
+
end
|
25
|
+
exist
|
8
26
|
end
|
9
27
|
|
10
|
-
def
|
11
|
-
|
28
|
+
def find_stack(stack_name)
|
29
|
+
resp = cfn.describe_stacks(stack_name: stack_name)
|
30
|
+
resp.stacks.first
|
31
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
32
|
+
# example: Stack with id demo-web does not exist
|
33
|
+
if e.message =~ /Stack with/ && e.message =~ /does not exist/
|
34
|
+
nil
|
35
|
+
else
|
36
|
+
raise
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def find_stack_resources(stack_name)
|
41
|
+
resp = cfn.describe_stack_resources(stack_name: stack_name)
|
42
|
+
resp.stack_resources
|
43
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
44
|
+
if e.message.include?("does not exist")
|
45
|
+
nil
|
46
|
+
else
|
47
|
+
raise
|
48
|
+
end
|
12
49
|
end
|
13
50
|
end
|
14
51
|
end
|
data/lib/lono/aws_services.rb
CHANGED
@@ -11,27 +11,27 @@ module Lono
|
|
11
11
|
include Helper
|
12
12
|
|
13
13
|
def cfn
|
14
|
-
Aws::CloudFormation::Client.new
|
14
|
+
Aws::CloudFormation::Client.new(aws_options)
|
15
15
|
end
|
16
16
|
memoize :cfn
|
17
17
|
|
18
18
|
def ec2
|
19
|
-
Aws::EC2::Client.new
|
19
|
+
Aws::EC2::Client.new(aws_options)
|
20
20
|
end
|
21
21
|
memoize :ec2
|
22
22
|
|
23
23
|
def iam
|
24
|
-
Aws::IAM::Client.new
|
24
|
+
Aws::IAM::Client.new(aws_options)
|
25
25
|
end
|
26
26
|
memoize :iam
|
27
27
|
|
28
28
|
def s3
|
29
|
-
Aws::S3::Client.new
|
29
|
+
Aws::S3::Client.new(aws_options)
|
30
30
|
end
|
31
31
|
memoize :s3
|
32
32
|
|
33
33
|
def s3_resource
|
34
|
-
Aws::S3::Resource.new
|
34
|
+
Aws::S3::Resource.new(aws_options)
|
35
35
|
end
|
36
36
|
memoize :s3_resource
|
37
37
|
|
@@ -41,8 +41,39 @@ module Lono
|
|
41
41
|
memoize :s3_presigner
|
42
42
|
|
43
43
|
def sts
|
44
|
-
Aws::STS::Client.new # part of aws-sdk-core
|
44
|
+
Aws::STS::Client.new(aws_options) # part of aws-sdk-core
|
45
45
|
end
|
46
46
|
memoize :sts
|
47
|
+
|
48
|
+
# Override the AWS retry settings with Lono AWS clients.
|
49
|
+
#
|
50
|
+
# The aws-sdk-core has exponential backup with this formula:
|
51
|
+
#
|
52
|
+
# 2 ** c.retries * c.config.retry_base_delay
|
53
|
+
#
|
54
|
+
# Source:
|
55
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-core/lib/aws-sdk-core/plugins/retry_errors.rb
|
56
|
+
#
|
57
|
+
# So the max delay will be 2 ** 7 * 0.6 = 76.8s
|
58
|
+
#
|
59
|
+
# Only scoping this to deploy because dont want to affect people's application that use the aws sdk.
|
60
|
+
#
|
61
|
+
# There is also additional rate backoff logic elsewhere, since this is only scoped to deploys.
|
62
|
+
#
|
63
|
+
# Useful links:
|
64
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/gems/aws-sdk-core/lib/aws-sdk-core/plugins/retry_errors.rb
|
65
|
+
# https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html
|
66
|
+
#
|
67
|
+
def aws_options
|
68
|
+
options = {
|
69
|
+
retry_limit: 7, # default: 3
|
70
|
+
retry_base_delay: 0.6, # default: 0.3
|
71
|
+
}
|
72
|
+
options.merge!(
|
73
|
+
log_level: :debug,
|
74
|
+
logger: Logger.new($stdout),
|
75
|
+
) if ENV['LONO_DEBUG_AWS_SDK']
|
76
|
+
options
|
77
|
+
end
|
47
78
|
end
|
48
79
|
end
|
data/lib/lono/blueprint.rb
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
module Lono
|
2
|
-
class Blueprint
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Blueprint
|
3
|
+
attr_reader :name
|
4
|
+
def initialize(options={})
|
5
|
+
@options = options
|
6
|
+
@name = options[:blueprint]
|
6
7
|
end
|
7
|
-
register(New, "new", "new NAME", "Generates new lono blueprint.")
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
def exist?
|
10
|
+
!root.nil?
|
11
|
+
end
|
12
|
+
|
13
|
+
def root
|
14
|
+
paths = Dir.glob("#{Lono.root}/{app,vendor}/blueprints/*")
|
15
|
+
paths.find do |path|
|
16
|
+
path.include?("blueprints/#{@name}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def output_path
|
21
|
+
"#{Lono.root}/output/#{@name}/template.yml"
|
13
22
|
end
|
14
23
|
end
|
15
24
|
end
|
data/lib/lono/booter.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Lono
|
2
|
+
module Booter
|
3
|
+
def boot
|
4
|
+
run_hooks
|
5
|
+
Lono::Bundler.require # load plugins
|
6
|
+
end
|
7
|
+
|
8
|
+
# Special boot hooks run super early.
|
9
|
+
# Useful for setting env vars and other early things.
|
10
|
+
#
|
11
|
+
# config/boot.rb
|
12
|
+
# config/boot/dev.rb
|
13
|
+
#
|
14
|
+
def run_hooks
|
15
|
+
run_hook
|
16
|
+
run_hook(Lono.env)
|
17
|
+
Lono::App::Inits.run_all
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_hook(env=nil)
|
21
|
+
name = env ? "boot/#{env}" : "boot"
|
22
|
+
path = "#{Lono.root}/config/#{name}.rb"
|
23
|
+
require path if File.exist?(path)
|
24
|
+
end
|
25
|
+
|
26
|
+
extend self
|
27
|
+
end
|
28
|
+
end
|
@@ -1,13 +1,12 @@
|
|
1
|
-
module Lono::
|
1
|
+
module Lono::Builder::Context::Loader
|
2
2
|
module LoadFiles
|
3
3
|
# Load custom helper methods from project
|
4
|
-
def load_files(
|
5
|
-
paths = Dir.glob("#{
|
4
|
+
def load_files(dir)
|
5
|
+
paths = Dir.glob("#{dir}/**/*.rb")
|
6
6
|
paths.sort_by! { |p| p.size } # so namespaces are loaded first
|
7
7
|
paths.each do |path|
|
8
|
-
#
|
9
|
-
|
10
|
-
filename = path.sub(%r{.*/lib/},'').sub(%r{.*/app/helpers/},'').sub('.rb','')
|
8
|
+
# helpers = blueprint or project extensions
|
9
|
+
filename = path.sub(%r{.*/helpers/},'').sub('.rb','')
|
11
10
|
module_name = filename.camelize
|
12
11
|
|
13
12
|
# Prepend a period so require works LONO_ROOT is set to a relative path without a period.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Lono::Builder::Context
|
2
|
+
module Loader
|
3
|
+
include LoadFiles
|
4
|
+
|
5
|
+
# Variables in base.rb are overridden by their environment specific variables
|
6
|
+
# file. Example, file LONO_ENV=dev:
|
7
|
+
#
|
8
|
+
# config/vars/base.rb
|
9
|
+
# config/vars/dev.rb - will override any variables in base.rb
|
10
|
+
# config/vars/base.rb
|
11
|
+
# config/vars/dev.rb - will override any variables in base.rb
|
12
|
+
#
|
13
|
+
def load_variables
|
14
|
+
layers = Lono::Layering::Layer.new(@blueprint, "vars").paths
|
15
|
+
layers.each do |layer|
|
16
|
+
evaluate_variables_file(layer)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Load the variables defined in config/vars/* to make available in lono scope.
|
21
|
+
#
|
22
|
+
# NOTE: Was only able to make instance variables avaialble with instance_eval, wasnt able to make local variables
|
23
|
+
# available.
|
24
|
+
def evaluate_variables_file(path)
|
25
|
+
return unless File.exist?(path)
|
26
|
+
instance_eval(IO.read(path), path)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Load blueprint helpers
|
30
|
+
# blueprint helpers override extension helpers
|
31
|
+
def load_blueprint_helpers
|
32
|
+
load_files("#{@blueprint.root}/#{Lono.config.paths.helpers}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,16 +1,12 @@
|
|
1
1
|
# Encapsulates helper methods and instance variables to be rendered in the ERB templates.
|
2
|
-
|
3
|
-
class Context < Lono::
|
2
|
+
module Lono::Builder
|
3
|
+
class Context < Lono::CLI::Base
|
4
4
|
extend Memoist
|
5
|
-
include Lono::Template::
|
5
|
+
include Lono::Builder::Template::Helpers
|
6
6
|
include Loader
|
7
7
|
include Helpers # ERB
|
8
|
-
include
|
9
|
-
|
10
|
-
def initialize(options={})
|
11
|
-
super
|
12
|
-
load_context
|
13
|
-
end
|
8
|
+
include Template::Dsl::Evaluator::Syntax # DSL
|
9
|
+
include Lono::Utils::Context
|
14
10
|
|
15
11
|
# Take a hash and makes them instance variables in the current scope.
|
16
12
|
# Use this in custom helper methods to make variables accessible to ERB templates.
|
@@ -1,15 +1,16 @@
|
|
1
|
-
|
2
|
-
class
|
3
|
-
attr_reader :env_path, :base_path # set when
|
1
|
+
module Lono::Builder
|
2
|
+
class Param < Lono::CLI::Base
|
3
|
+
attr_reader :env_path, :base_path # set when build is called
|
4
4
|
|
5
|
-
def
|
6
|
-
|
5
|
+
def build
|
6
|
+
logger.info "Building parameters"
|
7
7
|
|
8
8
|
contents = []
|
9
|
-
|
10
|
-
|
11
|
-
contents << render_erb(
|
9
|
+
|
10
|
+
layers.each do |layer|
|
11
|
+
contents << render_erb(layer)
|
12
12
|
end
|
13
|
+
|
13
14
|
contents = contents.compact.join("\n") # result
|
14
15
|
|
15
16
|
data = convert_to_cfn_format(contents)
|
@@ -17,30 +18,28 @@ class Lono::Param
|
|
17
18
|
json = JSON.pretty_generate(camel_data)
|
18
19
|
write_output(json)
|
19
20
|
unless @options[:mute]
|
20
|
-
|
21
|
-
|
21
|
+
short_param_path = param_path.sub("#{Lono.root}/","")
|
22
|
+
logger.info " #{short_param_path}"
|
22
23
|
end
|
23
24
|
|
24
25
|
data
|
25
26
|
end
|
26
27
|
|
28
|
+
def layers
|
29
|
+
Lono::Layering::Layer.new(@blueprint, "params").paths
|
30
|
+
end
|
31
|
+
|
27
32
|
def parameters
|
28
|
-
|
33
|
+
build
|
29
34
|
end
|
30
35
|
|
31
36
|
def render_erb(path)
|
32
37
|
return unless path
|
33
38
|
if File.exist?(path)
|
34
|
-
RenderMePretty.result(path, context:
|
39
|
+
RenderMePretty.result(path, context: params_context)
|
35
40
|
end
|
36
41
|
end
|
37
42
|
|
38
|
-
# Context for ERB rendering.
|
39
|
-
# This is where we control what references get passed to the ERB rendering.
|
40
|
-
def context
|
41
|
-
@context ||= Lono::Template::Context.new(@options)
|
42
|
-
end
|
43
|
-
|
44
43
|
def convert_to_cfn_format(contents, casing=:underscore)
|
45
44
|
lines = parse_contents(contents)
|
46
45
|
|
@@ -96,14 +95,14 @@ class Lono::Param
|
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
99
|
-
def
|
100
|
-
"#{Lono.root}/output/#{@blueprint}/params
|
98
|
+
def param_path
|
99
|
+
"#{Lono.root}/output/#{@blueprint.name}/params.json"
|
101
100
|
end
|
102
101
|
|
103
102
|
def write_output(json)
|
104
|
-
dir = File.dirname(
|
103
|
+
dir = File.dirname(param_path)
|
105
104
|
FileUtils.mkdir_p(dir)
|
106
|
-
IO.write(
|
105
|
+
IO.write(param_path, json)
|
107
106
|
end
|
108
107
|
end
|
109
108
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "aws-sdk-s3"
|
2
|
+
|
3
|
+
class Lono::Builder::Template::AwsService
|
4
|
+
def s3
|
5
|
+
return @s3 if @s3
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
endpoint = ENV['S3_ENDPOINT'] if ENV['S3_ENDPOINT']
|
9
|
+
options[:endpoint] = endpoint if endpoint
|
10
|
+
if options[:endpoint]
|
11
|
+
options[:region] = options[:endpoint].split('.')[1]
|
12
|
+
end
|
13
|
+
@s3 = Aws::S3::Client.new(options)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
class Lono::Builder::Template
|
4
|
+
class Bashify
|
5
|
+
include Lono::Utils::Logging
|
6
|
+
|
7
|
+
def initialize(options={})
|
8
|
+
@options = options
|
9
|
+
@path = options[:path]
|
10
|
+
end
|
11
|
+
|
12
|
+
def user_data_paths(data,path="")
|
13
|
+
paths = []
|
14
|
+
paths << path
|
15
|
+
data.each do |key,value|
|
16
|
+
if value.is_a?(Hash)
|
17
|
+
paths += user_data_paths(value,"#{path}/#{key}")
|
18
|
+
else
|
19
|
+
paths += ["#{path}/#{key}"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
paths.select {|p| p =~ /UserData/ && p =~ /Fn::Join/ }
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
raw = open(@path).read
|
27
|
+
json = JSON.load(raw)
|
28
|
+
paths = user_data_paths(json)
|
29
|
+
if paths.empty?
|
30
|
+
logger.info "No UserData script found"
|
31
|
+
return
|
32
|
+
end
|
33
|
+
paths.each do |path|
|
34
|
+
logger.info "UserData script for #{path}:"
|
35
|
+
key = path.sub('/','').split("/").map {|x| "['#{x}']"}.join('')
|
36
|
+
user_data = eval("json#{key}")
|
37
|
+
delimiter = user_data[0]
|
38
|
+
script = user_data[1]
|
39
|
+
logger.info script.join(delimiter)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class Lono::Template
|
2
|
-
class ConfigsetInjector < Lono::
|
1
|
+
class Lono::Builder::Template
|
2
|
+
class ConfigsetInjector < Lono::CLI::Base
|
3
3
|
def initialize(options={})
|
4
4
|
super
|
5
5
|
end
|
@@ -16,7 +16,7 @@ class Lono::Template
|
|
16
16
|
resource = @cfn["Resources"][logical_id]
|
17
17
|
|
18
18
|
unless resource
|
19
|
-
|
19
|
+
logger.info "WARN: Resources.#{logical_id} not found in the template. Are you sure you are specifying the correct resource id in your configsets configs?".color(:yellow)
|
20
20
|
next
|
21
21
|
end
|
22
22
|
|
@@ -46,7 +46,7 @@ class Lono::Template
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def template_path
|
49
|
-
"#{Lono.
|
49
|
+
"#{Lono.root}/output/#{@blueprint.name}/templates/#{@template}.yml"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|