lono 8.0.0.pre.rc2 → 8.0.0.pre.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -2
  3. data/Gemfile +1 -3
  4. data/lib/lono/app/callable_option/concern.rb +12 -0
  5. data/lib/lono/app/callable_option.rb +56 -0
  6. data/lib/lono/app.rb +22 -23
  7. data/lib/lono/autoloader.rb +1 -0
  8. data/lib/lono/aws_services/helper.rb +0 -2
  9. data/lib/lono/blueprint.rb +1 -18
  10. data/lib/lono/builder/allow/base.rb +54 -0
  11. data/lib/lono/builder/allow/env.rb +17 -0
  12. data/lib/lono/builder/allow/region.rb +20 -0
  13. data/lib/lono/builder/allow.rb +8 -0
  14. data/lib/lono/builder/configset/combiner.rb +145 -0
  15. data/lib/lono/builder/configset/definition/base.rb +47 -0
  16. data/lib/lono/builder/configset/definition/context.rb +29 -0
  17. data/lib/lono/{configset/strategy/helpers/dsl → builder/configset/definition/dsl/syntax}/auth.rb +1 -1
  18. data/lib/lono/{configset/strategy/helpers/dsl/core.rb → builder/configset/definition/dsl/syntax/content.rb} +12 -4
  19. data/lib/lono/{configset/strategy/helpers/dsl/syntax.rb → builder/configset/definition/dsl/syntax/core.rb} +15 -9
  20. data/lib/lono/{configset/strategy/helpers/dsl → builder/configset/definition/dsl/syntax}/package.rb +1 -1
  21. data/lib/lono/builder/configset/definition/dsl/syntax.rb +5 -0
  22. data/lib/lono/{configset/strategy → builder/configset/definition}/dsl.rb +10 -14
  23. data/lib/lono/{configset/strategy → builder/configset/definition}/erb.rb +13 -16
  24. data/lib/lono/builder/configset/definition.rb +18 -0
  25. data/lib/lono/builder/configset/evaluator.rb +10 -0
  26. data/lib/lono/builder/configset/registration.rb +35 -0
  27. data/lib/lono/builder/context.rb +40 -0
  28. data/lib/lono/builder/dsl/evaluator.rb +6 -55
  29. data/lib/lono/builder/dsl/finalizer/base.rb +8 -0
  30. data/lib/lono/builder/dsl/finalizer/configsets.rb +7 -28
  31. data/lib/lono/builder/dsl/finalizer/files/base.rb +4 -0
  32. data/lib/lono/builder/dsl/finalizer/files/build.rb +58 -0
  33. data/lib/lono/builder/dsl/finalizer/files/replace.rb +31 -0
  34. data/lib/lono/builder/dsl/finalizer/files.rb +9 -0
  35. data/lib/lono/builder/dsl/finalizer/parameter_groups.rb +4 -3
  36. data/lib/lono/builder/dsl/finalizer.rb +4 -2
  37. data/lib/lono/builder/dsl/helpers/files.rb +7 -0
  38. data/lib/lono/builder/dsl/helpers/partials.rb +48 -53
  39. data/lib/lono/builder/dsl/helpers/s3.rb +1 -1
  40. data/lib/lono/builder/dsl/helpers/ssm/fetcher.rb +3 -1
  41. data/lib/lono/builder/dsl/helpers/template_file.rb +18 -6
  42. data/lib/lono/builder/dsl/helpers.rb +1 -11
  43. data/lib/lono/builder/dsl/syntax/core/resource/property_mover.rb +11 -1
  44. data/lib/lono/builder/dsl/syntax/core/squeezer.rb +16 -2
  45. data/lib/lono/builder/dsl.rb +1 -1
  46. data/lib/lono/builder/param.rb +4 -1
  47. data/lib/lono/builder/template/upload.rb +2 -15
  48. data/lib/lono/cfn/cancel.rb +5 -5
  49. data/lib/lono/cfn/deploy/iam.rb +1 -1
  50. data/lib/lono/cfn/deploy.rb +32 -3
  51. data/lib/lono/cfn/download.rb +0 -1
  52. data/lib/lono/cfn/plan/changeset.rb +2 -2
  53. data/lib/lono/cfn/plan/diff/data.rb +11 -1
  54. data/lib/lono/cfn/plan/param.rb +1 -1
  55. data/lib/lono/cfn/plan/template.rb +2 -2
  56. data/lib/lono/cfn/plan.rb +1 -0
  57. data/lib/lono/cli/abstract.rb +0 -6
  58. data/lib/lono/cli/base.rb +5 -3
  59. data/lib/lono/cli/build.rb +16 -60
  60. data/lib/lono/cli/clean.rb +3 -2
  61. data/lib/lono/cli/code.rb +12 -12
  62. data/lib/lono/cli/help/new/helper/blueprint.md +17 -0
  63. data/lib/lono/cli/help/new/helper/project.md +16 -0
  64. data/lib/lono/cli/list.rb +3 -6
  65. data/lib/lono/cli/new/blueprint.rb +3 -7
  66. data/lib/lono/cli/new/configset.rb +11 -44
  67. data/lib/lono/cli/new/helper/blueprint.rb +26 -0
  68. data/lib/lono/cli/new/helper/project.rb +24 -0
  69. data/lib/lono/cli/new/helper.rb +8 -27
  70. data/lib/lono/cli/new/sequence.rb +6 -1
  71. data/lib/lono/cli/new.rb +8 -12
  72. data/lib/lono/cli/status.rb +18 -0
  73. data/lib/lono/cli.rb +6 -9
  74. data/lib/lono/command.rb +0 -1
  75. data/lib/lono/component.rb +29 -0
  76. data/lib/lono/concerns/aws_info.rb +14 -0
  77. data/lib/lono/concerns/names.rb +9 -0
  78. data/lib/lono/configset.rb +17 -0
  79. data/lib/lono/core.rb +1 -1
  80. data/lib/lono/ext/bundler.rb +7 -0
  81. data/lib/lono/ext/core/module.rb +31 -0
  82. data/lib/lono/ext/core/object.rb +32 -0
  83. data/lib/lono/ext/core/string.rb +9 -0
  84. data/lib/lono/ext.rb +4 -0
  85. data/lib/lono/files/base.rb +12 -0
  86. data/lib/lono/files/builder.rb +37 -0
  87. data/lib/lono/files/compressor.rb +53 -0
  88. data/lib/lono/files/concerns/post_processing.rb +35 -0
  89. data/lib/lono/files/concerns/registration.rb +13 -0
  90. data/lib/lono/files/registry.rb +6 -0
  91. data/lib/lono/files.rb +37 -0
  92. data/lib/lono/importer/base.rb +1 -1
  93. data/lib/lono/inspector/summary.rb +0 -3
  94. data/lib/lono/layering/layer.rb +3 -17
  95. data/lib/lono/logger.rb +1 -3
  96. data/lib/lono/names.rb +1 -1
  97. data/lib/lono/s3/uploader.rb +29 -28
  98. data/lib/lono/seeder.rb +18 -27
  99. data/lib/lono/user_data.rb +3 -1
  100. data/lib/lono/version.rb +1 -1
  101. data/lib/lono/yamler/validator.rb +7 -22
  102. data/lib/lono.rb +8 -0
  103. data/lib/templates/configset/configset.rb +2 -16
  104. data/lib/templates/examples/configset/configset.rb +16 -0
  105. data/lib/templates/helper/%underscore_name%_helper.rb.tt +1 -1
  106. data/lono.gemspec +1 -1
  107. metadata +52 -39
  108. data/lib/lono/app_file/base.rb +0 -28
  109. data/lib/lono/app_file/build/lambda_layer/ruby_packager.rb +0 -153
  110. data/lib/lono/app_file/build/lambda_layer.rb +0 -20
  111. data/lib/lono/app_file/build.rb +0 -79
  112. data/lib/lono/app_file/registry/item.rb +0 -24
  113. data/lib/lono/app_file/registry.rb +0 -16
  114. data/lib/lono/app_file/upload.rb +0 -12
  115. data/lib/lono/builder/context/generic.rb +0 -11
  116. data/lib/lono/builder/context/loaders/load_files.rb +0 -23
  117. data/lib/lono/builder/context/loaders.rb +0 -35
  118. data/lib/lono/builder/context/params.rb +0 -6
  119. data/lib/lono/builder/context/template.rb +0 -4
  120. data/lib/lono/configset/builder.rb +0 -59
  121. data/lib/lono/configset/combiner.rb +0 -164
  122. data/lib/lono/configset/evaluate_file.rb +0 -8
  123. data/lib/lono/configset/meta/dsl.rb +0 -12
  124. data/lib/lono/configset/meta.rb +0 -19
  125. data/lib/lono/configset/s3_file/build.rb +0 -34
  126. data/lib/lono/configset/s3_file/item.rb +0 -38
  127. data/lib/lono/configset/s3_file/registry.rb +0 -12
  128. data/lib/lono/configset/s3_file/upload.rb +0 -12
  129. data/lib/lono/configset/strategy/base.rb +0 -83
  130. data/lib/lono/configset/strategy/helpers/dsl.rb +0 -8
  131. data/lib/lono/configset/strategy/helpers/erb.rb +0 -9
  132. data/lib/lono/lookup.rb +0 -12
  133. data/lib/lono/seeder/service_role.rb +0 -11
  134. data/lib/lono/utils/contexts.rb +0 -15
  135. data/lib/lono/utils/item/file_methods.rb +0 -29
  136. data/lib/lono/utils/item/zip.rb +0 -42
