Class: SmartMachine::Base
- Inherits:
-
Object
- Object
- SmartMachine::Base
show all
- Includes:
- Logger
- Defined in:
- lib/smart_machine/base.rb
Direct Known Subclasses
Apps::App, Apps::Container, Apps::Manager, SmartMachine::Buildpackers::Buildpacker, SmartMachine::Buildpackers::Rails, Configuration, Credentials, Docker, Engine, Grids::Elasticsearch, Grids::Minio, Grids::Mysql, Grids::Nextcloud, Grids::Nginx, Grids::Phpmyadmin, Grids::Prereceiver, Grids::Redis, Grids::Solr, Grids::Terminal, Machine, Machines::Network, SCP, SSH, Syncer
Instance Method Summary
collapse
Methods included from Logger
configure_logger_for, included, #logger, logger_for
Constructor Details
#initialize ⇒ Base
9
10
|
# File 'lib/smart_machine/base.rb', line 9
def initialize
end
|
Instance Method Details
#machine_has_engine_installed? ⇒ Boolean
25
26
27
28
|
# File 'lib/smart_machine/base.rb', line 25
def machine_has_engine_installed?
machine = SmartMachine::Machine.new
machine.run_on_machine(commands: ["which smartengine | grep -q '/smartengine'"])
end
|
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/smart_machine/base.rb', line 12
def platform_on_machine?(os:, distro_name: nil)
case os
when "linux"
command = "(uname | grep -q 'Linux')"
command += " && (cat /etc/os-release | grep -q 'NAME=\"Debian GNU/Linux\"')" if distro_name == "debian"
when "mac"
command = "(uname | grep -q 'Darwin')"
end
machine = SmartMachine::Machine.new
command ? machine.run_on_machine(commands: command) : false
end
|
#user_bash(command) ⇒ Object
30
31
32
33
|
# File 'lib/smart_machine/base.rb', line 30
def user_bash(command)
remove_envs = %w(RUBY_MAJOR RUBY_VERSION RUBY_DOWNLOAD_SHA256 GEM_HOME BUNDLE_APP_CONFIG BUNDLE_SILENCE_ROOT_WARNING)
'env -u ' + remove_envs.join(' -u ') + ' bash --login -c \'' + command + '\''
end
|