ops_team 1.5.0 → 1.6.0rc1

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: 756dc825ef1aa3ad8d89851637b530c22b9d60ab7432e401c0e9bb6516921ec2
4
- data.tar.gz: 68b6345a698c3931efa9b447b25c8bf9bf7dc16b78d569761a92e54aeed7b473
3
+ metadata.gz: c5ac5db707fcb33c6cb634fb44092714f0ad7024d53d66635c62bf8af1b02daf
4
+ data.tar.gz: 75c3498ef557c913eff438ff0c103e193016fa59b7422701198c354eebe46f43
5
5
  SHA512:
6
- metadata.gz: 1d44786bc8a0abf6fecb0d08f0a45a695707887fdd4d8fecdfda166daf19371f3542c0c69b91b10617cbf1f41b21a36446760ad342ea1d4ab1ba8b4576f3682e
7
- data.tar.gz: a02254d754ba41eb0eeafe8546722ba1728b9d3f04d46fda1dd96b922d7f2aa26c6810b2d288124ae8f304b234a8f45bd77690afeea2ed39e15178455023df2f
6
+ metadata.gz: 3af8361a36671875b8b21639af28e37e2df4bd4687973401ed10a8c870b70674ebea7162d75c129686549bf7b66a13c3cd3603f7ad2a0180b92d89ec8d09c75b
7
+ data.tar.gz: 7d7df063bb0710541f23324b3d4f48b20369f2a00c3c70a0028dfae22341cb3132de9a305a3a769b983ac8883cd508205098303bcc4c37dcba0d2774065371c4
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.6.0rc1'
6
6
  s.authors = [
7
7
  'nickthecook@gmail.com'
8
8
  ]
9
- s.date = '2021-05-05'
10
- s.summary = 'ops_team handles basic operations tasks for your project, driven by self-documenting YAML config'
9
+ s.date = '2021-06-21'
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,14 +1,14 @@
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.6.0rc1
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
- date: 2021-05-05 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt_pbkdf
@@ -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: []