ops_team 1.17.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependencies/snap.rb +32 -0
- data/lib/options.rb +9 -0
- 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: f87bb63a70bee49f12e7279f94061cc29e8442addece8d06761528fde9cb0c9c
|
4
|
+
data.tar.gz: ac77a15296d299cd1f77e2ceab9afb3590e2e0bcbd8a2ce6b5b1973d33ff6565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c29733262fc698a77102ab19ee6471bbc00abfdbe0e88fceb50ce4298f523debfe623004c30be374439c4149b9253ff1fa6b280f7faed3657d9bc465b4832970
|
7
|
+
data.tar.gz: 3364890f3a416d1206fa4eb5af5c7b922e7b7fa774b79b29b7ee87dc971f05b99c69c7267d0e75d784c99554c6d6638ab3cad4e314baa1b14ad653605784a874
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dependencies
|
4
|
+
class Snap < VersionedDependency
|
5
|
+
def met?
|
6
|
+
system("snap list | grep -q \"^name \"")
|
7
|
+
end
|
8
|
+
|
9
|
+
def meet
|
10
|
+
execute("#{sudo_string}snap install #{name}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def unmeet
|
14
|
+
# do nothing; we don't want to uninstall packages and reinstall them every time
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
def should_meet?
|
19
|
+
return false unless Options.get("snap.install")
|
20
|
+
return false unless `uname`.chomp == "Linux"
|
21
|
+
return false unless system("which snap", out: File::NULL, err: File::NULL)
|
22
|
+
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def sudo_string
|
29
|
+
return "sudo " unless Options.get("snap.use_sudo") == false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/options.rb
CHANGED
@@ -3,11 +3,20 @@
|
|
3
3
|
class Options
|
4
4
|
class << self
|
5
5
|
def get(path)
|
6
|
+
env_var = ENV[env_var(path)]
|
7
|
+
return YAML.safe_load(env_var) unless env_var.nil?
|
8
|
+
|
6
9
|
@options&.dig(*path.split('.'))
|
7
10
|
end
|
8
11
|
|
9
12
|
def set(options)
|
10
13
|
@options = options
|
11
14
|
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def env_var(path)
|
19
|
+
"OPS__#{path.upcase.gsub(".", "__")}"
|
20
|
+
end
|
12
21
|
end
|
13
22
|
end
|
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.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nickthecook@gmail.com
|
@@ -215,6 +215,7 @@ files:
|
|
215
215
|
- lib/dependencies/gem.rb
|
216
216
|
- lib/dependencies/helpers/apt_cache_policy.rb
|
217
217
|
- lib/dependencies/pip.rb
|
218
|
+
- lib/dependencies/snap.rb
|
218
219
|
- lib/dependencies/sshkey.rb
|
219
220
|
- lib/dependencies/versioned_dependency.rb
|
220
221
|
- lib/dependency.rb
|
@@ -251,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
252
|
- !ruby/object:Gem::Version
|
252
253
|
version: '0'
|
253
254
|
requirements: []
|
254
|
-
rubygems_version: 3.
|
255
|
+
rubygems_version: 3.3.13
|
255
256
|
signing_key:
|
256
257
|
specification_version: 4
|
257
258
|
summary: ops_team handles basic automation for your project, driven by self-documenting
|