aris-control 3.0.0 → 3.0.1
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 +4 -4
- data/aris-control.gemspec +1 -1
- data/lib/aris-control/bookkeeper.rb +10 -10
- data/lib/aris-control/persistence.rb +16 -16
- data/lib/aris-control/thor.rb +15 -15
- data/lib/aris-control/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d6ea4084e8e8ef5e2231a1703549d83694a1b40
|
4
|
+
data.tar.gz: b5ffad423578b924b83a937364fd17f77e1a0955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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, :
|
5
|
+
attr_reader :persistence, :apps
|
6
6
|
|
7
7
|
def initialize(persistence = default_persistence)
|
8
8
|
@persistence = persistence
|
9
|
-
@
|
9
|
+
@apps = persistence.load_apps
|
10
10
|
end
|
11
11
|
|
12
12
|
def list
|
13
|
-
|
13
|
+
apps
|
14
14
|
end
|
15
15
|
|
16
16
|
def add(name, opts = {})
|
17
|
-
|
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] ||
|
23
|
-
h['ssh_key'] = 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
|
-
|
28
|
-
persistence.
|
27
|
+
apps[name] = app.merge(_opts)
|
28
|
+
persistence.store_apps(apps)
|
29
29
|
end
|
30
30
|
|
31
31
|
def delete(name)
|
32
|
-
|
33
|
-
persistence.
|
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 :
|
6
|
+
attr_reader :apps_file_path
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@
|
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
|
13
|
-
|
14
|
-
IO.binwrite(
|
15
|
-
|
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
|
19
|
-
|
20
|
-
|
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
|
24
|
-
'/opt/aris/config/
|
23
|
+
def default_apps_file_path
|
24
|
+
'/opt/aris/config/apps.yml'
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
def
|
30
|
-
YAML.dump({ '
|
29
|
+
def serialized_apps(apps)
|
30
|
+
YAML.dump({ 'aris_apps' => apps })
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def deserialized_apps(string)
|
34
34
|
yaml = YAML.load(string) || {}
|
35
|
-
yaml['
|
35
|
+
yaml['aris_apps'] || {}
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/aris-control/thor.rb
CHANGED
@@ -2,10 +2,10 @@ require 'thor'
|
|
2
2
|
require 'pp'
|
3
3
|
|
4
4
|
class ArisControl::Thor < Thor
|
5
|
-
desc 'add/update
|
6
|
-
method_option :email, type: :string, desc: 'The
|
7
|
-
method_option :ssh_key, type: :string, desc: 'The
|
8
|
-
method_option :env_vars, type: :hash, desc: 'The
|
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
|
16
|
+
puts "Added/Updated app: #{name}, #{opts}"
|
17
17
|
puts "-----------------------------"
|
18
|
-
|
18
|
+
print_current_aris_apps
|
19
19
|
end
|
20
20
|
|
21
|
-
desc 'delete name', 'Deletes aris
|
21
|
+
desc 'delete name', 'Deletes aris app'
|
22
22
|
def delete(name)
|
23
23
|
bookkeeper.delete(name)
|
24
|
-
puts "Removed
|
24
|
+
puts "Removed app: #{name}"
|
25
25
|
puts "-----------------------------"
|
26
|
-
|
26
|
+
print_current_aris_apps
|
27
27
|
end
|
28
28
|
|
29
|
-
desc 'list', 'Lists current aris-
|
29
|
+
desc 'list', 'Lists current aris-apps'
|
30
30
|
def list
|
31
|
-
|
31
|
+
print_current_aris_apps
|
32
32
|
end
|
33
33
|
|
34
|
-
desc 'rollout', 'Runs ansible to provision the current
|
34
|
+
desc 'rollout', 'Runs ansible to provision the current apps.yml state'
|
35
35
|
def rollout
|
36
36
|
provsioner.rollout
|
37
|
-
|
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
|
48
|
-
puts "Current aris
|
47
|
+
def print_current_aris_apps
|
48
|
+
puts "Current aris app database"
|
49
49
|
puts "-----------------------------"
|
50
50
|
pp bookkeeper.list
|
51
51
|
end
|
data/lib/aris-control/version.rb
CHANGED
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.
|
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-
|
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
|
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:
|