Module: Lono::Template::Dsl::Builder::Helper
- Extended by:
- Memoist
- Defined in:
- lib/lono/template/dsl/builder/helper.rb
Instance Method Summary collapse
- #content(path) ⇒ Object
- #dimensions(hash, casing: :camelize) ⇒ Object
- #file_s3_key(name, options = {}) ⇒ Object (also: #s3_key)
- #render_file(folder, path) ⇒ Object
- #render_path(path) ⇒ Object
- #s3_bucket ⇒ Object
- #setting ⇒ Object
- #tags(hash, casing: :camelize) ⇒ Object
- #user_data(path) ⇒ Object
Instance Method Details
#content(path) ⇒ Object
31 32 33 |
# File 'lib/lono/template/dsl/builder/helper.rb', line 31 def content(path) render_file(Lono.config.content_path, path) end |
#dimensions(hash, casing: :camelize) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/lono/template/dsl/builder/helper.rb', line 24 def dimensions(hash, casing: :camelize) (hash, casing: casing).map { |h| h[:name] = h.delete(:key) h } end |
#file_s3_key(name, options = {}) ⇒ Object Also known as: s3_key
61 62 63 64 |
# File 'lib/lono/template/dsl/builder/helper.rb', line 61 def file_s3_key(name, ={}) Lono::AppFile::Registry.register(name, @blueprint, ) "file://app/files/#{name}" # placeholder for post processing end |
#render_file(folder, path) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/lono/template/dsl/builder/helper.rb', line 39 def render_file(folder, path) path = "#{folder}/#{path}" if File.exist?(path) render_path(path) else = "WARNING: path #{path} not found" puts .color(:yellow) puts "Called from:" puts caller[2] end end |
#render_path(path) ⇒ Object
53 54 55 |
# File 'lib/lono/template/dsl/builder/helper.rb', line 53 def render_path(path) RenderMePretty.result(path, context: self) end |
#s3_bucket ⇒ Object
57 58 59 |
# File 'lib/lono/template/dsl/builder/helper.rb', line 57 def s3_bucket Lono::S3::Bucket.name end |
#setting ⇒ Object
67 68 69 |
# File 'lib/lono/template/dsl/builder/helper.rb', line 67 def setting Lono::Setting.new end |
#tags(hash, casing: :camelize) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lono/template/dsl/builder/helper.rb', line 6 def (hash, casing: :camelize) hash.map do |k,v| k = k.to_s k = case casing when :camelize CfnCamelizer.camelize(k) when :underscore k.underscore when :dasherize k.dasherize else # leave alone k end {key: k, value: v} end end |