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
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
module Lono::Bundler::Component::Http
|
5
|
+
module Concern
|
6
|
+
include LB::Util::Logging
|
7
|
+
|
8
|
+
def http_request(url, auth_domain: nil)
|
9
|
+
uri = URI(url)
|
10
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
11
|
+
http.use_ssl = uri.scheme == "https"
|
12
|
+
# Total time will be 40s = 20 x 2
|
13
|
+
http.max_retries = 1 # Default is already 1, just being explicit
|
14
|
+
http.read_timeout = 20 # Sites that dont return in 20 seconds are considered down
|
15
|
+
request = Net::HTTP::Get.new(uri)
|
16
|
+
|
17
|
+
if auth_domain
|
18
|
+
path = "#{ENV['HOME']}/.terraform.d/credentials.tfrc.json"
|
19
|
+
if File.exist?(path)
|
20
|
+
data = JSON.load(IO.read(path))
|
21
|
+
token = data['credentials'][auth_domain]['token']
|
22
|
+
request.add_field 'Authorization', "Bearer #{token}"
|
23
|
+
else
|
24
|
+
auth_error_exit!
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
http.request(request) # response
|
30
|
+
rescue Net::OpenTimeout => e # internal ELB but VPC is not configured for Lambda function
|
31
|
+
http_request_error_message(e)
|
32
|
+
rescue Exception => e
|
33
|
+
# Net::ReadTimeout - too slow
|
34
|
+
# Errno::ECONNREFUSED - completely down
|
35
|
+
# SocketError - improper url "dsfjsl" instead of example.com
|
36
|
+
http_request_error_message(e)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def http_request_error_message(e)
|
41
|
+
logger.info "ERROR: #{e.message}\n#{e.message}".color(:red)
|
42
|
+
exit 1
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
module Lono::Bundler::Component::Http
|
5
|
+
class Source
|
6
|
+
include LB::Util::Logging
|
7
|
+
include Concern
|
8
|
+
|
9
|
+
def initialize(params)
|
10
|
+
@params = params
|
11
|
+
@options = params[:options]
|
12
|
+
@source = @options[:source]
|
13
|
+
end
|
14
|
+
|
15
|
+
def url
|
16
|
+
@source
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class Lono::Bundler::Component
|
2
|
+
class OrgRepo
|
3
|
+
def initialize(url)
|
4
|
+
@url = url.sub('ssh://','') # important to copy so dont change the string reference
|
5
|
+
end
|
6
|
+
|
7
|
+
def repo
|
8
|
+
org_repo_words[-1]
|
9
|
+
end
|
10
|
+
|
11
|
+
def org
|
12
|
+
s = org_folder.split('/').last
|
13
|
+
s ? s.split('/').last : 'none'
|
14
|
+
end
|
15
|
+
|
16
|
+
def org_folder
|
17
|
+
org_repo_words[-2] # second to last word
|
18
|
+
end
|
19
|
+
|
20
|
+
def repo_folder
|
21
|
+
org_repo_words.join('/')
|
22
|
+
end
|
23
|
+
|
24
|
+
def org_repo_words
|
25
|
+
if @url.include?(':') && !@url.match(%r{http[s?]://}) # user@host:repo git@github.com:org/repo
|
26
|
+
folder, repo = handle_string_with_colon
|
27
|
+
else # IE: https://github.com/org/repo, org/repo, etc
|
28
|
+
parts = @url.split('/')
|
29
|
+
folder = parts[0..-2].join('/')
|
30
|
+
repo = parts.last
|
31
|
+
end
|
32
|
+
|
33
|
+
org_path = clean_folder(folder)
|
34
|
+
repo = strip_dot_git(repo)
|
35
|
+
[org_path, repo]
|
36
|
+
end
|
37
|
+
|
38
|
+
def clean_folder(folder)
|
39
|
+
folder.sub(%r{.*@},'') # remove user@
|
40
|
+
.sub(%r{http[s?]://},'') # remove https://
|
41
|
+
end
|
42
|
+
|
43
|
+
# user@host:repo git@github.com:org/repo
|
44
|
+
def handle_string_with_colon
|
45
|
+
host, path = @url.split(':')
|
46
|
+
if path.size == 2
|
47
|
+
folder, repo = path.split(':')
|
48
|
+
else
|
49
|
+
folder = join(host, File.dirname(path))
|
50
|
+
repo = File.basename(path)
|
51
|
+
end
|
52
|
+
[folder, repo]
|
53
|
+
end
|
54
|
+
|
55
|
+
def join(*path)
|
56
|
+
path.compact!
|
57
|
+
path[1] = path[1].sub('/','') if path[1].starts_with?('/')
|
58
|
+
path.reject(&:blank?).join('/')
|
59
|
+
end
|
60
|
+
|
61
|
+
def strip_dot_git(s)
|
62
|
+
s.sub(/\.git$/,'')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Lono::Bundler::Component::Props
|
2
|
+
module Extension
|
3
|
+
def props(*names)
|
4
|
+
names.each { |n| prop(n) }
|
5
|
+
end
|
6
|
+
|
7
|
+
def prop(name)
|
8
|
+
name = name.to_sym
|
9
|
+
define_method(name) do
|
10
|
+
@props[name]
|
11
|
+
end
|
12
|
+
|
13
|
+
define_method("#{name}=") do |v|
|
14
|
+
@props[name] = v
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Lono::Bundler::Component::Props
|
2
|
+
class Typer
|
3
|
+
include Lono::Bundler::Component::Concerns::LocalConcern
|
4
|
+
include Lono::Bundler::Component::Concerns::NotationConcern
|
5
|
+
|
6
|
+
delegate :source, to: :props
|
7
|
+
|
8
|
+
attr_reader :props
|
9
|
+
def initialize(props)
|
10
|
+
@props = props # Props.new object
|
11
|
+
end
|
12
|
+
|
13
|
+
# IE: git or registry
|
14
|
+
def source_type
|
15
|
+
if source.include?('ssh://')
|
16
|
+
"git"
|
17
|
+
elsif source.include?('::')
|
18
|
+
source.split('::').first # IE: git:: s3:: gcs::
|
19
|
+
elsif local?
|
20
|
+
"local"
|
21
|
+
elsif registry?
|
22
|
+
"registry"
|
23
|
+
else
|
24
|
+
"git"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
# dont use registry? externally. instead use type since it can miss local detection
|
30
|
+
def registry?
|
31
|
+
if source.nil? ||
|
32
|
+
source.starts_with?('git@') || # git@github.com:tongueroo/pet
|
33
|
+
source.starts_with?('http') || # https://github.com/tongueroo/pet
|
34
|
+
source.include?('::') # git::https:://git.example.com/pet
|
35
|
+
return false
|
36
|
+
end
|
37
|
+
s = remove_notations(@props.source)
|
38
|
+
s.split('/').size == 3 || s.split('/').size == 4
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# Use to build component from Lonofile entry.
|
2
|
+
# The Lonofile.lock does not need this because it's simple and just merges the data.
|
3
|
+
class Lono::Bundler::Component
|
4
|
+
class Props
|
5
|
+
extend Memoist
|
6
|
+
include Concerns::NotationConcern
|
7
|
+
include LB::Util::Logging
|
8
|
+
|
9
|
+
delegate :source_type, to: :typer
|
10
|
+
|
11
|
+
attr_reader :source
|
12
|
+
def initialize(options={})
|
13
|
+
@options = options
|
14
|
+
@source, @version = @options[:source], @options[:version]
|
15
|
+
end
|
16
|
+
|
17
|
+
def name
|
18
|
+
remove_notations(@options[:name])
|
19
|
+
end
|
20
|
+
|
21
|
+
def build
|
22
|
+
unless @source
|
23
|
+
logger.error "ERROR: The source option must be set for the #{name} component in the Lonofile".color(:red)
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
o = @options.merge(
|
27
|
+
name: name,
|
28
|
+
source_type: source_type,
|
29
|
+
url: url,
|
30
|
+
)
|
31
|
+
o[:subfolder] ||= subfolder(@source)
|
32
|
+
o[:ref] ||= ref(@source)
|
33
|
+
o.deep_symbolize_keys
|
34
|
+
end
|
35
|
+
|
36
|
+
# url is normalized
|
37
|
+
def url
|
38
|
+
url = case source_type
|
39
|
+
when 'registry'
|
40
|
+
registry.github_url
|
41
|
+
when 'local'
|
42
|
+
source
|
43
|
+
when 'http'
|
44
|
+
http_source_url
|
45
|
+
else # git
|
46
|
+
git_source_url
|
47
|
+
end
|
48
|
+
remove_notations(clone_with(url))
|
49
|
+
end
|
50
|
+
|
51
|
+
# apply clone_with option if set
|
52
|
+
def clone_with(url)
|
53
|
+
with = @options[:clone_with] || LB.config.clone_with
|
54
|
+
return url unless with
|
55
|
+
if with == 'https'
|
56
|
+
url.sub(/.*@(.*):/,'https://\1/')
|
57
|
+
else # git@
|
58
|
+
url.sub(%r{http[s]?://(.*?)/},'git@\1:')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def http_source_url
|
63
|
+
source = Http::Source.new(@params)
|
64
|
+
source.url
|
65
|
+
end
|
66
|
+
|
67
|
+
# git_source_url is normalized
|
68
|
+
#
|
69
|
+
# See: https://stackoverflow.com/questions/6167905/git-clone-through-ssh
|
70
|
+
#
|
71
|
+
# ssh://username@host.xz/absolute/path/to/repo.git/ - just a forward slash for absolute path on server
|
72
|
+
# username@host.xz:relative/path/to/repo.git/ - just a colon (it mustn't have the ssh:// for relative path on server (relative to home dir of username on server machine)
|
73
|
+
#
|
74
|
+
# When colon is separator for relative path do not want ssh prepended
|
75
|
+
#
|
76
|
+
# git clone ec2-user@localhost:repo
|
77
|
+
#
|
78
|
+
# When slash is separator for absolute path want ssh prepended
|
79
|
+
#
|
80
|
+
# git clone ssh://ec2-user@localhost/path/to/repo => valid URI
|
81
|
+
#
|
82
|
+
def git_source_url
|
83
|
+
if @source.include?('http') || @source.include?(':')
|
84
|
+
# Examples:
|
85
|
+
# component "pet1", source: "https://github.com/tongueroo/pet"
|
86
|
+
# component "pet2", source: "git@github.com:tongueroo/pet"
|
87
|
+
# component "pet3", source: "git@gitlab.com:tongueroo/pet"
|
88
|
+
# component "pet4", source: "git@bitbucket.org:tongueroo/pet"
|
89
|
+
# component "example3", source: "git::https://example.com/example-module.git"
|
90
|
+
#
|
91
|
+
# sub to allow for generic git repo notiation
|
92
|
+
source = @source.sub('git::','')
|
93
|
+
if source.include?('ssh://')
|
94
|
+
if source.count(':') == 1
|
95
|
+
return source
|
96
|
+
else
|
97
|
+
return source.sub('ssh://', '')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
source
|
101
|
+
else
|
102
|
+
# Examples:
|
103
|
+
# component "pet", source: "tongueroo/pet"
|
104
|
+
# Or:
|
105
|
+
# org "tongueroo"
|
106
|
+
# component "pet", source: "pet"
|
107
|
+
org_source = @source.include?('/') ? @source : "#{LB.config.org}/#{@source}" # adds inferred org
|
108
|
+
"#{LB.config.base_clone_url}#{org_source}"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def typer
|
113
|
+
Typer.new(self)
|
114
|
+
end
|
115
|
+
memoize :typer
|
116
|
+
|
117
|
+
def registry
|
118
|
+
Registry.new(@source, @version)
|
119
|
+
end
|
120
|
+
memoize :registry
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
class Lono::Bundler::Component
|
2
|
+
class Registry
|
3
|
+
include LB::Util::Logging
|
4
|
+
include Http::Concern
|
5
|
+
|
6
|
+
def initialize(source, version)
|
7
|
+
@source, @version = source, version
|
8
|
+
end
|
9
|
+
|
10
|
+
def github_url
|
11
|
+
if @source.split('/').size > 3 # IE: app.terraform.io/demo-qa/s3-webapp/aws
|
12
|
+
private_github_url
|
13
|
+
else # assume size is 3. IE: terraform-aws-blueprints/security-group/aws
|
14
|
+
public_github_url
|
15
|
+
end
|
16
|
+
end
|
17
|
+
\
|
18
|
+
# https://www.terraform.io/docs/cloud/api/blueprints.html#get-a-module
|
19
|
+
# GET /organizations/:organization_name/registry-blueprints/:registry_name/:namespace/:name/:provider
|
20
|
+
# GET /organizations/demo-qa/registry-blueprints/private/demo-qa/s3-webapp/aws
|
21
|
+
#
|
22
|
+
# :organization_name The name of the organization the module belongs to.
|
23
|
+
# :namespace The namespace of the module. For private blueprints this is the name of the organization that owns the module.
|
24
|
+
# :name The module name.
|
25
|
+
# :provider The module provider.
|
26
|
+
# :registry-name Either public or private.
|
27
|
+
#
|
28
|
+
# Example: app.terraform.io/demo-qa/s3-webapp/aws
|
29
|
+
#
|
30
|
+
# domain: app.terraform.io (private registry indicator)
|
31
|
+
# org: demo-qa
|
32
|
+
# module: s3-webapp
|
33
|
+
# provider: aws
|
34
|
+
#
|
35
|
+
def private_github_url
|
36
|
+
domain, org, name, provider = @source.split('/')
|
37
|
+
registry_name = 'private'
|
38
|
+
namespace = org
|
39
|
+
|
40
|
+
base_site = "https://#{domain}" # IE: domain = 'app.terraform.io'
|
41
|
+
base_url = "#{base_site}/api/v2"
|
42
|
+
api_url = "#{base_url}/organizations/#{org}/registry-blueprints/#{registry_name}/#{namespace}/#{name}/#{provider}"
|
43
|
+
|
44
|
+
resp = http_request(api_url, auth_domain: domain)
|
45
|
+
|
46
|
+
repo_url = case resp.code.to_i
|
47
|
+
when 200
|
48
|
+
result = JSON.load(resp.body)
|
49
|
+
result['data']['attributes']['vcs-repo']['repository-http-url'] # repo_url
|
50
|
+
when 401
|
51
|
+
auth_error_exit!(resp)
|
52
|
+
else
|
53
|
+
logger.error "ERROR: Unable to lookup up module in Terraform Registry: #{@source}".color(:red)
|
54
|
+
puts "resp.code #{resp.code}"
|
55
|
+
pp resp
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
|
59
|
+
clone_with = 'git' # TODO: make configurable
|
60
|
+
unless clone_with == 'https'
|
61
|
+
repo_url.sub!('https://github.com/', 'git@github.com:')
|
62
|
+
end
|
63
|
+
|
64
|
+
repo_url
|
65
|
+
end
|
66
|
+
|
67
|
+
# Lonofile example
|
68
|
+
#
|
69
|
+
# component "sg", source: "terraform-aws-blueprints/security-group/aws", version: "3.10.0"
|
70
|
+
#
|
71
|
+
# Resources: https://www.terraform.io/docs/registry/api.html
|
72
|
+
#
|
73
|
+
# Latest version:
|
74
|
+
#
|
75
|
+
# https://registry.terraform.io/v1/blueprints/terraform-aws-blueprints/sqs/aws/2.1.0/download
|
76
|
+
#
|
77
|
+
# The latest version returns an 302 and contains a location header that is followed
|
78
|
+
# and then downloaded the same way the specific version is downloaded.
|
79
|
+
#
|
80
|
+
# Specific version:
|
81
|
+
#
|
82
|
+
# https://registry.terraform.io/v1/blueprints/terraform-aws-blueprints/sqs/aws/download
|
83
|
+
#
|
84
|
+
# The specific version returns an 204 and then we grab the download url info form the x-terraform-get header.
|
85
|
+
def public_github_url
|
86
|
+
base_site = "https://registry.terraform.io"
|
87
|
+
base_url = "#{base_site}/v1/blueprints"
|
88
|
+
version = get_version(base_url)
|
89
|
+
api_url = [base_url, @source, version, "download"].compact.join('/')
|
90
|
+
|
91
|
+
resp = http_request(api_url)
|
92
|
+
|
93
|
+
case resp.code.to_i
|
94
|
+
when 204 # IE: curl -v https://registry.terraform.io/v1/blueprints/terraform-aws-blueprints/security-group/aws/3.10.0/download
|
95
|
+
download_url = resp.header["x-terraform-get"]
|
96
|
+
else
|
97
|
+
logger.error "ERROR: Unable to lookup up module in Terraform Registry: #{@source}".color(:red)
|
98
|
+
logger.error "api_url: #{api_url}"
|
99
|
+
puts "resp.code #{resp.code}"
|
100
|
+
pp resp
|
101
|
+
exit 1
|
102
|
+
end
|
103
|
+
|
104
|
+
url = download_url.sub(%r{/archive/.*},'')
|
105
|
+
# IE: git::https://github.com/terraform-aws-blueprints/terraform-aws-security-group?ref=v3.10.0
|
106
|
+
url.sub(/^git::/,'').sub(/\?.*/,'')
|
107
|
+
end
|
108
|
+
|
109
|
+
def get_version(base_url)
|
110
|
+
return @version.sub(/^v/,'') if @version # v1.0 => 1.0
|
111
|
+
api_url = [base_url, @source].join('/')
|
112
|
+
resp = http_request(api_url)
|
113
|
+
data = JSON.load(resp.body)
|
114
|
+
data['version']
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
def auth_error_exit!(resp=nil, domain=nil)
|
119
|
+
logger.error <<~EOL.color(:red)
|
120
|
+
ERROR: Unauthorized. Unable to lookup up module in Terraform Registry:
|
121
|
+
|
122
|
+
#{@source}
|
123
|
+
|
124
|
+
Try logging in with:
|
125
|
+
|
126
|
+
terraform login #{domain}
|
127
|
+
|
128
|
+
EOL
|
129
|
+
if resp
|
130
|
+
puts "resp.code #{resp.code}"
|
131
|
+
pp resp
|
132
|
+
end
|
133
|
+
exit 1
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class Component
|
3
|
+
extend Memoist
|
4
|
+
extend Props::Extension
|
5
|
+
props :export_to, :name, :sha, :source, :subfolder, :source_type, :type, :url, :clone_with
|
6
|
+
delegate :repo, :org, :repo_folder, :org_folder, to: :org_repo
|
7
|
+
|
8
|
+
include Concerns::StackConcern
|
9
|
+
include Concerns::LocalConcern
|
10
|
+
|
11
|
+
attr_reader :props, :version, :ref, :tag, :branch
|
12
|
+
def initialize(options={})
|
13
|
+
@props = Component::Props.new(options.deep_symbolize_keys).build
|
14
|
+
# These props are used for version comparing by VersionComparer
|
15
|
+
@version, @ref, @tag, @branch = @props[:version], @props[:ref], @props[:tag], @props[:branch]
|
16
|
+
end
|
17
|
+
|
18
|
+
# support variety of options, prefer version
|
19
|
+
def checkout_version
|
20
|
+
@version || @ref || @tag || @branch
|
21
|
+
end
|
22
|
+
|
23
|
+
def latest_sha
|
24
|
+
fetcher = Fetcher.new(self).instance
|
25
|
+
fetcher.run
|
26
|
+
fetcher.sha
|
27
|
+
end
|
28
|
+
|
29
|
+
def vcs_provider
|
30
|
+
if url.include?('http')
|
31
|
+
# "https://github.com/org/repo" => github.com
|
32
|
+
url.match(%r{http[s]?://(.*?)/})[1]
|
33
|
+
elsif url.include?('http') # git@
|
34
|
+
# "git@github.com:org/repo" => github.com
|
35
|
+
url.match(%r{git@(.*?):})[1]
|
36
|
+
else # ssh://user@domain.com/path/to/repo
|
37
|
+
'none'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def export_path
|
42
|
+
export_to = self.export_to || LB.config.export_to
|
43
|
+
"#{export_to}/#{type.pluralize}/#{name}"
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
def org_repo
|
48
|
+
OrgRepo.new(url)
|
49
|
+
end
|
50
|
+
memoize :org_repo
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class Config
|
3
|
+
extend Memoist
|
4
|
+
include Singleton
|
5
|
+
|
6
|
+
def config
|
7
|
+
config = ActiveSupport::OrderedOptions.new
|
8
|
+
config.base_clone_url = "https://github.com/"
|
9
|
+
config.export_to = ENV['LB_EXPORT_TO'] || "vendor"
|
10
|
+
config.export_purge = ENV['LB_EXPORT_PRUNE'] == '0' ? false : true
|
11
|
+
config.lonofile = ENV['LB_LONOFILE'] || "Lonofile"
|
12
|
+
config.lockfile = "#{config.lonofile}.lock"
|
13
|
+
config.logger = Lono.config.logger
|
14
|
+
config
|
15
|
+
end
|
16
|
+
memoize :config
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class Lono::Bundler::Dsl
|
2
|
+
module Syntax
|
3
|
+
def org(value)
|
4
|
+
config.org = value
|
5
|
+
end
|
6
|
+
alias_method :user, :org
|
7
|
+
|
8
|
+
def base_clone_url(value)
|
9
|
+
config.base_clone_url = value
|
10
|
+
end
|
11
|
+
|
12
|
+
def export_to(path)
|
13
|
+
config.export_to = path
|
14
|
+
end
|
15
|
+
|
16
|
+
def export_purge(value)
|
17
|
+
config.export_purge = value
|
18
|
+
end
|
19
|
+
|
20
|
+
def stack_options(value={})
|
21
|
+
config.stack_options.merge!(value)
|
22
|
+
end
|
23
|
+
|
24
|
+
def clone_with(value)
|
25
|
+
config.clone_with = value
|
26
|
+
end
|
27
|
+
|
28
|
+
def config
|
29
|
+
LB.config
|
30
|
+
end
|
31
|
+
|
32
|
+
def component(name, options={})
|
33
|
+
meta[:components] << options.merge(name: name)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.friendly_method(meth)
|
37
|
+
define_method meth do |name, options={}|
|
38
|
+
component(name, options.merge(type: meth.to_s))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
friendly_method :blueprint
|
43
|
+
friendly_method :configset
|
44
|
+
friendly_method :extension
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class Dsl
|
3
|
+
include DslEvaluator
|
4
|
+
include Syntax
|
5
|
+
|
6
|
+
class_attribute :meta, default: {global: {}, components: []}
|
7
|
+
|
8
|
+
def run
|
9
|
+
evaluate_file(LB.config.lonofile)
|
10
|
+
self
|
11
|
+
end
|
12
|
+
|
13
|
+
def meta
|
14
|
+
self.class.meta
|
15
|
+
end
|
16
|
+
|
17
|
+
def global
|
18
|
+
meta[:global]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Lono::Bundler::Exporter
|
2
|
+
class Copy < Base
|
3
|
+
def initialize(component)
|
4
|
+
@component = component
|
5
|
+
end
|
6
|
+
|
7
|
+
def component
|
8
|
+
FileUtils.rm_rf(@component.export_path)
|
9
|
+
FileUtils.mkdir_p(File.dirname(@component.export_path))
|
10
|
+
logger.debug "Copy: cp -r #{src_path} #{@component.export_path}"
|
11
|
+
FileUtils.cp_r(src_path, @component.export_path)
|
12
|
+
FileUtils.rm_rf("#{@component.export_path}/.git")
|
13
|
+
end
|
14
|
+
|
15
|
+
# src path is from the stage area
|
16
|
+
def src_path
|
17
|
+
path = stage_path(rel_dest_dir)
|
18
|
+
path = "#{path}/#{@component.subfolder}" if @component.subfolder
|
19
|
+
path
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Lono::Bundler
|
2
|
+
class Exporter
|
3
|
+
include LB::Component::Concerns::PathConcern
|
4
|
+
include LB::Util::Logging
|
5
|
+
|
6
|
+
def initialize(options={})
|
7
|
+
@options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
purge_all
|
12
|
+
components.each do |component|
|
13
|
+
logger.info "Exporting #{component.export_path}"
|
14
|
+
purge(component)
|
15
|
+
export(component)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def components
|
20
|
+
components = lockfile.components
|
21
|
+
if LB.update_mode? && !@options[:components].empty?
|
22
|
+
components.select! { |component| @options[:components].include?(component.name) }
|
23
|
+
end
|
24
|
+
components
|
25
|
+
end
|
26
|
+
|
27
|
+
def export(component)
|
28
|
+
fetcher = Component::Fetcher.new(component).instance
|
29
|
+
fetcher.run
|
30
|
+
fetcher.switch_version(component.sha)
|
31
|
+
copy = Copy.new(component)
|
32
|
+
copy.component
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def purge_all
|
37
|
+
return if LB.update_mode?
|
38
|
+
return unless LB.config.export_purge
|
39
|
+
FileUtils.rm_rf(LB.config.export_to)
|
40
|
+
end
|
41
|
+
|
42
|
+
def purge(component)
|
43
|
+
FileUtils.rm_rf(component.export_path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def lockfile
|
47
|
+
Lockfile.instance
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|