jarbs 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/lib/jarbs.rb +15 -4
- data/lib/jarbs/github_auth.rb +2 -2
- data/lib/jarbs/lambda.rb +3 -1
- data/lib/jarbs/project_generator.rb +1 -1
- data/lib/jarbs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80c0ed1b1f5fd38489ea989503475ffdd1758219
|
4
|
+
data.tar.gz: bc04c29c3bc74f163189be69feaa9b5ad4e64dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f8059131403aac6efe3b5fc31e45d1a8b7a97886cc649480e4b131d38303d30b26566a2ef3fc8b0b2431b5e1288b5067db59b53712f9bb195ae2c91e84f522
|
7
|
+
data.tar.gz: 4b5b269192663041025ac69be82d7010622404912a6a3dc53e9b154ffc4639aaf8096646bbddcfa3a9cab44fde34d9f570589edae28d523aa642f9c757497b6f
|
data/lib/jarbs.rb
CHANGED
@@ -31,8 +31,11 @@ module Jarbs
|
|
31
31
|
program :version, Jarbs::VERSION
|
32
32
|
program :description, 'Lambda Tooling'
|
33
33
|
|
34
|
-
global_option('-e', '--env
|
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 [default]', String, 'AWS credential profile to use') do |profile|
|
37
|
+
@config.set('aws.profile', profile)
|
38
|
+
end
|
36
39
|
|
37
40
|
command :new do |c|
|
38
41
|
c.syntax = 'jarbs new [options] name'
|
@@ -40,7 +43,7 @@ module Jarbs
|
|
40
43
|
c.option "-f", "--force", "Force overwrite of existing function definition"
|
41
44
|
c.action do |args, options|
|
42
45
|
name = args.shift || abort("Must provide a lambda name")
|
43
|
-
options.default
|
46
|
+
options.default global_defaults
|
44
47
|
|
45
48
|
lambda = Lambda.new(name, options)
|
46
49
|
|
@@ -58,7 +61,7 @@ module Jarbs
|
|
58
61
|
c.option "--role [STRING]", String, "IAM role for Lambda execution"
|
59
62
|
c.action do |args, options|
|
60
63
|
name = args.shift || abort('Name argument required')
|
61
|
-
options.default
|
64
|
+
options.default global_defaults
|
62
65
|
|
63
66
|
lambda = Lambda.new(name, options)
|
64
67
|
|
@@ -73,7 +76,7 @@ module Jarbs
|
|
73
76
|
c.summary = "Delete a lambda function"
|
74
77
|
c.action do |args, options|
|
75
78
|
abort('Name argument required') if args.empty?
|
76
|
-
options.default
|
79
|
+
options.default global_defaults
|
77
80
|
|
78
81
|
begin
|
79
82
|
args.each do |fn|
|
@@ -105,6 +108,14 @@ module Jarbs
|
|
105
108
|
|
106
109
|
private
|
107
110
|
|
111
|
+
def profile
|
112
|
+
@config.get('aws.profile') { 'default' }
|
113
|
+
end
|
114
|
+
|
115
|
+
def global_defaults
|
116
|
+
GLOBAL_DEFAULTS.merge profile: profile
|
117
|
+
end
|
118
|
+
|
108
119
|
def project_exists?(name, remove: false)
|
109
120
|
if Dir.exists? name
|
110
121
|
if remove
|
data/lib/jarbs/github_auth.rb
CHANGED
@@ -11,9 +11,9 @@ module Jarbs
|
|
11
11
|
password: password('Password (not saved): ')
|
12
12
|
end
|
13
13
|
|
14
|
-
def generate_token
|
14
|
+
def generate_token(name)
|
15
15
|
resp = @client.create_authorization scopes: ['public_repo'],
|
16
|
-
note:
|
16
|
+
note: "Jarbs error reporting for #{name}",
|
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
@@ -18,7 +18,9 @@ module Jarbs
|
|
18
18
|
@options = options
|
19
19
|
|
20
20
|
@function = FunctionDefinition.new(name, @options.env)
|
21
|
-
|
21
|
+
|
22
|
+
credentials = Aws::SharedCredentials.new(profile_name: @options.profile)
|
23
|
+
@client = Aws::Lambda::Client.new region: default_region, credentials: credentials
|
22
24
|
end
|
23
25
|
|
24
26
|
def generate
|
data/lib/jarbs/version.rb
CHANGED