Skip to content

Commit 739251a

Browse files
authored
Merge pull request #16 from navarasu/fix_11_add_docs
Fix 11 Added docs using docsify with examples and improved readme
2 parents 00c68b4 + 1945749 commit 739251a

17 files changed

+598
-1188
lines changed

README.md

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com) [![npm](https://img.shields.io/npm/v/serverless-ruby-layer.svg)](https://www.npmjs.com/package/serverless-ruby-layer) [![Build Status](https://img.shields.io/circleci/build/github/navarasu/serverless-ruby-layer)](https://circleci.com/gh/navarasu/serverless-ruby-layer) [![Coverage Status](https://coveralls.io/repos/github/navarasu/serverless-ruby-layer/badge.svg?branch=master)](https://coveralls.io/github/navarasu/serverless-ruby-layer?branch=master) [![MIT License](https://img.shields.io/npm/l/serverless-ruby-layer)](https://github.com/navarasu/serverless-ruby-layer/blob/master/LICENSE)
44

5-
A Serverless Plugin to bundle ruby gems from Gemfile and deploy it to lambda layer automatically while running `severless deploy`.
5+
A Serverless Plugin to bundle ruby gems from Gemfile and deploy it to the lambda layer automatically while running `serverless deploy`.
66

7-
It auto configures the lamda layer and RUBY_PATH to the all the functions.
7+
It auto-configures the AWS lambda layer and RUBY_PATH to all the functions.
88

99
## Install
1010

@@ -14,11 +14,22 @@ sls plugin install -n serverless-ruby-layer
1414

1515
*This will add the plugin to `package.json` and the plugins section of `serverless.yml`.*
1616

17-
## Simple Usage
17+
## Documentation
18+
19+
Check out the documentation [here](https://navarasu.github.io/serverless-ruby-layer) for,
20+
21+
* [Quick Start](https://navarasu.github.io/serverless-ruby-layer/#/quickstart)
22+
* [Usage and Examples](https://navarasu.github.io/serverless-ruby-layer/#/usage_examples)
23+
* [Configuration](https://navarasu.github.io/serverless-ruby-layer/#/configuration)
24+
* [Release Notes](https://navarasu.github.io/serverless-ruby-layer/#/release_notes)
25+
26+
## Getting Started
27+
28+
### Simple Usage
1829

1930
*`serverless.yml`*
2031

21-
```YML
32+
```yml
2233
service: basic
2334

2435
plugins:
@@ -40,48 +51,39 @@ functions:
4051
gem 'httparty'
4152
```
4253

43-
Running `servleress deploy` automatically deploys the required gems as in Gemfile to AWS lambda layer and make the gems available to the `RUBY_PATH` of the functions `hello.handler`
54+
Running `serverless deploy` automatically deploys the required gems as in Gemfile to AWS lambda layer and make the gems available to the `RUBY_PATH` of the functions `hello.handler`
4455

45-
Refer [here](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/basic) for example.
56+
Refer [example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/basic) amd [docs](https://navarasu.github.io/serverless-ruby-layer) for more details
4657

47-
## Customization
58+
### Customization
4859

49-
### Using docker for gems with OS specific C extentions
60+
The plugin operation can be customized by specifying the `custom` configuration under `rubyLayer`.
5061

51-
*`serverless.yml`*
62+
For example, to use docker environment for packing gem, the below configuration is added to `serverless.yml`
5263

5364
```YML
54-
service: basic
55-
56-
plugins:
57-
- serverless-ruby-layer
58-
5965
custom:
6066
rubyLayer:
6167
use_docker: true
68+
```
6269

63-
provider:
64-
name: aws
65-
runtime: ruby2.5
70+
For more details, refer the docs [here](https://navarasu.github.io/serverless-ruby-layer/#/configuration)
6671

67-
functions:
68-
hello:
69-
handler: handler.hello
70-
```
7172

72-
*`Gemfile`*
73+
## Usage
74+
75+
Using the custom configuration, the plugin can be utilized for below cases,
76+
* Using locallly installed bundler for gems which native extensions - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/basic) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_local_bundler)
77+
* Using Docker for gems with OS native C extensions or system libraries like `http`, `Nokogiri` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_docker)
78+
* Preinstall OS packages (yum packages) for gems which requires OS native system libraries like `pg`, `mysql`, `RMagick` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_with_yums) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_docker_with_yums)
79+
* Using Dockerfile for gems which with other OS Linux image or system libraries and utilities - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_file) - [Docs](https://navarasu.github.io/serverless-ruby-layer/#/use_docker_file)
7380

74-
```ruby
75-
source 'https://rubygems.org'
76-
gem 'http'
77-
gem 'nokogiri'
78-
```
7981

8082
## Contributing
8183

8284
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
8385

84-
Please make sure to update tests as appropriate.
86+
Please make sure to update the tests as appropriate.
8587

8688
## License
8789

docs/README.md

Lines changed: 0 additions & 87 deletions
This file was deleted.

docs/_navbar.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
<!-- - [Home]()
1+
- [Home](/)
22

3-
- [Quick Start](quickstart.md) -->
3+
- [Quick Start](quickstart.md)
4+
- <a class="btn" target="_blank" type="button" href="https://github.com/navarasu/serverless-ruby-layer/">View on GitHub</a>

docs/_sidebar.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
- Getting started
1+
<!-- docs/_sidebar.md -->
22

3-
- [Quick Start](quickstart.md)
3+
* [Quick Start](/quickstart.md)
4+
5+
* [Usage and Examples](usage_examples)
6+
* [Using Local Bundler](use_local_bundler)
7+
* [Using Docker Bundler](use_docker)
8+
* [Docker with Yums installed](use_docker_with_yums)
9+
* [Using Custom Dockerfile](use_docker_file)
10+
* [Configuration](/configuration.md)
11+
* [Release Notes](/release_notes.md)
26.6 KB
Loading

docs/configuration.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Configuration
2+
3+
The plugin operation can be customized by specifying the `custom` configuration under `rubyLayer`.
4+
5+
For example,
6+
7+
```yml
8+
custom:
9+
rubyLayer:
10+
use_docker: true
11+
docker_yums:
12+
- postgresql-devel
13+
native_libs:
14+
- /usr/lib64/libpq.so.5
15+
```
16+
17+
### Configuration Options
18+
19+
20+
| Option | Type | Default | Detail |
21+
| ------------- |-------- |-------------- | --------------------|
22+
| **use_docker** | boolean | false | Set true to use Docker to bundle gems with OS native C extensions or system libraries |
23+
| **docker_yums** | array | undefined | List of yum libraries to be preinstalled for gems which require OS native system libraries |
24+
| **native_libs** | array | undefined | Paths of the native libraries files that need to be packed in lambda layer along with gems |
25+
| **docker_file** | string | undefined | Path of the custom docker file to be used for bundling gems|

docs/home.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<h1><div style="height:75px" class="side-bar-logo">&nbsp;</div></h1>
2+
3+
4+
[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com) [![npm](https://img.shields.io/npm/v/serverless-ruby-layer.svg)](https://www.npmjs.com/package/serverless-ruby-layer) [![Build Status](https://img.shields.io/circleci/build/github/navarasu/serverless-ruby-layer)](https://circleci.com/gh/navarasu/serverless-ruby-layer) [![Coverage Status](https://coveralls.io/repos/github/navarasu/serverless-ruby-layer/badge.svg?branch=master)](https://coveralls.io/github/navarasu/serverless-ruby-layer?branch=master) [![MIT License](https://img.shields.io/npm/l/serverless-ruby-layer)](https://github.com/navarasu/serverless-ruby-layer/blob/master/LICENSE)
5+
6+
A Serverless Plugin to bundle ruby gems from Gemfile and deploy it to the lambda layer automatically while running `serverless deploy`.
7+
8+
It auto-configures the AWS lambda layer and RUBY_PATH to all the functions.
9+
10+
## Install
11+
12+
```
13+
sls plugin install -n serverless-ruby-layer
14+
```
15+
16+
*This will add the plugin to `package.json` and the plugins section of `serverless.yml`.*
17+
18+
## Documentation
19+
20+
Check out the documentation [here](https://navarasu.github.io/serverless-ruby-layer) for,
21+
22+
* [Quick Start](https://navarasu.github.io/serverless-ruby-layer/#/quickstart)
23+
* [Usage and Examples](https://navarasu.github.io/serverless-ruby-layer/#/usage_examples)
24+
* [Configuration](https://navarasu.github.io/serverless-ruby-layer/#/configuration)
25+
* [Release Notes](https://navarasu.github.io/serverless-ruby-layer/#/release_notes)
26+
27+
## Getting Started
28+
29+
### Simple Usage
30+
31+
*`serverless.yml`*
32+
33+
```yml
34+
service: basic
35+
36+
plugins:
37+
- serverless-ruby-layer
38+
39+
provider:
40+
name: aws
41+
runtime: ruby2.5
42+
43+
functions:
44+
hello:
45+
handler: handler.hello
46+
```
47+
48+
*`Gemfile`*
49+
50+
```ruby
51+
source 'https://rubygems.org'
52+
gem 'httparty'
53+
```
54+
55+
Running `serverless deploy` automatically deploys the required gems as in Gemfile to AWS lambda layer and make the gems available to the `RUBY_PATH` of the functions `hello.handler`
56+
57+
Refer [example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/basic) amd [docs](https://navarasu.github.io/serverless-ruby-layer) for more details
58+
59+
### Customization
60+
61+
The plugin operation can be customized by specifying the `custom` configuration under `rubyLayer`.
62+
63+
For example, to use docker environment for packing gem, the below configuration is added to `serverless.yml`
64+
65+
```YML
66+
custom:
67+
rubyLayer:
68+
use_docker: true
69+
```
70+
71+
For more details, refer the docs [here](https://navarasu.github.io/serverless-ruby-layer/configuration)
72+
73+
74+
## Usage
75+
76+
Using the custom configuration, the plugin can be utilized for below cases,
77+
* Using locallly installed bundler for gems which native extensions - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/basic) - [Docs](https://navarasu.github.io/serverless-ruby-layer/use_docker)
78+
* Using Docker for gems with OS native C extensions or system libraries like `http`, `Nokogiri` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker) - [Docs](https://navarasu.github.io/serverless-ruby-layer/use_docker)
79+
* Preinstall OS packages (yum packages) for gems which requires OS native system libraries like `pg`, `mysql`, `RMagick` - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_with_yums) - [Docs](https://navarasu.github.io/serverless-ruby-layer/use_docker_with_yums)
80+
* Using Dockerfile for gems which with other OS Linux image or system libraries and utilities - [Example](https://github.com/navarasu/serverless-ruby-layer/blob/master/examples/use_docker_file) - [Docs](https://navarasu.github.io/serverless-ruby-layer/use_docker_file)
81+
82+
83+
## Contributing
84+
85+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
86+
87+
Please make sure to update the tests as appropriate.
88+
89+
## License
90+
91+
[MIT](https://choosealicense.com/licenses/mit/)

0 commit comments

Comments
 (0)