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
@@ -1,19 +1,11 @@
|
|
1
1
|
class Lono::Extensions
|
2
2
|
module Loader
|
3
|
-
include Lono::
|
3
|
+
include Lono::Builder::Context::Loader::LoadFiles
|
4
4
|
|
5
5
|
def load_all_extension_helpers
|
6
|
-
Lono::Jade::Registry.tracked_extensions.each do |registry|
|
7
|
-
load_extension_helpers(registry)
|
8
|
-
end
|
9
6
|
end
|
10
7
|
|
11
8
|
def load_extension_helpers(registry)
|
12
|
-
root = find_extensions_root_path(registry)
|
13
|
-
extension_file = "#{root}/lib/#{registry.name}"
|
14
|
-
require extension_file
|
15
|
-
helpers_path = "#{root}/lib/#{registry.name}/helpers"
|
16
|
-
load_files(helpers_path)
|
17
9
|
end
|
18
10
|
|
19
11
|
#
|
@@ -22,9 +14,6 @@ class Lono::Extensions
|
|
22
14
|
# 3. materialized gem
|
23
15
|
#
|
24
16
|
def find_extensions_root_path(registry)
|
25
|
-
@finder ||= Lono::Finder::Extension.new
|
26
|
-
jadespec = @finder.find(registry.name)
|
27
|
-
jadespec.root
|
28
17
|
end
|
29
18
|
end
|
30
19
|
end
|
data/lib/lono/extensions.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Lono
|
2
2
|
class Extensions
|
3
3
|
include Dsl
|
4
|
-
include Lono::Template::Evaluate
|
4
|
+
include Lono::Builder::Template::Evaluate
|
5
5
|
|
6
6
|
def initialize(template_path)
|
7
7
|
@template_path = template_path
|
8
8
|
end
|
9
9
|
|
10
10
|
def evaluate
|
11
|
-
|
11
|
+
evaluate_template_paths(@template_path) # handle extend_with
|
12
12
|
end
|
13
13
|
|
14
14
|
# The extend_with methods are used in file as the normal DSL evaluation.
|
data/lib/lono/importer/base.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Lono::Importer
|
2
|
-
class Base < Lono::
|
2
|
+
class Base < Lono::CLI::Base
|
3
3
|
include Download
|
4
4
|
include Thor::Actions
|
5
5
|
include Thor::Base
|
@@ -14,7 +14,7 @@ class Lono::Importer
|
|
14
14
|
private
|
15
15
|
def summarize
|
16
16
|
return unless @options[:summary]
|
17
|
-
|
17
|
+
logger.info "Template Summary:"
|
18
18
|
Lono::Inspector::Summary.new(@options).run
|
19
19
|
end
|
20
20
|
|
@@ -24,10 +24,10 @@ class Lono::Importer
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def create_params_file(template_path, env)
|
27
|
-
params_path = if @blueprint != @template
|
28
|
-
"
|
27
|
+
params_path = if @blueprint.name != @template
|
28
|
+
"config/#{@blueprint.name}/params/#{env}/#{@template}.txt"
|
29
29
|
else
|
30
|
-
"
|
30
|
+
"config/#{@blueprint.name}/params/#{env}.txt"
|
31
31
|
end
|
32
32
|
params = Params.new(template_path, params_path)
|
33
33
|
params.create
|
@@ -23,16 +23,16 @@ class Lono::Importer
|
|
23
23
|
def read_source(source)
|
24
24
|
open(source).read
|
25
25
|
rescue OpenURI::HTTPError, SocketError, Errno::ENOENT
|
26
|
-
|
26
|
+
logger.info "ERROR: Unable to read source template provided: #{source}".color(:red)
|
27
27
|
e = $!
|
28
|
-
|
29
|
-
|
28
|
+
logger.info "#{e.class}: #{e.message}"
|
29
|
+
logger.info "Please double check the source provided."
|
30
30
|
exit 1
|
31
31
|
rescue Exception => e
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
logger.info "ERROR: Unable to read source template provided: #{source}".color(:red)
|
33
|
+
logger.info "General Exception Error:"
|
34
|
+
logger.info "#{e.class}: #{e.message}"
|
35
|
+
logger.info "Please double check the source provided."
|
36
36
|
exit 1
|
37
37
|
end
|
38
38
|
|
data/lib/lono/importer/dsl.rb
CHANGED
@@ -4,7 +4,7 @@ class Lono::Importer
|
|
4
4
|
tmp_template_path = download_template(@source, @tmp_path)
|
5
5
|
template = IO.read(tmp_template_path)
|
6
6
|
|
7
|
-
Lono::Blueprint::New.start([@blueprint, "--import", "--type", "dsl"])
|
7
|
+
Lono::Blueprint::New.start([@blueprint.name, "--import", "--type", "dsl"])
|
8
8
|
|
9
9
|
translate_to_dsl(template)
|
10
10
|
create_params(tmp_template_path)
|
@@ -19,13 +19,13 @@ class Lono::Importer
|
|
19
19
|
coder = Service::Coder.new(template, @options)
|
20
20
|
result = coder.translate
|
21
21
|
|
22
|
-
path = "#{Lono.config.
|
22
|
+
path = "#{Lono.config.paths.templates}/#{@template}.rb"
|
23
23
|
FileUtils.mkdir_p(File.dirname(path))
|
24
24
|
create_file(path, result) # Thor::Action
|
25
25
|
end
|
26
26
|
|
27
27
|
def final_message
|
28
|
-
|
28
|
+
logger.info <<~EOL
|
29
29
|
#{"="*64}
|
30
30
|
Congrats 🎉 You have successfully imported a lono blueprint.
|
31
31
|
|
@@ -22,10 +22,10 @@ class Lono::Importer::Service::Coder
|
|
22
22
|
ruby_code = print(data) # returns data["ruby_code"] / passthrough
|
23
23
|
ruby_code
|
24
24
|
else
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
#
|
25
|
+
logger.info "Error: Unable to convert template to Ruby code."
|
26
|
+
logger.info "The error has been reported."
|
27
|
+
logger.info "Non-successful http response status code: #{res.code}"
|
28
|
+
# logger.info "headers: #{res.each_header.to_h.inspect}"
|
29
29
|
exit 1
|
30
30
|
end
|
31
31
|
end
|
@@ -36,26 +36,26 @@ private
|
|
36
36
|
|
37
37
|
if data["error"]
|
38
38
|
# Code was processed but there was this error with an HTTP 200 OK
|
39
|
-
$stderr.
|
39
|
+
$stderr.logger.info "ERROR: #{data["error"]}".color(:red)
|
40
40
|
if data["message"]
|
41
|
-
$stderr.
|
41
|
+
$stderr.logger.info data["message"]
|
42
42
|
end
|
43
43
|
return
|
44
44
|
end
|
45
45
|
|
46
46
|
validity = data["valid_ruby"] ? "valid" : "invalid"
|
47
47
|
if validity == "valid"
|
48
|
-
$stderr.
|
48
|
+
$stderr.logger.info "INFO: The generated Ruby code is has #{validity} syntax."
|
49
49
|
else
|
50
|
-
$stderr.
|
50
|
+
$stderr.logger.info "WARN: The generated Ruby code is has #{validity} syntax. Providing because it may be small errors.".color(:yellow) # note redirection disables color
|
51
51
|
end
|
52
52
|
|
53
|
-
$stderr.
|
53
|
+
$stderr.logger.info <<~EOL
|
54
54
|
Translated ruby code below:
|
55
55
|
|
56
56
|
EOL
|
57
57
|
ruby_code = data["ruby_code"]
|
58
|
-
|
58
|
+
logger.info ruby_code
|
59
59
|
ruby_code
|
60
60
|
end
|
61
61
|
|
data/lib/lono/importer.rb
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
module Lono
|
2
|
-
class Importer
|
3
|
-
def initialize(options)
|
4
|
-
@options = options
|
5
|
-
|
6
|
-
Lono::ProjectChecker.check
|
7
|
-
@blueprint = Lono::Conventions.new(options).blueprint
|
8
|
-
# Dont use set_blueprint_root because it doesnt exist yet. The import creates it
|
9
|
-
Lono.blueprint_root = "#{Lono.root}/app/blueprints/#{@blueprint}"
|
10
|
-
end
|
11
|
-
|
2
|
+
class Importer < Lono::CLI::Base
|
12
3
|
def run
|
13
4
|
# Examples:
|
14
5
|
# Lono::Importer::Erb.new(source, options.clone).run
|
data/lib/lono/inspector/base.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
module Lono::Inspector
|
2
|
-
class Base < Lono::
|
2
|
+
class Base < Lono::CLI::Base
|
3
3
|
extend Memoist
|
4
4
|
|
5
5
|
def run
|
6
|
-
|
6
|
+
build
|
7
7
|
templates = @template_name ? [@template_name] : all_templates
|
8
8
|
templates.each do |template_name|
|
9
9
|
perform(template_name)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def build
|
14
14
|
if @options[:source]
|
15
15
|
Lono::Cfn::Download.new(@options).run
|
16
16
|
else
|
17
|
-
|
17
|
+
build_templates
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
Lono::Template
|
21
|
+
def build_templates
|
22
|
+
Lono::Builder::Template.new(@options.merge(quiet: false)).run
|
23
23
|
end
|
24
24
|
|
25
25
|
def all_templates
|
26
|
-
templates_path = "#{Lono.
|
26
|
+
templates_path = "#{Lono.root}/output/#{@blueprint.name}/templates"
|
27
27
|
Dir.glob("#{templates_path}/**").map do |path|
|
28
28
|
path.sub("#{templates_path}/", '').sub('.yml','') # template_name
|
29
29
|
end
|
@@ -1,43 +1,45 @@
|
|
1
1
|
module Lono::Inspector
|
2
2
|
class Summary < Base
|
3
|
-
|
4
|
-
to: :output_template
|
3
|
+
include Lono::Cfn::Concerns::TemplateOutput
|
5
4
|
|
6
5
|
def perform(template)
|
7
6
|
# little dirty but @template is used in data method so we dont have to pass it to the data method
|
8
7
|
@template = template
|
9
8
|
|
10
|
-
|
11
|
-
return if
|
9
|
+
logger.info "=> CloudFormation Template Summary for template #{@template.color(:sienna)}:"
|
10
|
+
return if ENV['LONO_NOOP']
|
12
11
|
|
13
12
|
print_parameters_summary
|
14
|
-
|
13
|
+
logger.info "# Resources:"
|
15
14
|
print_resource_types
|
16
15
|
end
|
17
16
|
|
18
17
|
def print_parameters_summary
|
18
|
+
parameters = template_output.parameters
|
19
|
+
parameter_groups = template_output.parameter_groups
|
20
|
+
|
19
21
|
if parameters.empty?
|
20
|
-
|
22
|
+
logger.info "There are no parameters in this template."
|
21
23
|
return
|
22
24
|
end
|
23
25
|
|
24
26
|
shown = []
|
25
|
-
|
27
|
+
logger.info "# Parameters Total (#{parameters.size})"
|
26
28
|
parameter_groups.each do |label, parameters|
|
27
|
-
|
29
|
+
logger.info "# Parameter Group (#{parameters.size}): #{label}".color(:sienna)
|
28
30
|
parameters.each do |name|
|
29
|
-
|
31
|
+
logger.info parameter_line(name)
|
30
32
|
shown << name
|
31
33
|
end
|
32
|
-
end if
|
34
|
+
end if parameter_groups
|
33
35
|
|
34
36
|
parameters.each do |name, data|
|
35
|
-
|
37
|
+
logger.info parameter_line(name) unless shown.include?(name)
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
39
41
|
def parameter_line(name)
|
40
|
-
data = parameters[name]
|
42
|
+
data = template_output.parameters[name]
|
41
43
|
example = description_example(data["Description"])
|
42
44
|
if data["Default"].nil?
|
43
45
|
line = "#{name}=#{example} # (required)"
|
@@ -58,7 +60,7 @@ module Lono::Inspector
|
|
58
60
|
end
|
59
61
|
|
60
62
|
def resource_types
|
61
|
-
resources = data["Resources"]
|
63
|
+
resources = template_output.data["Resources"]
|
62
64
|
return unless resources
|
63
65
|
|
64
66
|
types = Hash.new(0)
|
@@ -70,7 +72,7 @@ module Lono::Inspector
|
|
70
72
|
|
71
73
|
def print_resource_types
|
72
74
|
unless resource_types
|
73
|
-
|
75
|
+
logger.info "No resources found."
|
74
76
|
return
|
75
77
|
end
|
76
78
|
|
@@ -83,9 +85,9 @@ module Lono::Inspector
|
|
83
85
|
printf "%3s %s\n", total, "Total"
|
84
86
|
end
|
85
87
|
|
86
|
-
def
|
87
|
-
Lono::
|
88
|
+
def template_output
|
89
|
+
Lono::Builder::Template::Output.new(@blueprint)
|
88
90
|
end
|
89
|
-
memoize :
|
91
|
+
memoize :template_output
|
90
92
|
end
|
91
93
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require "aws_data"
|
2
|
+
|
3
|
+
# Layers example
|
4
|
+
#
|
5
|
+
# app/blueprints/demo/config/params/base.txt
|
6
|
+
# app/blueprints/demo/config/params/dev.txt
|
7
|
+
# app/blueprints/demo/config/params/prod.txt
|
8
|
+
# app/blueprints/demo/config/vars/base.rb
|
9
|
+
# app/blueprints/demo/config/vars/dev.rb
|
10
|
+
# app/blueprints/demo/config/vars/prod.rb
|
11
|
+
#
|
12
|
+
module Lono::Layering
|
13
|
+
class Layer
|
14
|
+
include Lono::Layering
|
15
|
+
include Lono::Utils::Logging
|
16
|
+
include Lono::Utils::Pretty
|
17
|
+
extend Memoist
|
18
|
+
|
19
|
+
delegate :region, to: :aws_data
|
20
|
+
|
21
|
+
def initialize(blueprint, type)
|
22
|
+
@blueprint, @type = blueprint, type
|
23
|
+
end
|
24
|
+
|
25
|
+
def paths
|
26
|
+
blueprint = full_layers("app/blueprints/#{@blueprint.name}/config")
|
27
|
+
project = full_layers("config/blueprints/#{@blueprint.name}")
|
28
|
+
paths = blueprint + project
|
29
|
+
add_ext!(paths)
|
30
|
+
paths.map! { |p| "#{Lono.root}/#{p}" }
|
31
|
+
show_layers(paths)
|
32
|
+
paths
|
33
|
+
end
|
34
|
+
|
35
|
+
def full_layering
|
36
|
+
# layers defined in Lono::Layering module
|
37
|
+
all = layers.map { |layer| layer.sub(/\/$/,'') } # strip trailing slash
|
38
|
+
all.inject([]) do |sum, layer|
|
39
|
+
sum += layer_levels(layer) unless layer.nil?
|
40
|
+
sum
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# interface method
|
45
|
+
def main_layers
|
46
|
+
[
|
47
|
+
'',
|
48
|
+
region,
|
49
|
+
account,
|
50
|
+
"#{account}/#{region}",
|
51
|
+
]
|
52
|
+
end
|
53
|
+
|
54
|
+
def account
|
55
|
+
name = aws_data.account
|
56
|
+
# friendly name mapping
|
57
|
+
names = Lono.config.layering.names.stringify_keys
|
58
|
+
names[name] || name
|
59
|
+
end
|
60
|
+
|
61
|
+
# adds prefix and to each layer pair that has base and Lono.env. IE:
|
62
|
+
#
|
63
|
+
# "#{prefix}/base"
|
64
|
+
# "#{prefix}/#{Lono.env}"
|
65
|
+
#
|
66
|
+
def layer_levels(prefix=nil)
|
67
|
+
levels = ["base", Lono.env]
|
68
|
+
levels.map! do |i|
|
69
|
+
# base layer has prefix of '', reject with blank so it doesnt produce '//'
|
70
|
+
[prefix, i].reject(&:blank?).join('/')
|
71
|
+
end
|
72
|
+
levels.unshift(prefix) # unless prefix.blank? # IE: params/us-west-2.txt
|
73
|
+
levels
|
74
|
+
end
|
75
|
+
|
76
|
+
def add_ext!(paths)
|
77
|
+
exts = {
|
78
|
+
params: "txt",
|
79
|
+
vars: "rb",
|
80
|
+
}
|
81
|
+
ext = exts[@type.to_sym]
|
82
|
+
|
83
|
+
paths.map! do |path|
|
84
|
+
if path.include?("teams")
|
85
|
+
puts "path: #{path}"
|
86
|
+
end
|
87
|
+
|
88
|
+
if path.ends_with?('/')
|
89
|
+
"#{path.sub(/\/$/,'')}.#{ext}"
|
90
|
+
else
|
91
|
+
"#{path}.#{ext}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def full_layers(dir)
|
97
|
+
layers = full_layering.map do |layer|
|
98
|
+
"#{dir}/#{@type}/#{layer}"
|
99
|
+
end
|
100
|
+
if Lono.app
|
101
|
+
app_layers = full_layering.map do |layer|
|
102
|
+
"#{dir}/#{@type}/#{Lono.app}/#{layer}"
|
103
|
+
end
|
104
|
+
layers += app_layers
|
105
|
+
end
|
106
|
+
layers
|
107
|
+
end
|
108
|
+
|
109
|
+
@@shown_layers = {}
|
110
|
+
def show_layers(paths)
|
111
|
+
return if @@shown_layers[@type]
|
112
|
+
logger.debug "#{@type.capitalize} Layers:"
|
113
|
+
paths.each do |path|
|
114
|
+
logger.debug " #{pretty_path(path)}" if File.exist?(path) || ENV['LONO_SHOW_ALL_LAYERS']
|
115
|
+
end
|
116
|
+
logger.debug ""
|
117
|
+
@@shown_layers[@type] = true
|
118
|
+
end
|
119
|
+
|
120
|
+
private
|
121
|
+
def aws_data
|
122
|
+
AwsData.new
|
123
|
+
end
|
124
|
+
memoize :aws_data
|
125
|
+
end
|
126
|
+
end
|
data/lib/lono/layering.rb
CHANGED
@@ -1,65 +1,23 @@
|
|
1
|
-
|
2
|
-
class Layering < AbstractBase
|
3
|
-
extend Memoist
|
4
|
-
|
5
|
-
def initialize(config, options={}, env=Lono.env, root=Lono.root)
|
6
|
-
super(options)
|
7
|
-
# config can be params or variables
|
8
|
-
@config, @options, @env, @root = config, options, env, root
|
9
|
-
@requested = determine_requested
|
10
|
-
end
|
11
|
-
|
12
|
-
def locations
|
13
|
-
paths = always + requested
|
14
|
-
layers = paths.map do |path|
|
15
|
-
requested_file(path)
|
16
|
-
end.compact
|
17
|
-
print_layers(layers)
|
18
|
-
layers
|
19
|
-
end
|
20
|
-
|
21
|
-
def always
|
22
|
-
base = "#{@root}/configs/#{@blueprint}/#{@config}/base"
|
23
|
-
env = "#{@root}/configs/#{@blueprint}/#{@config}/#{@env}"
|
24
|
-
[base, env]
|
25
|
-
end
|
1
|
+
require "active_support/lazy_load_hooks"
|
26
2
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
def standard_layers
|
32
|
-
config_level = "#{@root}/configs/#{@blueprint}/#{@config}/#{@requested}"
|
33
|
-
env_level = "#{@root}/configs/#{@blueprint}/#{@config}/#{@env}/#{@requested}"
|
34
|
-
template_level = "#{@root}/configs/#{@blueprint}/#{@config}/#{@env}/#{@template}/#{@requested}"
|
35
|
-
[config_level, env_level, template_level]
|
36
|
-
end
|
37
|
-
|
38
|
-
def direct_layers
|
39
|
-
if @requested.starts_with?('/')
|
40
|
-
[@requested] # IE: absolute full path
|
41
|
-
else
|
42
|
-
["#{@root}/#{@requested}"] # IE : relative path within lono project]
|
43
|
-
end
|
3
|
+
module Lono
|
4
|
+
module Layering
|
5
|
+
def layers
|
6
|
+
pre_layers + main_layers + post_layers
|
44
7
|
end
|
45
8
|
|
46
|
-
def
|
47
|
-
|
48
|
-
puts "layers #{@config}:"
|
49
|
-
pp layers
|
9
|
+
def main_layers
|
10
|
+
super
|
50
11
|
end
|
51
12
|
|
52
|
-
def
|
53
|
-
|
54
|
-
config_key = @config.singularize.to_sym # param or variable
|
55
|
-
@options[config_key] || @options[:config] || @stack
|
13
|
+
def pre_layers
|
14
|
+
[]
|
56
15
|
end
|
57
16
|
|
58
|
-
def
|
59
|
-
|
60
|
-
paths = [path, "#{path}.txt", "#{path}.sh", "#{path}.rb"].compact
|
61
|
-
paths.find { |p| File.file?(p) }
|
17
|
+
def post_layers
|
18
|
+
[]
|
62
19
|
end
|
63
|
-
memoize :requested_file
|
64
20
|
end
|
65
21
|
end
|
22
|
+
|
23
|
+
ActiveSupport.run_load_hooks(:lono_layering, Lono::Layering)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Lono::Logger
|
2
|
+
class Formatter < ::Logger::Formatter
|
3
|
+
def call(severity, time, progname, msg)
|
4
|
+
# careful changing the format. All::Summary uses a regexp on this format to remove the timestamp
|
5
|
+
"[#{format_datetime(time)} ##{Process.pid} #{progname}]: #{msg}"
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
def format_datetime(time)
|
10
|
+
time.strftime("%Y-%m-%dT%H:%M:%S")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/lono/logger.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Lono
|
4
|
+
class Logger < ::Logger
|
5
|
+
def initialize(*args)
|
6
|
+
super
|
7
|
+
self.formatter = Formatter.new
|
8
|
+
self.level = ENV['LONO_LOG_LEVEL'] || :info # note: only respected when config.logger not set in config/app.rb
|
9
|
+
end
|
10
|
+
|
11
|
+
def format_message(severity, datetime, progname, msg)
|
12
|
+
line = if @logdev.dev == $stdout || @logdev.dev == $stderr || @logdev.dev.is_a?(StringIO)
|
13
|
+
msg # super simple format if stdout
|
14
|
+
else
|
15
|
+
super # use the configured formatter
|
16
|
+
end
|
17
|
+
line =~ /\n$/ ? line : "#{line}\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Used to allow terraform output to always go to stdout
|
21
|
+
# Terraspace output goes to stderr by default
|
22
|
+
# See: terraspace/shell.rb
|
23
|
+
def stdout(msg, newline: true)
|
24
|
+
if newline
|
25
|
+
puts msg
|
26
|
+
else
|
27
|
+
print msg
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
public :print
|
32
|
+
end
|
33
|
+
end
|
data/lib/lono/lookup.rb
ADDED
data/lib/lono/names.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
module Lono
|
2
|
+
class Names
|
3
|
+
extend Memoist
|
4
|
+
|
5
|
+
attr_reader :blueprint
|
6
|
+
def initialize(options={})
|
7
|
+
@options = options
|
8
|
+
@blueprint = options[:blueprint]
|
9
|
+
end
|
10
|
+
|
11
|
+
def stack
|
12
|
+
expansion(Lono.config.names.stack)
|
13
|
+
end
|
14
|
+
memoize :stack
|
15
|
+
|
16
|
+
def expansion(string)
|
17
|
+
return string unless string.is_a?(String) # in case of nil
|
18
|
+
|
19
|
+
string = string.dup
|
20
|
+
vars = string.scan(/:\w+/) # => [":APP", ":BLUEPRINT", :ENV"]
|
21
|
+
vars.each do |var|
|
22
|
+
string.gsub!(var, var_value(var))
|
23
|
+
end
|
24
|
+
strip(string)
|
25
|
+
end
|
26
|
+
|
27
|
+
def var_value(unexpanded)
|
28
|
+
name = unexpanded.sub(':','').downcase
|
29
|
+
if respond_to?(name)
|
30
|
+
value = send(name).to_s
|
31
|
+
else
|
32
|
+
unexpanded
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def strip(string)
|
37
|
+
string.sub(/^-+/,'').sub(/-+$/,'') # remove leading and trailing -
|
38
|
+
.gsub(%r{-+},'-') # remove double dashes are more. IE: -- => -
|
39
|
+
.gsub('_','-') # underscores are not allowed in CloudFormation stack names
|
40
|
+
end
|
41
|
+
|
42
|
+
def app
|
43
|
+
Lono.app
|
44
|
+
end
|
45
|
+
|
46
|
+
def env
|
47
|
+
Lono.env
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Lono::Plugin
|
2
|
+
module Meta
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
cattr_accessor :meta, default: []
|
7
|
+
end
|
8
|
+
|
9
|
+
class_methods do
|
10
|
+
def register(o={})
|
11
|
+
found = meta.find { |m| m[:name] == o[:name] && m[:type] == o[:type] }
|
12
|
+
meta << o unless found
|
13
|
+
end
|
14
|
+
|
15
|
+
def find(o={})
|
16
|
+
found = meta.find { |m| m[:name] == o[:name] && m[:type] == o[:type] }
|
17
|
+
Lono::Plugin.new(found) if found
|
18
|
+
end
|
19
|
+
|
20
|
+
def delegate_to_meta(*attrs)
|
21
|
+
attrs.each do |attr|
|
22
|
+
attr = attr.to_sym
|
23
|
+
define_method attr do
|
24
|
+
@options[attr]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|