jets 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/Gemfile.lock +1 -1
- data/README.md +3 -12
- data/lib/jets.rb +3 -0
- data/lib/jets/builders/code_builder.rb +7 -10
- data/lib/jets/builders/gem_replacer.rb +1 -1
- data/lib/jets/builders/node-shim.js +9 -2
- data/lib/jets/commands/deploy.rb +14 -0
- data/lib/jets/commands/help/build.md +8 -1
- data/lib/jets/commands/help/call.md +15 -9
- data/lib/jets/commands/help/console.md +7 -1
- data/lib/jets/commands/help/db/generate.md +1 -1
- data/lib/jets/commands/help/dbconsole.md +5 -1
- data/lib/jets/commands/help/delete.md +14 -1
- data/lib/jets/commands/help/deploy.md +28 -1
- data/lib/jets/commands/help/dynamodb/generate.md +20 -18
- data/lib/jets/commands/help/generate.md +19 -2
- data/lib/jets/commands/help/new.md +23 -3
- data/lib/jets/commands/help/routes.md +14 -0
- data/lib/jets/commands/help/server.md +10 -1
- data/lib/jets/commands/help/status.md +14 -1
- data/lib/jets/commands/help/url.md +2 -1
- data/lib/jets/commands/main.rb +1 -1
- data/lib/jets/commands/templates/skeleton/public/index.html.tt +16 -3
- data/lib/jets/route.rb +11 -0
- data/lib/jets/router.rb +8 -0
- data/lib/jets/ruby_server.rb +1 -1
- data/lib/jets/version.rb +1 -1
- data/vendor/lambdagem/lib/lambdagem/base.rb +1 -1
- metadata +2 -6
- data/lib/jets/commands/help/process/controller.md +0 -6
- data/lib/jets/commands/help/process/function.md +0 -5
- data/lib/jets/commands/help/process/job.md +0 -5
- data/lib/jets/commands/help/process/rule.md +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05f493298a24d9f81047427851d58c6a2b07d210c1712e92bbe7f75b26d17933
|
4
|
+
data.tar.gz: daaa2abacea4002f91a0d4a9d49085c25618b3d6ce7df00c856a04aa6b13d9f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f11fd73231957fb357babf695267f5bf37b955fa2d9bcc916979412dc07315a37027dbab1f0a252dc5b3f6017f2aaf2216797090420ab5ad414c3e0a441319
|
7
|
+
data.tar.gz: 625f09d4db4790fd7765031932f16f67adc8b116d2e7b07a1972962f6319d46a887b2bcb36dbc7cbe00fafc29b3628913e281b55335c4456ffaacb5096de22ed
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.5.4]
|
7
|
+
- add route check before cloudformation update: pull request #11
|
8
|
+
- hide confusing debugging logs for node shim for user
|
9
|
+
- update docs, grammar fixes
|
10
|
+
- update initial welcome page, improve mobile, use encoding: utf-8 for starter index page
|
11
|
+
- update to use Jets::RUBY_VERSION
|
12
|
+
|
6
13
|
## [0.5.3]
|
7
14
|
- add x-jets-prewarm-count and x-jets-call-count headers: pull request #10 from tongueroo/call-count
|
8
15
|
- adjust default prewarming concurrency to 2
|
@@ -19,7 +26,7 @@ This project *tries* to adhere to [Semantic Versioning](http://semver.org/), eve
|
|
19
26
|
- update docs
|
20
27
|
|
21
28
|
## [0.5.0]
|
22
|
-
- First good release
|
29
|
+
- First big good release
|
23
30
|
|
24
31
|
## [0.1.2]
|
25
32
|
- Fix bundled gems.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Ruby and Lambda splat out a baby and that child's name is Jets.
|
|
9
9
|
|
10
10
|
## What is Jets?
|
11
11
|
|
12
|
-
Jets is a Ruby Serverless Framework. Jets allows you to create serverless applications with a beautiful language: Ruby. It includes everything required to build an application and deploy it to
|
12
|
+
Jets is a Ruby Serverless Framework. Jets allows you to create serverless applications with a beautiful language: Ruby. It includes everything required to build an application and deploy it to AWS Lambda.
|
13
13
|
|
14
14
|
It is key to understand AWS Lambda and API Gateway to understand Jets conceptually. Jets maps your code to Lambda functions and API Gateway resources.
|
15
15
|
|
@@ -123,14 +123,5 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
|
|
123
123
|
* [Prewarming](http://rubyonjets.com/docs/prewarming/)
|
124
124
|
* [Installation](http://rubyonjets.com/docs/install/)
|
125
125
|
* [CLI Reference](http://rubyonjets.com/reference/)
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
I love pull requests! Happy to answer questions to help.
|
130
|
-
|
131
|
-
1. Fork it
|
132
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
133
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
134
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
135
|
-
5. Create new Pull Request
|
136
|
-
|
126
|
+
* [Contributing](http://rubyonjets.com/docs/contributing/)
|
127
|
+
* [Support Jets](http://rubyonjets.com/support-jets/)
|
data/lib/jets.rb
CHANGED
@@ -9,6 +9,9 @@ require "pp" # TODO: remove pp after debugging
|
|
9
9
|
require "memoist"
|
10
10
|
|
11
11
|
module Jets
|
12
|
+
# When we update Jets::RUBY_VERSION, need to update lambdagem/base.rb: def jets_ruby_version also
|
13
|
+
RUBY_VERSION = "2.5.0"
|
14
|
+
|
12
15
|
autoload :CLI, "jets/cli"
|
13
16
|
autoload :Commands, "jets/commands"
|
14
17
|
|
@@ -51,11 +51,8 @@ require "action_view"
|
|
51
51
|
class Jets::Builders
|
52
52
|
class CodeBuilder
|
53
53
|
include Jets::Timing
|
54
|
-
# When we update JETS_RUBY_VERSION, need to update `def jets_ruby_version` in
|
55
|
-
# vendor/lambdagem/lib/lambdagem/base.rb also.
|
56
|
-
JETS_RUBY_VERSION = "2.5.0"
|
57
|
-
|
58
54
|
include ActionView::Helpers::NumberHelper # number_to_human_size
|
55
|
+
|
59
56
|
attr_reader :full_project_path
|
60
57
|
def initialize
|
61
58
|
# Expanding to the full path and capture now.
|
@@ -118,12 +115,12 @@ class Jets::Builders
|
|
118
115
|
|
119
116
|
def extract_ruby
|
120
117
|
headline "Setting up a vendored copy of ruby."
|
121
|
-
Lambdagem::Extract::Ruby.new(
|
118
|
+
Lambdagem::Extract::Ruby.new(Jets::RUBY_VERSION, lambdagem_options).run
|
122
119
|
end
|
123
120
|
|
124
121
|
def extract_gems
|
125
122
|
headline "Replacing compiled gems with AWS Lambda Linux compiled versions."
|
126
|
-
GemReplacer.new(
|
123
|
+
GemReplacer.new(Jets::RUBY_VERSION, lambdagem_options).run
|
127
124
|
end
|
128
125
|
|
129
126
|
# This happens in the current app directory not the tmp app_root for simplicity
|
@@ -222,7 +219,7 @@ class Jets::Builders
|
|
222
219
|
# The lambda server only has ruby 2.5.0 installed.
|
223
220
|
def reconfigure_ruby_version
|
224
221
|
ruby_version = "#{full(tmp_app_root)}/.ruby-version"
|
225
|
-
IO.write(ruby_version,
|
222
|
+
IO.write(ruby_version, Jets::RUBY_VERSION)
|
226
223
|
end
|
227
224
|
|
228
225
|
def copy_bundled_to_app_root
|
@@ -383,8 +380,8 @@ EOL
|
|
383
380
|
def check_ruby_version
|
384
381
|
unless ruby_version_supported?
|
385
382
|
puts "You are using ruby version #{RUBY_VERSION} which is not supported by Jets."
|
386
|
-
ruby_variant =
|
387
|
-
abort("Jets uses ruby #{
|
383
|
+
ruby_variant = Jets::RUBY_VERSION.split('.')[0..1].join('.') + '.x'
|
384
|
+
abort("Jets uses ruby #{Jets::RUBY_VERSION}. You should use a variant of ruby #{ruby_variant}".colorize(:red))
|
388
385
|
end
|
389
386
|
end
|
390
387
|
|
@@ -392,7 +389,7 @@ EOL
|
|
392
389
|
pattern = /(\d+)\.(\d+)\.(\d+)/
|
393
390
|
md = RUBY_VERSION.match(pattern)
|
394
391
|
ruby = {major: md[1], minor: md[2]}
|
395
|
-
md =
|
392
|
+
md = Jets::RUBY_VERSION.match(pattern)
|
396
393
|
jets = {major: md[1], minor: md[2]}
|
397
394
|
|
398
395
|
ruby[:major] == jets[:major] && ruby[:minor] == jets[:minor]
|
@@ -5,6 +5,7 @@ const fs = require('fs');
|
|
5
5
|
const TMP_LOG_PATH = '/tmp/shim-subprocess.log';
|
6
6
|
const subprocess_out = fs.openSync(TMP_LOG_PATH, 'a');
|
7
7
|
const subprocess_err = fs.openSync(TMP_LOG_PATH, 'a');
|
8
|
+
const JETS_DEBUG = process.env.JETS_DEBUG // set JETS_DEBUG=1 to see more debugging info
|
8
9
|
|
9
10
|
function once() {
|
10
11
|
// Uncomment fake run once locally. No need to do this on real lambda environment.
|
@@ -67,8 +68,14 @@ function rubyError(resp) {
|
|
67
68
|
// But locally when we're testing the shim, the log output can mess up piping
|
68
69
|
// to jq. So not logging to stdout because when testing this shim locally the
|
69
70
|
// stdout output messes up a pipe to jq.
|
70
|
-
function log(text) {
|
71
|
-
|
71
|
+
function log(text, level="info") {
|
72
|
+
if (level == "info" && JETS_DEBUG) {
|
73
|
+
// only log if JETS_DEBUG is set
|
74
|
+
console.error(text);
|
75
|
+
} else if (level == "debug") {
|
76
|
+
// always log if "debug" passed into method
|
77
|
+
console.error(text);
|
78
|
+
}
|
72
79
|
}
|
73
80
|
|
74
81
|
////////////////////////////
|
data/lib/jets/commands/deploy.rb
CHANGED
@@ -13,6 +13,8 @@ module Jets::Commands
|
|
13
13
|
return if @options[:noop]
|
14
14
|
|
15
15
|
build_code
|
16
|
+
validate_routes!
|
17
|
+
|
16
18
|
# first time will deploy minimal stack
|
17
19
|
exit_unless_updateable!
|
18
20
|
|
@@ -27,6 +29,18 @@ module Jets::Commands
|
|
27
29
|
end
|
28
30
|
time :build_code
|
29
31
|
|
32
|
+
# Checks that all routes are validate and have corresponding lambda functions
|
33
|
+
def validate_routes!
|
34
|
+
return if Jets::Router.all_routes_valid
|
35
|
+
|
36
|
+
puts "Deploy fail: The jets application contain invalid routes.".colorize(:red)
|
37
|
+
puts "Please double check the routes below map to valid controllers:"
|
38
|
+
Jets::Router.invalid_routes.each do |route|
|
39
|
+
puts " /#{route.path} => #{route.controller_name}##{route.action_name}"
|
40
|
+
end
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
|
30
44
|
def ship(stack_options)
|
31
45
|
options = @options.merge(stack_options) # includes stack_type and s3_bucket
|
32
46
|
Jets::Commands::Build.new(options).build_templates
|
@@ -1 +1,8 @@
|
|
1
|
-
|
1
|
+
Builds a zip file package to be uploaded to AWS Lambda. This allows you to build the project without deploying and inspect the zip file that gets deployed to AWS Lambda. The package contains:
|
2
|
+
|
3
|
+
* your application code
|
4
|
+
* generated node shims
|
5
|
+
* bundled gems
|
6
|
+
* bundled Ruby
|
7
|
+
|
8
|
+
If the application has no ruby code and only uses polymorphic functions, then gems and Ruby is not bundled up.
|
@@ -1,10 +1,16 @@
|
|
1
|
+
## Remote mode
|
2
|
+
|
1
3
|
Invoke the lambda function on AWS. The `jets call` command does a few extra things for your convenience:
|
2
4
|
|
3
5
|
It adds the function namespace to the function name. So, you pass in `posts_controller-index` and the Lambda function is `demo-dev-posts_controller-index`.
|
4
6
|
|
5
|
-
|
7
|
+
CLI Name | Lambda Function
|
8
|
+
--- | ---
|
9
|
+
posts_controller-index | demo-dev-posts_controller-index
|
10
|
+
|
11
|
+
The `jets call` command can also print out the last 4KB of the lambda logs with the `--show-logs` option. The logging output is directed to stderr and the response output from the lambda function itself is directed to stdout so you can safely pipe the results of the call command to other tools like `jq`.
|
6
12
|
|
7
|
-
For controllers, the event you pass at the CLI is automatically transformed into Lambda Proxy payload that contains the params as the queryStringParameters
|
13
|
+
For [controllers](http://rubyonjets.com/docs/controllers/), the event you pass at the CLI is automatically transformed into [Lambda Proxy](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html) payload that contains the params as the `queryStringParameters`. For example:
|
8
14
|
|
9
15
|
{"test":1}
|
10
16
|
|
@@ -12,11 +18,11 @@ Gets changed to:
|
|
12
18
|
|
13
19
|
{"queryStringParameters":{"test":1}}
|
14
20
|
|
15
|
-
This spares you from assembling the event payload manually to the payload that Jets controllers normally
|
21
|
+
This spares you from assembling the event payload manually to the payload that Jets controllers normally receive. If you would like to disable this Lambda Proxy transformation then use the `--no-lambda-proxy` flag.
|
16
22
|
|
17
|
-
For jobs, the event is passed through untouched.
|
23
|
+
For [jobs](http://rubyonjets.com/docs/jobs/), the event is passed through untouched.
|
18
24
|
|
19
|
-
Examples
|
25
|
+
## Examples
|
20
26
|
|
21
27
|
jets call hard_job-drive '{"test":1}'
|
22
28
|
jets call hard_job-drive '{"test":1}' | jq .
|
@@ -33,7 +39,7 @@ The equivalent AWS Lambda CLI command:
|
|
33
39
|
aws lambda invoke --function-name demo-dev-posts_controller-index --payload '{"queryStringParameters":{"test":1}}' outfile.txt
|
34
40
|
cat outfile.txt | jq '.'
|
35
41
|
|
36
|
-
For convenience, you can also provide the function name with only dashes and jets call
|
42
|
+
For convenience, you can also provide the function name with only dashes and `jets call` figures out what function you intend to call. Examples:
|
37
43
|
|
38
44
|
jets call posts-controller-index
|
39
45
|
jets call admin-related-pages-controller-index
|
@@ -43,13 +49,13 @@ Are the same as:
|
|
43
49
|
aws lambda invoke --function-name demo-dev-posts_controller-index
|
44
50
|
aws lambda invoke --function-name demo-dev-admin/related_pages_controller-index
|
45
51
|
|
46
|
-
|
52
|
+
Jets figures out what functions to call by evaluating the app code and finds if the controller and method exists. If you want to turn guess mode off and want to always explicitly provide the method name use the `--no-guess` option. The function name will then have to match the lambda function without the namespace. Example:
|
47
53
|
|
48
54
|
jets call admin-related_pages_controller-index --no-guess
|
49
55
|
|
50
|
-
Local mode
|
56
|
+
## Local mode
|
51
57
|
|
52
|
-
Instead of calling AWS lambda remote, you can also have `jets call` use the code directly on your machine. To enable this use the `--local` flag. Example:
|
58
|
+
Instead of calling AWS lambda remote, you can also have `jets call` use the code directly on your machine. To enable this, use the `--local` flag. Example:
|
53
59
|
|
54
60
|
jets call hard_job-drive --local
|
55
61
|
|
@@ -5,4 +5,4 @@ Generates migration in `db/migrate`
|
|
5
5
|
jets db:generate create_articles title:string user_id:integer
|
6
6
|
jets db:generate AddTitleBodyToPost title:string body:text published:boolean
|
7
7
|
|
8
|
-
This task delegates to Rails `rails generate migration`. For more examples
|
8
|
+
This task delegates to Rails `rails generate migration`. For more examples, refer to the [Active Record Migrations Rails Guide](https://edgeguides.rubyonrails.org/active_record_migrations.html).
|
@@ -1,8 +1,21 @@
|
|
1
|
-
This
|
1
|
+
This deletes the all the contents in the internal s3 bucket that jets uses and the associated CloudFormation stacks.
|
2
2
|
|
3
3
|
## Examples
|
4
4
|
|
5
5
|
$ jets delete
|
6
|
+
Deleting project...
|
7
|
+
Are you sure you want to want to delete the 'demo-dev' project? (y/N)
|
8
|
+
y
|
9
|
+
First, deleting objects in s3 bucket demo-dev-s3bucket-89jrrj60c7bj
|
10
|
+
Deleting demo-dev...
|
11
|
+
05:14:09AM DELETE_IN_PROGRESS AWS::CloudFormation::Stack demo-dev User Initiated
|
12
|
+
...
|
13
|
+
05:14:23AM DELETE_IN_PROGRESS AWS::CloudFormation::Stack PostsController
|
14
|
+
05:15:31AM DELETE_COMPLETE AWS::S3::Bucket S3Bucket
|
15
|
+
Stack demo-dev deleted.
|
16
|
+
Time took for deletion: 1m 27s.
|
17
|
+
Project demo-dev deleted!
|
18
|
+
$
|
6
19
|
|
7
20
|
You can bypass the are you sure prompt with the `--sure` flag.
|
8
21
|
|
@@ -1,5 +1,32 @@
|
|
1
|
-
This
|
1
|
+
This builds the project and deploys it AWS Lambda. The deployment is mainly handled by CloudFormation. To check on the status of the deploy you can also check the CloudFormation console.
|
2
|
+
|
3
|
+
![](http://rubyonjets.com/img/cli/deploy-cloudformation-status.png)
|
2
4
|
|
3
5
|
## Example
|
4
6
|
|
5
7
|
$ jets deploy
|
8
|
+
Deploying to Lambda demo-dev environment...
|
9
|
+
=> Compling assets in current project directory
|
10
|
+
=> Copying current project directory to temporary build area: /tmp/jets/demo/app_root
|
11
|
+
=> Tidying project: removing ignored files to reduce package size.
|
12
|
+
=> Generating node shims in the handlers folder.
|
13
|
+
=> Bundling: running bundle install in cache area: /tmp/jets/demo/cache.
|
14
|
+
=> Setting up a vendored copy of ruby.
|
15
|
+
=> Replacing compiled gems with AWS Lambda Linux compiled versions.
|
16
|
+
Creating zip file.
|
17
|
+
=> cd /tmp/jets/demo/app_root && zip --symlinks -rq /tmp/jets/demo/code/code-temp.zip .
|
18
|
+
Building parent template.
|
19
|
+
Deploying CloudFormation stack with jets app!
|
20
|
+
Uploading /tmp/jets/demo/code/code-7169d0ac.zip (88.8 MB) to S3
|
21
|
+
Time to upload code to s3: 1s
|
22
|
+
Deploying CloudFormation stack with jets app!
|
23
|
+
02:08:20AM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack demo-dev User Initiated
|
24
|
+
02:08:23AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiGateway
|
25
|
+
...
|
26
|
+
02:08:48AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack PostsController
|
27
|
+
02:10:03AM UPDATE_COMPLETE AWS::CloudFormation::Stack demo-dev
|
28
|
+
Stack success status: UPDATE_COMPLETE
|
29
|
+
Time took for stack deployment: 1m 46s.
|
30
|
+
Prewarming application...
|
31
|
+
API Gateway Endpoint: https://ewwnealfk0.execute-api.us-west-2.amazonaws.com/dev/
|
32
|
+
$
|
@@ -1,27 +1,29 @@
|
|
1
|
-
Generates a migration file which can be used to create a DynamoDB table. To run the migration file use `jets
|
1
|
+
Generates a migration file which can be used to create a DynamoDB table. To run the migration file use `jets dynamodb:migrate`.
|
2
2
|
|
3
|
-
The table name will have a namespace. For example,
|
3
|
+
The table name will have a namespace. For example, if your project is called `demo`, the environment is `development`, and you create a table called `posts`. The DynamoDB full table name will be `demo-dev-posts`. You can change this behavior by editing your `config/dynamodb.yml` and adjusting the `table_namespace` value.
|
4
4
|
|
5
|
-
|
5
|
+
DynamoDB tables support certain types of attribute types. The CLI will parse the `--partition-key` option and use the second part of the option to map it to the underlying DynamoDB type using this mapping.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
```ruby
|
8
|
+
ATTRIBUTE_TYPE_MAP = {
|
9
|
+
'string' => 'S',
|
10
|
+
'number' => 'N',
|
11
|
+
'binary' => 'B',
|
12
|
+
's' => 'S',
|
13
|
+
'n' => 'N',
|
14
|
+
'b' => 'B',
|
15
|
+
}
|
16
|
+
```
|
15
17
|
|
16
|
-
For example,
|
18
|
+
For example, `--partition-key id:string` maps 'string' to 's'. More info on DynamoDB types is available at the ruby aws-sdk docs: [Aws::DynamoDB::Types::AttributeDefinition](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Types/AttributeDefinition.html)
|
17
19
|
|
18
|
-
Examples
|
20
|
+
## Examples
|
19
21
|
|
20
22
|
$ jets dynamodb:generate create_posts --partition-key id # default attribute type is string
|
21
23
|
$ jets dynamodb:generate create_posts --partition-key id:number # attribute type will be number
|
22
24
|
$ jets dynamodb:generate create_comments --partition-key post_id:string --sort-key created_at:string
|
23
25
|
|
24
|
-
|
26
|
+
## Running migrations
|
25
27
|
|
26
28
|
$ jets dynamodb:migrate path/to/migration
|
27
29
|
$ jets dynamodb:migrate dynamodb/migrate/20171112162404-create_articles_migration.rb
|
@@ -34,14 +36,14 @@ To run:
|
|
34
36
|
|
35
37
|
$ jets dynamodb:migrate dynamodb/migrate/20171112161530-create_posts_migration.rb
|
36
38
|
|
37
|
-
Conventions
|
39
|
+
## Conventions
|
38
40
|
|
39
|
-
|
41
|
+
A create_table or update_table migration file is generated based name you provide. If `update` is included in the name then an update_table migration table is generated. If `create` is included in the name then a create_table migration table is generated.
|
40
42
|
|
41
43
|
The table_name is also inferred from the migration name you provide. Examples:
|
42
44
|
|
43
|
-
$ jets dynamodb:generate create_posts
|
44
|
-
$ jets dynamodb:generate update_comments
|
45
|
+
$ jets dynamodb:generate create_posts # table_name: posts
|
46
|
+
$ jets dynamodb:generate update_comments # table_name: comments
|
45
47
|
|
46
48
|
You can override both of these conventions:
|
47
49
|
|
@@ -1,5 +1,22 @@
|
|
1
|
-
This piggy backs off of rails
|
1
|
+
This piggy backs off of the [rails scaffold generator](https://guides.rubyonrails.org/command_line.html#rails-generate).
|
2
2
|
|
3
3
|
## Example
|
4
4
|
|
5
|
-
jets generate scaffold Post title:string body:text published:boolean
|
5
|
+
$ jets generate scaffold Post title:string body:text published:boolean
|
6
|
+
invoke active_record
|
7
|
+
create db/migrate/20180817052529_create_posts.rb
|
8
|
+
create app/models/post.rb
|
9
|
+
invoke resource_route
|
10
|
+
route resources :posts
|
11
|
+
invoke scaffold_controller
|
12
|
+
create app/controllers/posts_controller.rb
|
13
|
+
invoke erb
|
14
|
+
create app/views/posts
|
15
|
+
create app/views/posts/index.html.erb
|
16
|
+
create app/views/posts/edit.html.erb
|
17
|
+
create app/views/posts/show.html.erb
|
18
|
+
create app/views/posts/new.html.erb
|
19
|
+
create app/views/posts/_form.html.erb
|
20
|
+
invoke helper
|
21
|
+
create app/helpers/posts_helper.rb
|
22
|
+
$
|
@@ -1,9 +1,29 @@
|
|
1
1
|
## Examples
|
2
2
|
|
3
|
-
$ jets new
|
3
|
+
$ jets new demo
|
4
|
+
Creating new project called demo.
|
5
|
+
create demo/app/controllers/application_controller.rb
|
6
|
+
create demo/app/helpers/application_helper.rb
|
7
|
+
create demo/app/jobs/application_job.rb
|
8
|
+
...
|
9
|
+
================================================================
|
10
|
+
Congrats You have successfully created a Jets project.
|
11
|
+
|
12
|
+
Cd into the project directory:
|
13
|
+
cd demo
|
14
|
+
|
15
|
+
To start a server and test locally:
|
16
|
+
jets server # localhost:8888 should have the Jets welcome page
|
17
|
+
|
18
|
+
Scaffold example:
|
19
|
+
jets generate scaffold Post title:string body:text published:boolean
|
20
|
+
|
21
|
+
To deploy to AWS Lambda:
|
22
|
+
jets deploy
|
23
|
+
$
|
4
24
|
|
5
25
|
Use the `--repo` flag to clone an example project from GitHub instead. With this flag, jets new command clones a jets project repo from GitHub:
|
6
26
|
|
7
27
|
$ jets new blog --repo tongueroo/tutorial
|
8
|
-
$ jets new
|
9
|
-
$ jets new
|
28
|
+
$ jets new todos --repo tongueroo/todos
|
29
|
+
$ jets new whatever --repo user/repo # any github repo
|
@@ -1,3 +1,17 @@
|
|
1
1
|
## Example
|
2
2
|
|
3
3
|
$ jets routes
|
4
|
+
+--------+----------------+--------------------+
|
5
|
+
| Verb | Path | Controller#action |
|
6
|
+
+--------+----------------+--------------------+
|
7
|
+
| GET | posts | posts#index |
|
8
|
+
| GET | posts/new | posts#new |
|
9
|
+
| GET | posts/:id | posts#show |
|
10
|
+
| POST | posts | posts#create |
|
11
|
+
| GET | posts/:id/edit | posts#edit |
|
12
|
+
| PUT | posts/:id | posts#update |
|
13
|
+
| DELETE | posts/:id | posts#delete |
|
14
|
+
| GET | | jets/welcome#index |
|
15
|
+
| ANY | *catchall | jets/public#show |
|
16
|
+
+--------+----------------+--------------------+
|
17
|
+
$
|
@@ -3,4 +3,13 @@ The local server for mimics API Gateway and provides a way to test your app loca
|
|
3
3
|
## Examples
|
4
4
|
|
5
5
|
$ jets server
|
6
|
-
|
6
|
+
=> bundle exec shotgun --port 8888 --host 127.0.0.1
|
7
|
+
Jets booting up in development mode!
|
8
|
+
== Shotgun/WEBrick on http://127.0.0.1:8888/
|
9
|
+
[2018-08-17 05:31:33] INFO WEBrick 1.4.2
|
10
|
+
[2018-08-17 05:31:33] INFO ruby 2.5.1 (2018-03-29) [x86_64-linux]
|
11
|
+
[2018-08-17 05:31:33] INFO WEBrick::HTTPServer#start: pid=27433 port=8888
|
12
|
+
|
13
|
+
Start up server binding to host `0.0.0.0`:
|
14
|
+
|
15
|
+
jets server --host 0.0.0.0
|
@@ -1 +1,14 @@
|
|
1
|
-
Essentially the events of the CloudFormation stack update. If the CloudFormation stack is currently updating, this will tail the events logs.
|
1
|
+
The CloudFormation stack status info. Essentially the events of the CloudFormation stack since the last update. If the CloudFormation stack is currently updating, this will live tail the events logs.
|
2
|
+
|
3
|
+
## Example
|
4
|
+
|
5
|
+
$ jets status
|
6
|
+
The current status for the stack demo-dev is UPDATE_COMPLETE
|
7
|
+
Stack events:
|
8
|
+
05:21:42AM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack demo-dev User Initiated
|
9
|
+
05:21:45AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiGateway
|
10
|
+
...
|
11
|
+
05:23:22AM CREATE_COMPLETE AWS::CloudFormation::Stack JetsPreheatJob
|
12
|
+
05:23:25AM UPDATE_COMPLETE_CLEANUP_IN_PROGRESS AWS::CloudFormation::Stack demo-dev
|
13
|
+
05:23:25AM UPDATE_COMPLETE AWS::CloudFormation::Stack demo-dev
|
14
|
+
$
|
data/lib/jets/commands/main.rb
CHANGED
@@ -84,7 +84,7 @@ module Jets::Commands
|
|
84
84
|
Jets::Generator.invoke(generator, *args)
|
85
85
|
end
|
86
86
|
|
87
|
-
desc "status", "Shows the current status of the Jets app
|
87
|
+
desc "status", "Shows the current status of the Jets app"
|
88
88
|
long_desc Help.text(:status)
|
89
89
|
def status
|
90
90
|
Jets::Cfn::Status.new(options).run
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
<!DOCTYPE html>
|
2
3
|
<html>
|
3
4
|
<head>
|
@@ -32,6 +33,11 @@
|
|
32
33
|
.title {
|
33
34
|
font-size: 1.5em;
|
34
35
|
}
|
36
|
+
@media (max-width: 500px) {
|
37
|
+
.title {
|
38
|
+
font-size: 1.3em;
|
39
|
+
}
|
40
|
+
}
|
35
41
|
.intro {
|
36
42
|
text-align: left;
|
37
43
|
font-size: large;
|
@@ -48,6 +54,12 @@
|
|
48
54
|
width: 99%;
|
49
55
|
overflow: auto;
|
50
56
|
}
|
57
|
+
@media (max-width: 500px) {
|
58
|
+
pre {
|
59
|
+
margin-left: -30px;
|
60
|
+
font-size: 0.8em;
|
61
|
+
}
|
62
|
+
}
|
51
63
|
</style>
|
52
64
|
</head>
|
53
65
|
|
@@ -55,7 +67,7 @@
|
|
55
67
|
<div class="container">
|
56
68
|
<header class="header">
|
57
69
|
<img src="https://s3.amazonaws.com/jets-public/jets/images/jets.png" class="logo" alt="logo" />
|
58
|
-
<h1 class="title">Welcome
|
70
|
+
<h1 class="title">Welcome and congrats 🎉<br /> Jets is running.</h1>
|
59
71
|
</header>
|
60
72
|
<div class="intro">
|
61
73
|
<p>
|
@@ -68,11 +80,12 @@
|
|
68
80
|
$ open http://localhost:8888/posts
|
69
81
|
$ jets help
|
70
82
|
</code></pre></div>
|
71
|
-
<p>More on: <a href="http://rubyonjets.com">rubyonjets.com</a></p>
|
83
|
+
<p>More on info: <a href="http://rubyonjets.com">rubyonjets.com</a></p>
|
84
|
+
<p>Also check out the <a href="http://rubyonjets.com/reference">Jets CLI reference</a>.</p>
|
72
85
|
</div>
|
73
86
|
<p class="version">
|
74
87
|
<strong>Jets version:</strong> <%= Jets.version %><br />
|
75
|
-
<strong>Ruby version:</strong> <%= RUBY_VERSION %>
|
88
|
+
<strong>Ruby version:</strong> <%= Jets::RUBY_VERSION %>
|
76
89
|
</p>
|
77
90
|
</div>
|
78
91
|
</body>
|
data/lib/jets/route.rb
CHANGED
@@ -48,6 +48,17 @@ class Jets::Route
|
|
48
48
|
to.sub(/.*#/,'')
|
49
49
|
end
|
50
50
|
|
51
|
+
# Checks to see if the corresponding controller exists. Useful to validate routes
|
52
|
+
# before deploying to CloudFormation and then rolling back.
|
53
|
+
def valid?
|
54
|
+
controller_class = begin
|
55
|
+
controller_name.constantize
|
56
|
+
rescue NameError
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
controller_class.all_tasks.keys.include?(action_name.to_sym)
|
60
|
+
end
|
61
|
+
|
51
62
|
# Extracts the path parameters from the actual path
|
52
63
|
# Only supports extracting 1 parameter. So:
|
53
64
|
#
|
data/lib/jets/router.rb
CHANGED
data/lib/jets/ruby_server.rb
CHANGED
data/lib/jets/version.rb
CHANGED
@@ -10,7 +10,7 @@ class Lambdagem::Base
|
|
10
10
|
@build_root = options[:build_root] || "/tmp/lambdagem"
|
11
11
|
@artifacts_root = "#{@build_root}/artifacts"
|
12
12
|
@s3_bucket = options[:s3] || 'lambdagems'
|
13
|
-
@lambdagems_url = options[:lambdagems_url] || "https://lambdagems.com"
|
13
|
+
@lambdagems_url = options[:lambdagems_url] || "https://gems.lambdagems.com"
|
14
14
|
end
|
15
15
|
|
16
16
|
# The gems are stored in a ruby version folder that always has a patch version of
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -472,10 +472,6 @@ files:
|
|
472
472
|
- lib/jets/commands/help/dynamodb/migrate.md
|
473
473
|
- lib/jets/commands/help/generate.md
|
474
474
|
- lib/jets/commands/help/new.md
|
475
|
-
- lib/jets/commands/help/process/controller.md
|
476
|
-
- lib/jets/commands/help/process/function.md
|
477
|
-
- lib/jets/commands/help/process/job.md
|
478
|
-
- lib/jets/commands/help/process/rule.md
|
479
475
|
- lib/jets/commands/help/routes.md
|
480
476
|
- lib/jets/commands/help/server.md
|
481
477
|
- lib/jets/commands/help/status.md
|
@@ -1,6 +0,0 @@
|
|
1
|
-
The node shim spawns out to this command.
|
2
|
-
|
3
|
-
## Example
|
4
|
-
|
5
|
-
$ jets process:controller '{"pathParameters":{}}' '{"context":"data"}' "handlers/controllers/posts_controller.index"
|
6
|
-
$ jets process:controller '{"pathParameters":{"id":"tung"}}' '{}' handlers/controllers/posts_controller.show
|