lono 6.1.11 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/acceptance.sh +19 -3
- data/.gitignore +2 -2
- data/CHANGELOG.md +16 -1
- data/README.md +18 -20
- data/Rakefile +1 -0
- data/lib/lono.rb +7 -5
- data/lib/lono/abstract_base.rb +25 -0
- data/lib/lono/api/client.rb +30 -0
- data/lib/lono/api/proxy.rb +58 -0
- data/lib/lono/api/repos.rb +8 -0
- data/lib/lono/api/verify.rb +13 -0
- data/lib/lono/app_file/base.rb +4 -11
- data/lib/lono/app_file/build.rb +1 -1
- data/lib/lono/app_file/upload.rb +1 -4
- data/lib/lono/autoloader.rb +3 -1
- data/lib/lono/aws_services.rb +9 -9
- data/lib/lono/aws_services/helper.rb +14 -0
- data/lib/lono/aws_services/{util.rb → stack.rb} +1 -9
- data/lib/lono/aws_services/stack_set.rb +41 -0
- data/lib/lono/blueprint.rb +2 -2
- data/lib/lono/blueprint/configset/loader.rb +7 -0
- data/lib/lono/blueprint/helper.rb +8 -2
- data/lib/lono/blueprint/meta.rb +4 -12
- data/lib/lono/blueprint/new.rb +3 -3
- data/lib/lono/blueprint/root.rb +6 -26
- data/lib/lono/bundle.rb +54 -0
- data/lib/lono/cfn.rb +31 -75
- data/lib/lono/cfn/base.rb +39 -136
- data/lib/lono/cfn/cancel.rb +14 -9
- data/lib/lono/cfn/create.rb +15 -19
- data/lib/lono/cfn/delete.rb +9 -9
- data/lib/lono/cfn/deploy.rb +4 -4
- data/lib/lono/cfn/download.rb +27 -9
- data/lib/lono/cfn/opts.rb +80 -0
- data/lib/lono/cfn/preview/changeset.rb +23 -23
- data/lib/lono/cfn/preview/codediff.rb +5 -6
- data/lib/lono/cfn/preview/param.rb +10 -10
- data/lib/lono/cfn/rollback.rb +5 -5
- data/lib/lono/cfn/status.rb +0 -10
- data/lib/lono/cfn/update.rb +22 -27
- data/lib/lono/clean.rb +3 -3
- data/lib/lono/cli.rb +69 -34
- data/lib/lono/code.rb +22 -0
- data/lib/lono/command.rb +7 -0
- data/lib/lono/config_location.rb +6 -13
- data/lib/lono/configset.rb +9 -0
- data/lib/lono/configset/combiner.rb +128 -0
- data/lib/lono/configset/evaluate_file.rb +8 -0
- data/lib/lono/configset/list.rb +67 -0
- data/lib/lono/configset/loader.rb +98 -0
- data/lib/lono/configset/loader/dsl.rb +9 -0
- data/lib/lono/configset/materializer/final.rb +10 -0
- data/lib/lono/configset/materializer/gems_builder.rb +81 -0
- data/lib/lono/configset/materializer/jade.rb +15 -0
- data/lib/lono/configset/materializer/source.rb +54 -0
- data/lib/lono/configset/meta.rb +19 -0
- data/lib/lono/configset/meta/dsl.rb +12 -0
- data/lib/lono/configset/new.rb +84 -0
- data/lib/lono/configset/preparer.rb +44 -0
- data/lib/lono/configset/register/base.rb +121 -0
- data/lib/lono/configset/register/blueprint.rb +16 -0
- data/lib/lono/configset/register/dsl.rb +15 -0
- data/lib/lono/configset/register/project.rb +12 -0
- data/lib/lono/configset/registry.rb +34 -0
- data/lib/lono/configset/resolver.rb +42 -0
- data/lib/lono/conventions.rb +18 -7
- data/lib/lono/core.rb +16 -20
- data/lib/lono/default/settings.yml +2 -3
- data/lib/lono/ext/bundler.rb +7 -0
- data/lib/lono/file_uploader.rb +8 -5
- data/lib/lono/finder/base.rb +140 -0
- data/lib/lono/finder/blueprint.rb +11 -0
- data/lib/lono/finder/blueprint/configset.rb +17 -0
- data/lib/lono/finder/configset.rb +11 -0
- data/lib/lono/generate.rb +93 -0
- data/lib/lono/help/blueprint/new.md +0 -1
- data/lib/lono/help/cfn/delete.md +1 -1
- data/lib/lono/help/cfn/deploy.md +5 -76
- data/lib/lono/help/cfn/status.md +0 -4
- data/lib/lono/help/cfn/update.md +1 -1
- data/lib/lono/help/code/convert.md +51 -0
- data/lib/lono/help/code/import.md +30 -0
- data/lib/lono/help/configsets.md +24 -0
- data/lib/lono/help/generate.md +4 -4
- data/lib/lono/help/new.md +1 -2
- data/lib/lono/help/sets/delete.md +8 -0
- data/lib/lono/help/sets/deploy.md +76 -0
- data/lib/lono/help/sets/instances/delete.md +21 -0
- data/lib/lono/help/sets/instances/list.md +14 -0
- data/lib/lono/help/sets/instances/status.md +15 -0
- data/lib/lono/help/sets/instances/sync.md +88 -0
- data/lib/lono/help/sets/status.md +23 -0
- data/lib/lono/help/upgrade.md +1 -0
- data/lib/lono/importer.rb +22 -0
- data/lib/lono/importer/base.rb +59 -0
- data/lib/lono/importer/converter.rb +19 -0
- data/lib/lono/importer/download.rb +46 -0
- data/lib/lono/importer/dsl.rb +36 -0
- data/lib/lono/importer/erb.rb +31 -0
- data/lib/lono/importer/params.rb +56 -0
- data/lib/lono/importer/service/coder.rb +81 -0
- data/lib/lono/inspector/base.rb +12 -22
- data/lib/lono/inspector/graph.rb +1 -1
- data/lib/lono/inspector/summary.rb +41 -17
- data/lib/lono/jade.rb +103 -0
- data/lib/lono/jade/circular.rb +26 -0
- data/lib/lono/jadespec.rb +41 -0
- data/lib/lono/new.rb +2 -2
- data/lib/lono/opts.rb +43 -0
- data/lib/lono/output/template.rb +48 -0
- data/lib/lono/param.rb +3 -5
- data/lib/lono/param/generator.rb +13 -33
- data/lib/lono/pro.rb +15 -0
- data/lib/lono/pro/base.rb +16 -0
- data/lib/lono/pro/repo.rb +27 -0
- data/lib/lono/project_checker.rb +4 -29
- data/lib/lono/registration.rb +15 -0
- data/lib/lono/registration/base.rb +37 -0
- data/lib/lono/registration/check.rb +15 -0
- data/lib/lono/registration/temp.rb +60 -0
- data/lib/lono/registration/user.rb +54 -0
- data/lib/lono/script/base.rb +1 -10
- data/lib/lono/script/upload.rb +2 -12
- data/lib/lono/seed.rb +2 -11
- data/lib/lono/seed/base.rb +55 -110
- data/lib/lono/sets.rb +38 -0
- data/lib/lono/sets/base.rb +45 -0
- data/lib/lono/sets/create.rb +30 -0
- data/lib/lono/sets/delete.rb +47 -0
- data/lib/lono/sets/deploy.rb +11 -0
- data/lib/lono/sets/instances.rb +33 -0
- data/lib/lono/sets/instances/base.rb +30 -0
- data/lib/lono/sets/instances/delete.rb +69 -0
- data/lib/lono/sets/instances/list.rb +13 -0
- data/lib/lono/sets/instances/opts.rb +29 -0
- data/lib/lono/sets/instances/status.rb +12 -0
- data/lib/lono/sets/instances/sync.rb +182 -0
- data/lib/lono/sets/list.rb +35 -0
- data/lib/lono/sets/opts.rb +18 -0
- data/lib/lono/sets/preview/codediff.rb +35 -0
- data/lib/lono/sets/preview/param.rb +32 -0
- data/lib/lono/sets/status.rb +116 -0
- data/lib/lono/sets/status/instance.rb +20 -0
- data/lib/lono/sets/status/instance/base.rb +120 -0
- data/lib/lono/sets/status/instance/completed.rb +35 -0
- data/lib/lono/sets/status/instance/deleted.rb +32 -0
- data/lib/lono/sets/status/instance/show.rb +7 -0
- data/lib/lono/sets/status/instances.rb +111 -0
- data/lib/lono/sets/summarize.rb +20 -0
- data/lib/lono/sets/time_spent.rb +11 -0
- data/lib/lono/sets/update.rb +81 -0
- data/lib/lono/template.rb +5 -7
- data/lib/lono/template/configset_injector.rb +50 -0
- data/lib/lono/template/context.rb +4 -4
- data/lib/lono/template/context/loader.rb +4 -16
- data/lib/lono/template/evaluate.rb +2 -1
- data/lib/lono/template/generator.rb +17 -15
- data/lib/lono/template/helper.rb +7 -7
- data/lib/lono/template/post_processor.rb +2 -12
- data/lib/lono/template/strategy/base.rb +4 -0
- data/lib/lono/template/{dsl.rb → strategy/dsl.rb} +4 -6
- data/lib/lono/template/{dsl → strategy/dsl}/builder.rb +11 -15
- data/lib/lono/template/{dsl → strategy/dsl}/builder/fn.rb +1 -1
- data/lib/lono/template/strategy/dsl/builder/helpers.rb +11 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/core_helper.rb +14 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb +48 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/lookup_helper.rb +27 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/s3_helper.rb +13 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/tags_helper.rb +39 -0
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/base.rb +6 -17
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/condition.rb +1 -1
- data/lib/lono/template/strategy/dsl/builder/section/extensions.rb +9 -0
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/mapping.rb +1 -1
- data/lib/lono/template/{dsl/builder/section_methods.rb → strategy/dsl/builder/section/methods.rb} +9 -2
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/output.rb +1 -1
- data/lib/lono/template/strategy/dsl/builder/section/parameter.rb +69 -0
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/resource.rb +1 -1
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/resource/property_mover.rb +1 -1
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/section.rb +1 -1
- data/lib/lono/template/{dsl → strategy/dsl}/builder/squeezer.rb +1 -1
- data/lib/lono/template/strategy/dsl/builder/stringify.rb +15 -0
- data/lib/lono/template/{dsl → strategy/dsl}/builder/syntax.rb +3 -2
- data/lib/lono/template/strategy/dsl/finalizer.rb +12 -0
- data/lib/lono/template/strategy/dsl/finalizer/parameter_groups.rb +56 -0
- data/lib/lono/template/{erb.rb → strategy/erb.rb} +5 -5
- data/lib/lono/template/strategy/source.rb +8 -0
- data/lib/lono/template/template.rb +1 -1
- data/lib/lono/template/upload.rb +4 -9
- data/lib/lono/template/util.rb +0 -40
- data/lib/lono/upgrade.rb +12 -10
- data/lib/lono/user_data.rb +4 -4
- data/lib/lono/utils/pretty_time.rb +14 -0
- data/lib/lono/utils/sure.rb +23 -0
- data/lib/lono/version.rb +1 -1
- data/lib/lono/yamler/loader.rb +52 -0
- data/lib/lono/yamler/validator.rb +51 -0
- data/lib/templates/blueprint/%blueprint_name%.gemspec.tt +4 -0
- data/lib/templates/blueprint/README.md.tt +1 -1
- data/lib/templates/blueprint/seed/configs.rb +2 -2
- data/lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb +17 -18
- data/lib/templates/blueprint_types/erb/app/templates/%blueprint_name%.yml +63 -4
- data/lib/templates/configset/%configset_name%.gemspec.tt +41 -0
- data/lib/templates/configset/.gitignore +11 -0
- data/lib/templates/configset/CHANGELOG.md +7 -0
- data/lib/templates/configset/Gemfile +4 -0
- data/lib/templates/configset/README.md.tt +3 -0
- data/lib/templates/configset/Rakefile.tt +9 -0
- data/lib/templates/configset/lib/configset.yml +20 -0
- data/lib/templates/skeleton/.gitignore +1 -0
- data/lib/templates/skeleton/Gemfile +0 -1
- data/lib/templates/skeleton/README.md +4 -4
- data/lib/templates/skeleton/configs/settings.yml +1 -1
- data/lono.gemspec +1 -4
- metadata +146 -79
- data/Guardfile +0 -19
- data/lib/lono/app_file.rb +0 -5
- data/lib/lono/blueprint/find.rb +0 -90
- data/lib/lono/blueprint/info.rb +0 -10
- data/lib/lono/blueprint/list.rb +0 -14
- data/lib/lono/cfn/current.rb +0 -95
- data/lib/lono/cfn/preview.rb +0 -4
- data/lib/lono/cfn/suffix.rb +0 -67
- data/lib/lono/cfn/util.rb +0 -27
- data/lib/lono/help/cfn/current.md +0 -18
- data/lib/lono/help/upgrade4.md +0 -25
- data/lib/lono/inspector.rb +0 -4
- data/lib/lono/output_template.rb +0 -35
- data/lib/lono/template/base.rb +0 -13
- data/lib/lono/template/dsl/builder/helpers.rb +0 -8
- data/lib/lono/template/dsl/builder/helpers/core_helper.rb +0 -107
- data/lib/lono/template/dsl/builder/helpers/param_helper.rb +0 -61
- data/lib/lono/template/dsl/builder/parameter.rb +0 -39
- data/lib/lono/upgrade/upgrade4.rb +0 -175
- data/lib/lono/upgrade/upgrade42.rb +0 -36
- data/lib/lono/upgrade/upgrade5.rb +0 -55
- data/lib/templates/blueprint/.meta/config.yml.tt +0 -4
- data/lib/templates/skeleton/Guardfile +0 -12
- data/lib/templates/upgrade5/blueprints/main/.lono/config.yml +0 -3
- data/lib/templates/upgrade5/blueprints/main/.meta/config.yml +0 -3
data/Guardfile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
guard "bundler", cmd: "bundle" do
|
2
|
-
watch("Gemfile")
|
3
|
-
watch(/^.+\.gemspec/)
|
4
|
-
end
|
5
|
-
|
6
|
-
guard :rspec, cmd: "bundle exec rspec" do
|
7
|
-
require "guard/rspec/dsl"
|
8
|
-
dsl = Guard::RSpec::Dsl.new(self)
|
9
|
-
|
10
|
-
# RSpec files
|
11
|
-
rspec = dsl.rspec
|
12
|
-
watch(rspec.spec_helper) { rspec.spec_dir }
|
13
|
-
watch(rspec.spec_support) { rspec.spec_dir }
|
14
|
-
watch(rspec.spec_files)
|
15
|
-
|
16
|
-
# Ruby files
|
17
|
-
ruby = dsl.ruby
|
18
|
-
dsl.watch_spec_files_for(ruby.lib_files)
|
19
|
-
end
|
data/lib/lono/app_file.rb
DELETED
data/lib/lono/blueprint/find.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
|
3
|
-
class Lono::Blueprint
|
4
|
-
class Find
|
5
|
-
class << self
|
6
|
-
extend Memoist
|
7
|
-
|
8
|
-
def one_or_all(blueprint)
|
9
|
-
blueprint ? [blueprint] : all_blueprints
|
10
|
-
end
|
11
|
-
|
12
|
-
# Returns both project and gem blueprints
|
13
|
-
def all_blueprints
|
14
|
-
project_blueprints = all_project_blueprint_infos.map { |info| info.name }
|
15
|
-
|
16
|
-
gem_blueprints = specs.map do |spec|
|
17
|
-
dot_lono = dot_meta_path(spec)
|
18
|
-
config = YAML.load_file(dot_lono)
|
19
|
-
config["blueprint_name"]
|
20
|
-
end
|
21
|
-
|
22
|
-
all = project_blueprints + gem_blueprints
|
23
|
-
all.uniq
|
24
|
-
end
|
25
|
-
|
26
|
-
# Returns blueprint root full path. Can be:
|
27
|
-
#
|
28
|
-
# 1. projects blueprints/BLUEPRINT - higher precedence
|
29
|
-
# 2. full gem path
|
30
|
-
#
|
31
|
-
def find(blueprint)
|
32
|
-
# Check projects blueprints
|
33
|
-
info = all_project_blueprint_infos.find { |info| info.name == blueprint}
|
34
|
-
return info.path if info
|
35
|
-
|
36
|
-
# Check gem specs
|
37
|
-
result = specs.find do |spec|
|
38
|
-
dot_lono = dot_meta_path(spec)
|
39
|
-
config = YAML.load_file(dot_lono)
|
40
|
-
config["blueprint_name"] == blueprint
|
41
|
-
end
|
42
|
-
result.full_gem_path if result
|
43
|
-
end
|
44
|
-
|
45
|
-
# Returns: Array of Blueprint::Info. Example:
|
46
|
-
#
|
47
|
-
# [#<Lono::Blueprint::Info:0x0000561e620e0548
|
48
|
-
# @name="ecs-spot-fleet",
|
49
|
-
# @path="/full/path/to/blueprint/ecs-spot-demo">,
|
50
|
-
# #<Lono::Blueprint::Info:0x0000561e61e132c0
|
51
|
-
# @name="ec2",
|
52
|
-
# @path="/full/path/to/blueprint/ec2">]
|
53
|
-
def all_project_blueprint_infos
|
54
|
-
infos = []
|
55
|
-
Dir.glob("#{Lono.root}/blueprints/*").select do |p|
|
56
|
-
dot_lono = dot_meta_path(p)
|
57
|
-
next unless File.exist?(dot_lono)
|
58
|
-
config = YAML.load_file(dot_lono)
|
59
|
-
infos << Info.new(config["blueprint_name"], p)
|
60
|
-
end
|
61
|
-
infos
|
62
|
-
end
|
63
|
-
|
64
|
-
# Only the blueprint specs
|
65
|
-
def specs
|
66
|
-
specs = Bundler.load.specs
|
67
|
-
specs.select do |spec|
|
68
|
-
File.exist?(dot_meta_path(spec))
|
69
|
-
end
|
70
|
-
end
|
71
|
-
memoize :specs
|
72
|
-
|
73
|
-
def dot_meta_path(source)
|
74
|
-
if source.is_a?(String) # path to folder
|
75
|
-
"#{source}/.meta/config.yml"
|
76
|
-
else # spec
|
77
|
-
"#{source.full_gem_path}/.meta/config.yml"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def bundler_version_check!
|
82
|
-
return unless Bundler.bundler_major_version >= 1 # LockfileParser only works for Bundler version 2+
|
83
|
-
|
84
|
-
puts "ERROR: The bundler version detected is too old. Please use bundler 2+".color(:red)
|
85
|
-
puts "Current detected bundler version is #{Bundler.bundler_major_version}"
|
86
|
-
exit 1
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
data/lib/lono/blueprint/info.rb
DELETED
data/lib/lono/blueprint/list.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
class Lono::Blueprint
|
2
|
-
class List
|
3
|
-
class << self
|
4
|
-
def available
|
5
|
-
puts "Current available blueprints:"
|
6
|
-
Find.all_blueprints.sort.each do |b|
|
7
|
-
full_path = Find.find(b)
|
8
|
-
path = full_path.sub("#{Lono.root}/", "")
|
9
|
-
puts " #{b}: #{path}"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/lib/lono/cfn/current.rb
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
|
3
|
-
class Lono::Cfn
|
4
|
-
class Current
|
5
|
-
def initialize(options={})
|
6
|
-
Lono::ProjectChecker.check
|
7
|
-
@options = options
|
8
|
-
@file = ".lono/current"
|
9
|
-
@path = "#{Lono.root}/#{@file}"
|
10
|
-
end
|
11
|
-
|
12
|
-
def run
|
13
|
-
@options[:rm] ? rm : set
|
14
|
-
end
|
15
|
-
|
16
|
-
def rm
|
17
|
-
FileUtils.rm_f(@path)
|
18
|
-
puts "Current settings have been removed. Removed #{@file}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def set
|
22
|
-
if @options.empty?
|
23
|
-
show
|
24
|
-
else
|
25
|
-
d = data # assign data to d to create local variable for merge to work
|
26
|
-
d = d.merge(@options).delete_if do |k,v|
|
27
|
-
v&.empty? || v == ['']
|
28
|
-
end
|
29
|
-
text = YAML.dump(d)
|
30
|
-
FileUtils.mkdir_p(File.dirname(@path))
|
31
|
-
IO.write(@path, text)
|
32
|
-
puts "Current settings saved in .lono/current"
|
33
|
-
show
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def show
|
38
|
-
if data.empty?
|
39
|
-
puts <<-EOL
|
40
|
-
There are no current settings. To set a current stack run:
|
41
|
-
|
42
|
-
lono cfn current --name mystack
|
43
|
-
lono cfn current -h # for more examples
|
44
|
-
EOL
|
45
|
-
return
|
46
|
-
end
|
47
|
-
|
48
|
-
data.each do |key, value|
|
49
|
-
puts "Current #{key}: #{value}"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def data
|
54
|
-
YAML.load(IO.read(@path)) rescue {}
|
55
|
-
end
|
56
|
-
|
57
|
-
def suffix
|
58
|
-
current = data["suffix"]
|
59
|
-
return current unless current&.empty?
|
60
|
-
end
|
61
|
-
|
62
|
-
# reads suffix, returns nil if not set
|
63
|
-
def self.suffix
|
64
|
-
Current.new.suffix
|
65
|
-
end
|
66
|
-
|
67
|
-
def name
|
68
|
-
current = data["name"]
|
69
|
-
return current unless current&.empty?
|
70
|
-
end
|
71
|
-
|
72
|
-
# reads name, returns nil if not set
|
73
|
-
def self.name
|
74
|
-
Current.new.name
|
75
|
-
end
|
76
|
-
|
77
|
-
# reads name, will exit if current name not set
|
78
|
-
def self.name!(name=:current)
|
79
|
-
return name if name != :current
|
80
|
-
|
81
|
-
name = Current.name
|
82
|
-
return name if name
|
83
|
-
|
84
|
-
# TODO: don't think it is possible to get here...
|
85
|
-
puts "ERROR: stack name must be specified.".color(:red)
|
86
|
-
puts <<-EOL
|
87
|
-
Example:
|
88
|
-
lono cfn #{ARGV[1]} STACK
|
89
|
-
You can also set a current stack name to be remembered with:
|
90
|
-
lono cfn current --name STACK
|
91
|
-
EOL
|
92
|
-
exit 1
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
data/lib/lono/cfn/preview.rb
DELETED
data/lib/lono/cfn/suffix.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
class Lono::Cfn
|
2
|
-
module Suffix
|
3
|
-
# Appends a short suffix at the end of a stack name.
|
4
|
-
# Lono internally strips this same suffix for the template name.
|
5
|
-
# Makes it convenient for the development flow.
|
6
|
-
#
|
7
|
-
# lono cfn current --suffix 1
|
8
|
-
# lono cfn create demo => demo-1
|
9
|
-
# lono cfn update demo-1
|
10
|
-
#
|
11
|
-
# Instead of typing:
|
12
|
-
#
|
13
|
-
# lono cfn create demo-1 --template demo
|
14
|
-
# lono cfn update demo-1 --template demo
|
15
|
-
#
|
16
|
-
# The suffix can be specified at the CLI but can also be saved as a
|
17
|
-
# preference.
|
18
|
-
#
|
19
|
-
# A random suffix can be specified with random. Example:
|
20
|
-
#
|
21
|
-
# lono cfn current --suffix random
|
22
|
-
# lono cfn create demo => demo-[RANDOM], example: demo-abc
|
23
|
-
# lono cfn update demo-abc
|
24
|
-
#
|
25
|
-
# It is not a default setting because it might confuse new lono users.
|
26
|
-
@@append_suffix = nil
|
27
|
-
def append_suffix(stack_name)
|
28
|
-
return @@append_suffix if @@append_suffix
|
29
|
-
return stack_name unless allow_suffix?
|
30
|
-
|
31
|
-
suffix ||= stack_name_suffix == 'random' ? random_suffix : stack_name_suffix
|
32
|
-
@@append_suffix = [stack_name, suffix].compact.join('-')
|
33
|
-
end
|
34
|
-
|
35
|
-
def remove_suffix(stack_name)
|
36
|
-
return stack_name unless allow_suffix?
|
37
|
-
return stack_name unless stack_name_suffix
|
38
|
-
|
39
|
-
if stack_name_suffix == 'random'
|
40
|
-
stack_name.sub(/-(\w{3})$/,'') # strip the random suffix at the end
|
41
|
-
elsif stack_name_suffix
|
42
|
-
pattern = Regexp.new("-#{stack_name_suffix}$",'')
|
43
|
-
stack_name.sub(pattern, '') # strip suffix
|
44
|
-
else
|
45
|
-
stack_name
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def allow_suffix?
|
50
|
-
%w[Lono::Cfn::Create Lono::Cfn::Deploy].include?(self.class.to_s)
|
51
|
-
end
|
52
|
-
|
53
|
-
# only generate random suffix for Create class
|
54
|
-
def random_suffix
|
55
|
-
return nil unless allow_suffix?
|
56
|
-
(0...3).map { (65 + rand(26)).chr }.join.downcase # Ex: jhx
|
57
|
-
end
|
58
|
-
|
59
|
-
def stack_name_suffix
|
60
|
-
if @options[:suffix] && !@options[:suffix].nil?
|
61
|
-
return @options[:suffix] # CLI option takes highest precedence
|
62
|
-
end
|
63
|
-
|
64
|
-
Lono.suffix # core.rb accounts for LONO_SUFFIX env variable, current, and settings
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
data/lib/lono/cfn/util.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
class Lono::Cfn
|
2
|
-
module Util
|
3
|
-
def are_you_sure?(stack_name, action)
|
4
|
-
if @options[:sure]
|
5
|
-
sure = 'y'
|
6
|
-
else
|
7
|
-
message = case action
|
8
|
-
when :update
|
9
|
-
"Are you sure you want to want to update the #{stack_name.color(:green)} stack with the changes? (y/N)"
|
10
|
-
when :delete
|
11
|
-
"Are you sure you want to want to delete the #{stack_name.color(:green)} stack? (y/N)"
|
12
|
-
end
|
13
|
-
puts message
|
14
|
-
sure = $stdin.gets
|
15
|
-
end
|
16
|
-
|
17
|
-
unless sure =~ /^y/
|
18
|
-
puts "Whew! Exiting without running #{action}."
|
19
|
-
exit 0
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def switch_current(stack_name)
|
24
|
-
Current.name!(stack_name)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
Set current values like stack name and suffix.
|
2
|
-
|
3
|
-
{% include current-options.md %}
|
4
|
-
|
5
|
-
## Static Example
|
6
|
-
|
7
|
-
lono cfn create demo
|
8
|
-
lono cfn current --name demo
|
9
|
-
lono cfn update
|
10
|
-
|
11
|
-
## Suffix Example
|
12
|
-
|
13
|
-
lono cfn current --suffix random
|
14
|
-
lono cfn create demo
|
15
|
-
lono cfn update demo-abc # generated random suffix was abc
|
16
|
-
lono cfn current --name demo-abc
|
17
|
-
lono cfn update
|
18
|
-
lono cfn update # update again
|
data/lib/lono/help/upgrade4.md
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Lono version 4 changed a few things:
|
2
|
-
|
3
|
-
* Simplified the [directory structure](http://lono.cloud/docs/directory-structure/) of a lono project.
|
4
|
-
* Format of the [settings.yml](http://lono.cloud/docs/settings/) changed.
|
5
|
-
* LONO_ENV are longer full names now.
|
6
|
-
* Refer to the [CHANGELOG](https://github.com/tongueroo/lono/blob/master/CHANGELOG.md) for more details.
|
7
|
-
|
8
|
-
This task helps you upgrade from lono version 3 to version 4.
|
9
|
-
|
10
|
-
### Example Output
|
11
|
-
|
12
|
-
$ lono upgrade4
|
13
|
-
Upgrading structure of your current project to the new lono version 4 project structure
|
14
|
-
mv helpers app/helpers
|
15
|
-
mv params config/params
|
16
|
-
mv config/templates app/definitions
|
17
|
-
mv templates app/templates
|
18
|
-
mv app/templates/partial app/partials
|
19
|
-
mv app/partials/user_data app/user_data
|
20
|
-
Updating structure of config/variables
|
21
|
-
Updating structure of app/definitions
|
22
|
-
mv config/params/prod config/params/production
|
23
|
-
mv config/params/stag config/params/staging
|
24
|
-
Upgrade to lono version 4 complete!
|
25
|
-
$
|
data/lib/lono/inspector.rb
DELETED
data/lib/lono/output_template.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
module Lono
|
2
|
-
class OutputTemplate
|
3
|
-
def initialize(blueprint, template)
|
4
|
-
@blueprint, @template = blueprint, template
|
5
|
-
end
|
6
|
-
|
7
|
-
def data
|
8
|
-
template_path = "#{Lono.config.output_path}/#{@blueprint}/templates/#{@template}.yml"
|
9
|
-
check_template_exists(template_path)
|
10
|
-
YAML.load(IO.read(template_path))
|
11
|
-
end
|
12
|
-
|
13
|
-
# Check if the template exists and print friendly error message. Exits if it
|
14
|
-
# does not exist.
|
15
|
-
def check_template_exists(template_path)
|
16
|
-
unless File.exist?(template_path)
|
17
|
-
puts "The template #{template_path} does not exist. Are you sure you use the right template name? The template name does not require the extension.".color(:red)
|
18
|
-
exit 1
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def required_parameters
|
23
|
-
parameters.select { |logical_id, p| p["Default"].nil? }
|
24
|
-
end
|
25
|
-
|
26
|
-
def optional_parameters
|
27
|
-
parameters.reject { |logical_id, p| p["Default"].nil? }
|
28
|
-
end
|
29
|
-
|
30
|
-
def parameters
|
31
|
-
data["Parameters"] || []
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
data/lib/lono/template/base.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
class Lono::Template
|
2
|
-
class Base
|
3
|
-
include Lono::Blueprint::Root
|
4
|
-
|
5
|
-
def initialize(blueprint, options={})
|
6
|
-
@blueprint, @options = blueprint, options
|
7
|
-
@template = @options[:template] || @blueprint
|
8
|
-
Lono::ProjectChecker.check
|
9
|
-
set_blueprint_root(@blueprint)
|
10
|
-
Lono::ProjectChecker.empty_templates
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|