ops_team 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f947ab7c489798b9868dde0124578cfbc747baee9017edab35ddeed55328e27
4
- data.tar.gz: 49e885e7155a06c8960dadd505713a2da32081537a7998a4b6fc6c0aa6cb916b
3
+ metadata.gz: ffbfe47eb5ac6fd8b908604cb1409e4b90f5e03761d6f111b53dfd93ecb2d9fe
4
+ data.tar.gz: ce01d34fcab6f08a8b07a41cf7cfe99d3ed96c6ac9a3353f48ebbb65d2c03694
5
5
  SHA512:
6
- metadata.gz: fe7fd8380653accb913cccc03b22b1a5463b9da28305df09587f9c2c21c9adf2c43f11217fadf4746a65e3f685ff88e258735f5e34a338846dea77f492f2919e
7
- data.tar.gz: 7ceea9ca0c2ced123f2afa57a6d33901546fbaff1b91fee357e66b9a85d1e91c3fb64dac9206552010bca2033f18fe285156320bae422d468b68c60b91de4234
6
+ metadata.gz: fd14eed08cc7eb9e38e1bc8c995142b197d27ef8789718a0c8daea0af57f45704c5720fed3e15b7a8f6d0a0021d21e098bd02cd234cfde3ba822804a532bbec5
7
+ data.tar.gz: 27b74a7306b5577f38b1864be03a13fd3eeababf2447a37f317b0a55c5f59c94d648f957f93b010ce981fbb3b161e1889d1b841509d0cd638e7850d143558939
@@ -29,6 +29,12 @@ class Action
29
29
  @config["command"]
30
30
  end
31
31
 
32
+ def description
33
+ @config["description"]
34
+ end
35
+
36
+ private
37
+
32
38
  def load_secrets?
33
39
  @config["load_secrets"]
34
40
  end
@@ -1,6 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Builtin
4
+ class << self
5
+ def description
6
+ "no description"
7
+ end
8
+ end
9
+
4
10
  def initialize(args, config)
5
11
  @args = args
6
12
  @config = config
@@ -8,7 +8,13 @@ require 'builtins/helpers/dependency_handler'
8
8
 
9
9
  module Builtins
10
10
  class Down < Builtin
11
- def run
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
@@ -5,6 +5,12 @@ require 'output'
5
5
 
6
6
  module Builtins
7
7
  class Env < Builtin
8
+ class << self
9
+ def description
10
+ "Prints the current environment, e.g. 'dev', 'production', 'staging', etc."
11
+ end
12
+ end
13
+
8
14
  def run
9
15
  Output.print(environment)
10
16
  end
@@ -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
@@ -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.")
@@ -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
@@ -8,7 +8,13 @@ module Builtins
8
8
  class Version < Builtin
9
9
  GEMSPEC_FILE = "#{__dir__}/../../ops_team.gemspec"
10
10
 
11
- def run
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ops_team'
5
- s.version = '0.2.1'
5
+ s.version = '0.2.2'
6
6
  s.authors = [
7
7
  'nickthecook@gmail.com'
8
8
  ]
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.1
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