unidad 0.0.1.beta2 → 0.0.1.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/config/unidad.yml +3 -0
- data/lib/unidad/cli/ansible/base.rb +17 -0
- data/lib/unidad/cli/ansible/galaxy.rb +17 -0
- data/lib/unidad/cli/ansible/playbook.rb +8 -20
- data/lib/unidad/cli/namespaced_group.rb +13 -0
- data/lib/unidad/cli/root.rb +4 -0
- data/lib/unidad/messenger.rb +1 -1
- data/lib/unidad/version.rb +1 -1
- data/lib/util/match_method_macros.rb +3 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08d1f8141269514c7d44d53b5d768e48849a210d
|
4
|
+
data.tar.gz: 52d48d7e06b198cc661c510f732c000922c3ef38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35b482f34d7b6fa81e28124a256d6552c098692a1097eb55d38f38640cf2a0ad4ad5f4f4b03fd2b93e8050a5e56ff9247f54ecbbffab85e330100da61d75c0dd
|
7
|
+
data.tar.gz: faf792535c4603546078ac6841d720635c353f98714c50d296c55ae391d7f563e301d6e56e52c521a1b8438c55d5cc44f88ce0dba753b6f8833583a7a329847d
|
data/.rubocop.yml
CHANGED
data/config/unidad.yml
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Unidad
|
2
|
+
module Cli
|
3
|
+
module Ansible
|
4
|
+
class Base < Unidad::Cli::NamespacedGroup
|
5
|
+
class_option :ansible_path, :default => 'ansible',
|
6
|
+
:type => :string,
|
7
|
+
:desc => 'The relative path to your ansible playbooks. (optional)'
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def ansible_path
|
12
|
+
Unidad.root.join(options[:ansible_path])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Unidad
|
2
|
+
module Cli
|
3
|
+
module Ansible
|
4
|
+
class Galaxy < Unidad::Cli::Ansible::Base
|
5
|
+
argument :requirements_file, :desc => 'The YAML file containing requirements to install',
|
6
|
+
:type => :string,
|
7
|
+
:required => true
|
8
|
+
|
9
|
+
def run_galaxy
|
10
|
+
Unidad::CommandBuilder.all(:galaxy, :requirements_file => ansible_path.join(requirements_file)).each do |command|
|
11
|
+
say_status :run, command
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module Unidad
|
2
2
|
module Cli
|
3
3
|
module Ansible
|
4
|
-
class Playbook <
|
5
|
-
include Thor::Actions
|
6
|
-
|
4
|
+
class Playbook < Unidad::Cli::Ansible::Base
|
7
5
|
argument :hosts_file, :desc => 'The hosts file to use when running the playbook',
|
8
6
|
:type => :string,
|
9
7
|
:required => true
|
@@ -11,24 +9,18 @@ module Unidad
|
|
11
9
|
:type => :string,
|
12
10
|
:required => true
|
13
11
|
|
14
|
-
class_option :ansible_path, :default => 'ansible',
|
15
|
-
:type => :string,
|
16
|
-
:desc => 'The path to your ansible playbooks. (optional, defaults to ./ansible)',
|
17
|
-
:banner => '--ansible_path my_playbooks'
|
18
|
-
|
19
12
|
class_option :vault_password, :type => :string,
|
20
|
-
:desc => 'The Ansible vault password required to run your playbook. (optional)'
|
21
|
-
|
13
|
+
:desc => 'The Ansible vault password required to run your playbook. (optional)'
|
14
|
+
|
22
15
|
def before
|
23
16
|
messenger.on(:before)
|
24
17
|
end
|
25
18
|
|
26
19
|
def ask_for_vault_password
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
20
|
+
return if password_file_exists?
|
21
|
+
vault_password = options.fetch(:vault_password, ask('What is your Ansible vault password?', :echo => false))
|
22
|
+
puts
|
23
|
+
create_file password_file_path, vault_password
|
32
24
|
end
|
33
25
|
|
34
26
|
def run_playbook
|
@@ -57,11 +49,7 @@ module Unidad
|
|
57
49
|
end
|
58
50
|
|
59
51
|
def password_file_exists?
|
60
|
-
File.
|
61
|
-
end
|
62
|
-
|
63
|
-
def ansible_path
|
64
|
-
Unidad.root.join(options[:ansible_path])
|
52
|
+
File.exist?(password_file_path)
|
65
53
|
end
|
66
54
|
|
67
55
|
def command_options
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Unidad
|
2
|
+
module Cli
|
3
|
+
class NamespacedGroup < Thor::Group
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
# The banner for this class. You can customize it if you are invoking the
|
7
|
+
# thor class by another ways which is not the Thor::Runner.
|
8
|
+
def self.banner
|
9
|
+
"#{basename} #{name.split('::').last.downcase} #{arguments.collect(&:usage).compact.join(' ')}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/unidad/cli/root.rb
CHANGED
@@ -4,14 +4,18 @@ require 'thor/group'
|
|
4
4
|
|
5
5
|
Dotenv.load
|
6
6
|
|
7
|
+
require 'unidad/cli/namespaced_group'
|
7
8
|
require 'unidad/cli/deploy'
|
9
|
+
require 'unidad/cli/ansible/base'
|
8
10
|
require 'unidad/cli/ansible/playbook'
|
11
|
+
require 'unidad/cli/ansible/galaxy'
|
9
12
|
|
10
13
|
module Unidad
|
11
14
|
module Cli
|
12
15
|
class Root < Thor
|
13
16
|
register Unidad::Cli::Deploy, 'deploy', 'deploy [ENVIRONMENT]', 'Deploy your application to the specified environment.'
|
14
17
|
register Unidad::Cli::Ansible::Playbook, 'playbook', 'playbook [HOSTS_FILE] [PLAYBOOK]', 'Run an Ansible playbook.'
|
18
|
+
register Unidad::Cli::Ansible::Galaxy, 'galaxy', 'galaxy [REQUIREMENTS_FILE]', 'Install Ansible dependencies via Galaxy.'
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
data/lib/unidad/messenger.rb
CHANGED
data/lib/unidad/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PJ Kelly
|
@@ -215,8 +215,11 @@ files:
|
|
215
215
|
- config/unidad.yml
|
216
216
|
- lib/unidad.rb
|
217
217
|
- lib/unidad/cli.rb
|
218
|
+
- lib/unidad/cli/ansible/base.rb
|
219
|
+
- lib/unidad/cli/ansible/galaxy.rb
|
218
220
|
- lib/unidad/cli/ansible/playbook.rb
|
219
221
|
- lib/unidad/cli/deploy.rb
|
222
|
+
- lib/unidad/cli/namespaced_group.rb
|
220
223
|
- lib/unidad/cli/root.rb
|
221
224
|
- lib/unidad/command_builder.rb
|
222
225
|
- lib/unidad/messenger.rb
|