data/lib/lono/files.rb ADDED
@@ -0,0 +1,37 @@
1
+ # Class name is Lono::Files because can represent a single file or a directory.
2
+ # Also, it avoids conflicting with the stdlib File class name.
3
+ # Files is like a "FileList". Using shorter Files name.
4
+ module Lono
5
+ class Files < Lono::CLI::Base
6
+ include Concerns::Registration
7
+ include Concerns::PostProcessing
8
+
9
+ attr_reader :path
10
+ def initialize(options={})
11
+ super
12
+ @path = options[:path]
13
+ @caller = options[:caller] # original caller stack at registration time
14
+ end
15
+
16
+ def full_path
17
+ "#{@blueprint.root}/#{@path}"
18
+ end
19
+
20
+ class << self
21
+ def register(options={})
22
+ path = options[:path]
23
+ file = files.find { |f| f.path == path }
24
+ unless file
25
+ file = Files.new(options.merge(caller: caller))
26
+ files << file
27
+ end
28
+ file.marker
29
+ end
30
+
31
+ delegate :empty?, :files, to: :files
32
+ def files
33
+ Registry.files
34
+ end
35
+ end
36
+ end
37
+ end
@@ -5,7 +5,7 @@ class Lono::Importer
5
5
  include Thor::Base
6
6
 
7
7
  def initialize(options)
8
- reinitialize(options)
8
+ super
9
9
  @source = options[:source]
10
10
  @tmp_path = "/tmp/lono/import/template.yml"
11
11
  self.destination_root = Dir.pwd # Thor::Actions require destination_root to be set
@@ -5,10 +5,7 @@ module Lono::Inspector
5
5
  def perform(template)
6
6
  # little dirty but @template is used in data method so we dont have to pass it to the data method
7
7
  @template = template
8
-
9
8
  logger.info "=> CloudFormation Template Summary for template #{@template.color(:sienna)}:"
10
- return if ENV['LONO_NOOP']
11
-
12
9
  print_parameters_summary
13
10
  logger.info "# Resources:"
14
11
  print_resource_types
@@ -14,10 +14,9 @@ module Lono::Layering
14
14
  include Lono::Layering
15
15
  include Lono::Utils::Logging
16
16
  include Lono::Utils::Pretty
17
+ include Lono::Concerns::AwsInfo
17
18
  extend Memoist
18
19
 
19
- delegate :region, to: :aws_data
20
-
21
20
  def initialize(blueprint, type)
22
21
  @blueprint, @type = blueprint, type
23
22
  end
@@ -81,15 +80,8 @@ module Lono::Layering
81
80
  ext = exts[@type.to_sym]
82
81
 
83
82
  paths.map! do |path|
84
- if path.include?("teams")
85
- puts "path: #{path}"
86
- end
87
-
88
- if path.ends_with?('/')
89
- "#{path.sub(/\/$/,'')}.#{ext}"
90
- else
91
- "#{path}.#{ext}"
92
- end
83
+ path = path.sub(/\/$/,'') if path.ends_with?('/')
84
+ "#{path}.#{ext}"
93
85
  end
94
86
  end
95
87
 
@@ -116,11 +108,5 @@ module Lono::Layering
116
108
  logger.debug ""
117
109
  @@shown_layers[@type] = true
118
110
  end
119
-
120
- private
121
- def aws_data
122
- AwsData.new
123
- end
124
- memoize :aws_data
125
111
  end
126
112
  end
data/lib/lono/logger.rb CHANGED
@@ -17,9 +17,7 @@ module Lono
17
17
  line =~ /\n$/ ? line : "#{line}\n"
18
18
  end
19
19
 
20
- # Used to allow terraform output to always go to stdout
21
- # Terraspace output goes to stderr by default
22
- # See: terraspace/shell.rb
20
+ # Used to allow output to always go to stdout
23
21
  def stdout(msg, newline: true)
24
22
  if newline
25
23
  puts msg
data/lib/lono/names.rb CHANGED
@@ -9,7 +9,7 @@ module Lono
9
9
  end
10
10
 
11
11
  def stack
12
- expansion(Lono.config.names.stack)
12
+ expansion(Lono.config.names.stack) # IE: :APP-:BLUEPRINT-:ENV
13
13
  end
