ops_team 1.4.2 → 1.6.0.pre.pre

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
  SHA256:
3
- metadata.gz: 7bf95d0b212fcf2fc2b6f6beb2d9acf60002725f6b0e51a85ae7b49cb337772c
4
- data.tar.gz: 9ad06b3344df5c710420d31580ce7b316b9e22d172143397081d37c9e6b0b55f
3
+ metadata.gz: be60abf42c17c9dd49eb8138efa2baa9158fe6b915d3f57618622436535ee0c5
4
+ data.tar.gz: 212a99e857496b114bc6869a2bc8cc55f71e2c40d5ad9d7b93f20a462a1d75cd
5
5
  SHA512:
6
- metadata.gz: 69e8a3408d8111ac85c032ae51d9d8bd83c4b2d4455b459f11e4a202868335652c1b93df6bf56de97c98bf8cd3fa34a4855b2a6b0917ed95d0cb345c4c20923f
7
- data.tar.gz: 47a7174fffd8a391359a8ff3253be91d3b1a03ea7607cfc628e3cce0cb36f17e227928592f35d6ab344494d0cb4687747cc67a8e8205d40cda839056aa0b518f
6
+ metadata.gz: 230bca7765df3c169c531dc2730a8e9adf2e1356281c45a622e3debfdc33c127960b3a4da100757f1266765a4e2fab09f36bc424ef0369f4f61a7eb1870a4244
7
+ data.tar.gz: cc9231a47b708cccdc75dba79fe8ba85e4dcb3d726d362772fbfb9e597031f204f559ae692bb39fe56ebfc5cc29ec40b1a8a1da42f9c54f057179a56be59eee3
data/Gemfile CHANGED
@@ -10,7 +10,6 @@ gem 'concurrent-ruby', require: 'concurrent'
10
10
  gem "e2mmap"
11
11
  gem "ed25519"
12
12
  gem "ejson"
13
- gem "etc"
14
13
  gem "io-console"
15
14
  gem "json", ">= 2.3.0"
16
15
  gem "net-ssh"
data/lib/builtins/help.rb CHANGED
@@ -4,10 +4,11 @@ require 'colorize'
4
4
 
5
5
  require 'builtin'
6
6
  require 'forwards'
7
+ require 'builtins/helpers/enumerator'
7
8
 
8
9
  module Builtins
9
10
  class Help < Builtin
10
- NAME_WIDTH = 35
11
+ NAME_WIDTH = 40
11
12
 
12
13
  class << self
13
14
  def description
@@ -35,34 +36,13 @@ module Builtins
35
36
  end
36
37
 
37
38
  def builtins
38
- builtin_class_map.map do |klass, name|
39
- format("%<name>-#{NAME_WIDTH}s %<desc>s", name: name.downcase.to_s.yellow, desc: klass.description)
40
- end
41
- end
42
-
43
- def builtin_class_map
44
- builtin_class_names.each_with_object({}) do |name, hash|
45
- # get the class reference for this name
46
- constant = const_for(name)
47
- # check hash for an existing entry for the same class
48
- existing_name = hash[constant]
39
+ builtin_enumerator.names_by_constant.map do |klass, names|
40
+ names_string = names.map(&:downcase).map(&:to_s).uniq.join(", ").yellow
49
41
 
50
- # if there is an existing key for the same class, and it's longer than the one we just found,
51
- # skip adding this one one to avoid duplicates, leaving the shortest name for each class
52
- next if existing_name && existing_name.length <= name.length
53
-
54
- hash[constant] = name
42
+ format("%<names>-#{NAME_WIDTH}s %<desc>s", names: names_string, desc: klass.description)
55
43
  end
56
44
  end
57
45
 
58
- def builtin_class_names
59
- @builtin_class_names ||= Builtins.constants.select { |c| const_for(c).is_a?(Class) }.sort
60
- end
61
-
62
- def const_for(name)
63
- Builtins.const_get(name, false)
64
- end
65
-
66
46
  def actions
67
47
  return [] unless @config["actions"]
68
48
 
@@ -79,5 +59,9 @@ module Builtins
79
59
 
80
60
  ""
81
61
  end
62
+
63
+ def builtin_enumerator
64
+ @builtin_enumerator ||= ::Builtins::Helpers::Enumerator
65
+ end
82
66
  end
