From 903543fcc93be3fa65ff091e40da34663c3be175 Mon Sep 17 00:00:00 2001 From: Roman Myers Date: Thu, 26 Sep 2024 14:36:20 -0700 Subject: [PATCH] Initial commit for Ruby layer example --- sample-apps/layer-ruby/function/lambda_function.rb | 8 ++++++++ sample-apps/layer-ruby/layer/1-install.sh | 3 +++ sample-apps/layer-ruby/layer/2-package.sh | 3 +++ sample-apps/layer-ruby/layer/Gemfile | 5 +++++ 4 files changed, 19 insertions(+) create mode 100644 sample-apps/layer-ruby/function/lambda_function.rb create mode 100755 sample-apps/layer-ruby/layer/1-install.sh create mode 100755 sample-apps/layer-ruby/layer/2-package.sh create mode 100644 sample-apps/layer-ruby/layer/Gemfile diff --git a/sample-apps/layer-ruby/function/lambda_function.rb b/sample-apps/layer-ruby/function/lambda_function.rb new file mode 100644 index 00000000..2c6d85d3 --- /dev/null +++ b/sample-apps/layer-ruby/function/lambda_function.rb @@ -0,0 +1,8 @@ +require 'json' +require 'tzinfo' + +def lambda_handler(event:, context:) + tz = TZInfo::Timezone.get('America/New_York') + { statusCode: 200, body: tz.to_local(Time.utc(2018, 2, 1, 12, 30, 0)) } +end + diff --git a/sample-apps/layer-ruby/layer/1-install.sh b/sample-apps/layer-ruby/layer/1-install.sh new file mode 100755 index 00000000..eaf29ac1 --- /dev/null +++ b/sample-apps/layer-ruby/layer/1-install.sh @@ -0,0 +1,3 @@ +bundle config set --local path 'vendor/bundle' +bundle install + diff --git a/sample-apps/layer-ruby/layer/2-package.sh b/sample-apps/layer-ruby/layer/2-package.sh new file mode 100755 index 00000000..305a5b7b --- /dev/null +++ b/sample-apps/layer-ruby/layer/2-package.sh @@ -0,0 +1,3 @@ +mkdir -p ruby/gems/3.3.0 +cp -r vendor/bundle/ruby/3.3.0/* ruby/gems/3.3.0/ +zip -r layer_content.zip ruby diff --git a/sample-apps/layer-ruby/layer/Gemfile b/sample-apps/layer-ruby/layer/Gemfile new file mode 100644 index 00000000..64ad6202 --- /dev/null +++ b/sample-apps/layer-ruby/layer/Gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "tzinfo"