Class: SmartCloud::Engine
Instance Method Summary collapse
-
#initialize ⇒ Engine
constructor
A new instance of Engine.
- #install ⇒ Object
- #uninstall ⇒ Object
Methods included from Logger
configure_logger_for, included, #logger, logger_for
Constructor Details
#initialize ⇒ Engine
Returns a new instance of Engine.
4 5 |
# File 'lib/smart_cloud/engine.rb', line 4 def initialize end |
Instance Method Details
#install ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/smart_cloud/engine.rb', line 7 def install self.uninstall SmartCloud::User.create_htpasswd_files ssh = SmartCloud::SSH.new machine = SmartCloud::Machine.new system("mkdir -p ./tmp/engine") system("cp #{SmartCloud.config.root_path}/lib/smartcloud/engine/Dockerfile ./tmp/engine/Dockerfile") gem_file_path = File.("../../cache/smartcloud-#{SmartCloud.version}.gem", SmartCloud.config.root_path) system("cp #{gem_file_path} ./tmp/engine/smartcloud-#{SmartCloud.version}.gem") machine.sync first_sync: true puts "-----> Creating image smartcloud ... " ssh.run "docker image build -t smartcloud \ --build-arg SMARTCLOUD_MASTER_KEY=#{SmartCloud::Credentials.new.read_key} \ --build-arg SMARTCLOUD_VERSION=#{SmartCloud.version} \ --build-arg USER_NAME=`id -un` \ --build-arg USER_UID=`id -u` \ --build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \ ~/.smartcloud/tmp/engine" puts "-----> Adding smartcloud to PATH ... " ssh.run "chmod +x ~/.smartcloud/bin/smartcloud.sh && sudo ln -sf ~/.smartcloud/bin/smartcloud.sh /usr/local/bin/smartcloud" system("rm ./tmp/engine/Dockerfile") system("rm ./tmp/engine/smartcloud-#{SmartCloud.version}.gem") machine.sync end |
#uninstall ⇒ Object
40 41 42 43 44 45 |
# File 'lib/smart_cloud/engine.rb', line 40 def uninstall ssh = SmartCloud::SSH.new ssh.run "sudo rm /usr/local/bin/smartcloud" ssh.run "docker rmi smartcloud" end |