ops_team 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/action.rb +6 -0
- data/lib/builtin.rb +6 -0
- data/lib/builtins/down.rb +7 -1
- data/lib/builtins/env.rb +6 -0
- data/lib/builtins/help.rb +42 -0
- data/lib/builtins/init.rb +6 -0
- data/lib/builtins/up.rb +6 -0
- data/lib/builtins/version.rb +7 -1
- data/ops_team.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffbfe47eb5ac6fd8b908604cb1409e4b90f5e03761d6f111b53dfd93ecb2d9fe
|
4
|
+
data.tar.gz: ce01d34fcab6f08a8b07a41cf7cfe99d3ed96c6ac9a3353f48ebbb65d2c03694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd14eed08cc7eb9e38e1bc8c995142b197d27ef8789718a0c8daea0af57f45704c5720fed3e15b7a8f6d0a0021d21e098bd02cd234cfde3ba822804a532bbec5
|
7
|
+
data.tar.gz: 27b74a7306b5577f38b1864be03a13fd3eeababf2447a37f317b0a55c5f59c94d648f957f93b010ce981fbb3b161e1889d1b841509d0cd638e7850d143558939
|
data/lib/action.rb
CHANGED
data/lib/builtin.rb
CHANGED
data/lib/builtins/down.rb
CHANGED
@@ -8,7 +8,13 @@ require 'builtins/helpers/dependency_handler'
|
|
8
8
|
|
9
9
|
module Builtins
|
10
10
|
class Down < Builtin
|
11
|
-
|
11
|
+
class << self
|
12
|
+
def description
|
13
|
+
"Stops dependent services listed in ops.yml"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
12
18
|
# TODO: return a success/failure status to the caller
|
13
19
|
unmeet_dependencies
|
14
20
|
end
|
data/lib/builtins/env.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'colorize'
|
4
|
+
|
5
|
+
require 'builtin'
|
6
|
+
|
7
|
+
module Builtins
|
8
|
+
class Help < Builtin
|
9
|
+
class << self
|
10
|
+
def description
|
11
|
+
"Displays available builtins and actions"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
Output.out("Builtins:")
|
17
|
+
Output.out(" #{builtins.join("\n ")}")
|
18
|
+
Output.out("")
|
19
|
+
Output.out("Actions:")
|
20
|
+
Output.out(" #{actions.join("\n ")}")
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def builtins
|
26
|
+
builtin_class_names.map do |class_name|
|
27
|
+
description = Builtins.const_get(class_name).description
|
28
|
+
format("%<name>-35s %<desc>s", name: class_name.downcase.to_s.yellow, desc: description)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def builtin_class_names
|
33
|
+
Builtins.constants.select { |c| Builtins.const_get(c).is_a? Class }
|
34
|
+
end
|
35
|
+
|
36
|
+
def actions
|
37
|
+
@config["actions"].map do |name, value|
|
38
|
+
format("%<name>-35s %<desc>s", name: name.yellow, desc: value["description"] || value["command"])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/builtins/init.rb
CHANGED
@@ -12,6 +12,12 @@ module Builtins
|
|
12
12
|
OPS_YML_TEMPLATE = File.join(TEMPLATE_DIR, "%<template_name>s.template.yml")
|
13
13
|
DEFAULT_TEMPLATE_NAME = "ops"
|
14
14
|
|
15
|
+
class << self
|
16
|
+
def description
|
17
|
+
"Creates an ops.yml file from a template"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
15
21
|
def run
|
16
22
|
if File.exist?(OPS_YML)
|
17
23
|
Output.error("File '#{OPS_YML} exists; not initializing.")
|
data/lib/builtins/up.rb
CHANGED
@@ -9,6 +9,12 @@ require 'output'
|
|
9
9
|
|
10
10
|
module Builtins
|
11
11
|
class Up < Builtin
|
12
|
+
class << self
|
13
|
+
def description
|
14
|
+
"Attempts to meet dependencies listed in ops.yml"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
12
18
|
def run
|
13
19
|
# TODO: return a success/failure status to the caller
|
14
20
|
meet_dependencies
|
data/lib/builtins/version.rb
CHANGED
@@ -8,7 +8,13 @@ module Builtins
|
|
8
8
|
class Version < Builtin
|
9
9
|
GEMSPEC_FILE = "#{__dir__}/../../ops_team.gemspec"
|
10
10
|
|
11
|
-
|
11
|
+
class << self
|
12
|
+
def description
|
13
|
+
"Prints the version of ops that is running"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
12
18
|
unless gemspec
|
13
19
|
Output.error("Unable to load gemspec at '#{GEMSPEC_FILE}")
|
14
20
|
return false
|
data/ops_team.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ops_team
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nickthecook@gmail.com
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/builtin.rb
|
69
69
|
- lib/builtins/down.rb
|
70
70
|
- lib/builtins/env.rb
|
71
|
+
- lib/builtins/help.rb
|
71
72
|
- lib/builtins/helpers/dependency_handler.rb
|
72
73
|
- lib/builtins/init.rb
|
73
74
|
- lib/builtins/up.rb
|