aris-control 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf5a7051810e77cacf1b9d3893bbbba869252172
4
- data.tar.gz: 4e3da98479265243b83078f4fdc61a12474fb560
3
+ metadata.gz: 5d6ea4084e8e8ef5e2231a1703549d83694a1b40
4
+ data.tar.gz: b5ffad423578b924b83a937364fd17f77e1a0955
5
5
  SHA512:
6
- metadata.gz: 0ba27e958f9a875c0491cb24b76011f3cbbacc4de421f766575646762f868ea6f1a4d7a89c981721f7610882cba7fb19a0173f73953e6b691239e85cbf5182b6
7
- data.tar.gz: 9191e7672e45b884f7e2fa6150f2d6a3eaab2e86b2346f256fa03be72ea10f7e9cd56580971538f010d61fc33f293979c6640a6ea4ae3084dd0e876a683083d9
6
+ metadata.gz: 61f44aa24b942529f5761c223ffe46a594584d49f18268a2c255628f94d4cd06dc3eebccb3a022daebbfac2408a4b70ab6c327f629074818beaddda78206ae26
7
+ data.tar.gz: d3b3f2674e04f2b6edde27351e1ce761163b70d6d49701dc1d880b000f7dc8f9daec7c85aea4053da61e537388ecd714b58ed9d886a35225d742dfcd93cf3337
data/aris-control.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["gregory.igelmund@gmail.com"]
11
11
 
12
12
  spec.summary = 'Aris utility'
13
- spec.description = 'Manage aris users from the command line. Add, delete or list them.'
13
+ spec.description = 'Manage aris apps from the command line. Add, delete or list them.'
14
14
  spec.homepage = 'https://github.com/grekko/aris-control'
15
15
  spec.license = 'MIT'
16
16
 
@@ -2,35 +2,35 @@ require_relative 'persistence'
2
2
 
3
3
  module ArisControl
4
4
  class Bookkeeper
5
- attr_reader :persistence, :users
5
+ attr_reader :persistence, :apps
6
6
 
7
7
  def initialize(persistence = default_persistence)
8
8
  @persistence = persistence
9
- @users = persistence.load_users
9
+ @apps = persistence.load_apps
10
10
  end
11
11
 
12
12
  def list
13
- users
13
+ apps
14
14
  end
15
15
 
16
16
  def add(name, opts = {})
17
- user = users[name] || {}
17
+ app = apps[name] || {}
18
18
  ssh_key = opts[:ssh_key]
19
19
  env_vars = opts[:env_vars]
20
20
 
21
21
  _opts = Hash.new.tap do |h|
22
- h['email'] = opts[:email] || user.fetch('email')
23
- h['ssh_key'] = ssh_key || user['ssh_key'] || ''
22
+ h['email'] = opts[:email] || app.fetch('email')
23
+ h['ssh_key'] = ssh_key || app['ssh_key'] || ''
24
24
  h['env_vars'] = with_upcased_keys(env_vars) if env_vars
25
25
  end
26
26
 
27
- users[name] = user.merge(_opts)
28
- persistence.store_users(users)
27
+ apps[name] = app.merge(_opts)
28
+ persistence.store_apps(apps)
29
29
  end
30
30
 
31
31
  def delete(name)
32
- users.delete(name)
33
- persistence.store_users(users)
32
+ apps.delete(name)
33
+ persistence.store_apps(apps)
34
34
  end
35
35
 
36
36
  def default_persistence
@@ -3,36 +3,36 @@ require 'pathname'
3
3
 
4
4
  module ArisControl
5
5
  class Persistence
6
- attr_reader :users_file_path
6
+ attr_reader :apps_file_path
7
7
 
8
- def initialize(users_file_path = default_users_file_path)
9
- @users_file_path = Pathname.new(users_file_path)
8
+ def initialize(apps_file_path = default_apps_file_path)
9
+ @apps_file_path = Pathname.new(apps_file_path)
10
10
  end
11
11
 
12
- def store_users(users)
13
- users ||= {}
14
- IO.binwrite(users_file_path, serialized_users(users))
15
- users
12
+ def store_apps(apps)
13
+ apps ||= {}
14
+ IO.binwrite(apps_file_path, serialized_apps(apps))
15
+ apps
16
16
  end