14
14
  memoize :stack
15
15
 
@@ -3,53 +3,46 @@ module Lono::S3
3
3
  extend Memoist
4
4
  include Lono::AwsServices
5
5
  include Lono::Utils::Logging
6
+ include Lono::Utils::Pretty
6
7
 
7
- attr_reader :path
8
- def initialize(path, options={})
9
- @path, @options = path, options
8
+ attr_reader :local_path
9
+ def initialize(local_path, options={})
10
+ @local_path, @options = local_path, options
10
11
  @checksums = {}
11
12
  end
12
13
 
13
14
  # Inputs:
14
15
  #
15
- # path: can be full path or relative path
16
+ # local_path: can be full path or relative path
16
17
  #
17
18
  def upload
18
- path = @path.gsub("#{Lono.root}/",'') # remove Lono.root
19
- key = "#{Lono.env}/#{path}"
19
+ logger.debug "May upload #{local_path}"
20
+ logger.debug "To #{s3_path}"
20
21
 
21
- pretty_path = path.sub(/^\.\//, '')
22
- s3_path = "s3://#{s3_bucket}/#{key}"
23
-
24
- local_checksum = Digest::MD5.hexdigest(IO.read(@path))
25
- remote_checksum = remote_checksum(key)
22
+ local_checksum = Digest::MD5.hexdigest(IO.read(local_path))
26
23
  if local_checksum == remote_checksum
27
- logger.debug "Not modified: #{pretty_path} to #{s3_path}"
24
+ logger.debug "Not modified #{s3_path}"
28
25
  return # do not upload unless the checksum has changed
29
26
  else
30
27
  # Example output:
31
- # Uploaded: app/files/docker.yml to s3://boltops-dev/s3_folder/templates/development/docker.yml
32
- # Uploaded: app/files/ecs/private.yml to s3://boltops-dev/s3_folder/templates/development/ecs/private.yml
33
- message = "Uploading #{pretty_path} to #{s3_path}"
34
- logger.debug message
28
+ # Uploaded: files/ecs/private.yml to s3://bucket/output/demo/files/ecs/private.yml
29
+ logger.debug "Uploading #{pretty_path(local_path)} to #{s3_path}"
35
30
  end
36
31
 
37
32
  s3.put_object(
38
- body: IO.read(@path),
33
+ body: IO.read(local_path),
39
34
  bucket: s3_bucket,
40
- key: key,
35
+ key: s3_key,
41
36
  )
42
37
  end
43
38
 
44
39
  # https://s3.amazonaws.com/mybucket/development/output/blueprint/templates/blueprint.yml
45
40
  def https_url
46
- key = "#{Lono.env}/#{@path}"
47
- "https://s3.amazonaws.com/#{s3_bucket}/#{key}"
41
+ "https://s3.amazonaws.com/#{s3_bucket}/#{s3_key}"
48
42
  end
49
43
 
50
44
  def presigned_url
51
- key = "#{Lono.env}/#{@path}"
52
- s3_presigner.presigned_url(:get_object, bucket: s3_bucket, key: key)
45
+ s3_presigner.presigned_url(:get_object, bucket: s3_bucket, key: s3_key)
53
46
  end
54
47
 
55
48
  # used for file_s3_key helper
@@ -62,7 +55,7 @@ module Lono::S3
62
55
  resp = s3.list_objects(bucket: s3_bucket, prefix: prefix)
63
56
  resp.contents.each do |object|
64
57
  # key does not include the bucket name
65
- # full path = s3://my-bucket/s3_folder/files/production/my-template.yml
58
+ # full path = s3://my-bucket/files/production/my-template.yml
66
59
  # key = s3_folder/files/production/my-template.yml
67
60
  # etag is the checksum as long as the file is not a multi-part file upload
68
61
  # it has extra double quotes wrapped around it.
@@ -74,17 +67,25 @@ module Lono::S3
74
67
  memoize :load_checksums!
75
68
 
76
69
  # key example: cloudformation/production/files/lifecycle-0719ab81.zip
77
- # s3 path: s3://boltops-dev/cloudformation/production/files/lifecycle-0719ab81.zip
78
- # s3_folder: s3://boltops-dev/cloudformation
79
- def remote_checksum(key)
80
- load_checksums!(key)
81
- @checksums[key]
70
+ # s3 path: s3://bucket/cloudformation/production/files/lifecycle-0719ab81.zip
71
+ # s3_folder: s3://bucket/cloudformation
72
+ def remote_checksum
73
+ load_checksums!(s3_key)
74
+ @checksums[s3_key]
82
75
  end
83
76
 
84
77
  def strip_surrounding_quotes(string)
85
78
  string.sub(/^"/,'').sub(/"$/,'')
86
79
  end
87
80
 
81
+ def s3_path
82
+ "s3://#{s3_bucket}/#{s3_key}"
83
+ end
84
+
85
+ def s3_key
86
+ "#{Lono.env}/#{pretty_path(local_path)}"
87
+ end
88
+
88
89
  def s3_bucket
89
90
  Lono::S3::Bucket.name
90
91
  end
data/lib/lono/seeder.rb CHANGED
@@ -5,37 +5,21 @@ require "yaml"
5
5
 
6
6
  module Lono
7
7
  class Seeder < Lono::CLI::Base
8
+ extend Memoist
8
9
  include Lono::AwsServices
9
10
  include Lono::Cfn::Concerns::TemplateOutput
10
- include ServiceRole
11
-
12
- # What's needed for a Thor::Group or "Sequence"
13
- # Gives us Thor::Actions commands like create_file
14
- include Thor::Actions
15
- include Thor::Base
16
- # Override Thor::Base initialize
17
- def initialize(options={})
18
- reinitialize(options)
19
- end
20
-
21
- extend Memoist
22
11
 
23
12
  def run
24
13
  build_template
25
- self.destination_root = Dir.pwd # Thor::Actions require destination_root to be set
26
- create_params
27
- create_variables
14
+ build_params
15
+ build_vars
28
16
  end
29
17
 
30
18
  def build_template
31
19
  Lono::Builder::Template.new(@options).run
32
20
  end
33
21
 
34
- def create_params
35
- create_param_file
36
- end
37
-
38
- def create_param_file
22
+ def build_params
39
23
  if template_output.parameters.empty?
40
24
  logger.info "Template has no parameters."
41
25
  return
@@ -83,11 +67,7 @@ module Lono
83
67
  md[2]
84
68
  end
85
69
 
86
- def self.source_root
87
- Lono.root
88
- end
89
-
90
- def create_variables
70
+ def build_vars
91
71
  src = "#{@blueprint.root}/seed/vars"
92
72
  dest = "#{dest_folder}/vars"
93
73
  directory(src, dest) if File.exist?(src)
@@ -112,8 +92,19 @@ module Lono
112
92
  end
113
93
 
114
94
  private
115
- def env
116
- Lono.env # allows for seed/vars/%env%.rb.tt
95
+ def create_file(dest_path, content) # Thor::Action)
96
+ sequence.create_file(dest_path, content)
97
+ end
98
+
99
+ def directory(src, dest)
100
+ sequence.send(:set_template_paths, src)
101
+ sequence.destination_root = Lono.root
102
+ sequence.directory(".", dest, context: binding) # Thor::Action
103
+ end
104
+
105
+ def sequence
106
+ sequence = Lono::CLI::New::Sequence.new(@options)
117
107
  end
108
+ memoize :sequence
118
109
  end
119
110
  end
@@ -6,6 +6,8 @@ module Lono
6
6
  # Normally, the Lono::Erb#run method generates the CloudFormation template
7
7
  # and embeds user-data script into the template.
8
8
  class UserData < Lono::CLI::Base
9
+ include Lono::Builder::Dsl::Syntax
10
+
9
11
  def initialize(options={})
10
12
  super
11
13
  @name = options[:name]
@@ -16,7 +18,7 @@ module Lono
16
18
  pretty_path = pretty_path(@path)
17
19
  logger.info "Building user_data for '#{@name}' at #{pretty_path}"
18
20
  if File.exist?(@path)
19
- logger.info RenderMePretty.result(@path, context: template_context)
21
+ logger.info RenderMePretty.result(@path, context: self)
20
22
  else
21
23
  logger.info "ERROR: #{pretty_path} does not exist".color(:red)
22
24
  exit 1
data/lib/lono/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "8.0.0-rc2"
2
+ VERSION = "8.0.0-rc3"
3
3
  end
@@ -1,5 +1,8 @@
1
1
  module Lono::Yamler
2
2
  class Validator
3
+ include Lono::Utils::Logging
4
+ include Lono::Utils::Pretty
5
+
3
6
  def initialize(path)
4
7
  @path = path
5
8
  end
@@ -18,34 +21,16 @@ module Lono::Yamler
18
21
  end
19
22
 
20
23
  def handle_yaml_syntax_error(e, path)
21
- io = StringIO.new
22
- io.puts "Invalid yaml. Output written for debugging: #{path}".color(:red)
23
- io.puts "ERROR: #{e.message}".color(:red)
24
+ logger.error "ERROR: Invalid YAML. #{e.message}".color(:red)
25
+ logger.error "Template for debugging: #{pretty_path(path)}"
24
26
 
25
27
  # Grab line info. Example error:
26
28
  # ERROR: (<unknown>): could not find expected ':' while scanning a simple key at line 2 column 1
27
29
  md = e.message.match(/at line (\d+) column (\d+)/)
28
30
  line = md[1].to_i
29
31
 
30
- lines = IO.read(path).split("\n")
31
- context = 5 # lines of context
32
- top, bottom = [line-context-1, 0].max, line+context-1
33
- spacing = lines.size.to_s.size
34
- lines[top..bottom].each_with_index do |line_content, index|
35
- line_number = top+index+1
36
- if line_number == line
37
- io.printf("%#{spacing}d %s\n".color(:red), line_number, line_content)
38
- else
39
- io.printf("%#{spacing}d %s\n", line_number, line_content)
40
- end
41
- end
42
-
43
- if ENV['LONO_TEST']
44
- io.string
45
- else
46
- puts io.string
47
- exit 1
48
- end
32
+ DslEvaluator.print_code(path, line)
33
+ exit 1
49
34
  end
50
35
  end
51
36
  end
data/lib/lono.rb CHANGED
@@ -11,6 +11,7 @@ require 'cli-format'
11
11
  require 'dsl_evaluator'
12
12
  require 'fileutils'
13
13
  require 'json'
14
+ require 'lono/ext'
14
15
  require 'memoist'
15
16
  require 'plissken'
16
17
  require 'rainbow/ext/string'
@@ -27,4 +28,11 @@ module Lono
27
28
  extend Core
28
29
  end
29
30
 
31
+ DslEvaluator.configure do |config|
32
+ config.backtrace.select_pattern = Lono.root.to_s
33
+ config.logger = Lono.logger
34
+ config.on_exception = :exit
35
+ config.root = Lono.root
36
+ end
37
+
30
38
  Lono::Booter.boot
@@ -1,16 +1,2 @@
1
- configset("config1") do
2
- command("test",
3
- command: 'echo "$CFNTEST" > test1.txt',
4
- env: {
5
- CFNTEST: "I come from config1"
6
- }
7
- )
8
- end
9
- configset("config2") do
10
- command("test",
11
- command: 'echo "$CFNTEST" > test2.txt',
12
- env: {
13
- CFNTEST: "I come from config2"
14
- }
15
- )
16
- end
1
+ # This is where you write your configset code
2
+ # Docs: https://lono.cloud/docs/configsets/
@@ -0,0 +1,16 @@
1
+ configset("config1") do
2
+ command("test",
3
+ command: 'echo "$CFNTEST" > test1.txt',
4
+ env: {
5
+ CFNTEST: "I come from config1"
6
+ }
7
+ )
8
+ end
9
+ configset("config2") do
10
+ command("test",
11
+ command: 'echo "$CFNTEST" > test2.txt',
12
+ env: {
13
+ CFNTEST: "I come from config2"
14
+ }
15
+ )
16
+ end
@@ -1,6 +1,6 @@
1
1
  module <%= class_name %>Helper
2
2
  # Your code goes here
3
- # def custom_dsl_method
3
+ # def custom_method
4
4
  # ...
5
5
  # end
6
6
  end
data/lono.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency "cfn-status"
37
37
  spec.add_dependency "cfn_camelizer"
38
38
  spec.add_dependency "cli-format"
39
- spec.add_dependency "dsl_evaluator"
39
+ spec.add_dependency "dsl_evaluator", ">= 0.2.5" # for DslEvaluator.print_code
40
40
  spec.add_dependency "filesize"
41
41
  spec.add_dependency "graph" # lono graph command dependency
42
42
  spec.add_dependency "hashie"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0.pre.rc2
4
+ version: 8.0.0.pre.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-23 00:00:00.000000000 Z
11
+ date: 2022-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - ">="
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: 0.2.5
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
- version: '0'
194
+ version: 0.2.5
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: filesize
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -502,31 +502,45 @@ files:
502
502
  - lib/lono/api/repos.rb
503
503
  - lib/lono/api/verify.rb
504
504
  - lib/lono/app.rb
505
+ - lib/lono/app/callable_option.rb
506
+ - lib/lono/app/callable_option/concern.rb
505
507
  - lib/lono/app/inits.rb
506
- - lib/lono/app_file/base.rb
507
- - lib/lono/app_file/build.rb
508
- - lib/lono/app_file/build/lambda_layer.rb
509
- - lib/lono/app_file/build/lambda_layer/ruby_packager.rb
510
- - lib/lono/app_file/registry.rb
511
- - lib/lono/app_file/registry/item.rb
512
- - lib/lono/app_file/upload.rb
513
508
  - lib/lono/autoloader.rb
514
509
  - lib/lono/aws_services.rb
515
510
  - lib/lono/aws_services/helper.rb
516
511
  - lib/lono/blueprint.rb
517
512
  - lib/lono/booter.rb
518
- - lib/lono/builder/context/generic.rb
519
- - lib/lono/builder/context/loaders.rb
520
- - lib/lono/builder/context/loaders/load_files.rb
521
- - lib/lono/builder/context/params.rb
522
- - lib/lono/builder/context/template.rb
513
+ - lib/lono/builder/allow.rb
514
+ - lib/lono/builder/allow/base.rb
515
+ - lib/lono/builder/allow/env.rb
516
+ - lib/lono/builder/allow/region.rb
517
+ - lib/lono/builder/configset/combiner.rb
518
+ - lib/lono/builder/configset/definition.rb
519
+ - lib/lono/builder/configset/definition/base.rb
520
+ - lib/lono/builder/configset/definition/context.rb
521
+ - lib/lono/builder/configset/definition/dsl.rb
522
+ - lib/lono/builder/configset/definition/dsl/syntax.rb
523
+ - lib/lono/builder/configset/definition/dsl/syntax/auth.rb
524
+ - lib/lono/builder/configset/definition/dsl/syntax/content.rb
525
+ - lib/lono/builder/configset/definition/dsl/syntax/core.rb
526
+ - lib/lono/builder/configset/definition/dsl/syntax/package.rb
527
+ - lib/lono/builder/configset/definition/erb.rb
528
+ - lib/lono/builder/configset/evaluator.rb
529
+ - lib/lono/builder/configset/registration.rb
530
+ - lib/lono/builder/context.rb
523
531
  - lib/lono/builder/dsl.rb
524
532
  - lib/lono/builder/dsl/evaluator.rb
525
533
  - lib/lono/builder/dsl/finalizer.rb
534
+ - lib/lono/builder/dsl/finalizer/base.rb
526
535
  - lib/lono/builder/dsl/finalizer/configsets.rb
536
+ - lib/lono/builder/dsl/finalizer/files.rb
537
+ - lib/lono/builder/dsl/finalizer/files/base.rb
538
+ - lib/lono/builder/dsl/finalizer/files/build.rb
539
+ - lib/lono/builder/dsl/finalizer/files/replace.rb
527
540
  - lib/lono/builder/dsl/finalizer/parameter_groups.rb
528
541
  - lib/lono/builder/dsl/helpers.rb
529
542
  - lib/lono/builder/dsl/helpers/ec2.rb
543
+ - lib/lono/builder/dsl/helpers/files.rb
530
544
  - lib/lono/builder/dsl/helpers/partials.rb
531
545
  - lib/lono/builder/dsl/helpers/s3.rb
532
546
  - lib/lono/builder/dsl/helpers/ssm.rb
@@ -658,6 +672,8 @@ files:
658
672
  - lib/lono/cli/help/completion_script.md
659
673
  - lib/lono/cli/help/configsets.md
660
674
  - lib/lono/cli/help/down.md
675
+ - lib/lono/cli/help/new/helper/blueprint.md
676
+ - lib/lono/cli/help/new/helper/project.md
661
677
  - lib/lono/cli/help/new/project.md
662
678
  - lib/lono/cli/help/param.md
663
679
  - lib/lono/cli/help/param/generate.md
@@ -679,6 +695,8 @@ files:
679
695
  - lib/lono/cli/new/configset.rb
680
696
  - lib/lono/cli/new/extension.rb
681
697
  - lib/lono/cli/new/helper.rb
698
+ - lib/lono/cli/new/helper/blueprint.rb
699
+ - lib/lono/cli/new/helper/project.rb
682
700
  - lib/lono/cli/new/project.rb
683
701
  - lib/lono/cli/new/sequence.rb
684
702
  - lib/lono/cli/new/shim.rb
@@ -692,30 +710,29 @@ files:
692
710
  - lib/lono/cli/script/build.rb
693
711
  - lib/lono/cli/script/upload.rb
694
712
  - lib/lono/cli/seed.rb
713
+ - lib/lono/cli/status.rb
695
714
  - lib/lono/cli/test.rb
696
715
  - lib/lono/command.rb
697
716
  - lib/lono/completer.rb
698
717
  - lib/lono/completer/script.rb
699
718
  - lib/lono/completer/script.sh
700
- - lib/lono/configset/builder.rb
701
- - lib/lono/configset/combiner.rb
702
- - lib/lono/configset/evaluate_file.rb
703
- - lib/lono/configset/meta.rb
704
- - lib/lono/configset/meta/dsl.rb
705
- - lib/lono/configset/s3_file/build.rb
706
- - lib/lono/configset/s3_file/item.rb
707
- - lib/lono/configset/s3_file/registry.rb
708
- - lib/lono/configset/s3_file/upload.rb
709
- - lib/lono/configset/strategy/base.rb
710
- - lib/lono/configset/strategy/dsl.rb
711
- - lib/lono/configset/strategy/erb.rb
712
- - lib/lono/configset/strategy/helpers/dsl.rb
713
- - lib/lono/configset/strategy/helpers/dsl/auth.rb
714
- - lib/lono/configset/strategy/helpers/dsl/core.rb
715
- - lib/lono/configset/strategy/helpers/dsl/package.rb
716
- - lib/lono/configset/strategy/helpers/dsl/syntax.rb
717
- - lib/lono/configset/strategy/helpers/erb.rb
719
+ - lib/lono/component.rb
720
+ - lib/lono/concerns/aws_info.rb
721
+ - lib/lono/concerns/names.rb
722
+ - lib/lono/configset.rb
718
723
  - lib/lono/core.rb
724
+ - lib/lono/ext.rb
725
+ - lib/lono/ext/bundler.rb
726
+ - lib/lono/ext/core/module.rb
727
+ - lib/lono/ext/core/object.rb
728
+ - lib/lono/ext/core/string.rb
729
+ - lib/lono/files.rb
730
+ - lib/lono/files/base.rb
731
+ - lib/lono/files/builder.rb
732
+ - lib/lono/files/compressor.rb
733
+ - lib/lono/files/concerns/post_processing.rb
734
+ - lib/lono/files/concerns/registration.rb
735
+ - lib/lono/files/registry.rb
719
736
  - lib/lono/importer.rb
720
737
  - lib/lono/importer/base.rb
721
738
  - lib/lono/importer/converter.rb
@@ -729,7 +746,6 @@ files:
729
746
  - lib/lono/layering/layer.rb
730
747
  - lib/lono/logger.rb
731
748
  - lib/lono/logger/formatter.rb
732
- - lib/lono/lookup.rb
733
749
  - lib/lono/md5.rb
734
750
  - lib/lono/names.rb
735
751
  - lib/lono/plugin.rb
@@ -744,11 +760,7 @@ files:
744
760
  - lib/lono/script/build.rb
745
761
  - lib/lono/script/upload.rb
746
762
  - lib/lono/seeder.rb
747
- - lib/lono/seeder/service_role.rb
748
763
  - lib/lono/user_data.rb
749
- - lib/lono/utils/contexts.rb
750
- - lib/lono/utils/item/file_methods.rb
751
- - lib/lono/utils/item/zip.rb
752
764
  - lib/lono/utils/logging.rb
753
765
  - lib/lono/utils/pretty.rb
754
766
  - lib/lono/utils/quit.rb
@@ -760,6 +772,7 @@ files:
760
772
  - lib/templates/blueprint/template.rb
761
773
  - lib/templates/configset/configset.rb
762
774
  - lib/templates/examples/blueprint/template.rb
775
+ - lib/templates/examples/configset/configset.rb
763
776
  - lib/templates/extension/lib/%extension_name%.rb.tt
764
777
  - lib/templates/extension/lib/%extension_name%/autoloader.rb.tt
765
778
  - lib/templates/extension/lib/%extension_name%/helpers/mappings.rb.tt
@@ -1,28 +0,0 @@
1
- # Naming AppFile instead of File so we dont to use ::File for normal regular File class
2
- module Lono::AppFile
3
- class Base < Lono::CLI::Base
4
- # What's needed for a Thor::Group or "Sequence". Gives us Thor::Actions commands like create_file
5
- # Must be included before `def initialize` as we override the Thor initialize
6
- include Thor::Actions
7
- include Thor::Base
8
- # Override Thor::Base initialize
9
- def initialize(options={})
10
- reinitialize(options)
11
- initialize_variables
12
- end
13
-
14
- def initialize_variables
15
- end
16
-
17
- private
18
- # Hack Thor to be able to dynamically set the source_paths at runtime instance methods
19
- def override_source_paths(*paths)
20
- # Using string with instance_eval because block doesnt have access to path at runtime.
21
- self.class.instance_eval %{
22
- def self.source_paths
23
- #{paths.flatten.inspect}
24
- end
25
- }
26
- end
27
- end
28
- end