Sha256: 4fab062bea98404e3a67964b585e9b9b23aacd99befba13db625558632d6735b

Contents?: true

Size: 953 Bytes

Versions: 7

Compression:

Stored size: 953 Bytes

Contents

# frozen_string_literal: true

require_relative 'resource'
require_relative '../cli/code_bundler'

# Ruby function
module Bauble
  module Resources
    # a ruby lambda function
    class GemLayer < Resource
      def bundle
        FileUtils.mkdir_p("#{@app.config.gem_layer_asset_dir}/#{@app.gem_layer_hash}")

        Bauble::Cli::CodeBundler.docker_bundle_gems(
          gem_path: ".bauble/assets/gem_layer/#{@app.gem_layer_hash}"
        )
      end

      def synthesize
        {
          'gemLayer' => {
            'type' => 'aws:lambda:LayerVersion',
            'name' => resource_name('gem_layer'),
            'properties' => {
              'code' => {
                'fn::fileArchive' => "#{@app.config.gem_layer_asset_dir}/#{@app.gem_layer_hash}"
              },
              'layerName' => resource_name('gem_layer'),
              'compatibleRuntimes' => %w[ruby3.2]
            }
          }
        }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bauble_core-0.5.3 lib/bauble/resources/gem_layer.rb
bauble_core-0.5.2 lib/bauble/resources/gem_layer.rb
bauble_core-0.5.1 lib/bauble/resources/gem_layer.rb
bauble_core-0.5.0 lib/bauble/resources/gem_layer.rb
bauble_core-0.4.0 lib/bauble/resources/gem_layer.rb
bauble_core-0.3.0 lib/bauble/resources/gem_layer.rb
bauble_core-0.2.0 lib/bauble/resources/gem_layer.rb