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 +4 -4
- data/lib/action.rb +7 -1
- data/lib/action_list.rb +8 -6
- data/lib/builtin.rb +10 -0
- data/lib/builtins/helpers/dependency_handler.rb +1 -1
- data/lib/builtins/helpers/enumerator.rb +3 -0
- data/lib/dependencies/pip.rb +35 -0
- data/lib/hook_handler.rb +1 -0
- data/lib/ops.rb +0 -2
- data/lib/runner.rb +5 -4
- data/ops_team.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c0933e00ebfbc331a0fcf88344ab554fb87c9f0889a9033dd26c1afcd30200
|
4
|
+
data.tar.gz: 44805923090fb8846ccf1f78375ac70bc30b54238aa444961127a17730f67c7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
44
|
-
check_duplicate_alias(name,
|
45
|
-
@aliases[
|
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,
|
51
|
-
return if @aliases[
|
52
|
+
def check_duplicate_alias(name, aliaz)
|
53
|
+
return if @aliases[aliaz].nil?
|
52
54
|
|
53
|
-
Output.warn("Duplicate alias '#{
|
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
|
@@ -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
data/lib/ops.rb
CHANGED
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)
|
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
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.
|
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.
|
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
|