lambchop 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/bin/lambchop +24 -2
- data/bin/lambchop-cat +3 -1
- data/bin/lambchop-diff +4 -2
- data/bin/lambchop-tail +4 -1
- data/lib/lambchop/diff.rb +6 -3
- data/lib/lambchop/dump.rb +4 -1
- data/lib/lambchop/utils.rb +12 -0
- data/lib/lambchop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb6e7edb6b8897dfc463c70e4e637d42cbcc1e6d
|
4
|
+
data.tar.gz: 6e4914af3aebb815e215adb75b30858d14eb7826
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb728da0839f37876e7abc7cb855842e6aac748b2b2d4dbd712f0d2ce73787c57bbde2821bc853e13ab5f708ad3e24c52e3c521216237c99c74ec5e27ce0d4c2
|
7
|
+
data.tar.gz: e3e22cfbcda1c72b42896d916f9acdd0e81b91e3e590c41a8277282b4c5b7968f087e6d8bcf83d3159d0ab818e31812d0187bb1fbad8d3c66bc90ff3cc4a1af1
|
data/README.md
CHANGED
@@ -24,6 +24,10 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
**Terminal 1**:
|
26
26
|
```sh
|
27
|
+
$ export AWS_ACCESS_KEY_ID=...
|
28
|
+
$ export AWS_SECRET_ACCESS_KEY=...
|
29
|
+
$ export AWS_REGION=us-east-1
|
30
|
+
|
27
31
|
$ cat test.js
|
28
32
|
#!/usr/bin/env lambchop
|
29
33
|
/*
|
@@ -53,6 +57,10 @@ $ ./test.js
|
|
53
57
|
|
54
58
|
**Terminal 2**:
|
55
59
|
```sh
|
60
|
+
$ export AWS_ACCESS_KEY_ID=...
|
61
|
+
$ export AWS_SECRET_ACCESS_KEY=...
|
62
|
+
$ export AWS_REGION=us-east-1
|
63
|
+
|
56
64
|
$ lambchop-cat
|
57
65
|
usage: lambchop-cat <function-name>
|
58
66
|
|
@@ -62,6 +70,7 @@ $ echo '{"key1":100, "key2":200, "key3":300}' | lambchop-cat test
|
|
62
70
|
|
63
71
|
**Terminal 1**:
|
64
72
|
```sh
|
73
|
+
(Wait event...)
|
65
74
|
2014-11-23T08:06:53.212Z xxxxxxxxxxxxxxxx Loading event
|
66
75
|
START RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
67
76
|
2014-11-23T08:06:53.330Z xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx value1 = 100
|
data/bin/lambchop
CHANGED
@@ -13,6 +13,28 @@ ARGV.options do |opt|
|
|
13
13
|
opt.parse!
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
if ARGV.length < 1
|
17
|
+
puts <<-EOS
|
18
|
+
Please run the lambda script that has the following header:
|
19
|
+
|
20
|
+
#!/usr/bin/env lambchop
|
21
|
+
/*
|
22
|
+
function_name: any_name # default: file name without ext
|
23
|
+
runtime: nodejs # default: nodejs
|
24
|
+
mode: event # default: event
|
25
|
+
description: any_desc # default: (empty)
|
26
|
+
timeout: 3 # default: 3
|
27
|
+
memory_size: 128 # default: 128
|
28
|
+
handler: test.handler # Module name is filename, e.g. index.js -> index.handler
|
29
|
+
role: arn:aws:iam::NNNNNNNNNNNN:role/any_lambda_exec_role
|
30
|
+
*/
|
31
|
+
EOS
|
32
|
+
exit 1
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
Lambchop::Utils.with_error_logging do
|
37
|
+
open(ARGV[0]) do |f|
|
38
|
+
Lambchop::Client.start(f.read, f.path, options)
|
39
|
+
end
|
18
40
|
end
|
data/bin/lambchop-cat
CHANGED
data/bin/lambchop-diff
CHANGED
data/bin/lambchop-tail
CHANGED
data/lib/lambchop/diff.rb
CHANGED
@@ -24,10 +24,13 @@ class Lambchop::Diff
|
|
24
24
|
page = @client.get_function(:function_name => @function_name).first
|
25
25
|
|
26
26
|
Lambchop::Utils.open_source(page.code.location) do |name, func|
|
27
|
-
@out.puts("--- #{@function_name}:#{name}")
|
28
|
-
@out.puts("+++ #{@file.path}")
|
29
27
|
diff = Diffy::Diff.new(func, file, :include_diff_info => true).to_s
|
30
|
-
|
28
|
+
|
29
|
+
unless diff.empty?
|
30
|
+
@out.puts("--- #{@function_name}:#{name}")
|
31
|
+
@out.puts("+++ #{@file.path}")
|
32
|
+
@out.puts(diff.each_line.to_a.slice(2..-1).join)
|
33
|
+
end
|
31
34
|
end
|
32
35
|
end
|
33
36
|
end
|
data/lib/lambchop/dump.rb
CHANGED
@@ -43,7 +43,10 @@ class Lambchop::Dump
|
|
43
43
|
|
44
44
|
def puts_source(location)
|
45
45
|
Lambchop::Utils.open_source(location) do |name, src|
|
46
|
-
|
46
|
+
unless src =~ %r|\A// #{Regexp.escape(name)}\n|
|
47
|
+
@out.puts("// #{name}")
|
48
|
+
end
|
49
|
+
|
47
50
|
@out.puts(src)
|
48
51
|
end
|
49
52
|
end
|
data/lib/lambchop/utils.rb
CHANGED
@@ -30,5 +30,17 @@ class Lambchop::Utils
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
def with_error_logging
|
35
|
+
begin
|
36
|
+
yield
|
37
|
+
rescue => e
|
38
|
+
if ENV['DEBUG'] == '1'
|
39
|
+
raise e
|
40
|
+
else
|
41
|
+
$stdout.puts("[ERROR] #{e.message}")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
33
45
|
end # of class methods
|
34
46
|
end
|
data/lib/lambchop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lambchop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|