lono 7.5.2 → 8.0.0.pre.rc3
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 +46 -5
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +3 -1
- data/LICENSE.txt +201 -1
- data/README.md +6 -11
- data/lib/lono/api/client.rb +3 -2
- data/lib/lono/app/callable_option/concern.rb +12 -0
- data/lib/lono/app/callable_option.rb +56 -0
- data/lib/lono/app/inits.rb +13 -0
- data/lib/lono/app.rb +73 -0
- data/lib/lono/autoloader.rb +3 -2
- data/lib/lono/aws_services/helper.rb +41 -6
- data/lib/lono/aws_services.rb +37 -6
- data/lib/lono/blueprint.rb +3 -11
- data/lib/lono/booter.rb +28 -0
- data/lib/lono/builder/allow/base.rb +54 -0
- data/lib/lono/builder/allow/env.rb +17 -0
- data/lib/lono/builder/allow/region.rb +20 -0
- data/lib/lono/builder/allow.rb +8 -0
- data/lib/lono/builder/configset/combiner.rb +145 -0
- data/lib/lono/builder/configset/definition/base.rb +47 -0
- data/lib/lono/builder/configset/definition/context.rb +29 -0
- data/lib/lono/{configset/strategy/helpers/dsl → builder/configset/definition/dsl/syntax}/auth.rb +1 -1
- data/lib/lono/{configset/strategy/helpers/dsl/core.rb → builder/configset/definition/dsl/syntax/content.rb} +11 -3
- data/lib/lono/{configset/strategy/helpers/dsl/syntax.rb → builder/configset/definition/dsl/syntax/core.rb} +15 -9
- data/lib/lono/{configset/strategy/helpers/dsl → builder/configset/definition/dsl/syntax}/package.rb +1 -1
- data/lib/lono/builder/configset/definition/dsl/syntax.rb +5 -0
- data/lib/lono/{configset/strategy → builder/configset/definition}/dsl.rb +10 -14
- data/lib/lono/{configset/strategy → builder/configset/definition}/erb.rb +13 -16
- data/lib/lono/builder/configset/definition.rb +18 -0
- data/lib/lono/builder/configset/evaluator.rb +10 -0
- data/lib/lono/builder/configset/registration.rb +35 -0
- data/lib/lono/builder/context.rb +40 -0
- data/lib/lono/builder/dsl/evaluator.rb +45 -0
- data/lib/lono/builder/dsl/finalizer/base.rb +8 -0
- data/lib/lono/builder/dsl/finalizer/configsets.rb +20 -0
- data/lib/lono/builder/dsl/finalizer/files/base.rb +4 -0
- data/lib/lono/builder/dsl/finalizer/files/build.rb +58 -0
- data/lib/lono/builder/dsl/finalizer/files/replace.rb +31 -0
- data/lib/lono/builder/dsl/finalizer/files.rb +9 -0
- data/lib/lono/{template/strategy → builder}/dsl/finalizer/parameter_groups.rb +6 -5
- data/lib/lono/builder/dsl/finalizer.rb +15 -0
- data/lib/lono/{template/strategy/dsl/builder/helpers/ec2_helper.rb → builder/dsl/helpers/ec2.rb} +3 -3
- data/lib/lono/builder/dsl/helpers/files.rb +7 -0
- data/lib/lono/builder/dsl/helpers/partials.rb +140 -0
- data/lib/lono/{template/strategy/dsl/builder/helpers/s3_helper.rb → builder/dsl/helpers/s3.rb} +3 -3
- data/lib/lono/{template/context/ssm_fetcher.rb → builder/dsl/helpers/ssm/fetcher.rb} +5 -3
- data/lib/lono/{template/context/helpers.rb → builder/dsl/helpers/ssm.rb} +3 -3
- data/lib/lono/{template/strategy/dsl/builder/helpers/stack_helper.rb → builder/dsl/helpers/stack.rb} +14 -9
- data/lib/lono/{template/strategy/dsl/builder/helpers/tags_helper.rb → builder/dsl/helpers/tags.rb} +2 -2
- data/lib/lono/builder/dsl/helpers/template_file.rb +66 -0
- data/lib/lono/builder/dsl/helpers.rb +5 -0
- data/lib/lono/builder/dsl/syntax/core/base.rb +22 -0
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/condition.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/mapping.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/output.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/parameter.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/resource/property_mover.rb +12 -2
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/resource.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/section.rb +1 -1
- data/lib/lono/builder/dsl/syntax/core/squeezer.rb +38 -0
- data/lib/lono/{template/strategy/dsl/builder/section/methods.rb → builder/dsl/syntax/core.rb} +8 -8
- data/lib/lono/{template/strategy/dsl/builder → builder/dsl/syntax}/fn.rb +2 -2
- data/lib/lono/{template/strategy/dsl/builder → builder/dsl}/syntax/parameter_group.rb +1 -1
- data/lib/lono/builder/dsl/syntax.rb +9 -0
- data/lib/lono/builder/dsl.rb +14 -0
- data/lib/lono/{param/generator.rb → builder/param.rb} +24 -22
- data/lib/lono/builder/template/aws_service.rb +15 -0
- data/lib/lono/builder/template/bashify.rb +43 -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/builder/template/upload.rb +8 -0
- data/lib/lono/builder/template.rb +55 -0
- data/lib/lono/{template/strategy/dsl/builder → builder/util}/stringify.rb +1 -1
- 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 +18 -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 +33 -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 +12 -29
- 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 +48 -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 +100 -5
- data/lib/lono/cfn/download.rb +4 -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 +62 -0
- data/lib/lono/cfn/plan/diff/file.rb +57 -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 +34 -0
- data/lib/lono/cfn/show.rb +30 -0
- data/lib/lono/cfn/status.rb +1 -1
- data/lib/lono/cli/abstract.rb +11 -0
- data/lib/lono/cli/base.rb +11 -0
- data/lib/lono/cli/build.rb +47 -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 +23 -0
- data/lib/lono/cli/code.rb +22 -0
- 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 -1
- 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/helper/blueprint.md +17 -0
- data/lib/lono/cli/help/new/helper/project.md +16 -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/cli/help/seed.md +24 -0
- 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 +25 -0
- data/lib/lono/cli/new/blueprint.rb +29 -0
- data/lib/lono/cli/new/concerns.rb +16 -0
- data/lib/lono/cli/new/configset.rb +37 -0
- data/lib/lono/{extension/new.rb → cli/new/extension.rb} +2 -10
- data/lib/lono/cli/new/helper/blueprint.rb +26 -0
- data/lib/lono/cli/new/helper/project.rb +24 -0
- data/lib/lono/cli/new/helper.rb +13 -0
- data/lib/lono/cli/new/project.rb +77 -0
- data/lib/lono/cli/new/sequence.rb +56 -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 +27 -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/status.rb +18 -0
- data/lib/lono/cli/test.rb +35 -0
- data/lib/lono/cli.rb +78 -109
- data/lib/lono/command.rb +27 -1
- data/lib/lono/component.rb +29 -0
- data/lib/lono/concerns/aws_info.rb +14 -0
- data/lib/lono/concerns/names.rb +9 -0
- data/lib/lono/configset.rb +11 -10
- data/lib/lono/core.rb +25 -54
- data/lib/lono/ext/core/module.rb +31 -0
- data/lib/lono/ext/core/object.rb +32 -0
- data/lib/lono/ext/core/string.rb +9 -0
- data/lib/lono/ext.rb +4 -0
- data/lib/lono/files/base.rb +12 -0
- data/lib/lono/files/builder.rb +37 -0
- data/lib/lono/files/compressor.rb +53 -0
- data/lib/lono/files/concerns/post_processing.rb +35 -0
- data/lib/lono/files/concerns/registration.rb +13 -0
- data/lib/lono/files/registry.rb +6 -0
- data/lib/lono/files.rb +37 -0
- data/lib/lono/importer/base.rb +6 -6
- data/lib/lono/importer/download.rb +7 -7
- data/lib/lono/importer/dsl.rb +3 -3
- data/lib/lono/importer/service/coder.rb +67 -63
- data/lib/lono/importer.rb +1 -10
- data/lib/lono/inspector/base.rb +7 -7
- data/lib/lono/inspector/summary.rb +18 -19
- data/lib/lono/layering/layer.rb +112 -0
- data/lib/lono/layering.rb +13 -55
- data/lib/lono/logger/formatter.rb +13 -0
- data/lib/lono/logger.rb +32 -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 +42 -42
- data/lib/lono/s3/rollback.rb +8 -0
- data/lib/lono/s3/uploader.rb +33 -34
- 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/seeder.rb +110 -0
- data/lib/lono/user_data.rb +10 -13
- 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/yamler/validator.rb +7 -22
- data/lib/lono.rb +15 -12
- data/lib/templates/blueprint/template.rb +2 -0
- data/lib/templates/configset/configset.rb +2 -0
- data/lib/templates/examples/blueprint/template.rb +9 -0
- data/lib/templates/{configset/lib → examples/configset}/configset.rb +0 -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 +282 -296
- 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/app_file/base.rb +0 -28
- data/lib/lono/app_file/build/lambda_layer/ruby_packager.rb +0 -153
- data/lib/lono/app_file/build/lambda_layer.rb +0 -20
- data/lib/lono/app_file/build.rb +0 -84
- data/lib/lono/app_file/registry/item.rb +0 -24
- data/lib/lono/app_file/registry.rb +0 -16
- data/lib/lono/app_file/upload.rb +0 -12
- 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/code.rb +0 -22
- data/lib/lono/configset/combiner.rb +0 -162
- data/lib/lono/configset/evaluate_file.rb +0 -8
- data/lib/lono/configset/generator.rb +0 -57
- data/lib/lono/configset/list.rb +0 -67
- data/lib/lono/configset/meta/dsl.rb +0 -12
- data/lib/lono/configset/meta.rb +0 -19
- data/lib/lono/configset/new.rb +0 -77
- 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/s3_file/build.rb +0 -33
- data/lib/lono/configset/s3_file/item.rb +0 -38
- data/lib/lono/configset/s3_file/registry.rb +0 -12
- data/lib/lono/configset/s3_file/upload.rb +0 -12
- data/lib/lono/configset/strategy/base.rb +0 -83
- data/lib/lono/configset/strategy/helpers/dsl.rb +0 -8
- data/lib/lono/configset/strategy/helpers/erb.rb +0 -9
- 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/extension/helper.rb +0 -13
- data/lib/lono/extension/list.rb +0 -40
- data/lib/lono/extension.rb +0 -9
- data/lib/lono/extensions/dsl.rb +0 -11
- data/lib/lono/extensions/loader.rb +0 -30
- data/lib/lono/extensions/preparer.rb +0 -26
- data/lib/lono/extensions/register.rb +0 -15
- data/lib/lono/extensions.rb +0 -18
- 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/seed.md +0 -23
- 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/base.rb +0 -116
- data/lib/lono/seed/service_role.rb +0 -11
- 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/configset_injector.rb +0 -52
- data/lib/lono/template/context/loader/load_files.rb +0 -24
- data/lib/lono/template/context/loader.rb +0 -52
- data/lib/lono/template/context.rb +0 -29
- data/lib/lono/template/evaluate.rb +0 -40
- 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/helpers/core_helper.rb +0 -14
- data/lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb +0 -48
- data/lib/lono/template/strategy/dsl/builder/helpers.rb +0 -16
- data/lib/lono/template/strategy/dsl/builder/section/base.rb +0 -30
- data/lib/lono/template/strategy/dsl/builder/squeezer.rb +0 -24
- data/lib/lono/template/strategy/dsl/builder/syntax/extend_with.rb +0 -9
- data/lib/lono/template/strategy/dsl/builder/syntax.rb +0 -11
- data/lib/lono/template/strategy/dsl/builder.rb +0 -59
- data/lib/lono/template/strategy/dsl/finalizer.rb +0 -12
- 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/upload.rb +0 -23
- 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/lono/utils/item/file_methods.rb +0 -29
- data/lib/lono/utils/item/zip.rb +0 -42
- 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
@@ -0,0 +1,39 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class Info < CLI::Base
|
3
|
+
def run
|
4
|
+
file = LB.config.lockfile
|
5
|
+
unless File.exist?(file)
|
6
|
+
logger.info "No #{file} found".color(:red)
|
7
|
+
logger.info "Maybe run: lono bundle"
|
8
|
+
return
|
9
|
+
end
|
10
|
+
|
11
|
+
name = @options[:component]
|
12
|
+
all = lockfile.components.find_all { |c| c.name == @options[:component] }
|
13
|
+
all = all.select { |c| c.type == @options[:type] } if @options[:type]
|
14
|
+
if all.size > 1
|
15
|
+
logger.info "Multiple components found with different types"
|
16
|
+
end
|
17
|
+
|
18
|
+
all.each do |found|
|
19
|
+
show(found)
|
20
|
+
end
|
21
|
+
unless all.size > 0
|
22
|
+
logger.info "Could not find component in #{LB.config.lockfile}: #{name}".color(:red)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def show(component)
|
27
|
+
props = component.props.reject { |k,v| k == :name }.stringify_keys # for sort
|
28
|
+
puts "#{component.name}:"
|
29
|
+
props.keys.sort.each do |k|
|
30
|
+
v = props[k]
|
31
|
+
puts " #{k}: #{v}" unless v.blank?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def lockfile
|
36
|
+
Lockfile.instance
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class List < CLI::Base
|
3
|
+
def run
|
4
|
+
file = LB.config.lockfile
|
5
|
+
unless File.exist?(file)
|
6
|
+
logger.info "No #{file} found".color(:red)
|
7
|
+
logger.info "Maybe run: lono bundle"
|
8
|
+
return
|
9
|
+
end
|
10
|
+
|
11
|
+
logger.info "Components included by #{file}\n\n"
|
12
|
+
presenter = CliFormat::Presenter.new(@options.merge(format: "table"))
|
13
|
+
presenter.header = ["Name", "Type"]
|
14
|
+
lockfile.components.each do |component|
|
15
|
+
row = [component.name, component.type]
|
16
|
+
presenter.rows << row
|
17
|
+
end
|
18
|
+
presenter.show
|
19
|
+
logger.info "\nUse `lono bundle info` to print more detailed information about a component"
|
20
|
+
end
|
21
|
+
|
22
|
+
def lockfile
|
23
|
+
Lockfile.instance
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class Lono::Bundler::Lockfile
|
2
|
+
class VersionComparer
|
3
|
+
attr_reader :reason, :changed
|
4
|
+
def initialize(locked, current)
|
5
|
+
@locked, @current = locked, current
|
6
|
+
@changed = false
|
7
|
+
end
|
8
|
+
|
9
|
+
def changed?
|
10
|
+
@changed
|
11
|
+
end
|
12
|
+
|
13
|
+
# Tricky logic, maybe spec this.
|
14
|
+
#
|
15
|
+
# no components specified:
|
16
|
+
# lono bundle update # no components specified => update all
|
17
|
+
# lono bundle install # no Lonofile.lock => update all
|
18
|
+
# components specified:
|
19
|
+
# lono bundle update s3 # explicit component => update s3
|
20
|
+
# lono bundle install s3 # errors: not possible to specify componentule for install command
|
21
|
+
#
|
22
|
+
# Note: Install with specific components wipes existing components. Not worth it to support.
|
23
|
+
#
|
24
|
+
def run
|
25
|
+
@changed = false
|
26
|
+
|
27
|
+
# Most props are "strict" version checks. So if user changes options generally in the component line
|
28
|
+
# the Lonofile.lock will get updated, which is expected behavior.
|
29
|
+
props = @locked.props.keys + @current.props.keys
|
30
|
+
strict_versions = props.uniq.sort - [:sha, :type]
|
31
|
+
strict_versions.each do |version|
|
32
|
+
@changed = @locked.send(version) != @current.send(version)
|
33
|
+
if @changed
|
34
|
+
@reason = reason_message(version)
|
35
|
+
return @changed
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Lots of nuance with the sha check that works differently
|
40
|
+
# Only check when set.
|
41
|
+
# Also in update mode then always check it.
|
42
|
+
@changed = @current.sha && !@locked.sha.include?(@current.sha) ||
|
43
|
+
LB.update_mode? && !@current.latest_sha.include?(@locked.sha)
|
44
|
+
if @changed
|
45
|
+
@reason = reason_message("sha")
|
46
|
+
return @changed
|
47
|
+
end
|
48
|
+
|
49
|
+
@changed
|
50
|
+
end
|
51
|
+
|
52
|
+
def reason_message(version)
|
53
|
+
"Replacing component #{@current.name} because #{version} is different in Lonofile and Lonofile.lock"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
class Lono::Bundler::Lockfile
|
4
|
+
class Yamler
|
5
|
+
def initialize(components)
|
6
|
+
@components = components.sort_by(&:name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def dump
|
10
|
+
YAML.dump(data)
|
11
|
+
end
|
12
|
+
|
13
|
+
def data
|
14
|
+
@components.map do |component|
|
15
|
+
item(component)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def item(component)
|
20
|
+
props = component.props.dup # passthrough: name, url, version, ref, tag, branch etc
|
21
|
+
props[:sha] ||= component.latest_sha
|
22
|
+
props.delete_if { |k,v| v.nil? }
|
23
|
+
props.deep_stringify_keys
|
24
|
+
end
|
25
|
+
|
26
|
+
def write
|
27
|
+
IO.write(LB.config.lockfile, dump)
|
28
|
+
end
|
29
|
+
|
30
|
+
class << self
|
31
|
+
def write(components)
|
32
|
+
new(components).write
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
module Lono::Bundler
|
4
|
+
class Lockfile
|
5
|
+
include Singleton
|
6
|
+
include LB::Util::Logging
|
7
|
+
|
8
|
+
# [{"name"=>"vpc",
|
9
|
+
# "type"=>"blueprint",
|
10
|
+
# "sha"=>"52328b2b5197f9b95e3005cfcfb99595040ee45b",
|
11
|
+
# "source"=>"org/terraform-aws-vpc",
|
12
|
+
# "url"=>"https://github.com/org/terraform-aws-vpc"},
|
13
|
+
# {"name" => "instance",
|
14
|
+
# "type"=>"blueprint",
|
15
|
+
# "sha"=>"570cca3ea7b25e3af1961dc57b27ca2c129b934a",
|
16
|
+
# "source"=>"org/terraform-aws-instance",
|
17
|
+
# "url"=>"https://github.com/org/terraform-aws-instance"}]
|
18
|
+
@@components = nil
|
19
|
+
def components
|
20
|
+
return @@components if @@components
|
21
|
+
lockfile = LB.config.lockfile
|
22
|
+
components = File.exist?(lockfile) ? YAML.load_file(lockfile) : []
|
23
|
+
@@components = components.map do |props|
|
24
|
+
Component.new(props)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# update (if version mismatch) or create (if missing)
|
29
|
+
def sync(component)
|
30
|
+
replace!(component) if changed?(component)
|
31
|
+
end
|
32
|
+
|
33
|
+
# component built from Lonofile
|
34
|
+
def changed?(component)
|
35
|
+
# missing componentule case
|
36
|
+
found = components.find { |locked_component| locked_component.name == component.name }
|
37
|
+
unless found
|
38
|
+
logger.debug "Replacing component: #{component.name}. Not found in Lonofile.lock"
|
39
|
+
return true
|
40
|
+
end
|
41
|
+
|
42
|
+
comparer = VersionComparer.new(found, component)
|
43
|
+
comparer.run
|
44
|
+
logger.debug("REASON: #{comparer.reason}") if comparer.reason
|
45
|
+
comparer.changed?
|
46
|
+
end
|
47
|
+
|
48
|
+
def replace!(component)
|
49
|
+
# components are immediately fresh from writing to @@components directly
|
50
|
+
@@components.delete_if { |c| c.name == component.name && c.type == component.type }
|
51
|
+
@@components << component
|
52
|
+
@@components.sort_by!(&:name)
|
53
|
+
end
|
54
|
+
|
55
|
+
def prune(removed_components)
|
56
|
+
removals = removed_components.map(&:name)
|
57
|
+
@@components.delete_if { |m| removals.include?(m.name) }
|
58
|
+
end
|
59
|
+
|
60
|
+
class << self
|
61
|
+
def write
|
62
|
+
Yamler.write(@@components) if @@components
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class Lonofile
|
3
|
+
include Singleton
|
4
|
+
extend Memoist
|
5
|
+
include LB::Util::Logging
|
6
|
+
|
7
|
+
# dsl meta example:
|
8
|
+
# {:global=>{{:org=>"boltopspro"},
|
9
|
+
# :components=>[{:source=>"git@github.com:boltopspro/vpc", :type=>"blueprint", :name=>"vpc"}]
|
10
|
+
# }
|
11
|
+
def components
|
12
|
+
LB.dsl.meta[:components].map do |options|
|
13
|
+
Component.new(options)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
memoize :components
|
17
|
+
|
18
|
+
# Checks if any of the components defined in Lonofile has an inferred an org
|
19
|
+
# In this case the org must be set
|
20
|
+
# When a source is set with an inferred org and org is not set it looks like this:
|
21
|
+
#
|
22
|
+
# dsl.meta has {:source=>"terraform-random-pet"}
|
23
|
+
# component.source = "terraform-random-pet"
|
24
|
+
#
|
25
|
+
# Using info to detect that the org is missing and the Lonofile definition
|
26
|
+
# has at least one component line that has an inferred org.
|
27
|
+
#
|
28
|
+
def missing_org?
|
29
|
+
components.detect { |component| component.source.split('/').size == 1 } && LB.config.org.nil?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class Runner < CLI::Base
|
3
|
+
def run
|
4
|
+
Syncer.new(@options).run
|
5
|
+
Exporter.new(@options).run
|
6
|
+
# finish_message
|
7
|
+
end
|
8
|
+
|
9
|
+
def finish_message
|
10
|
+
no_components_found = true
|
11
|
+
export_paths.each do |path|
|
12
|
+
found = Dir.exist?(path) && !Dir.empty?(path)
|
13
|
+
next unless found
|
14
|
+
logger.info "components saved to #{path}"
|
15
|
+
no_components_found = false
|
16
|
+
end
|
17
|
+
|
18
|
+
logger.info("No components were found.") if no_components_found
|
19
|
+
end
|
20
|
+
|
21
|
+
def export_paths
|
22
|
+
export_paths = Lonofile.instance.mods.map(&:export_to).compact.uniq
|
23
|
+
export_paths << LB.config.export_to
|
24
|
+
export_paths
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class Syncer
|
3
|
+
include LB::Util::Logging
|
4
|
+
|
5
|
+
def initialize(options={})
|
6
|
+
@options = options
|
7
|
+
@component = @options[:component]
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
validate!
|
12
|
+
FileUtils.rm_f(LB.config.lockfile) if update_all?
|
13
|
+
logger.info "Bundling with #{LB.config.lonofile}..."
|
14
|
+
if File.exist?(LB.config.lockfile)
|
15
|
+
sync
|
16
|
+
else
|
17
|
+
create
|
18
|
+
end
|
19
|
+
LB::Lockfile.write
|
20
|
+
end
|
21
|
+
|
22
|
+
def sync
|
23
|
+
sync_components
|
24
|
+
removal_components = subtract(lockfile.components, lonofile.components)
|
25
|
+
lockfile.prune(removal_components)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create
|
29
|
+
sync_components
|
30
|
+
end
|
31
|
+
|
32
|
+
def sync_components
|
33
|
+
# VersionComparer is used in lockfile.sync and does heavy lifting to check if component should be updated and replaced
|
34
|
+
lonofile.components.each do |component|
|
35
|
+
next unless sync?(component)
|
36
|
+
logger.debug "Syncing #{component.name}"
|
37
|
+
lockfile.sync(component) # update (if version mismatch) or create (if missing)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def sync?(component)
|
42
|
+
names = @options[:components]
|
43
|
+
names.blank? or names.include?(component.name)
|
44
|
+
end
|
45
|
+
|
46
|
+
def validate!
|
47
|
+
return unless lonofile.missing_org?
|
48
|
+
logger.error "ERROR: org must be set in the #{LB.config.lonofile}.".color(:red)
|
49
|
+
logger.error "Please set org in the Lonofile"
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
|
53
|
+
def update_all?
|
54
|
+
LB.update_mode? && @options[:components].empty?
|
55
|
+
end
|
56
|
+
|
57
|
+
def subtract(components1, components2)
|
58
|
+
component2_names = components2.map(&:name)
|
59
|
+
components1.select { |component1| !component2_names.include?(component1.name) }
|
60
|
+
end
|
61
|
+
|
62
|
+
def lonofile
|
63
|
+
Lonofile.instance
|
64
|
+
end
|
65
|
+
|
66
|
+
def lockfile
|
67
|
+
Lockfile.instance
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Lono::Bundler::Util
|
2
|
+
module Git
|
3
|
+
include Logging
|
4
|
+
|
5
|
+
def sh(command)
|
6
|
+
command = "#{command} 2>&1" # always need output for the sha
|
7
|
+
logger.debug "=> #{command}"
|
8
|
+
out = `#{command}`
|
9
|
+
unless $?.success?
|
10
|
+
if command.include?("git")
|
11
|
+
raise LB::GitError.new("#{command}\n#{out}")
|
12
|
+
else
|
13
|
+
logger.error "ERROR: running #{command}".color(:red)
|
14
|
+
logger.error out
|
15
|
+
exit $?.exitstatus
|
16
|
+
end
|
17
|
+
end
|
18
|
+
out
|
19
|
+
end
|
20
|
+
|
21
|
+
def git(command)
|
22
|
+
sh("git #{command}")
|
23
|
+
rescue LB::GitError => e
|
24
|
+
action, version = command.split(' ')
|
25
|
+
if action == "checkout" && version !~ /^v/
|
26
|
+
command = "checkout v#{version}"
|
27
|
+
retry
|
28
|
+
else
|
29
|
+
logger.error "ERROR: There was a git error".color(:red)
|
30
|
+
logger.error "Current dir: #{Dir.pwd}"
|
31
|
+
logger.error "The error occur when running:"
|
32
|
+
logger.error e.message
|
33
|
+
end
|
34
|
+
exit 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Lono
|
2
|
-
|
3
|
-
|
2
|
+
module Bundler
|
3
|
+
extend Memoist
|
4
|
+
|
4
5
|
# Looks like for zeitwerk module autovivification to work `bundle exec` must be called.
|
5
6
|
# This allows zeitwork module autovivification to work even if the user has not called lono with `bundle exec lono`.
|
6
7
|
# Bundler.setup is essentially the same as `bundle exec`
|
@@ -9,7 +10,7 @@ module Lono
|
|
9
10
|
def setup
|
10
11
|
return unless gemfile?
|
11
12
|
Kernel.require "bundler/setup"
|
12
|
-
Bundler.setup # Same as Bundler.setup(:default)
|
13
|
+
::Bundler.setup # Same as Bundler.setup(:default)
|
13
14
|
rescue LoadError => e
|
14
15
|
handle_error(e)
|
15
16
|
end
|
@@ -17,7 +18,7 @@ module Lono
|
|
17
18
|
def require
|
18
19
|
return unless gemfile?
|
19
20
|
Kernel.require "bundler/setup"
|
20
|
-
Bundler.require(*bundler_groups)
|
21
|
+
::Bundler.require(*bundler_groups)
|
21
22
|
rescue LoadError => e
|
22
23
|
handle_error(e)
|
23
24
|
end
|
@@ -50,5 +51,38 @@ module Lono
|
|
50
51
|
end
|
51
52
|
|
52
53
|
extend self
|
54
|
+
|
55
|
+
@@logger = nil
|
56
|
+
def logger
|
57
|
+
config.logger
|
58
|
+
end
|
59
|
+
|
60
|
+
def logger=(v)
|
61
|
+
@@logger = v
|
62
|
+
end
|
63
|
+
|
64
|
+
def config
|
65
|
+
Config.instance.config
|
66
|
+
end
|
67
|
+
|
68
|
+
# DSL is evaluated once lazily when it get used
|
69
|
+
def dsl
|
70
|
+
dsl = Dsl.new
|
71
|
+
dsl.run
|
72
|
+
dsl
|
73
|
+
end
|
74
|
+
memoize :dsl
|
75
|
+
|
76
|
+
@@update_mode = false
|
77
|
+
def update_mode
|
78
|
+
@@update_mode
|
79
|
+
end
|
80
|
+
alias_method :update_mode?, :update_mode
|
81
|
+
|
82
|
+
def update_mode=(v)
|
83
|
+
@@update_mode = v
|
84
|
+
end
|
53
85
|
end
|
54
86
|
end
|
87
|
+
|
88
|
+
LB = Lono::Bundler
|
data/lib/lono/cfn/base.rb
CHANGED
@@ -1,201 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class Lono::Cfn
|
4
|
-
class Base < Lono::AbstractBase
|
1
|
+
module Lono::Cfn
|
2
|
+
class Base < Lono::CLI::Base
|
5
3
|
extend Memoist
|
4
|
+
|
6
5
|
include Lono::AwsServices
|
7
6
|
include Lono::Utils::Sure
|
7
|
+
include Lono::Utils::Logging
|
8
|
+
include Lono::Utils::Pretty
|
9
|
+
include Lono::Utils::Quit
|
8
10
|
|
9
|
-
|
10
|
-
action = self.class.to_s.split('::').last
|
11
|
-
puts "#{action} #{@stack.color(:green)} stack..."
|
12
|
-
end
|
13
|
-
|
14
|
-
def run
|
15
|
-
starting_message
|
16
|
-
parameters = generate_all
|
17
|
-
begin
|
18
|
-
save(parameters) # defined in the sub class
|
19
|
-
rescue Aws::CloudFormation::Errors::InsufficientCapabilitiesException => e
|
20
|
-
yes = rerun_with_iam?(e)
|
21
|
-
retry if yes
|
22
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
23
|
-
if e.message.include?("No updates") # No updates are to be performed.
|
24
|
-
puts "WARN: #{e.message}".color(:yellow)
|
25
|
-
elsif e.message.include?("UPDATE_ROLLBACK_FAILED") # https://amzn.to/2IiEjc5
|
26
|
-
continue_update_rollback
|
27
|
-
else
|
28
|
-
puts "ERROR: #{e.message}".color(:red)
|
29
|
-
exit 1
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
return unless @options[:wait]
|
34
|
-
|
35
|
-
success = false
|
36
|
-
if !@options[:noop]
|
37
|
-
success = status.wait
|
38
|
-
end
|
39
|
-
|
40
|
-
# exit code for cfn.rb cli, so there's less duplication
|
41
|
-
exit 1 unless success
|
42
|
-
success
|
43
|
-
end
|
44
|
-
|
45
|
-
def continue_update_rollback_sure?
|
46
|
-
puts <<~EOL
|
47
|
-
The stack is in the UPDATE_ROLLBACK_FAILED state. More info here: https://amzn.to/2IiEjc5
|
48
|
-
Would you like to try to continue the update rollback? (y/N)
|
49
|
-
EOL
|
50
|
-
|
51
|
-
sure = @options[:sure] ? "y" : $stdin.gets
|
52
|
-
unless sure =~ /^y/
|
53
|
-
puts "Exiting without continuing the update rollback."
|
54
|
-
exit 0
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def continue_update_rollback
|
59
|
-
continue_update_rollback_sure?
|
60
|
-
options = {stack_name: @stack}
|
61
|
-
show_options(options, "cfn.continue_update_rollback")
|
62
|
-
begin
|
63
|
-
cfn.continue_update_rollback(options)
|
64
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
65
|
-
puts "ERROR5: #{e.message}".color(:red)
|
66
|
-
exit 1
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def delete_rollback_stack
|
71
|
-
rollback = Rollback.new(@stack)
|
72
|
-
rollback.delete_stack
|
73
|
-
end
|
74
|
-
|
75
|
-
def status
|
76
|
-
Status.new(@stack)
|
77
|
-
end
|
78
|
-
memoize :status
|
79
|
-
|
80
|
-
def rerun_with_iam?(e)
|
81
|
-
# e.message is "Requires capabilities : [CAPABILITY_IAM]"
|
82
|
-
# grab CAPABILITY_IAM with regexp
|
83
|
-
capabilities = e.message.match(/\[(.*)\]/)[1]
|
84
|
-
confirm = prompt_for_iam(capabilities)
|
85
|
-
if confirm =~ /^y/
|
86
|
-
@options.merge!(capabilities: [capabilities])
|
87
|
-
puts "Re-running: #{command_with_iam(capabilities).color(:green)}"
|
88
|
-
true
|
89
|
-
else
|
90
|
-
puts "Exited"
|
91
|
-
exit 1
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def prompt_for_iam(capabilities)
|
96
|
-
puts "This stack will create IAM resources. Please approve to run the command again with #{capabilities} capabilities."
|
97
|
-
puts " #{command_with_iam(capabilities)}"
|
98
|
-
|
99
|
-
puts "Please confirm (y/N)"
|
100
|
-
$stdin.gets
|
101
|
-
end
|
102
|
-
|
103
|
-
def command_with_iam(capabilities)
|
104
|
-
"#{File.basename($0)} #{ARGV.join(' ')} --capabilities #{capabilities}"
|
105
|
-
end
|
106
|
-
|
107
|
-
def generate_all
|
108
|
-
Lono::Generate.new(@options).all
|
109
|
-
end
|
110
|
-
|
111
|
-
# Maps to CloudFormation format. Example:
|
112
|
-
#
|
113
|
-
# {"a"=>"1", "b"=>"2"}
|
114
|
-
# To
|
115
|
-
# [{key: "a", value: "1"}, {key: "b", value: "2"}]
|
116
|
-
#
|
117
|
-
def tags
|
118
|
-
tags = @options[:tags] || []
|
119
|
-
tags = tags.map do |k,v|
|
120
|
-
{ key: k, value: v }
|
121
|
-
end
|
122
|
-
|
123
|
-
update_operation = %w[Preview Update].include?(self.class.to_s)
|
124
|
-
if tags.empty? && update_operation
|
125
|
-
resp = cfn.describe_stacks(stack_name: @stack)
|
126
|
-
tags = resp.stacks.first.tags
|
127
|
-
tags = tags.map(&:to_h)
|
128
|
-
end
|
129
|
-
|
130
|
-
tags
|
131
|
-
end
|
132
|
-
|
133
|
-
def exit_unless_updatable!
|
134
|
-
return true if testing_update?
|
135
|
-
return false if @options[:noop]
|
136
|
-
|
137
|
-
status = stack_status
|
138
|
-
unless status =~ /_COMPLETE$/ || status == "UPDATE_ROLLBACK_FAILED"
|
139
|
-
puts "Cannot create a change set for the stack because the #{@stack} is not in an updatable state. Stack status: #{status}".color(:red)
|
140
|
-
quit(1)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
# All CloudFormation states listed here:
|
145
|
-
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html
|
146
|
-
def stack_status
|
147
|
-
return true if testing_update?
|
148
|
-
return false if @options[:noop]
|
149
|
-
resp = cfn.describe_stacks(stack_name: @stack)
|
150
|
-
resp.stacks[0].stack_status
|
151
|
-
end
|
152
|
-
|
153
|
-
# To allow mocking in specs
|
154
|
-
def quit(signal)
|
155
|
-
exit signal
|
156
|
-
end
|
157
|
-
|
158
|
-
def capabilities
|
159
|
-
return @options[:capabilities] if @options[:capabilities]
|
160
|
-
if @options[:sure] || @options[:iam]
|
161
|
-
["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def notification_arns
|
166
|
-
@setting ||= Lono::Setting.new
|
167
|
-
settings = @setting.data
|
168
|
-
arns = @options["notification_arns"] || settings["notification_arns"]
|
169
|
-
arns == [''] ? [] : arns # allow removing the notification_arns setting
|
170
|
-
end
|
171
|
-
|
172
|
-
def show_options(options, meth=nil)
|
173
|
-
options = options.clone.compact
|
174
|
-
if options[:template_body] # continue_update_rollback
|
175
|
-
options[:template_body] = "Hidden due to size... View at: #{pretty_path(template_path)}"
|
176
|
-
options[:template_url] = options[:template_url].sub(/\?.*/,'')
|
177
|
-
end
|
178
|
-
to = meth || "AWS API"
|
179
|
-
puts "Parameters passed to #{to}:"
|
180
|
-
puts YAML.dump(options.deep_stringify_keys)
|
181
|
-
end
|
182
|
-
|
183
|
-
# Lono always uploads the template to s3 so we can use much larger templates.
|
184
|
-
#
|
185
|
-
# template_body: 51,200 bytes - filesystem limit
|
186
|
-
# template_url: 460,800 bytes - s3 limit
|
187
|
-
#
|
188
|
-
# Reference: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html
|
189
|
-
def set_template_url!(options)
|
190
|
-
url_path = template_path.sub("#{Lono.root}/",'')
|
191
|
-
url = Lono::S3::Uploader.new(url_path).presigned_url
|
192
|
-
url.gsub!(/\.yml.*/, ".yml") # Interesting dont need presign query string. For stack sets it actually breaks it. So removing.
|
193
|
-
options[:template_url] = url
|
194
|
-
options
|
195
|
-
end
|
11
|
+
include Concerns
|
196
12
|
|
197
|
-
|
198
|
-
path.sub("#{Lono.root}/",'')
|
199
|
-
end
|
13
|
+
delegate :template_path, to: :build
|
200
14
|
end
|
201
|
-
end
|
15
|
+
end
|