aris-control 1.1.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aris-control/bookkeeper.rb +19 -4
- data/lib/aris-control/thor.rb +3 -3
- data/lib/aris-control/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: d9a61dd46a5d85a26cdaca8ea0e1e06b9cbab795
|
4
|
+
data.tar.gz: 87daf1c8bd1f7b82d0f425fcc911024a61365ba1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a9ce91d47604d931069a34412636284be00818006bafc560338c422457c51cb77000e4e3ba4695183c5cc433685a5e72c0b42a8bfd19f5f0e6106e7270081be
|
7
|
+
data.tar.gz: ccc9c11c12d61d0a36ab97ab86d9cccebd264b69dab282cc051276de57eb269df217612881cc032735a88de248f0176881c9de460b2671476aa543aa30b04152
|
@@ -13,10 +13,18 @@ module ArisControl
|
|
13
13
|
users
|
14
14
|
end
|
15
15
|
|
16
|
-
def add(name
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def add(name, opts = {})
|
17
|
+
user = users[name] || {}
|
18
|
+
ssh_key = opts[:ssh_key]
|
19
|
+
env_vars = opts[:env_vars]
|
20
|
+
|
21
|
+
_opts = Hash.new.tap do |h|
|
22
|
+
h[:email] = opts[:email] || user.fetch(:email)
|
23
|
+
h[:ssh_key] = ssh_key if ssh_key
|
24
|
+
h[:env_vars] = with_upcased_keys(env_vars) if env_vars
|
25
|
+
end
|
26
|
+
|
27
|
+
users[name] = user.merge(_opts)
|
20
28
|
persistence.store_users(users)
|
21
29
|
end
|
22
30
|
|
@@ -28,5 +36,12 @@ module ArisControl
|
|
28
36
|
def default_persistence
|
29
37
|
ArisControl::Persistence.new
|
30
38
|
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def with_upcased_keys(hash)
|
43
|
+
hash or return
|
44
|
+
hash.each_with_object({}) {|(k,v),h| h[k.to_s.upcase] = v }
|
45
|
+
end
|
31
46
|
end
|
32
47
|
end
|
data/lib/aris-control/thor.rb
CHANGED
@@ -3,7 +3,7 @@ require 'pp'
|
|
3
3
|
|
4
4
|
class ArisControl::Thor < Thor
|
5
5
|
desc 'add/update username', 'Adds/Updates an aris user.'
|
6
|
-
method_option :email, type: :string,
|
6
|
+
method_option :email, type: :string, desc: 'The users email address. Used for web login.'
|
7
7
|
method_option :ssh_key, type: :string, desc: 'The users ssh public key. Used for git access via ssh.'
|
8
8
|
method_option :env_vars, type: :hash, desc: 'The users app env vars. Env vars will be accessible inside the app via ENV[VAR-NAME].'
|
9
9
|
def add(name)
|
@@ -12,8 +12,8 @@ class ArisControl::Thor < Thor
|
|
12
12
|
h[:ssh_key] = options[:ssh_key] if options[:ssh_key]
|
13
13
|
h[:env_vars] = options[:env_vars] if options[:env_vars]
|
14
14
|
end
|
15
|
-
bookkeeper.add(name
|
16
|
-
puts "Added/Updated user: #{name}, #{
|
15
|
+
bookkeeper.add(name, **opts)
|
16
|
+
puts "Added/Updated user: #{name}, #{opts}"
|
17
17
|
puts "-----------------------------"
|
18
18
|
print_current_aris_users
|
19
19
|
end
|
data/lib/aris-control/version.rb
CHANGED