lono 3.5.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +15 -4
- data/.rspec +1 -0
- data/CHANGELOG.md +15 -1
- data/Gemfile +3 -3
- data/Guardfile +17 -8
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.md +20 -12
- data/Rakefile +1 -2
- data/{bin → exe}/lono +1 -0
- data/lib/lono.rb +12 -9
- data/lib/lono/cfn.rb +7 -9
- data/lib/lono/cfn/{aws_services.rb → aws_service.rb} +1 -1
- data/lib/lono/cfn/base.rb +41 -38
- data/lib/lono/cfn/create.rb +6 -2
- data/lib/lono/cfn/delete.rb +2 -2
- data/lib/lono/cfn/diff.rb +1 -1
- data/lib/lono/cfn/preview.rb +26 -15
- data/lib/lono/cfn/update.rb +11 -9
- data/lib/lono/cfn/util.rb +3 -3
- data/lib/lono/clean.rb +1 -1
- data/lib/lono/cli.rb +71 -39
- data/lib/lono/command.rb +42 -18
- data/lib/lono/completer.rb +162 -0
- data/lib/lono/completer/script.rb +6 -0
- data/lib/lono/completer/script.sh +10 -0
- data/lib/lono/completion.rb +15 -0
- data/lib/lono/core.rb +23 -9
- data/lib/lono/core/config.rb +20 -0
- data/lib/lono/default/settings.yml +33 -13
- data/lib/lono/help.rb +6 -79
- data/lib/lono/help/cfn.md +6 -0
- data/lib/lono/help/cfn/create.md +22 -0
- data/lib/lono/help/cfn/delete.md +5 -0
- data/lib/lono/help/cfn/diff.md +5 -0
- data/lib/lono/help/cfn/download.md +5 -0
- data/lib/lono/help/cfn/preview.md +11 -0
- data/lib/lono/help/cfn/update.md +21 -0
- data/lib/lono/help/completion.md +22 -0
- data/lib/lono/help/completion_script.md +3 -0
- data/lib/lono/help/generate.md +7 -0
- data/lib/lono/help/hello.md +5 -0
- data/lib/lono/help/import.md +7 -0
- data/lib/lono/help/inspect.md +4 -0
- data/lib/lono/help/inspect/depends.md +3 -0
- data/lib/lono/help/inspect/summary.md +3 -0
- data/lib/lono/help/new.md +8 -0
- data/lib/lono/help/param.md +3 -0
- data/lib/lono/{param/help.rb → help/param/generate.md} +1 -9
- data/lib/lono/help/script/build.md +5 -0
- data/lib/lono/help/script/upload.md +8 -0
- data/lib/lono/help/template.md +4 -0
- data/lib/lono/help/template/bashify.md +4 -0
- data/lib/lono/help/template/generate.md +7 -0
- data/lib/lono/help/user_data.md +3 -0
- data/lib/lono/importer.rb +43 -20
- data/lib/lono/inspector.rb +2 -19
- data/lib/lono/inspector/base.rb +2 -2
- data/lib/lono/inspector/{depends.rb → graph.rb} +3 -3
- data/lib/lono/inspector/summary.rb +1 -1
- data/lib/lono/new.rb +79 -26
- data/lib/lono/new/helper.rb +16 -0
- data/lib/lono/new/message.rb +35 -0
- data/lib/lono/param.rb +1 -2
- data/lib/lono/param/generator.rb +34 -86
- data/lib/lono/project_checker.rb +35 -40
- data/lib/lono/script.rb +19 -0
- data/lib/lono/script/base.rb +9 -0
- data/lib/lono/script/build.rb +73 -0
- data/lib/lono/script/upload.rb +81 -0
- data/lib/lono/sequence.rb +33 -0
- data/lib/lono/setting.rb +83 -0
- data/lib/lono/template.rb +8 -9
- data/lib/lono/template/{aws_services.rb → aws_service.rb} +1 -1
- data/lib/lono/template/context.rb +73 -0
- data/lib/lono/template/dsl.rb +63 -64
- data/lib/lono/template/helper.rb +201 -0
- data/lib/lono/template/template.rb +29 -221
- data/lib/lono/template/upload.rb +41 -33
- data/lib/lono/upgrade4.rb +175 -0
- data/lib/lono/user_data.rb +31 -0
- data/lib/lono/version.rb +1 -1
- data/lib/starter_projects/autoscaling/.gitignore +1 -0
- data/lib/starter_projects/{json_project → autoscaling}/Gemfile +0 -0
- data/lib/starter_projects/{yaml_project → autoscaling}/Guardfile +0 -0
- data/lib/starter_projects/autoscaling/README.md +118 -0
- data/lib/starter_projects/autoscaling/app/definitions/base.rb +2 -0
- data/lib/starter_projects/autoscaling/app/templates/autoscaling.yml +682 -0
- data/lib/starter_projects/autoscaling/config/params/base/autoscaling.txt +6 -0
- data/lib/starter_projects/autoscaling/config/settings.yml +33 -0
- data/lib/starter_projects/ec2/.gitignore +1 -0
- data/lib/starter_projects/{yaml_project → ec2}/Gemfile +0 -0
- data/lib/starter_projects/{json_project → ec2}/Guardfile +1 -1
- data/lib/starter_projects/ec2/README.md +86 -0
- data/lib/starter_projects/ec2/app/definitions/base.rb +2 -0
- data/lib/starter_projects/ec2/app/definitions/development.rb +1 -0
- data/lib/starter_projects/ec2/app/definitions/production.rb +1 -0
- data/lib/starter_projects/{yaml_project → ec2/app}/helpers/my_custom_helper.rb +0 -0
- data/lib/starter_projects/{json_project/templates/user_data/app.sh → ec2/app/partials/user_data/bootstrap.sh} +1 -2
- data/lib/starter_projects/{yaml_project → ec2/app}/templates/example.yml +0 -0
- data/lib/starter_projects/{json_project/params/base/api-web.txt → ec2/config/params/base/example.txt} +0 -0
- data/lib/starter_projects/ec2/config/params/development/example.txt +3 -0
- data/lib/starter_projects/ec2/config/params/production/example.txt +2 -0
- data/lib/starter_projects/ec2/config/settings.yml +33 -0
- data/lib/starter_projects/ec2/config/variables/base.rb +3 -0
- data/lib/starter_projects/ec2/config/variables/development.rb +2 -0
- data/lib/starter_projects/ec2/config/variables/production.rb +2 -0
- data/lib/starter_projects/ec2/welcome.txt +8 -0
- data/lib/starter_projects/skeleton/.gitignore +1 -0
- data/lib/starter_projects/skeleton/Gemfile +3 -0
- data/lib/starter_projects/skeleton/Guardfile +12 -0
- data/lib/starter_projects/skeleton/README.md +53 -0
- data/{spec/fixtures/my_project/templates/.gitkeep → lib/starter_projects/skeleton/app/definitions/base.rb} +0 -0
- data/lib/starter_projects/skeleton/config/settings.yml +33 -0
- data/lib/starter_projects/skeleton/welcome.txt +7 -0
- data/lono.gemspec +12 -10
- data/spec/fixtures/lono_project/.gitignore +1 -0
- data/spec/fixtures/lono_project/Gemfile +3 -0
- data/spec/fixtures/lono_project/Guardfile +12 -0
- data/spec/fixtures/lono_project/app/definitions/base.rb +10 -0
- data/spec/fixtures/lono_project/app/definitions/base/more.rb +7 -0
- data/spec/fixtures/lono_project/app/definitions/development.rb +1 -0
- data/spec/fixtures/lono_project/app/definitions/production.rb +1 -0
- data/spec/fixtures/lono_project/app/helpers/custom_helper.rb +5 -0
- data/spec/fixtures/lono_project/app/partials/security_group.yml +10 -0
- data/{lib/starter_projects/yaml_project/templates/partial → spec/fixtures/lono_project/app/partials}/user_data/bootstrap.sh +8 -2
- data/spec/fixtures/lono_project/app/templates/example.yml +50 -0
- data/{lib/starter_projects/yaml_project/params/base/api-web-prod.txt → spec/fixtures/lono_project/config/params/base/example.txt} +1 -0
- data/spec/fixtures/lono_project/config/params/development/example.txt +1 -0
- data/spec/fixtures/lono_project/config/params/production/example.txt +1 -0
- data/spec/fixtures/lono_project/config/settings.yml +31 -0
- data/spec/fixtures/lono_project/config/variables/base.rb +3 -0
- data/spec/fixtures/lono_project/config/variables/development.rb +1 -0
- data/spec/fixtures/lono_project/config/variables/production.rb +1 -0
- data/spec/fixtures/params/envonly/params/{prod → development}/network.txt +0 -0
- data/spec/fixtures/params/overlay/params/{prod → development}/network.txt +0 -0
- data/spec/fixtures/raw_templates/aws-waf-security-automations.template +2 -2
- data/spec/lib/lono/cfn_spec.rb +6 -9
- data/spec/lib/lono/cli_spec.rb +44 -0
- data/spec/lib/lono/completion_spec.rb +17 -0
- data/spec/lib/lono/inspect_spec.rb +6 -15
- data/spec/lib/lono/param/generator_spec.rb +45 -26
- data/spec/lib/lono/param_spec.rb +1 -3
- data/spec/lib/lono/setting_spec.rb +47 -0
- data/spec/lib/lono/template/dsl_spec.rb +33 -157
- data/spec/lib/lono/template_spec.rb +4 -16
- data/spec/spec_helper.rb +45 -14
- metadata +168 -82
- data/.coveralls.yml +0 -1
- data/lib/lono/cfn/help.rb +0 -103
- data/lib/lono/current_region.rb +0 -42
- data/lib/lono/inspector/help.rb +0 -21
- data/lib/lono/settings.rb +0 -45
- data/lib/lono/template/help.rb +0 -25
- data/lib/lono/template/helpers.rb +0 -136
- data/lib/starter_projects/json_project/.gitignore +0 -1
- data/lib/starter_projects/json_project/config/templates/base/blog.rb +0 -20
- data/lib/starter_projects/json_project/config/templates/base/stacks.rb +0 -58
- data/lib/starter_projects/json_project/templates/db.json +0 -212
- data/lib/starter_projects/json_project/templates/partial/host_record.json +0 -28
- data/lib/starter_projects/json_project/templates/partial/server.json +0 -45
- data/lib/starter_projects/json_project/templates/user_data/db.sh +0 -39
- data/lib/starter_projects/json_project/templates/user_data/db2.sh +0 -2
- data/lib/starter_projects/json_project/templates/user_data/ruby_script.rb +0 -5
- data/lib/starter_projects/json_project/templates/web.json +0 -386
- data/lib/starter_projects/yaml_project/.gitignore +0 -1
- data/lib/starter_projects/yaml_project/config/templates/base/blog.rb +0 -20
- data/lib/starter_projects/yaml_project/config/templates/base/stacks.rb +0 -56
- data/lib/starter_projects/yaml_project/config/templates/prod/stacks.rb +0 -1
- data/lib/starter_projects/yaml_project/config/templates/stag/stacks.rb +0 -1
- data/lib/starter_projects/yaml_project/config/variables/base/variables.rb +0 -4
- data/lib/starter_projects/yaml_project/config/variables/prod/variables.rb +0 -1
- data/lib/starter_projects/yaml_project/config/variables/stag/variables.rb +0 -1
- data/lib/starter_projects/yaml_project/params/base/example.txt +0 -2
- data/lib/starter_projects/yaml_project/params/prod/example.txt +0 -1
- data/lib/starter_projects/yaml_project/params/stag/example.txt +0 -1
- data/lib/starter_projects/yaml_project/templates/db.yml +0 -148
- data/lib/starter_projects/yaml_project/templates/partial/host_record.yml +0 -14
- data/lib/starter_projects/yaml_project/templates/partial/server.yml +0 -59
- data/lib/starter_projects/yaml_project/templates/web.yml +0 -206
- data/spec/fixtures/my_project/config/templates/base/stacks.rb +0 -3
- data/spec/fixtures/my_project/params/my-stack.txt +0 -3
- data/spec/fixtures/my_project/templates/my-stack.yml +0 -0
- data/spec/lib/lono/new_spec.rb +0 -59
- data/spec/lib/lono/template/template_spec.rb +0 -104
- data/spec/lib/lono_spec.rb +0 -27
File without changes
|
data/spec/lib/lono/new_spec.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Lono::New do
|
4
|
-
before(:each) do
|
5
|
-
@saved_root = ENV['LONO_ROOT']
|
6
|
-
ENV['LONO_ROOT'] = ENV['TMP_LONO_ROOT']
|
7
|
-
end
|
8
|
-
after(:each) do
|
9
|
-
ENV['LONO_ROOT'] = @saved_root
|
10
|
-
FileUtils.rm_rf(ENV['TMP_LONO_ROOT']) unless ENV['KEEP_TMP_PROJECT']
|
11
|
-
end
|
12
|
-
|
13
|
-
context "json starter project" do
|
14
|
-
before(:each) do
|
15
|
-
new_project = Lono::New.new(
|
16
|
-
force: true,
|
17
|
-
quiet: true,
|
18
|
-
format: 'json',
|
19
|
-
project_root: ENV['TMP_LONO_ROOT'],
|
20
|
-
)
|
21
|
-
new_project.run
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should be able to lono generate" do
|
25
|
-
dsl = Lono::Template::DSL.new(
|
26
|
-
quiet: true
|
27
|
-
)
|
28
|
-
dsl.run
|
29
|
-
generated = File.exist?("#{Lono.root}/output/blog-web.json")
|
30
|
-
expect(generated).to be true
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "yml starter project" do
|
35
|
-
before(:each) do
|
36
|
-
new_project = Lono::New.new(
|
37
|
-
force: true,
|
38
|
-
quiet: true,
|
39
|
-
format: 'yaml',
|
40
|
-
project_root: ENV['TMP_LONO_ROOT'],
|
41
|
-
)
|
42
|
-
new_project.run
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should be able to lono generate" do
|
46
|
-
dsl = Lono::Template::DSL.new(
|
47
|
-
quiet: true
|
48
|
-
)
|
49
|
-
dsl.run
|
50
|
-
generated = File.exist?("#{Lono.root}/output/blog-web.yml")
|
51
|
-
expect(generated).to be true
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context "multiple format starter project" do
|
56
|
-
# TODO: this should not generate anything but puts out a message to the user that the
|
57
|
-
# project needs to be either all yaml or all json format
|
58
|
-
end
|
59
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require_relative "../../../spec_helper"
|
2
|
-
|
3
|
-
describe Lono::Template do
|
4
|
-
let(:template) do
|
5
|
-
block = Proc.new {}
|
6
|
-
template = Lono::Template::Template.new("output_name.yml", block)
|
7
|
-
|
8
|
-
# override the puts and printf methods within the test
|
9
|
-
def template.messages
|
10
|
-
@messages
|
11
|
-
end
|
12
|
-
|
13
|
-
def template.puts(msg)
|
14
|
-
@messages ||= []
|
15
|
-
@messages << msg
|
16
|
-
nil
|
17
|
-
end
|
18
|
-
|
19
|
-
def template.printf(*args)
|
20
|
-
@messages ||= []
|
21
|
-
@messages << args
|
22
|
-
end
|
23
|
-
|
24
|
-
template
|
25
|
-
end
|
26
|
-
|
27
|
-
context "valid erb template" do
|
28
|
-
it "should be able to lono generate" do
|
29
|
-
template.erb_result("path", "template")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "invalid erb template" do
|
34
|
-
it "should print out useful error message about undefined variable" do
|
35
|
-
template.erb_result("path", "variable does not exist\n<% variable %>\nanother line")
|
36
|
-
errors = template.messages.grep(/Error evaluating ERB template on line/)
|
37
|
-
expect(errors).not_to be_empty
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should print out useful error message about syntax error" do
|
41
|
-
template.erb_result("path", "<%s dsfds ?%>\nanother line")
|
42
|
-
errors = template.messages.grep(/Error evaluating ERB template on line/)
|
43
|
-
expect(errors).not_to be_empty
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "parsing" do
|
48
|
-
it "should transform bash script into json array with cloudformation objects" do
|
49
|
-
block = Proc.new { }
|
50
|
-
template = Lono::Template::Template.new("foo", block)
|
51
|
-
|
52
|
-
line = '0{2345}7'
|
53
|
-
expect(template.bracket_positions(line)).to eq [[0,0],[1,6],[7,7]]
|
54
|
-
line = '0{2}4{6}' # more than one bracket
|
55
|
-
expect(template.bracket_positions(line)).to eq [[0,0],[1,3],[4,4],[5,7]]
|
56
|
-
line = '0{2}4{6{8}0}2' # nested brackets
|
57
|
-
expect(template.bracket_positions(line)).to eq [[0,0],[1,3],[4,4],[5,11],[12,12]]
|
58
|
-
|
59
|
-
line = '{'
|
60
|
-
expect(template.decompose(line)).to eq ['{']
|
61
|
-
|
62
|
-
##########################
|
63
|
-
line = '1{"Ref"=>"A"}{"Ref"=>"B"}'
|
64
|
-
expect(template.decompose(line)).to eq ['1','{"Ref"=>"A"}','{"Ref"=>"B"}']
|
65
|
-
|
66
|
-
line = '{"Ref"=>"A"}{"Ref"=>"B"}2'
|
67
|
-
expect(template.decompose(line)).to eq ['{"Ref"=>"A"}','{"Ref"=>"B"}','2']
|
68
|
-
|
69
|
-
line = '1{"Ref"=>"A"}{"Ref"=>"B"}2'
|
70
|
-
expect(template.decompose(line)).to eq ['1','{"Ref"=>"A"}','{"Ref"=>"B"}','2']
|
71
|
-
|
72
|
-
line = '{"Ref"=>"A"}{"Ref"=>"B"}'
|
73
|
-
expect(template.decompose(line)).to eq ['{"Ref"=>"A"}','{"Ref"=>"B"}']
|
74
|
-
|
75
|
-
line = 'Ref{"Ref"=>"B"}'
|
76
|
-
expect(template.decompose(line)).to eq ['Ref','{"Ref"=>"B"}']
|
77
|
-
##############################
|
78
|
-
|
79
|
-
# only allow whitelist
|
80
|
-
line = 'a{b}{"foo"=>"bar"}h'
|
81
|
-
expect(template.decompose(line)).to eq ['a{b}{"foo"=>"bar"}h']
|
82
|
-
|
83
|
-
line = 'a{b}{"Ref"=>"bar"}h'
|
84
|
-
expect(template.decompose(line)).to eq ['a{b}','{"Ref"=>"bar"}','h']
|
85
|
-
line = 'a{"Ref"=>"bar"}c{"Ref"=>{"cat"=>"mouse"}}e' # nested brackets
|
86
|
-
expect(template.decompose(line)).to eq ['a','{"Ref"=>"bar"}','c','{"Ref"=>{"cat"=>"mouse"}}','e']
|
87
|
-
|
88
|
-
line = 'test{"Ref"=>"world"}me' # nested brackets
|
89
|
-
decomposition = template.decompose(line)
|
90
|
-
result = template.recompose(decomposition)
|
91
|
-
expect(result).to eq ["test", {"Ref" => "world"}, "me"]
|
92
|
-
|
93
|
-
line = 'test{"Ref"=>"world"}me'
|
94
|
-
expect(template.transform(line)).to eq ["test", {"Ref" => "world"}, "me\n"]
|
95
|
-
line = '{"Ref"=>"world"}'
|
96
|
-
expect(template.transform(line)).to eq [{"Ref" => "world"}, "\n"]
|
97
|
-
line = '{'
|
98
|
-
expect(template.transform(line)).to eq ["{\n"]
|
99
|
-
line = 'Ref{"Ref"=>"B"}'
|
100
|
-
expect(template.transform(line)).to eq ['Ref',{"Ref"=>"B"}, "\n"]
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
data/spec/lib/lono_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require_relative "../spec_helper"
|
2
|
-
|
3
|
-
describe Lono do
|
4
|
-
describe "lono" do
|
5
|
-
before(:each) do
|
6
|
-
@env = "LONO_ROOT=#{ENV['LONO_ROOT']}"
|
7
|
-
end
|
8
|
-
after(:each) do
|
9
|
-
FileUtils.rm_rf("spec/fixtures/my_project/params/base")
|
10
|
-
end
|
11
|
-
|
12
|
-
it "generate should build templates" do
|
13
|
-
out = execute("#{@env} bin/lono generate")
|
14
|
-
expect(out).to match /Generating both CloudFormation template and parameter/
|
15
|
-
end
|
16
|
-
|
17
|
-
it "import should download template" do
|
18
|
-
path = "spec/fixtures/my_project/config/templates/base/stacks.rb"
|
19
|
-
backup = "spec/fixtures/my_project/config/templates/base/stacks.rb.bak"
|
20
|
-
FileUtils.cp(path, backup)
|
21
|
-
out = execute("#{@env} bin/lono import spec/fixtures/raw_templates/aws-waf-security-automations.template #{@args}")
|
22
|
-
expect(out).to match /Imported raw CloudFormation template/
|
23
|
-
FileUtils.mv(backup, path)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|