ops_team 1.11.2 → 1.14.1

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: 6775a19f3c97954027d7ed21ff4433ec76ae9f2102c378f36a6658d55603c196
4
- data.tar.gz: d9ce7a27cfd7124935c145df548f41f438e599ed89e8464a31c37e997822636a
3
+ metadata.gz: 21c0933e00ebfbc331a0fcf88344ab554fb87c9f0889a9033dd26c1afcd30200
4
+ data.tar.gz: 44805923090fb8846ccf1f78375ac70bc30b54238aa444961127a17730f67c7f
5
5
  SHA512:
6
- metadata.gz: 3feccc3a6ab8205664a041a0216bab8f2e68f36cb2fc8edc8a15371120550afa27994e2ab3c606f164742b1a4e378fda383c42c870acef4549bcde783ae663ba
7
- data.tar.gz: 3d265366298b75333ae17c10ad65790cd70909bbf2b301d1077d9ec9645f12094c8ecbb3e002074fc0d48db743bbbdb76e2da3172db26da6fc83718077913ce6
6
+ metadata.gz: ccc49f6c5b23f98bdcd944e96497c54245f3ef26e912bdc109b89eee20e070e5c18ecca9cfe474aac8791be003ad7b4945e33ce13e0ee74477c45ab5722957a2
7
+ data.tar.gz: 879871fd770c450b0560beb31788cc83b7e95fd103a86ce78d387533d79f54049ee5d7a7041cfe897fe2113eb0a15d69c642ce12bc652e7e5537a0f09424dbff
data/lib/action.rb CHANGED
@@ -26,7 +26,13 @@ class Action
26
26
  end
27
27
 
28
28
  def alias
29
- @config["alias"]
29
+ @config["alias"] || @config["aliases"]&.first
30
+ end
31
+
32
+ def aliases
33
+ return [@config["alias"]].compact unless @config["aliases"]
34
+
35
+ ([@config["alias"]] + @config["aliases"]).compact
30
36
  end
31
37
 
32
38
  def command
data/lib/action_list.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'action'
4
+
3
5
  class ActionList
4
6
  class UnknownActionError < StandardError; end
5
7
 
@@ -40,16 +42,16 @@ class ActionList
40
42
  action = Action.new(name, config, @args)
41
43
 
42
44
  @actions[name] = action
43
- if action.alias
44
- check_duplicate_alias(name, action)
45
- @aliases[action.alias] = action
45
+ action.aliases.each do |aliaz|
46
+ check_duplicate_alias(name, aliaz)
47
+ @aliases[aliaz] = action
46
48
  end
47
49
  end
48
50
  end
49
51
 
50
- def check_duplicate_alias(name, action)
51
- return if @aliases[action.alias].nil?
52
+ def check_duplicate_alias(name, aliaz)
53
+ return if @aliases[aliaz].nil?
52
54
 
53
- Output.warn("Duplicate alias '#{action.alias}' detected in action '#{name}'.")
55
+ Output.warn("Duplicate alias '#{aliaz}' detected in action '#{name}'.")
54
56
  end
55
57
  end
data/lib/builtin.rb CHANGED
@@ -6,16 +6,26 @@ class Builtin
6
6
  attr_reader :args, :config
7
7
 
8
8
  class << self
9
+ BUILTIN_DIR = "builtins"
10
+
9
11
  def description
10
12
  "no description"
11
13
  end
12
14
 
13
15
  def class_for(name:)
16
+ file = file_for(name: name)
17
+ return nil unless File.exist?(file)
18
+
19
+ require file
14
20
  Builtins.const_get(builtin_class_name_for(name: name), false)
15
21
  end
16
22
 
17
23
  private
18
24
 
25
+ def file_for(name:)
26
+ File.join(File.dirname(__FILE__), BUILTIN_DIR, "#{name}.rb")
27
+ end
28
+
19
29
  def builtin_class_name_for(name:)
20
30
  name.capitalize.to_sym
21
31
  end
@@ -18,7 +18,7 @@ module Builtins
18
18
 
19
19
  @dependency_set.map do |type, names|
20
20
  dependencies_for(type, names)
21
- end.flatten
21
+ end.flatten.compact
22
22
  end
23
23
 
24
24
  def dependencies_for(type, names)
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'require_all'
4
+ require_rel ".."
5
+
3
6
  module Builtins
4
7
  module Helpers
5
8
  class Enumerator
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'English'
4
+
5
+ require 'dependency'
6
+ require 'options'
7
+
8
+ module Dependencies
9
+ class Pip < Dependency
10
+ DEFAULT_PIP = "python3 -m pip"
11
+
12
+ def met?
13
+ execute("#{pip} show #{name}")
14
+ end
15
+
16
+ def meet
17
+ execute("#{pip} install #{name}")
18
+ end
19
+
20
+ def unmeet
21
+ # do nothing; we don't want to uninstall packages and reinstall them every time
22
+ true
23
+ end
24
+
25
+ def should_meet?
26
+ true
27
+ end
28
+
29
+ private
30
+
31
+ def pip
32
+ Options.get("pip.command") || DEFAULT_PIP
33
+ end
34
+ end
35
+ end
data/lib/hook_handler.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'output'
4
+ require 'executor'
4
5
 
5
6
  class HookHandler
6
7
  class HookConfigError < StandardError; end
data/lib/ops.rb CHANGED
@@ -10,8 +10,6 @@ require 'options'
10
10
  require 'version'
11
11
  require 'runner'
12
12
 
13
- require_rel "builtins"
14
-
15
13
  # executes commands based on local `ops.yml`
16
14
  class Ops
17
15
  INVALID_SYNTAX_EXIT_CODE = 64
data/lib/runner.rb CHANGED
@@ -6,6 +6,10 @@ require 'action_list'
6
6
  require 'action_suggester'
7
7
  require 'forwards'
8
8
  require 'environment'
9
+ require 'builtin'
10
+
11
+ module Builtins
12
+ end
9
13
 
10
14
  class Runner
11
15
  class UnknownActionError < StandardError; end
@@ -61,10 +65,7 @@ class Runner
61
65
  end
62
66
 
63
67
  def builtin
64
- @builtin ||= Builtin.class_for(name: @action_name).new(@args, @config)
65
- rescue NameError
66
- # this means there isn't a builtin with that name in that module
67
- nil
68
+ @builtin ||= Builtin.class_for(name: @action_name)&.new(@args, @config)
68
69
  end
69
70
 
70
71
  def builtin_names
data/ops_team.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ops_team'
5
- s.version = '1.11.2'
5
+ s.version = '1.14.1'
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: 1.11.2
4
+ version: 1.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nickthecook@gmail.com
@@ -193,6 +193,7 @@ files:
193
193
  - lib/dependencies/docker.rb
194
194
  - lib/dependencies/gem.rb
195
195
  - lib/dependencies/helpers/apt_cache_policy.rb
196
+ - lib/dependencies/pip.rb
196
197
  - lib/dependencies/sshkey.rb
197
198
  - lib/dependencies/versioned_dependency.rb
198
199
  - lib/dependency.rb
@@ -228,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
229
  - !ruby/object:Gem::Version
229
230
  version: '0'
230
231
  requirements: []
231
- rubygems_version: 3.1.6
232
+ rubygems_version: 3.2.15
232
233
  signing_key:
233
234
  specification_version: 4
234
235
  summary: ops_team handles basic automation for your project, driven by self-documenting