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
@@ -0,0 +1,56 @@
|
|
1
|
+
class Lono::CLI
|
2
|
+
module Help
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
class_methods do
|
6
|
+
def main_commands
|
7
|
+
%w[
|
8
|
+
build
|
9
|
+
down
|
10
|
+
list
|
11
|
+
new
|
12
|
+
plan
|
13
|
+
seed
|
14
|
+
show
|
15
|
+
up
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
19
|
+
def help(shell, subcommand)
|
20
|
+
list = printable_commands(true, subcommand)
|
21
|
+
list.sort! { |a, b| a[0] <=> b[0] }
|
22
|
+
filter = Proc.new do |command, desc|
|
23
|
+
main_commands.detect { |name| command =~ Regexp.new("^lono #{name}") }
|
24
|
+
end
|
25
|
+
main = list.select(&filter)
|
26
|
+
other = list.reject(&filter)
|
27
|
+
|
28
|
+
shell.say <<~EOL
|
29
|
+
Usage: lono COMMAND [args]
|
30
|
+
The available commands are listed below.
|
31
|
+
The primary workflow commands are given first, followed by
|
32
|
+
less common or more advanced commands.
|
33
|
+
EOL
|
34
|
+
shell.say "\nMain Commands:\n\n"
|
35
|
+
shell.print_table(main, :indent => 2, :truncate => true)
|
36
|
+
shell.say "\nOther Commands:\n\n"
|
37
|
+
shell.print_table(other, :indent => 2, :truncate => true)
|
38
|
+
shell.say <<~EOL
|
39
|
+
|
40
|
+
For more help on each command, you can use the -h option. Example:
|
41
|
+
|
42
|
+
lono up -h
|
43
|
+
|
44
|
+
CLI Reference also available at: https://lono.cloud/reference/
|
45
|
+
EOL
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def text(namespaced_command)
|
50
|
+
path = namespaced_command.to_s.gsub(':','/')
|
51
|
+
path = File.expand_path("../help/#{path}.md", __FILE__)
|
52
|
+
IO.read(path) if File.exist?(path)
|
53
|
+
end
|
54
|
+
extend self
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Lono::CLI
|
2
|
+
class List < Base
|
3
|
+
attr_reader :options
|
4
|
+
def initialize(options={})
|
5
|
+
@options = options
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
list_type("blueprints") if show?("blueprint")
|
10
|
+
list_type("configsets") if show?("configset")
|
11
|
+
list_type("extensions") if show?("extension")
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def list_type(type)
|
16
|
+
lookup.list(type)
|
17
|
+
end
|
18
|
+
|
19
|
+
def lookup
|
20
|
+
Lono::Lookup.new
|
21
|
+
end
|
22
|
+
memoize :lookup
|
23
|
+
|
24
|
+
def show?(type)
|
25
|
+
@options[:type] == type || @options[:type].nil? || @options[:type] == "all"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Lono::CLI::New
|
2
|
+
class Blueprint < Sequence
|
3
|
+
argument :name
|
4
|
+
def self.cli_options
|
5
|
+
[
|
6
|
+
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
|
7
|
+
[:examples, type: :boolean, desc: "Whether not to generate examples"],
|
8
|
+
[:project, desc: "Project name"],
|
9
|
+
]
|
10
|
+
end
|
11
|
+
cli_options.each do |args|
|
12
|
+
class_option(*args)
|
13
|
+
end
|
14
|
+
|
15
|
+
def set_source
|
16
|
+
if @options[:examples]
|
17
|
+
set_template_source "examples/blueprint"
|
18
|
+
else
|
19
|
+
set_template_source "blueprint"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# for specs
|
24
|
+
def set_dest
|
25
|
+
@dest = [@options[:project], "app/blueprints"].compact.join('/')
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_blueprint
|
29
|
+
logger.info "=> Creating new blueprint called #{name}."
|
30
|
+
directory ".", "#{@dest}/#{name}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Lono::CLI::New
|
2
|
+
module Concerns
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
private
|
6
|
+
def class_name
|
7
|
+
name.underscore.camelize
|
8
|
+
end
|
9
|
+
|
10
|
+
# Files should be named with underscores instead of dashes even though project name can contain a dash.
|
11
|
+
# This is because autoloading works with underscores in the filenames only.
|
12
|
+
def underscore_name
|
13
|
+
name.underscore
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,8 +1,5 @@
|
|
1
|
-
class Lono::
|
2
|
-
class
|
3
|
-
include Lono::Blueprint::Helper
|
4
|
-
include Lono::Utils::Generators::Tree
|
5
|
-
|
1
|
+
class Lono::CLI::New
|
2
|
+
class Configset < Sequence
|
6
3
|
argument :configset_name
|
7
4
|
|
8
5
|
def self.source_root
|
@@ -69,9 +66,5 @@ class Lono::Configset
|
|
69
66
|
|
70
67
|
EOL
|
71
68
|
end
|
72
|
-
|
73
|
-
def tree
|
74
|
-
tree_structure("configset")
|
75
|
-
end
|
76
69
|
end
|
77
70
|
end
|
@@ -1,9 +1,5 @@
|
|
1
|
-
class Lono::
|
2
|
-
class
|
3
|
-
include Lono::Blueprint::Helper # for user_info
|
4
|
-
include Lono::Extension::Helper
|
5
|
-
include Lono::Utils::Generators::Tree
|
6
|
-
|
1
|
+
class Lono::CLI::New
|
2
|
+
class Extension < Sequence
|
7
3
|
argument :extension_name
|
8
4
|
|
9
5
|
def self.source_root
|
@@ -57,9 +53,5 @@ class Lono::Extension
|
|
57
53
|
|
58
54
|
EOL
|
59
55
|
end
|
60
|
-
|
61
|
-
def tree
|
62
|
-
tree_structure("extension")
|
63
|
-
end
|
64
56
|
end
|
65
57
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Lono::CLI::New
|
2
|
+
class Helper < Sequence
|
3
|
+
def self.cli_options
|
4
|
+
[
|
5
|
+
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
|
6
|
+
[:blueprint, required: true, desc: "Blueprint name"],
|
7
|
+
[:name, default: "custom", desc: "Helper name"],
|
8
|
+
]
|
9
|
+
end
|
10
|
+
cli_options.each do |args|
|
11
|
+
class_option(*args)
|
12
|
+
end
|
13
|
+
|
14
|
+
def set_source
|
15
|
+
set_template_source "helper"
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_vars
|
19
|
+
@blueprint = @options[:blueprint]
|
20
|
+
@name = @options[:name]
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_blueprint
|
24
|
+
puts "underscore_name #{underscore_name}"
|
25
|
+
logger.info "=> Generating helper: #{@name}"
|
26
|
+
directory ".", "app/blueprints/#{@blueprint}/helpers"
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
attr_reader :name # required for templates/helper/%name%_helper.rb.tt
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
class Lono::CLI::New
|
2
|
+
class Project < Sequence
|
3
|
+
argument :name
|
4
|
+
set_template_source "project"
|
5
|
+
|
6
|
+
def self.cli_options
|
7
|
+
[
|
8
|
+
[:bundle, type: :boolean, default: true, desc: "Runs bundle install on the project"],
|
9
|
+
[:examples, type: :boolean, default: false, desc: "Also generate blueprint example"],
|
10
|
+
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
|
11
|
+
[:git, type: :boolean, default: true, desc: "Git initialize the project"],
|
12
|
+
[:quiet, type: :boolean, desc: "Quiet output."],
|
13
|
+
]
|
14
|
+
end
|
15
|
+
cli_options.each { |args| class_option(*args) }
|
16
|
+
|
17
|
+
# for specs
|
18
|
+
def set_pwd
|
19
|
+
@pwd = Dir.pwd
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_project
|
23
|
+
log "=> Creating new project called #{name}."
|
24
|
+
directory ".", "#{@pwd}/#{name}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_example_blueprint
|
28
|
+
return unless @options[:examples]
|
29
|
+
# https://github.com/erikhuda/thor/wiki/Invocations
|
30
|
+
args = ["demo", "--project", name]
|
31
|
+
args += ["--examples"] if @options[:examples]
|
32
|
+
args += ["--force"] if @options[:force]
|
33
|
+
Blueprint.start(args)
|
34
|
+
end
|
35
|
+
|
36
|
+
def bundle_install
|
37
|
+
return unless options[:bundle]
|
38
|
+
log "=> Installing dependencies with: bundle install"
|
39
|
+
::Bundler.with_unbundled_env do
|
40
|
+
bundle = "BUNDLE_IGNORE_CONFIG=1 bundle install"
|
41
|
+
bundle << " > /dev/null 2>&1" if @options[:quiet]
|
42
|
+
system(bundle, chdir: name)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def welcome_message
|
47
|
+
log <<~EOL
|
48
|
+
#{"="*64}
|
49
|
+
Congrats 🎉 You have successfully created a lono project.
|
50
|
+
|
51
|
+
cd #{name}
|
52
|
+
|
53
|
+
EOL
|
54
|
+
unless @options[:examples]
|
55
|
+
log <<~EOL
|
56
|
+
To generate a new blueprint:
|
57
|
+
|
58
|
+
lono new blueprint demo --examples
|
59
|
+
|
60
|
+
EOL
|
61
|
+
end
|
62
|
+
log <<~EOL
|
63
|
+
To deploy:
|
64
|
+
|
65
|
+
lono up demo
|
66
|
+
|
67
|
+
More info: https://lono.cloud/
|
68
|
+
EOL
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
def log(msg)
|
73
|
+
logger.info(msg) unless @options[:quiet]
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/core_ext/string'
|
4
|
+
require 'thor'
|
5
|
+
require 'bundler'
|
6
|
+
|
7
|
+
class Lono::CLI::New
|
8
|
+
class Sequence < Thor::Group
|
9
|
+
include Concerns
|
10
|
+
include Lono::Utils::Logging
|
11
|
+
include Thor::Actions
|
12
|
+
|
13
|
+
private
|
14
|
+
def self.set_template_source(folder)
|
15
|
+
source_root File.expand_path("../../../templates/#{folder}", __dir__)
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_template_source(*paths)
|
19
|
+
paths = paths.flatten.map do |path|
|
20
|
+
File.expand_path("../../../templates/#{path}", __dir__)
|
21
|
+
end
|
22
|
+
set_template_paths(paths)
|
23
|
+
end
|
24
|
+
|
25
|
+
def set_template_paths(*paths)
|
26
|
+
paths.flatten!
|
27
|
+
# https://github.com/erikhuda/thor/blob/34df888d721ecaa8cf0cea97d51dc6c388002742/lib/thor/actions.rb#L128
|
28
|
+
instance_variable_set(:@source_paths, nil) # unset instance variable cache
|
29
|
+
# Using string with instance_eval because block doesnt have access to path at runtime.
|
30
|
+
instance_eval %{
|
31
|
+
def self.source_paths
|
32
|
+
#{paths.flatten.inspect}
|
33
|
+
end
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def git_installed?
|
38
|
+
system("type git > /dev/null 2>&1")
|
39
|
+
end
|
40
|
+
|
41
|
+
def run_git?
|
42
|
+
options[:git] && git_installed?
|
43
|
+
end
|
44
|
+
|
45
|
+
def run_git_init
|
46
|
+
return unless run_git?
|
47
|
+
puts "=> Initialize git repo"
|
48
|
+
run("git init")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class Lono::CLI::New
|
2
|
+
class Shim < Thor::Group
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
def self.cli_options
|
6
|
+
[
|
7
|
+
[:path, aliases: %w[p], default: "/usr/local/bin/lono", desc: "path to save the shim script"],
|
8
|
+
]
|
9
|
+
end
|
10
|
+
cli_options.each { |args| class_option(*args) }
|
11
|
+
|
12
|
+
def self.source_root
|
13
|
+
File.expand_path("../../../templates/shim", __dir__)
|
14
|
+
end
|
15
|
+
|
16
|
+
def set_vars
|
17
|
+
@path = @options[:path]
|
18
|
+
end
|
19
|
+
|
20
|
+
def create
|
21
|
+
dest = @path
|
22
|
+
template "lono", dest
|
23
|
+
chmod dest, 0755
|
24
|
+
end
|
25
|
+
|
26
|
+
def message
|
27
|
+
dir = File.dirname(@path)
|
28
|
+
puts <<~EOL
|
29
|
+
A lono shim as been generated at #{@path}
|
30
|
+
Please make sure that it is found in the $PATH.
|
31
|
+
|
32
|
+
You can double check with:
|
33
|
+
|
34
|
+
which lono
|
35
|
+
|
36
|
+
You should see
|
37
|
+
|
38
|
+
$ which lono
|
39
|
+
#{@path}
|
40
|
+
|
41
|
+
If you do not, please add #{dir} to your PATH.
|
42
|
+
You can usually do so by adding this line to ~/.bash_profile and opening a new terminal to check.
|
43
|
+
|
44
|
+
export PATH=#{dir}:/$PATH
|
45
|
+
|
46
|
+
Also note, the shim wrapper contains starter code. Though it should generally work for most systems,
|
47
|
+
it might require adjustments depending on your system.
|
48
|
+
EOL
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def switch_ruby_version_line
|
53
|
+
rbenv_installed = system("type rbenv > /dev/null 2>&1")
|
54
|
+
if rbenv_installed
|
55
|
+
'eval "$(rbenv init -)"'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Lono::CLI::New::Test
|
2
|
+
class Blueprint < Sequence
|
3
|
+
argument :name
|
4
|
+
|
5
|
+
def self.cli_options
|
6
|
+
[
|
7
|
+
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
|
8
|
+
]
|
9
|
+
end
|
10
|
+
cli_options.each { |args| class_option(*args) }
|
11
|
+
|
12
|
+
def set_source
|
13
|
+
name = Lono.config.test.framework
|
14
|
+
framework = Lono::Plugin.find(name: name, type: "test_framework")
|
15
|
+
set_template_paths("#{framework.root}/lib/templates/blueprint")
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate
|
19
|
+
dest = "app/blueprints/#{name}"
|
20
|
+
directory ".", dest
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class Lono::CLI::New
|
2
|
+
class Test < Lono::Command
|
3
|
+
Help = Lono::CLI::Help
|
4
|
+
long_desc Help.text("new/test/blueprint")
|
5
|
+
Blueprint.cli_options.each { |args| option(*args) }
|
6
|
+
register(Blueprint, "blueprint", "blueprint NAME", "Generate new blueprint test.")
|
7
|
+
end
|
8
|
+
end
|
data/lib/lono/cli/new.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
class Lono::CLI
|
2
|
+
class New < Lono::Command
|
3
|
+
long_desc Help.text("new/blueprint")
|
4
|
+
Blueprint.cli_options.each { |args| option(*args) }
|
5
|
+
register(Blueprint, "blueprint", "blueprint NAME", "Generates new blueprint.")
|
6
|
+
|
7
|
+
long_desc Help.text("new/configset")
|
8
|
+
Configset.cli_options.each { |args| option(*args) }
|
9
|
+
register(Configset, "configset", "configset NAME", "Generates new configset.")
|
10
|
+
|
11
|
+
long_desc Help.text("new/extension")
|
12
|
+
Extension.cli_options.each { |args| option(*args) }
|
13
|
+
register(Extension, "extension", "extension NAME", "Generates new extension.")
|
14
|
+
|
15
|
+
long_desc Help.text("new/helper")
|
16
|
+
Helper.cli_options.each { |args| option(*args) }
|
17
|
+
register(Helper, "helper", "helper NAME", "Generates new helper.")
|
18
|
+
|
19
|
+
long_desc Help.text("new/project")
|
20
|
+
Project.cli_options.each { |args| option(*args) }
|
21
|
+
register(Project, "project", "project NAME", "Generates new project.")
|
22
|
+
|
23
|
+
long_desc Help.text("new/shim")
|
24
|
+
Shim.cli_options.each { |args| option(*args) }
|
25
|
+
register(Shim, "shim", "shim NAME", "Generates new shim.")
|
26
|
+
|
27
|
+
desc "test SUBCOMMAND", "test subcommands"
|
28
|
+
long_desc Help.text(:test)
|
29
|
+
subcommand "test", Test
|
30
|
+
end
|
31
|
+
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Lono::Opts instead of Lono::CLI::Opts
|
6
6
|
#
|
7
7
|
# Also, there's Thor Options class, so this is named Opts to avoid having to fully qualify it.
|
8
|
-
|
8
|
+
class Lono::CLI
|
9
9
|
class Opts
|
10
10
|
def initialize(cli)
|
11
11
|
@cli = cli
|
@@ -17,23 +17,20 @@ module Lono
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def yes
|
21
21
|
with_cli_scope do
|
22
|
-
option :
|
22
|
+
option :yes, aliases: :y, type: :boolean, desc: "Bypass are you sure prompt"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
# Based on https://github.com/rails/thor/blob/ab3b5be455791f4efb79f0efb4f88cc6b59c8ccf/lib/thor/actions.rb#L48
|
27
|
+
def runtime_options
|
27
28
|
with_cli_scope do
|
28
|
-
option :
|
29
|
-
|
30
|
-
end
|
29
|
+
option :force, :type => :boolean, :aliases => "-f", :group => :runtime,
|
30
|
+
:desc => "Overwrite files that already exist"
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
option :template, desc: "override convention and specify the template file to use"
|
35
|
-
option :param, desc: "override convention and specify the param file to use"
|
36
|
-
option :variable, desc: "override convention and specify the variable file to use"
|
32
|
+
option :skip, :type => :boolean, :aliases => "-s", :group => :runtime,
|
33
|
+
:desc => "Skip files that already exist"
|
37
34
|
end
|
38
35
|
end
|
39
36
|
|
@@ -1,23 +1,25 @@
|
|
1
|
-
|
2
|
-
class S3 < Command
|
1
|
+
class Lono::CLI
|
2
|
+
class S3 < Lono::Command
|
3
|
+
opts = Opts.new(self)
|
4
|
+
|
3
5
|
desc "deploy", "deploys lono managed s3 bucket"
|
4
6
|
long_desc Help.text("s3/deploy")
|
5
7
|
def deploy
|
6
|
-
Bucket.new(options).deploy
|
8
|
+
Lono::Bucket.new(options).deploy
|
7
9
|
end
|
8
10
|
|
9
11
|
desc "show", "shows lono managed s3 bucket"
|
10
12
|
long_desc Help.text("s3/show")
|
11
|
-
|
13
|
+
opts.yes
|
12
14
|
def show
|
13
|
-
Bucket.new(options).show
|
15
|
+
Lono::Bucket.new(options).show
|
14
16
|
end
|
15
17
|
|
16
18
|
desc "delete", "deletes lono managed s3 bucket"
|
17
19
|
long_desc Help.text("s3/delete")
|
18
|
-
|
20
|
+
opts.yes
|
19
21
|
def delete
|
20
|
-
Bucket.new(options).delete
|
22
|
+
Lono::Bucket.new(options).delete
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require "digest"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
class Lono::CLI::Script
|
5
|
+
class Build < Base
|
6
|
+
# Only avaialble after script has been built.
|
7
|
+
def self.scripts_name
|
8
|
+
new.scripts_name
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
reset
|
13
|
+
if Dir["#{@blueprint.root}/scripts/*"].empty?
|
14
|
+
return
|
15
|
+
else
|
16
|
+
puts "Detected scripts"
|
17
|
+
end
|
18
|
+
|
19
|
+
puts "Tarballing scripts folder to scripts.tgz"
|
20
|
+
tarball_path = create_tarball
|
21
|
+
save_scripts_info(tarball_path)
|
22
|
+
puts "Tarball created at #{tarball_path}"
|
23
|
+
end
|
24
|
+
|
25
|
+
# Only avaialble after script has been built.
|
26
|
+
def scripts_name
|
27
|
+
IO.read(SCRIPTS_INFO_PATH).strip
|
28
|
+
end
|
29
|
+
|
30
|
+
def reset
|
31
|
+
FileUtils.rm_f(SCRIPTS_INFO_PATH)
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_tarball
|
35
|
+
# https://apple.stackexchange.com/questions/14980/why-are-dot-underscore-files-created-and-how-can-i-avoid-them
|
36
|
+
# using system to avoid displaying command
|
37
|
+
system "cd #{@blueprint.root}/app && dot_clean ." if system("type dot_clean > /dev/null 2>&1")
|
38
|
+
|
39
|
+
# https://serverfault.com/questions/110208/different-md5sums-for-same-tar-contents
|
40
|
+
# Using tar czf directly results in a new m5sum each time because the gzip
|
41
|
+
# timestamp is included. So using: tar -c ... | gzip -n
|
42
|
+
sh "cd #{@blueprint.root}/app && tar -c scripts | gzip -n > scripts.tgz" # temporary scripts.tgz file
|
43
|
+
|
44
|
+
rename_with_md5!
|
45
|
+
end
|
46
|
+
|
47
|
+
# Apppend a md5 to file after it's been created and moves it to
|
48
|
+
# output/scripts/scripts-[MD5].tgz
|
49
|
+
def rename_with_md5!
|
50
|
+
md5_path = "output/#{@blueprint.name}/scripts/scripts-#{md5sum}.tgz"
|
51
|
+
FileUtils.mkdir_p(File.dirname(md5_path))
|
52
|
+
FileUtils.mv("#{@blueprint.root}/scripts.tgz", md5_path)
|
53
|
+
md5_path
|
54
|
+
end
|
55
|
+
|
56
|
+
def save_scripts_info(scripts_name)
|
57
|
+
FileUtils.mkdir_p(File.dirname(SCRIPTS_INFO_PATH))
|
58
|
+
IO.write(SCRIPTS_INFO_PATH, scripts_name)
|
59
|
+
end
|
60
|
+
|
61
|
+
# cache this because the file will get removed
|
62
|
+
def md5sum
|
63
|
+
@md5sum ||= Digest::MD5.file("#{@blueprint.root}/scripts.tgz").to_s[0..7]
|
64
|
+
end
|
65
|
+
|
66
|
+
def sh(command)
|
67
|
+
puts "=> #{command}"
|
68
|
+
system command
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "filesize"
|
2
|
+
|
3
|
+
class Lono::CLI::Script
|
4
|
+
class Upload < Base
|
5
|
+
include Lono::AwsServices
|
6
|
+
|
7
|
+
def run
|
8
|
+
return unless scripts_built?
|
9
|
+
|
10
|
+
upload(tarball_path)
|
11
|
+
puts "Uploaded #{File.basename(s3_dest)} to s3."
|
12
|
+
end
|
13
|
+
|
14
|
+
def upload(tarball_path)
|
15
|
+
puts "Uploading scripts.tgz (#{filesize}) to #{s3_dest}"
|
16
|
+
obj = s3_resource.bucket(bucket_name).object(key)
|
17
|
+
start_time = Time.now
|
18
|
+
obj.upload_file(tarball_path)
|
19
|
+
time_took = pretty_time(Time.now-start_time).color(:green)
|
20
|
+
puts "Time took to upload code to s3: #{time_took}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def filesize
|
24
|
+
Filesize.from(File.size(tarball_path).to_s + " B").pretty
|
25
|
+
end
|
26
|
+
|
27
|
+
def s3_dest
|
28
|
+
"s3://#{bucket_name}/#{key}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def key
|
32
|
+
# Example key: cloudformation/development/scripts/scripts-md5
|
33
|
+
"#{Lono.env}/output/#{@blueprint.name}/scripts/#{File.basename(tarball_path)}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def bucket_name
|
37
|
+
Lono::S3::Bucket.name
|
38
|
+
end
|
39
|
+
|
40
|
+
# Scripts are only built if the app/scripts folder is non empty
|
41
|
+
def scripts_built?
|
42
|
+
File.exist?(SCRIPTS_INFO_PATH) && !tarball_path.empty?
|
43
|
+
end
|
44
|
+
|
45
|
+
def tarball_path
|
46
|
+
IO.read(SCRIPTS_INFO_PATH).strip
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|