Class: MinioRunner::System
- Inherits:
-
Object
- Object
- MinioRunner::System
show all
- Defined in:
- lib/minio_runner/system.rb
Defined Under Namespace
Classes: InvalidEnvVar, InvalidPlatform
Constant Summary
collapse
- ENV_VAR_PREFIX =
"MINIO_RUNNER_"
Class Method Summary
collapse
Class Method Details
.defined_env?(name) ⇒ Boolean
.env(name) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/minio_runner/system.rb', line 15
def env(name)
name = name.to_sym
if !defined_env?(name)
raise MinioRunner::System::InvalidEnvVar.new(
"Environment variable #{ENV_VAR_PREFIX}#{name.upcase} is not valid for minio_runner.",
)
end
ENV["#{ENV_VAR_PREFIX}#{name.upcase}"]
end
|
.exit_hook ⇒ Object
62
63
64
65
|
# File 'lib/minio_runner/system.rb', line 62
def exit_hook
pid = Process.pid
at_exit { yield if Process.pid == pid }
end
|
.linux? ⇒ Boolean
58
59
60
|
# File 'lib/minio_runner/system.rb', line 58
def linux?
Gem::Platform.local.os[/linux/]
end
|
.mac? ⇒ Boolean
50
51
52
|
# File 'lib/minio_runner/system.rb', line 50
def mac?
Gem::Platform.local.os[/darwin|mac os/]
end
|
.mac_m? ⇒ Boolean
54
55
56
|
# File 'lib/minio_runner/system.rb', line 54
def mac_m?
mac? && Gem::Platform.local.cpu === "arm64"
end
|
.make_install_dir ⇒ Object
38
39
40
|
# File 'lib/minio_runner/system.rb', line 38
def valid_platform?
mac? || linux?
end
|
42
43
44
45
46
47
48
|
# File 'lib/minio_runner/system.rb', line 42
def validate_platform
if !valid_platform?
raise MinioRunner::System::InvalidPlatform.new(
"MinioRunner only supports Mac, macOS and Linux.",
)
end
end
|