yake 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 117ea613cf7d5a703aba3702eb6ab076fa77490c7e7a901b1e00c22db5c55675
4
- data.tar.gz: 8a9a8efba6b480218c2adf79990f567ed2d5a01756e98f4aa4e1d2ee7a6734fa
3
+ metadata.gz: 66fbefc1075634cd8d1e600c992aef045c440a19715f66296695b3cc0c38d45a
4
+ data.tar.gz: 9d629c68d1ed720382aacefb67608112b404e72488fd6dc4a8b3264cc9b66f56
5
5
  SHA512:
6
- metadata.gz: 9c543d7f07274ba4b6fb707fcd2326dfc33a10e027723d39a78eaf0bf5937209968759b1caa497d1a024911d70d76221da449346da67defd8d0c2ee1a9a8dfad
7
- data.tar.gz: 64f6319d4ad3578aa7920caba1315995b05df6790862bf0256a4b5019cf3e64c64b7861b4eec25acf4a4e729bfb44bc0e68b06863bcf7918a0980c2921a52fc5
6
+ metadata.gz: 10c73224492b43a8ec5bbd23d3514e3e6dcf7cf4a8a7158f1f98d1ec9fc013ac7bc4b87084f71a10140466890d6f4da2be27c6e46a172d8c44cc36b691b9f475
7
+ data.tar.gz: edde64eb9832f62bb4af5730561b314a0daff1b0bed201e1d27cb3a33628ae1922a528fedb2e69444e87d404717e3350dbf1a1b92318ad2da407c303bf9c54a2
data/README.md CHANGED
@@ -26,7 +26,7 @@ require "yake/api"
26
26
 
27
27
  header "content-type" => "application/json"
28
28
 
29
- get "/fizz" do |handler|
29
+ get "/fizz" do
30
30
  respond 200, { ok: true }.to_json
31
31
  end
32
32
 
@@ -59,19 +59,17 @@ Or install it yourself as:
59
59
  gem install yake
60
60
  ```
61
61
 
62
- ## Why Use It?
62
+ ## Why Is It Called "yake"?
63
63
 
64
- So why use `yake` for your Lambda functions?
64
+ "λ" + Rake, but "λ" is hard to type and I think "y" looks like a funny little upside-down-and-backwards Lambda symbol.
65
65
 
66
- #### Zero Dependencies
66
+ ## Why Use It?
67
67
 
68
- `yake` does not depend on any other gems, using the Ruby stdlib only. This helps keep your Lambda packages slim & speedy.
68
+ So why use `yake` for your Lambda functions?
69
69
 
70
70
  #### Event Logging
71
71
 
72
- By default, the `handler` function wraps its block in log lines formatted to match the style of Amazon's native Lambda logs sent to CloudWatch. Each invocation of the handler logs the input event and the returned value prefixed with the ID of the request.
73
-
74
- Example log lines:
72
+ By default, the `handler` function wraps its block in log lines formatted to match the style of Amazon's native Lambda logs sent to CloudWatch. Each invocation of the handler will log both the _input event_ and the _returned value_, prefixed with the ID of the request:
75
73
 
76
74
  ```
77
75
  START RequestId: 149c500f-028a-4b57-8977-0ef568cf8caf Version: $LATEST
@@ -82,9 +80,9 @@ END RequestId: 149c500f-028a-4b57-8977-0ef568cf8caf
82
80
  REPORT RequestId: 149c500f-028a-4b57-8977-0ef568cf8caf Duration: 43.97 ms Billed Duration: 44 ms Memory Size: 128 MB Max Memory Used: 77 MB
83
81
  ```
84
82
 
85
- This makes gathering logs lines for a particular execution in CloudWatch much easier.
83
+ Logging the request ID in this way makes gathering logs lines for a particular execution in CloudWatch much easier.
86
84
 
87
- This feature can be disabled by adding a declaration in your handler:
85
+ This feature can be disabled by adding a declaration in your handler file:
88
86
 
89
87
  ```ruby
90
88
  logging :off
@@ -156,10 +154,14 @@ handler :lambda_handler do |event|
156
154
  rescue Yake::UndeclaredRoute => err
157
155
  respond 404, { message: err.message }.to_json
158
156
  rescue => err
159
- respond 500 { message: err.message }.to_json
157
+ respond 500, { message: err.message }.to_json
160
158
  end
161
159
  ```
162
160
 
161
+ #### Zero Dependencies
162
+
163
+ Finally, `yake` does not depend on any other gems, using the Ruby stdlib only. This helps keep your Lambda packages slim & speedy.
164
+
163
165
  ## Development
164
166
 
165
167
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/lib/yake/dsl.rb CHANGED
@@ -16,11 +16,11 @@ module Yake
16
16
 
17
17
  ##
18
18
  # Turn logging on/off
19
- def logging(switch, **options)
19
+ def logging(switch, logdev = $stdout, **options)
20
20
  if switch == :on
21
- Yake.logger = Yake::Logger.new
21
+ Yake.logger = Yake::Logger.new(logdev)
22
22
  elsif switch == :off
23
- Yake.logger = nil
23
+ Yake.logger = ::Logger.new(nil)
24
24
  else
25
25
  raise Errors::UnknownLoggingSetting, switch
26
26
  end
data/lib/yake/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yake
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Mancevice
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-27 00:00:00.000000000 Z
11
+ date: 2021-04-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: