lono 8.0.0.pre.rc1 → 8.0.0.pre.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/acceptance/bin/build.sh +5 -5
- data/CHANGELOG.md +11 -0
- data/README.md +2 -7
- data/lib/lono/app.rb +3 -0
- data/lib/lono/app_file/build.rb +1 -1
- data/lib/lono/builder/context/generic.rb +11 -0
- data/lib/lono/builder/context/{loader → loaders}/load_files.rb +1 -1
- data/lib/lono/builder/context/{loader.rb → loaders.rb} +2 -2
- data/lib/lono/builder/context/params.rb +2 -3
- data/lib/lono/builder/context/template.rb +4 -0
- data/lib/lono/builder/dsl/evaluator.rb +94 -0
- data/lib/lono/builder/{template/configset_injector.rb → dsl/finalizer/configsets.rb} +11 -22
- data/lib/lono/builder/{template/dsl → dsl}/finalizer/parameter_groups.rb +2 -2
- data/lib/lono/builder/{template/dsl → dsl}/finalizer.rb +2 -1
- data/lib/lono/builder/{template/dsl/evaluator/helpers/ec2_helper.rb → dsl/helpers/ec2.rb} +3 -3
- data/lib/lono/builder/{template/helpers.rb → dsl/helpers/partials.rb} +2 -6
- data/lib/lono/builder/{template/dsl/evaluator/helpers/s3_helper.rb → dsl/helpers/s3.rb} +2 -2
- data/lib/lono/builder/{context/ssm_fetcher.rb → dsl/helpers/ssm/fetcher.rb} +2 -2
- data/lib/lono/builder/{context/helpers.rb → dsl/helpers/ssm.rb} +3 -3
- data/lib/lono/builder/{template/dsl/evaluator/helpers/stack_helper.rb → dsl/helpers/stack.rb} +5 -3
- data/lib/lono/builder/{template/dsl/evaluator/helpers/tags_helper.rb → dsl/helpers/tags.rb} +2 -2
- data/lib/lono/builder/dsl/helpers/template_file.rb +54 -0
- data/lib/lono/builder/{template/dsl/evaluator → dsl}/helpers.rb +3 -4
- data/lib/lono/builder/{template/dsl/evaluator/section → dsl/syntax/core}/base.rb +4 -5
- data/lib/lono/builder/{template/dsl/evaluator/section → dsl/syntax/core}/condition.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator/section → dsl/syntax/core}/mapping.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator/section → dsl/syntax/core}/output.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator/section → dsl/syntax/core}/parameter.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator/section → dsl/syntax/core}/resource/property_mover.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator/section → dsl/syntax/core}/resource.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator/section → dsl/syntax/core}/section.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator → dsl/syntax/core}/squeezer.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator/section/methods.rb → dsl/syntax/core.rb} +2 -2
- data/lib/lono/builder/{template/dsl/evaluator → dsl/syntax}/fn.rb +1 -1
- data/lib/lono/builder/{template/dsl/evaluator → dsl}/syntax/parameter_group.rb +1 -1
- data/lib/lono/builder/dsl/syntax.rb +9 -0
- data/lib/lono/builder/{template/dsl.rb → dsl.rb} +1 -1
- data/lib/lono/builder/{template/dsl/evaluator → util}/stringify.rb +1 -1
- data/lib/lono/bundler/component/props/extension.rb +0 -1
- data/lib/lono/bundler/extract/tar.rb +0 -1
- data/lib/lono/cfn/deploy/iam.rb +0 -1
- data/lib/lono/cfn/plan/diff/file.rb +2 -1
- data/lib/lono/cli/abstract.rb +1 -1
- data/lib/lono/cli/build.rb +1 -11
- data/lib/lono/cli/help/cfn/status.md +0 -1
- data/lib/lono/cli/help/seed.md +22 -21
- data/lib/lono/cli/s3.rb +3 -3
- data/lib/lono/cli.rb +1 -0
- data/lib/lono/importer/service/coder.rb +67 -63
- data/lib/lono/logger.rb +1 -0
- data/lib/lono/s3/bucket.rb +26 -26
- data/lib/lono/s3/rollback.rb +8 -0
- data/lib/lono/seeder.rb +20 -2
- data/lib/lono/user_data.rb +1 -1
- data/lib/lono/utils/{context.rb → contexts.rb} +4 -4
- data/lib/lono/version.rb +1 -1
- metadata +36 -40
- data/lib/lono/builder/context.rb +0 -25
- data/lib/lono/builder/template/dsl/evaluator/helpers/core_helper.rb +0 -14
- data/lib/lono/builder/template/dsl/evaluator/helpers/file_helper.rb +0 -44
- data/lib/lono/builder/template/dsl/evaluator/syntax/extend_with.rb +0 -9
- data/lib/lono/builder/template/dsl/evaluator/syntax.rb +0 -11
- data/lib/lono/builder/template/dsl/evaluator.rb +0 -45
- data/lib/lono/builder/template/evaluate.rb +0 -52
- data/lib/lono/extensions/dsl.rb +0 -8
- data/lib/lono/extensions/loader.rb +0 -19
- data/lib/lono/extensions.rb +0 -18
@@ -1,44 +0,0 @@
|
|
1
|
-
module Lono::Builder::Template::Dsl::Evaluator::Helpers
|
2
|
-
module FileHelper
|
3
|
-
extend Memoist
|
4
|
-
|
5
|
-
def user_data(path)
|
6
|
-
render_file(Lono.config.paths.user_data, path)
|
7
|
-
end
|
8
|
-
|
9
|
-
def user_data_script
|
10
|
-
unless @user_data_script
|
11
|
-
return <<~EOL
|
12
|
-
# @user_data_script variable not set. IE: @user_data_script = "config/#{@blueprint.name}/user_data/boostrap.sh"
|
13
|
-
# Also, make sure that "config/#{@blueprint.name}/user_data/boostrap.sh" path you're using exists.
|
14
|
-
EOL
|
15
|
-
end
|
16
|
-
|
17
|
-
if File.exist?(@user_data_script)
|
18
|
-
render_path(@user_data_script)
|
19
|
-
else
|
20
|
-
message = "WARN: #{@user_data_script} not found"
|
21
|
-
logger.info message.color(:yellow)
|
22
|
-
"# #{message}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def render_file(folder, path)
|
27
|
-
path = "#{folder}/#{path}"
|
28
|
-
if File.exist?(path)
|
29
|
-
render_path(path)
|
30
|
-
else
|
31
|
-
message = "WARNING: path #{path} not found"
|
32
|
-
logger.info message.color(:yellow)
|
33
|
-
logger.info "Called from:"
|
34
|
-
logger.info caller[2]
|
35
|
-
message
|
36
|
-
end
|
37
|
-
end
|
38
|
-
memoize :render_file
|
39
|
-
|
40
|
-
def render_path(path)
|
41
|
-
RenderMePretty.result(path, context: self)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
module Lono::Builder::Template::Dsl::Evaluator::Syntax
|
2
|
-
module ExtendWith
|
3
|
-
def extend_with(extension)
|
4
|
-
# Do nothing during the main DSL evaluation. The extend_with logical actual runs during during the
|
5
|
-
# pre_evalation stage before project helpers are loaded. This allows project helper to override extend helpers.
|
6
|
-
# Define the method here it does not error though.
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Encapsulates syntax methods so they can be included in both the Evaluator and Context scope
|
2
|
-
class Lono::Builder::Template::Dsl::Evaluator
|
3
|
-
module Syntax
|
4
|
-
include Fn
|
5
|
-
include Lono::Builder::Template::Evaluate
|
6
|
-
include Section::Methods
|
7
|
-
include ParameterGroup
|
8
|
-
include ExtendWith
|
9
|
-
include Helpers # built-in helpers
|
10
|
-
end
|
11
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
class Lono::Builder::Template::Dsl
|
2
|
-
class Evaluator
|
3
|
-
include Lono::Extensions::Loader
|
4
|
-
include Lono::Utils::Context
|
5
|
-
include Lono::Builder::Context::Loader
|
6
|
-
|
7
|
-
include Syntax
|
8
|
-
extend Memoist
|
9
|
-
|
10
|
-
def initialize(options={})
|
11
|
-
@options = options
|
12
|
-
@blueprint = Lono::Blueprint.new(options)
|
13
|
-
@template_path = "#{@blueprint.root}/template.rb"
|
14
|
-
@parameters = [] # registry
|
15
|
-
@cfn = {}
|
16
|
-
end
|
17
|
-
|
18
|
-
def build
|
19
|
-
# TODO: load_all_extension_helpers # after Extensions::Preparer#run
|
20
|
-
load_variables unless seed? # both blueprint and project variables
|
21
|
-
load_blueprint_helpers
|
22
|
-
evaluate_template_paths(@template_path) # modifies @cfn
|
23
|
-
finalize
|
24
|
-
to_yaml
|
25
|
-
@cfn
|
26
|
-
end
|
27
|
-
|
28
|
-
def finalize
|
29
|
-
o = @options.merge(parameters: @parameters)
|
30
|
-
@cfn = Finalizer.new(@cfn, o).run
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_yaml
|
34
|
-
# https://stackoverflow.com/questions/24508364/how-to-emit-yaml-in-ruby-expanding-aliases
|
35
|
-
# Trick to prevent YAML from emitting aliases
|
36
|
-
@cfn = YAML.load(@cfn.to_json)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Dont want any existing files to prevent building the blueprint.
|
40
|
-
# This means that parameters cannot be based on vars. It's a trade-off.
|
41
|
-
def seed?
|
42
|
-
ARGV[0] == "seed"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
class Lono::Builder::Template
|
2
|
-
module Evaluate
|
3
|
-
include Lono::Utils::Logging
|
4
|
-
|
5
|
-
# Example path: /full/path/to/project/app/blueprints/demo/template.rb
|
6
|
-
def evaluate_template_paths(path)
|
7
|
-
ext = File.extname(path)
|
8
|
-
folder = path.sub(ext, '')
|
9
|
-
expr = "#{folder}/**/*.rb"
|
10
|
-
evaluate_template_path(path) # process top-level template.rb first
|
11
|
-
Dir.glob(expr).each do |path|
|
12
|
-
evaluate_template_path(path)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def evaluate_template_path(path)
|
17
|
-
return unless File.exist?(path)
|
18
|
-
begin
|
19
|
-
instance_eval(File.read(path), path)
|
20
|
-
rescue Exception => e
|
21
|
-
template_evaluation_error(e)
|
22
|
-
logger.error "\nFull error:"
|
23
|
-
raise
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Prints out a user friendly task_definition error message
|
28
|
-
def template_evaluation_error(e)
|
29
|
-
lines = e.backtrace.reject { |l| l.include?("/lib/lono/") }
|
30
|
-
error_info = lines.first
|
31
|
-
path, line_no, _ = error_info.split(':')
|
32
|
-
line_no = line_no.to_i
|
33
|
-
logger.error "Error evaluating #{path}:".color(:red)
|
34
|
-
logger.error e.message
|
35
|
-
logger.error "Here's the line in #{path} with the error:\n\n"
|
36
|
-
|
37
|
-
contents = IO.read(path)
|
38
|
-
content_lines = contents.split("\n")
|
39
|
-
context = 5 # lines of context
|
40
|
-
top, bottom = [line_no-context-1, 0].max, line_no+context-1
|
41
|
-
spacing = content_lines.size.to_s.size
|
42
|
-
content_lines[top..bottom].each_with_index do |line_content, index|
|
43
|
-
line_number = top+index+1
|
44
|
-
if line_number == line_no
|
45
|
-
printf("%#{spacing}d %s\n".color(:red), line_number, line_content)
|
46
|
-
else
|
47
|
-
printf("%#{spacing}d %s\n", line_number, line_content)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
data/lib/lono/extensions/dsl.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
class Lono::Extensions
|
2
|
-
module Loader
|
3
|
-
include Lono::Builder::Context::Loader::LoadFiles
|
4
|
-
|
5
|
-
def load_all_extension_helpers
|
6
|
-
end
|
7
|
-
|
8
|
-
def load_extension_helpers(registry)
|
9
|
-
end
|
10
|
-
|
11
|
-
#
|
12
|
-
# 1. vendor/extensions
|
13
|
-
# 2. normal gem
|
14
|
-
# 3. materialized gem
|
15
|
-
#
|
16
|
-
def find_extensions_root_path(registry)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/lib/lono/extensions.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Lono
|
2
|
-
class Extensions
|
3
|
-
include Dsl
|
4
|
-
include Lono::Builder::Template::Evaluate
|
5
|
-
|
6
|
-
def initialize(template_path)
|
7
|
-
@template_path = template_path
|
8
|
-
end
|
9
|
-
|
10
|
-
def evaluate
|
11
|
-
evaluate_template_paths(@template_path) # handle extend_with
|
12
|
-
end
|
13
|
-
|
14
|
-
# The extend_with methods are used in file as the normal DSL evaluation.
|
15
|
-
# We use method_missing so we dont have to redefine all the normal methods of the DSL.
|
16
|
-
def method_missing(name, *args, &block); end
|
17
|
-
end
|
18
|
-
end
|