lambchop 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76a5cba184343fcf1021b5caf9e2be2f4033b176
4
- data.tar.gz: b9eb246ff6422c5217199f031eb7026e17f84cc3
3
+ metadata.gz: 0a06b5d29aea579996f3a040a11a32b5c85663e6
4
+ data.tar.gz: 7244edb14772e6eabefcbe0eb94428b4c4879adc
5
5
  SHA512:
6
- metadata.gz: 9c4f8ad22a1d84c5adb485db55f7eb5658ab943c9dd85d1bf2259af961f05f34499d387a5f3eba057ea14d3bb5f3d17bffec930c63a29c60e2b4e9c73accf450
7
- data.tar.gz: 7cec96ac4a2ceda26f4fb884f136e52a1e2f9b71ef1dd4a00526783b7fd79cbeb3245da369e9d1ec762debae7524a49b329ecccf678d55cc8f7e472754fc9264
6
+ metadata.gz: bb3082e665fc6abbf663bf6c609d2e55253bd093c823e8eb76ccae760b45fc9730fa97797ab4e19bcea1d276ce2eea1db9a701228ebeab06687c32ced8191cc2
7
+ data.tar.gz: 38fdfb9aa45ac677d1dd0a181cb081ad914150e82b42d9f927397e1a43fda1c70f7b958c31a574fa9c02b2cb836b619f45d9ec3c77ec3963972fd60e6a7cae88
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  It is a tool that invoke AWS Lambda function from the local machine as a normally script.
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/lambchop.svg)](http://badge.fury.io/rb/lambchop)
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -51,8 +53,9 @@ $ ./test.js
51
53
  ```sh
52
54
  $ lambchop-cat
53
55
  usage: lambchop-cat <function-name>
56
+
54
57
  $ lambchop-cat
55
- $ echo '{"key1":100, "key2":200, "key3":300}' | bundle exec ./bin/lambchop-cat test
58
+ $ echo '{"key1":100, "key2":200, "key3":300}' | lambchop-cat test
56
59
  ```
57
60
 
58
61
  **Terminal 1**:
@@ -94,6 +97,24 @@ exports.handler = function(event, context) {
94
97
  };
95
98
  ```
96
99
 
100
+ ### Upload only
101
+
102
+ ```javascript
103
+ #!/usr/bin/env lambchop -d
104
+ ...
105
+ ```
106
+
107
+ ### Follow log only
108
+
109
+ ```sh
110
+ ~$ lambchop-tail
111
+ usage: lambchop-tail <function-name>
112
+
113
+ ~$ lambchop-tail test
114
+ START RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
115
+ ...
116
+ ```
117
+
97
118
  ## Demo
98
119
 
99
120
  * https://asciinema.org/a/14158
data/bin/lambchop CHANGED
@@ -2,5 +2,17 @@
2
2
  $: << File.expand_path("#{File.dirname __FILE__}/../lib")
3
3
  require 'rubygems'
4
4
  require 'lambchop'
5
+ require 'optparse'
5
6
 
6
- Lambchop::Client.start(ARGF.read, ARGF.path)
7
+ Version = Lambchop::VERSION
8
+
9
+ options = {}
10
+
11
+ ARGV.options do |opt|
12
+ opt.on('-d', '--detach') { options[:detach] = true }
13
+ opt.parse!
14
+ end
15
+
16
+ open(ARGV[0]) do |f|
17
+ Lambchop::Client.start(f.read, f.path, options)
18
+ end
data/bin/lambchop-tail ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ $: << File.expand_path("#{File.dirname __FILE__}/../lib")
3
+ require 'rubygems'
4
+ require 'lambchop'
5
+
6
+ if ARGV.length != 1
7
+ puts 'usage: lambchop-tail <function-name>'
8
+ exit 1
9
+ end
10
+
11
+ Lambchop::Tail.tail(ARGV[0])
@@ -24,6 +24,8 @@ class Lambchop::Client
24
24
  $stderr.puts('Function was uploaded:')
25
25
  $stderr.puts(JSON.pretty_generate(resp.to_h))
26
26
 
27
+ exit if @options[:detach]
28
+
27
29
  Lambchop::WatchDog.start(function_name, @options[:watch_dog] || {})
28
30
 
29
31
  sleep
@@ -0,0 +1,15 @@
1
+ class Lambchop::Tail
2
+ def self.tail(function_name, options = {})
3
+ self.new(function_name, options).tail
4
+ end
5
+
6
+ def initialize(function_name, options = {})
7
+ @function_name = function_name
8
+ @options = options
9
+ end
10
+
11
+ def tail
12
+ Lambchop::WatchDog.start(@function_name, @options)
13
+ sleep
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Lambchop
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/lambchop.rb CHANGED
@@ -10,5 +10,6 @@ module Lambchop; end
10
10
  require 'lambchop/cat'
11
11
  require 'lambchop/client'
12
12
  require 'lambchop/dump'
13
+ require 'lambchop/tail'
13
14
  require 'lambchop/watch_dog'
14
15
  require 'lambchop/version'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambchop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
@@ -74,6 +74,7 @@ executables:
74
74
  - lambchop
75
75
  - lambchop-cat
76
76
  - lambchop-dump
77
+ - lambchop-tail
77
78
  extensions: []
78
79
  extra_rdoc_files: []
79
80
  files:
@@ -85,11 +86,13 @@ files:
85
86
  - bin/lambchop
86
87
  - bin/lambchop-cat
87
88
  - bin/lambchop-dump
89
+ - bin/lambchop-tail
88
90
  - lambchop.gemspec
89
91
  - lib/lambchop.rb
90
92
  - lib/lambchop/cat.rb
91
93
  - lib/lambchop/client.rb
92
94
  - lib/lambchop/dump.rb
95
+ - lib/lambchop/tail.rb
93
96
  - lib/lambchop/version.rb
94
97
  - lib/lambchop/watch_dog.rb
95
98
  homepage: https://github.com/winebarrel/lambchop