jarbs 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jarbs.rb +25 -5
- data/lib/jarbs/config.rb +26 -4
- data/lib/jarbs/github_auth.rb +1 -1
- data/lib/jarbs/lambda.rb +8 -7
- data/lib/jarbs/project_generator.rb +1 -1
- data/lib/jarbs/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: 7e0b7e12ac209ca690fa3878add1fa2dd87fcd4a
|
4
|
+
data.tar.gz: faef4d7bab85db92b5d63c07c2ebf5f7b65420ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 947badeb36fab1e41d7d415c4e08fbd0caf60b13dba5544f116fa7f1be70025cf0fb8bd3f66b18a16f97d1c7f66990eb768f2253bd83d62b1deaaaa4ba75ceaa
|
7
|
+
data.tar.gz: 9e19e63289b56712357b2bd86a45feabe35f4c26a29c0fbfe51808e69a5374b6a82fc64da11e30cec0f68282978df00ceda6347f54a71fd522da945e59707e13
|
data/lib/jarbs.rb
CHANGED
@@ -19,9 +19,9 @@ module Jarbs
|
|
19
19
|
def initialize
|
20
20
|
@config = Config.new
|
21
21
|
|
22
|
-
if @config.get('crashes.report')
|
22
|
+
if @config.get('crashes.report', from_global: true)
|
23
23
|
CrashReporter.configure do |c|
|
24
|
-
c.engines = [CrashReporter::GithubIssues.new('articulate/jarbs', @config.get('github.token'))]
|
24
|
+
c.engines = [CrashReporter::GithubIssues.new('articulate/jarbs', @config.get('github.token', from_global: true))]
|
25
25
|
c.version = Jarbs::VERSION
|
26
26
|
end
|
27
27
|
end
|
@@ -33,10 +33,30 @@ module Jarbs
|
|
33
33
|
|
34
34
|
global_option('-e', '--env [dev]', String, 'Set deployment environment')
|
35
35
|
global_option('-d', '--debug', 'Enable debug mode') { $debug = true }
|
36
|
-
global_option('-p', '--profile
|
36
|
+
global_option('-p', '--profile PROFILE', String, 'AWS credential profile to use') do |profile|
|
37
37
|
@config.set('aws.profile', profile)
|
38
38
|
end
|
39
39
|
|
40
|
+
command :config do |c|
|
41
|
+
c.syntax = 'jarbs config [options]'
|
42
|
+
c.option '-g', '--global', String, "Use global config"
|
43
|
+
c.action do |args, options|
|
44
|
+
method = args.shift
|
45
|
+
|
46
|
+
if method == 'set'
|
47
|
+
args.each do |settings|
|
48
|
+
k, v = settings.split("=")
|
49
|
+
|
50
|
+
@config.set(k, v, from_global: options.global)
|
51
|
+
end
|
52
|
+
elsif method == 'get'
|
53
|
+
@config.get(args.first, from_global: options.global)
|
54
|
+
else
|
55
|
+
@config.print(for_global: options.global)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
40
60
|
command :init do |c|
|
41
61
|
c.syntax = 'jarbs init'
|
42
62
|
c.summary = 'Setup lambda project in an existing directory'
|
@@ -156,7 +176,7 @@ for compatability.
|
|
156
176
|
private
|
157
177
|
|
158
178
|
def profile
|
159
|
-
@config.get('aws.profile')
|
179
|
+
@config.get('aws.profile') || 'default'
|
160
180
|
end
|
161
181
|
|
162
182
|
def global_defaults
|
@@ -178,7 +198,7 @@ for compatability.
|
|
178
198
|
if remove
|
179
199
|
lambda.function.remove!
|
180
200
|
else
|
181
|
-
abort("Function #{lambda.name} exists. Use the -f flag to force overwrite.")
|
201
|
+
abort("Function #{lambda.function.name} exists. Use the -f flag to force overwrite.")
|
182
202
|
end
|
183
203
|
end
|
184
204
|
end
|
data/lib/jarbs/config.rb
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
+
require 'pp'
|
2
|
+
|
1
3
|
module Jarbs
|
2
4
|
class Config
|
3
5
|
FILE_NAME = '.jarbs'
|
6
|
+
GLOBAL_CONFIG = File.join(Dir.home, FILE_NAME)
|
7
|
+
|
8
|
+
def self.touch(for_global: false)
|
9
|
+
path = for_global ? GLOBAL_CONFIG : FILE_NAME
|
10
|
+
File.open(path, 'w') {|f| f.write JSON.pretty_generate({}) }
|
11
|
+
end
|
4
12
|
|
5
|
-
def self.
|
6
|
-
|
13
|
+
def self.global
|
14
|
+
new GLOBAL_CONFIG
|
7
15
|
end
|
8
16
|
|
9
17
|
def initialize(file=FILE_NAME)
|
@@ -11,12 +19,20 @@ module Jarbs
|
|
11
19
|
@config = read
|
12
20
|
end
|
13
21
|
|
14
|
-
def
|
22
|
+
def global
|
23
|
+
@global ||= self.class.global
|
24
|
+
end
|
25
|
+
|
26
|
+
def set(key, value, from_global: false)
|
27
|
+
return global.set(key, value) if from_global
|
28
|
+
|
15
29
|
@config[key] = value
|
16
30
|
finalize
|
17
31
|
end
|
18
32
|
|
19
|
-
def get(key, &block)
|
33
|
+
def get(key, from_global: false, &block)
|
34
|
+
return global.get(key, &block) if from_global
|
35
|
+
|
20
36
|
val = @config[key]
|
21
37
|
|
22
38
|
if !val && block_given?
|
@@ -27,6 +43,12 @@ module Jarbs
|
|
27
43
|
val
|
28
44
|
end
|
29
45
|
|
46
|
+
def print(for_global: false)
|
47
|
+
return global.print if for_global
|
48
|
+
|
49
|
+
pp @config
|
50
|
+
end
|
51
|
+
|
30
52
|
private
|
31
53
|
|
32
54
|
def finalize
|
data/lib/jarbs/github_auth.rb
CHANGED
@@ -13,7 +13,7 @@ module Jarbs
|
|
13
13
|
|
14
14
|
def generate_token(name)
|
15
15
|
resp = @client.create_authorization scopes: ['public_repo'],
|
16
|
-
note: "Jarbs error reporting
|
16
|
+
note: "Jarbs error reporting",
|
17
17
|
headers: { 'X-GitHub-OTP' => ask('GitHub two-factor token: ') }
|
18
18
|
|
19
19
|
@config.set('github.token', resp.token)
|
data/lib/jarbs/lambda.rb
CHANGED
@@ -48,12 +48,12 @@ module Jarbs
|
|
48
48
|
|
49
49
|
capture_errors do
|
50
50
|
@client.create_function function_name: @function.env_name,
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
runtime: 'nodejs',
|
52
|
+
handler: 'index.handler',
|
53
|
+
role: role,
|
54
|
+
memory_size: 128,
|
55
|
+
timeout: 10,
|
56
|
+
code: { zip_file: @package }
|
57
57
|
end
|
58
58
|
|
59
59
|
say_ok "Complete!"
|
@@ -63,7 +63,8 @@ module Jarbs
|
|
63
63
|
say "Updating #{@function.env_name} on Lambda..."
|
64
64
|
|
65
65
|
capture_errors do
|
66
|
-
@client.update_function_code function_name: @function.env_name,
|
66
|
+
@client.update_function_code function_name: @function.env_name,
|
67
|
+
zip_file: @package
|
67
68
|
end
|
68
69
|
|
69
70
|
say_ok "Complete!"
|
data/lib/jarbs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jarbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke van der Hoeven
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|