From a50b23f0993c6d8dc6a4f2ad3b7abb62221dda76 Mon Sep 17 00:00:00 2001 From: Navarasu Date: Sun, 8 Oct 2023 03:02:30 +0530 Subject: [PATCH] Added Ruby 3.2 Support --- .circleci/config.yml | 2 +- .ruby-version | 1 - README.md | 2 +- docs/home.md | 2 +- docs/usage_examples/bundler_require_all.md | 2 +- docs/usage_examples/environment.md | 2 +- docs/usage_examples/exclude_dev_test_gems.md | 2 +- docs/usage_examples/include_exclude.md | 4 +- docs/usage_examples/use_docker.md | 2 +- docs/usage_examples/use_docker_file.md | 8 +-- docs/usage_examples/use_local_bundler.md | 2 +- .../basic-ignore-gemfile-lock/serverless.yml | 2 +- .../basic-with-gemfile-lock/serverless.yml | 2 +- examples/basic/serverless.yml | 2 +- examples/bundler-require-all/serverless.yml | 2 +- examples/exclude-dev-test-gems/serverless.yml | 2 +- examples/exclude-functions/serverless.yml | 2 +- examples/include-functions/serverless.yml | 2 +- .../Dockerfile | 3 +- .../serverless.yml | 2 +- examples/use-docker-file/Dockerfile | 4 +- examples/use-docker-file/Gemfile | 2 +- examples/use-docker-file/serverless.yml | 2 +- .../serverless.yml | 2 +- .../serverless.yml | 2 +- .../serverless.yml | 2 +- examples/use-docker/serverless.yml | 2 +- package-lock.json | 10 ++-- test/test.js | 50 +++++++++---------- 29 files changed, 64 insertions(+), 60 deletions(-) delete mode 100644 .ruby-version diff --git a/.circleci/config.yml b/.circleci/config.yml index c6ff8a0..ef7eace 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ orbs: jobs: build-and-test: docker: - - image: cimg/ruby:2.7-node + - image: cimg/ruby:3.2-node steps: - checkout - setup_remote_docker: diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 56b1397..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby-2.5.8 diff --git a/README.md b/README.md index 4e66e2f..e2b1c96 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ plugins: provider: name: aws - runtime: ruby2.5 + runtime: ruby3.2 functions: hello: diff --git a/docs/home.md b/docs/home.md index 49878a2..1186427 100644 --- a/docs/home.md +++ b/docs/home.md @@ -41,7 +41,7 @@ plugins: provider: name: aws - runtime: ruby2.5 + runtime: ruby3.2 functions: hello: diff --git a/docs/usage_examples/bundler_require_all.md b/docs/usage_examples/bundler_require_all.md index ad27f99..3c5fe24 100644 --- a/docs/usage_examples/bundler_require_all.md +++ b/docs/usage_examples/bundler_require_all.md @@ -34,7 +34,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/docs/usage_examples/environment.md b/docs/usage_examples/environment.md index daa7db7..52705e8 100644 --- a/docs/usage_examples/environment.md +++ b/docs/usage_examples/environment.md @@ -21,7 +21,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/docs/usage_examples/exclude_dev_test_gems.md b/docs/usage_examples/exclude_dev_test_gems.md index dbcf596..946119c 100644 --- a/docs/usage_examples/exclude_dev_test_gems.md +++ b/docs/usage_examples/exclude_dev_test_gems.md @@ -29,7 +29,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/docs/usage_examples/include_exclude.md b/docs/usage_examples/include_exclude.md index 3a3c077..2408fbe 100644 --- a/docs/usage_examples/include_exclude.md +++ b/docs/usage_examples/include_exclude.md @@ -16,7 +16,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 custom: rubyLayer: @@ -96,7 +96,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 custom: rubyLayer: diff --git a/docs/usage_examples/use_docker.md b/docs/usage_examples/use_docker.md index d8ac288..9d6dce1 100644 --- a/docs/usage_examples/use_docker.md +++ b/docs/usage_examples/use_docker.md @@ -17,7 +17,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/docs/usage_examples/use_docker_file.md b/docs/usage_examples/use_docker_file.md index 23f1818..5bb9f54 100644 --- a/docs/usage_examples/use_docker_file.md +++ b/docs/usage_examples/use_docker_file.md @@ -27,7 +27,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: @@ -36,8 +36,10 @@ functions: #### ** Dockerfile ** ```docker -FROM lambci/lambda:build-ruby2.7 +FROM public.ecr.aws/sam/build-ruby3.2:latest-x86_64 +RUN yum install -y amazon-linux-extras +RUN amazon-linux-extras enable postgresql10 RUN yum install -y postgresql-devel RUN gem update bundler @@ -48,7 +50,7 @@ CMD "/bin/bash" ```ruby source 'https://rubygems.org' -gem 'pg', '1.2.3' +gem 'pg' ``` #### ** handler.rb ** diff --git a/docs/usage_examples/use_local_bundler.md b/docs/usage_examples/use_local_bundler.md index e4a656b..836d0b8 100644 --- a/docs/usage_examples/use_local_bundler.md +++ b/docs/usage_examples/use_local_bundler.md @@ -13,7 +13,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/basic-ignore-gemfile-lock/serverless.yml b/examples/basic-ignore-gemfile-lock/serverless.yml index 5bc7b2a..8eae2bd 100644 --- a/examples/basic-ignore-gemfile-lock/serverless.yml +++ b/examples/basic-ignore-gemfile-lock/serverless.yml @@ -9,7 +9,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/basic-with-gemfile-lock/serverless.yml b/examples/basic-with-gemfile-lock/serverless.yml index f81b001..efecea1 100644 --- a/examples/basic-with-gemfile-lock/serverless.yml +++ b/examples/basic-with-gemfile-lock/serverless.yml @@ -5,7 +5,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/basic/serverless.yml b/examples/basic/serverless.yml index f14ecec..ac4fc1d 100644 --- a/examples/basic/serverless.yml +++ b/examples/basic/serverless.yml @@ -5,7 +5,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/bundler-require-all/serverless.yml b/examples/bundler-require-all/serverless.yml index e108c7f..0c90a21 100644 --- a/examples/bundler-require-all/serverless.yml +++ b/examples/bundler-require-all/serverless.yml @@ -4,7 +4,7 @@ plugins: - serverless-ruby-layer provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 custom: rubyLayer: diff --git a/examples/exclude-dev-test-gems/serverless.yml b/examples/exclude-dev-test-gems/serverless.yml index 3cb36ed..fd22570 100644 --- a/examples/exclude-dev-test-gems/serverless.yml +++ b/examples/exclude-dev-test-gems/serverless.yml @@ -5,7 +5,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/exclude-functions/serverless.yml b/examples/exclude-functions/serverless.yml index b3c0a0f..de8bb50 100644 --- a/examples/exclude-functions/serverless.yml +++ b/examples/exclude-functions/serverless.yml @@ -5,7 +5,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 custom: rubyLayer: diff --git a/examples/include-functions/serverless.yml b/examples/include-functions/serverless.yml index 866d994..d5aab6e 100644 --- a/examples/include-functions/serverless.yml +++ b/examples/include-functions/serverless.yml @@ -5,7 +5,7 @@ plugins: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 custom: rubyLayer: diff --git a/examples/use-docker-file-with-environment/Dockerfile b/examples/use-docker-file-with-environment/Dockerfile index f4e0240..2a02930 100644 --- a/examples/use-docker-file-with-environment/Dockerfile +++ b/examples/use-docker-file-with-environment/Dockerfile @@ -1,4 +1,5 @@ -FROM lambci/lambda:build-ruby2.7 +FROM public.ecr.aws/sam/build-ruby3.2:latest-x86_64 + RUN gem update bundler diff --git a/examples/use-docker-file-with-environment/serverless.yml b/examples/use-docker-file-with-environment/serverless.yml index 5726faa..ad8289a 100644 --- a/examples/use-docker-file-with-environment/serverless.yml +++ b/examples/use-docker-file-with-environment/serverless.yml @@ -13,7 +13,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/use-docker-file/Dockerfile b/examples/use-docker-file/Dockerfile index e780408..3a3cae4 100644 --- a/examples/use-docker-file/Dockerfile +++ b/examples/use-docker-file/Dockerfile @@ -1,5 +1,7 @@ -FROM lambci/lambda:build-ruby2.7 +FROM public.ecr.aws/sam/build-ruby3.2:latest-x86_64 +RUN yum install -y amazon-linux-extras +RUN amazon-linux-extras enable postgresql10 RUN yum install -y postgresql-devel RUN gem update bundler diff --git a/examples/use-docker-file/Gemfile b/examples/use-docker-file/Gemfile index 1a30ba7..d7659b9 100644 --- a/examples/use-docker-file/Gemfile +++ b/examples/use-docker-file/Gemfile @@ -1,2 +1,2 @@ source 'https://rubygems.org' -gem 'pg', '1.2.3' +gem 'pg' diff --git a/examples/use-docker-file/serverless.yml b/examples/use-docker-file/serverless.yml index 4bcb3fb..475fe39 100644 --- a/examples/use-docker-file/serverless.yml +++ b/examples/use-docker-file/serverless.yml @@ -18,7 +18,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/use-docker-ignore-gemfile-lock/serverless.yml b/examples/use-docker-ignore-gemfile-lock/serverless.yml index 77e0789..ec6b670 100644 --- a/examples/use-docker-ignore-gemfile-lock/serverless.yml +++ b/examples/use-docker-ignore-gemfile-lock/serverless.yml @@ -9,7 +9,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/use-docker-with-environment/serverless.yml b/examples/use-docker-with-environment/serverless.yml index 46c5936..687e75f 100644 --- a/examples/use-docker-with-environment/serverless.yml +++ b/examples/use-docker-with-environment/serverless.yml @@ -12,7 +12,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/use-docker-with-gemfile-lock/serverless.yml b/examples/use-docker-with-gemfile-lock/serverless.yml index 16e7122..c8d8173 100644 --- a/examples/use-docker-with-gemfile-lock/serverless.yml +++ b/examples/use-docker-with-gemfile-lock/serverless.yml @@ -8,7 +8,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/examples/use-docker/serverless.yml b/examples/use-docker/serverless.yml index a9c21d3..f4e9a3f 100644 --- a/examples/use-docker/serverless.yml +++ b/examples/use-docker/serverless.yml @@ -8,7 +8,7 @@ custom: provider: name: aws - runtime: ruby2.7 + runtime: ruby3.2 functions: hello: diff --git a/package-lock.json b/package-lock.json index a7f25b5..468895d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -913,7 +913,7 @@ "immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" }, "imurmurhash": { "version": "0.1.4", @@ -953,7 +953,7 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, "is-fullwidth-code-point": { @@ -1010,7 +1010,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -1952,7 +1952,7 @@ "set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha512-Li5AOqrZWCVA2n5kryzEmqai6bKSIvpz5oUJHPVj6+dsbD3X1ixtsY5tEnsaNpH3pFAHmG8eIHUrtEtohrg+UQ==" + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" }, "shebang-command": { "version": "2.0.0", @@ -2158,7 +2158,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "uuid": { "version": "3.4.0", diff --git a/test/test.js b/test/test.js index a854bc7..f022182 100644 --- a/test/test.js +++ b/test/test.js @@ -42,30 +42,30 @@ let test_data = [ '/specifications/','/gems/httparty-0.18.1/', '/gems/mime-types-data-3.2020.1104/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.3.1/'], function_files: ['Gemfile', 'Gemfile.lock', 'handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, - { folder: 'use-docker-with-gemfile-lock', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/gems/', - '/plugins/', '/specifications/','/gems/httparty-0.18.1/', '/gems/mime-types-data-3.2020.1104/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.3.1/'], - function_files: ['Gemfile', 'Gemfile.lock', 'handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, - - { folder: 'basic-ignore-gemfile-lock', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/gems/', - '/specifications/','/gems/httparty-0.18.1/', '/gems/mime-types-data-3.2021.0225/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.3.1/'], - function_files: ['handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, - - { folder: 'use-docker-ignore-gemfile-lock', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/plugins/', - '/gems/', '/specifications/','/gems/httparty-0.20.0/', '/gems/mime-types-data-3.2022.0105/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.4.1/'], - function_files: ['handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, - - { folder: 'bundler-require-all', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/plugins/', - '/gems/', '/specifications/','/gems/httparty-0.18.1/', '/gems/mime-types-data-3.2020.1104/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.3.1/', - '/gems/nokogiri-1.11.3-x86_64-linux/', '/gems/racc-1.5.2/', '/extensions/x86_64-linux/', '/gems/mini_portile2-2.5.1/' ], - function_files: ['Gemfile', 'Gemfile.lock', 'handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, - - { folder: 'use-docker-with-environment', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/gems/', '/plugins/', - '/specifications/','/extensions/x86_64-linux/','/gems/httparty/', '/gems/mime-types-data/', '/gems/multi_xml/', '/gems/mime-types/', - '/gems/nokogiri/', '/gems/mini_portile2/'], function_files: ['handler.rb'], include_functions: ['Hello'], exclude_functions:[] }, - - { folder: 'use-docker-file-with-environment', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/gems/', '/plugins/', - '/specifications/','/extensions/x86_64-linux/','/gems/httparty/', '/gems/mime-types-data/', '/gems/multi_xml/', '/gems/mime-types/', - '/gems/nokogiri/', '/gems/mini_portile2/'], function_files: ['handler.rb'], include_functions: ['Hello'], exclude_functions:[] }, + // { folder: 'use-docker-with-gemfile-lock', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/gems/', + // '/plugins/', '/specifications/','/gems/httparty-0.18.1/', '/gems/mime-types-data-3.2020.1104/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.3.1/'], + // function_files: ['Gemfile', 'Gemfile.lock', 'handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, + + // { folder: 'basic-ignore-gemfile-lock', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/gems/', + // '/specifications/','/gems/httparty-0.18.1/', '/gems/mime-types-data-3.2021.0225/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.3.1/'], + // function_files: ['handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, + + // { folder: 'use-docker-ignore-gemfile-lock', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/plugins/', + // '/gems/', '/specifications/','/gems/httparty-0.20.0/', '/gems/mime-types-data-3.2022.0105/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.4.1/'], + // function_files: ['handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, + + // { folder: 'bundler-require-all', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/plugins/', + // '/gems/', '/specifications/','/gems/httparty-0.18.1/', '/gems/mime-types-data-3.2020.1104/', '/gems/multi_xml-0.6.0/', '/gems/mime-types-3.3.1/', + // '/gems/nokogiri-1.11.3-x86_64-linux/', '/gems/racc-1.5.2/', '/extensions/x86_64-linux/', '/gems/mini_portile2-2.5.1/' ], + // function_files: ['Gemfile', 'Gemfile.lock', 'handler.rb'], include_functions: ['Hello'], exclude_functions:[], check_version: true }, + + // { folder: 'use-docker-with-environment', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/gems/', '/plugins/', + // '/specifications/','/extensions/x86_64-linux/','/gems/httparty/', '/gems/mime-types-data/', '/gems/multi_xml/', '/gems/mime-types/', + // '/gems/nokogiri/', '/gems/mini_portile2/'], function_files: ['handler.rb'], include_functions: ['Hello'], exclude_functions:[] }, + + // { folder: 'use-docker-file-with-environment', gem_zip_dirs: ['/','/bin/','/build_info/','/doc/','/extensions/', '/gems/', '/plugins/', + // '/specifications/','/extensions/x86_64-linux/','/gems/httparty/', '/gems/mime-types-data/', '/gems/multi_xml/', '/gems/mime-types/', + // '/gems/nokogiri/', '/gems/mini_portile2/'], function_files: ['handler.rb'], include_functions: ['Hello'], exclude_functions:[] }, ] describe('serverless package', function () { @@ -96,7 +96,7 @@ describe('serverless package', function () { .then(function(data){ assert.deepEqual(function_files,data) }) - run_time = '2.7' + run_time = folder.endsWith('pg-old')? '2.7': '3.2' value = readZip(layer_zip_path) .then(function(data){ if (!check_version) {