ops_team 1.5.0 → 1.5.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: 756dc825ef1aa3ad8d89851637b530c22b9d60ab7432e401c0e9bb6516921ec2
4
- data.tar.gz: 68b6345a698c3931efa9b447b25c8bf9bf7dc16b78d569761a92e54aeed7b473
3
+ metadata.gz: a54db2276ea07b84b3b6c8df6cb73dcca033c166b9ebf06585725a42892eb012
4
+ data.tar.gz: a3574a5efd0515911f089cc4df61693637b413cbea8316bef138a4c515785a01
5
5
  SHA512:
6
- metadata.gz: 1d44786bc8a0abf6fecb0d08f0a45a695707887fdd4d8fecdfda166daf19371f3542c0c69b91b10617cbf1f41b21a36446760ad342ea1d4ab1ba8b4576f3682e
7
- data.tar.gz: a02254d754ba41eb0eeafe8546722ba1728b9d3f04d46fda1dd96b922d7f2aa26c6810b2d288124ae8f304b234a8f45bd77690afeea2ed39e15178455023df2f
6
+ metadata.gz: 3f1a2b8726148706aba7ae2943c0bb9b9ad517f1e5ccd9b32d31b7e2dac403124647641fa6ae8256fda235d2d3e8f7cbb7f9e950762d7f9a5fe1c12aa0d05993
7
+ data.tar.gz: 5e25362c364f73db8c50f05af4a820795a3c284ec7fe724d82db9fefe5a60746eb208c54711ff36492dacd7908adb6f6ca02d4822799300eb74048549a9dff02
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/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.5.0'
5
+ s.version = '1.5.2'
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_team
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nickthecook@gmail.com
@@ -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
@@ -217,7 +218,7 @@ 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
@@ -226,9 +227,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
227
  - !ruby/object:Gem::Version
227
228
  version: '0'
228
229
  requirements: []
229
- rubygems_version: 3.1.2
230
+ rubygems_version: 3.2.15
230
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: []