-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d55de7
commit ff99a6d
Showing
16 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ Currently supports: | |
- Node.js | ||
- Golang | ||
- Python | ||
- Ruby | ||
- Java | ||
- Rust | ||
- Clojure | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
To run the example first setup your [AWS Credentials](http://apex.run/#aws-credentials), and ensure "role" in ./project.json is set to your Lambda function ARN. | ||
|
||
Deploy the functions: | ||
|
||
``` | ||
$ apex deploy | ||
``` | ||
|
||
Try it out: | ||
|
||
``` | ||
$ apex invoke simple < event.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"hello": "world" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source 'https://rubygems.org' | ||
gem 'activesupport' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
The build hook can be used to install required libraries using bundle. You need to install these libraries at function level so that they become part of the zip files. | ||
|
||
The requirements are mentioned in the Gemfile and the build hook is used to install the dependencies before the build | ||
|
||
``` | ||
"hooks":{ | ||
"build": "bundle install && bundle install --deployment" | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"description": "Example with ruby dependency on an external package", | ||
"hooks":{ | ||
"build": "bundle install && bundle install --deployment" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
puts "start dependency function" | ||
|
||
require 'active_support/core_ext/object/blank' | ||
|
||
def handler(event:, context:) | ||
puts "event.blank?: #{event.blank?}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
puts "start simple function" | ||
|
||
def handler(event:, context:) | ||
puts "processing event: #{event}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "ruby", | ||
"description": "Ruby example project", | ||
"role": "arn:aws:iam::293503197324:role/apex_lambda_function" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ var defaultPlugins = []string{ | |
"rust-gnu", | ||
"golang", | ||
"python", | ||
"ruby", | ||
"nodejs", | ||
"java", | ||
"clojure", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Package ruby implements the "ruby" runtime. | ||
package ruby | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/apex/apex/function" | ||
) | ||
|
||
const ( | ||
// Runtime for inference. | ||
Runtime = "ruby2.5" | ||
) | ||
|
||
func init() { | ||
function.RegisterPlugin("ruby", &Plugin{}) | ||
} | ||
|
||
// Plugin implementation. | ||
type Plugin struct{} | ||
|
||
// Open adds ruby defaults. | ||
func (p *Plugin) Open(fn *function.Function) error { | ||
if !strings.HasPrefix(fn.Runtime, "ruby") { | ||
return nil | ||
} | ||
|
||
if fn.Runtime == "ruby" { | ||
fn.Runtime = Runtime | ||
} | ||
|
||
if fn.Handler == "" { | ||
fn.Handler = "lambda.handler" | ||
} | ||
|
||
return nil | ||
} |