17
17
 
18
- def load_users
19
- store_users({}) unless users_file_path.exist?
20
- deserialized_users(IO.binread(users_file_path))
18
+ def load_apps
19
+ store_apps({}) unless apps_file_path.exist?
20
+ deserialized_apps(IO.binread(apps_file_path))
21
21
  end
22
22
 
23
- def default_users_file_path
24
- '/opt/aris/config/users.yml'
23
+ def default_apps_file_path
24
+ '/opt/aris/config/apps.yml'
25
25
  end
26
26
 
27
27
  private
28
28
 
29
- def serialized_users(users)
30
- YAML.dump({ 'aris_users' => users })
29
+ def serialized_apps(apps)
30
+ YAML.dump({ 'aris_apps' => apps })
31
31
  end
32
32
 
33
- def deserialized_users(string)
33
+ def deserialized_apps(string)
34
34
  yaml = YAML.load(string) || {}
35
- yaml['aris_users'] || {}
35
+ yaml['aris_apps'] || {}
36
36
  end
37
37
  end
38
38
  end
@@ -2,10 +2,10 @@ require 'thor'
2
2
  require 'pp'
3
3
 
4
4
  class ArisControl::Thor < Thor
5
- desc 'add/update username', 'Adds/Updates an aris user.'
6
- method_option :email, type: :string, desc: 'The users email address. Used for web login.'
7
- method_option :ssh_key, type: :string, desc: 'The users ssh public key. Used for git access via ssh.'
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].'
5
+ desc 'add/update appname', 'Adds/Updates an aris app.'
6
+ method_option :email, type: :string, desc: 'The apps email address. Used for web login.'
7
+ method_option :ssh_key, type: :string, desc: 'The apps ssh public key. Used for git access via ssh.'
8
+ method_option :env_vars, type: :hash, desc: 'The apps app env vars. Env vars will be accessible inside the app via ENV[VAR-NAME].'
9
9
  def add(name)
10
10
  opts = Hash.new.tap do |h|
11
11
  h[:email] = options[:email]
@@ -13,28 +13,28 @@ class ArisControl::Thor < Thor
13
13
  h[:env_vars] = options[:env_vars] if options[:env_vars]
14
14
  end
15
15
  bookkeeper.add(name, **opts)
16
- puts "Added/Updated user: #{name}, #{opts}"
16
+ puts "Added/Updated app: #{name}, #{opts}"
17
17
  puts "-----------------------------"
18
- print_current_aris_users
18
+ print_current_aris_apps
19
19
  end
20
20
 
21
- desc 'delete name', 'Deletes aris user'
21
+ desc 'delete name', 'Deletes aris app'
22
22
  def delete(name)
23
23
  bookkeeper.delete(name)
24
- puts "Removed user: #{name}"
24
+ puts "Removed app: #{name}"
25
25
  puts "-----------------------------"
26
- print_current_aris_users
26
+ print_current_aris_apps
27
27
  end
28
28
 
29
- desc 'list', 'Lists current aris-users'
29
+ desc 'list', 'Lists current aris-apps'
30
30
  def list
31
- print_current_aris_users
31
+ print_current_aris_apps
32
32
  end
33
33
 
34
- desc 'rollout', 'Runs ansible to provision the current users.yml state'
34
+ desc 'rollout', 'Runs ansible to provision the current apps.yml state'
35
35
  def rollout
36
36
  provsioner.rollout
37
- print_current_aris_users
37
+ print_current_aris_apps
38
38
  end
39
39
 
40
40
  desc 'version', 'Prints out aris-control version'
@@ -44,8 +44,8 @@ class ArisControl::Thor < Thor
44
44
 
45
45
  private
46
46
 
47
- def print_current_aris_users
48
- puts "Current aris user database"
47
+ def print_current_aris_apps
48
+ puts "Current aris app database"
49
49
  puts "-----------------------------"
50
50
  pp bookkeeper.list
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module ArisControl
2
- VERSION = '3.0.0'
2
+ VERSION = '3.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aris-control
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Igelmund
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.19'
83
- description: Manage aris users from the command line. Add, delete or list them.
83
+ description: Manage aris apps from the command line. Add, delete or list them.
84
84
  email:
85
85
  - gregory.igelmund@gmail.com
86
86
  executables: