Skip to content

Commit 93f163d

Browse files
committed
Correctly distribute build-gems.sh script
So that its installed with the plugin into node-modules and can be invoked from a serverless project when bundling w/native extensions.
1 parent 58b3f69 commit 93f163d

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
54
# script to build gems within amazon linux lambda containers
65
echo '## INSTALLING PACKAGES ##'
76
yum update -y

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ class PackageRubyBundlePlugin {
128128
const dockerImage = `amazon/aws-lambda-ruby:${imageTag}`;
129129
const command = `docker run --rm \
130130
--volume "${localPath}:/var/task" \
131-
--entrypoint '/var/task/bin/build-gems' \
132-
${dockerImage}`
131+
--entrypoint '/bin/bash' \
132+
${dockerImage} \
133+
'/var/task/node_modules/serverless-ruby-package/build-gems.sh'`
133134

134135
if (this.config.debug){
135136
this.log(`docker image: ${dockerImage}`);

integration-test.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
set -euo pipefail
22

3-
pushd __tests__/demo_service
4-
53
function test_version() {
64
local version="${1}"
75

8-
echo "## BUILD PACKAGE FPOR RUBY ${version}"
6+
echo "## BUILD PACKAGE FOR RUBY ${version}"
97
cp "serverless.${version}.yml" serverless.yml
108
npx serverless package
119
rm serverless.yml
@@ -34,5 +32,18 @@ function test_version() {
3432
rm .serverless/demo.zip
3533
}
3634

35+
echo "## BUILDING PLUGIN PACKAGE"
36+
npm pack
37+
mv serverless-ruby-*.tgz __tests__/demo_service/
38+
39+
echo "## INSTALLING PLUGIN PACKAGE FOR DEMO SERVICE"
40+
pushd __tests__/demo_service
41+
npm install --no-save serverless-ruby-*.tgz
42+
43+
echo "## RUNNING RUBY VERSION TESTS"
3744
test_version "3.2"
3845
test_version "2.7"
46+
47+
echo "## CLEANING UP"
48+
git checkout yarn.lock
49+
rm serverless-ruby-*.tgz

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
},
1010
"author": "Joshua Flanagan",
1111
"license": "MIT",
12+
"files": [
13+
"index.js",
14+
"build-gems.sh"
15+
],
1216
"devDependencies": {
1317
"jest": "^24.5.0",
1418
"serverless": "^3.33.0"

0 commit comments

Comments
 (0)