83
67
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Builtins
4
+ module Helpers
5
+ class Enumerator
6
+ class << self
7
+ def names_by_constant
8
+ constants_by_name.each_with_object({}) do |(name, const), hash|
9
+ if hash.include?(const)
10
+ hash[const] << name
11
+ else
12
+ hash[const] = [name]
13
+ end
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def constants_by_name
20
+ @constants_by_name = Builtins.constants.each_with_object({}) do |const_name, hash|
21
+ const = Builtins.const_get(const_name, false)
22
+
23
+ next unless const.is_a?(Class)
24
+
25
+ hash[const_name] = const
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
data/lib/builtins/up.rb CHANGED
@@ -23,7 +23,7 @@ module Builtins
23
23
  private
24
24
 
25
25
  def dependency_handler
26
- Helpers::DependencyHandler.new(@config["dependencies"])
26
+ Helpers::DependencyHandler.new(deps_to_meet)
27
27
  end
28
28
 
29
29
  def meet_dependencies
@@ -49,5 +49,11 @@ module Builtins
49
49
  Output.out(dependency.output)
50
50
  end
51
51
  end
52
+
53
+ def deps_to_meet
54
+ return @config["dependencies"] if @args.empty?
55
+
56
+ return @config["dependencies"].select { |dep, names| @args.include?(dep) }
57
+ end
52
58
  end
53
59
  end
data/ops_team.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ops_team'
5
- s.version = '1.4.2'
5
+ s.version = '1.6.0-pre'
6
6
  s.authors = [
7
7
  'nickthecook@gmail.com'
8
8
  ]
9
9
  s.date = '2021-05-05'
10
- s.summary = 'ops_team handles basic operations tasks for your project, driven by self-documenting YAML config'
10
+ s.summary = 'ops_team handles basic automation for your project, driven by self-documenting YAML config'
11
11
  s.homepage = 'https://github.com/nickthecook/ops'
12
12
  s.files = Dir[
13
13
  'Gemfile',
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  'ops_team.gemspec'
23
23
  ]
24
24
  s.executables << 'ops'
25
- s.required_ruby_version = '~> 2.5'
25
+ s.required_ruby_version = '> 2.5'
26
26
  s.add_runtime_dependency 'bcrypt_pbkdf', '~> 1.0', '>= 1.0.1'
27
27
  s.add_runtime_dependency 'colorize', '~> 0.8', '>= 0.8.1'
28
28
  s.add_runtime_dependency 'concurrent-ruby', '~> 1.1', '>= 1.1.7'
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_team
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.6.0.pre.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - nickthecook@gmail.com
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2021-05-05 00:00:00.000000000 Z
@@ -150,8 +150,8 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.1.6
153
- description:
154
- email:
153
+ description:
154
+ email:
155
155
  executables:
156
156
  - ops
157
157
  extensions: []
@@ -179,6 +179,7 @@ files:
179
179
  - lib/builtins/exec.rb
180
180
  - lib/builtins/help.rb
181
181
  - lib/builtins/helpers/dependency_handler.rb
182
+ - lib/builtins/helpers/enumerator.rb
182
183
  - lib/builtins/init.rb
183
184
  - lib/builtins/up.rb
184
185
  - lib/builtins/version.rb
@@ -211,24 +212,24 @@ homepage: https://github.com/nickthecook/ops
211
212
  licenses:
212
213
  - GPL-3.0-only
213
214
  metadata: {}
214
- post_install_message:
215
+ post_install_message:
215
216
  rdoc_options: []
216
217
  require_paths:
217
218
  - lib
218
219
  required_ruby_version: !ruby/object:Gem::Requirement
219
220
  requirements:
220
- - - "~>"
221
+ - - ">"
221
222
  - !ruby/object:Gem::Version
222
223
  version: '2.5'
223
224
  required_rubygems_version: !ruby/object:Gem::Requirement
224
225
  requirements:
225
- - - ">="
226
+ - - ">"
226
227
  - !ruby/object:Gem::Version
227
- version: '0'
228
+ version: 1.3.1
228
229
  requirements: []
229
- rubygems_version: 3.1.2
230
- signing_key:
230
+ rubygems_version: 3.2.15
231
+ signing_key:
231
232
  specification_version: 4
232
- summary: ops_team handles basic operations tasks for your project, driven by self-documenting
233
+ summary: ops_team handles basic automation for your project, driven by self-documenting
233
234
  YAML config
234
235
  test_files: []