class Commands::CIC::Command
Constants
- CONTAINER_NOT_RUNNING_MSG
- CONTAINER_STOPPED_MSG
Public Instance Methods
connect(container_name)
click to toggle source
# File lib/commands/cic/command.rb, line 24 def connect(container_name) command = "-it #{container_id(container_name)} " command << (options[:command] || 'bash -l') docker_exec(command) end
down()
click to toggle source
# File lib/commands/cic/command.rb, line 32 def down in_cic_directory do execute "#{courseware_environment} docker-compose down", pass_message: "Environment cic'd down :)", fail_message: 'Failed to cic down the environment see above output for details' end end
in_cic_directory() { || ... }
click to toggle source
# File lib/commands/cic/command.rb, line 68 def in_cic_directory cic_directory = '.cic' raise CICDirectoryMissing unless File.exist?(cic_directory) Dir.chdir(cic_directory) do yield end end
normalise(string)
click to toggle source
# File lib/commands/cic/command.rb, line 77 def normalise(string) string.gsub(%r{[:/]}, '-') end
start_help_msg(container_name)
click to toggle source
# File lib/commands/cic/command.rb, line 81 def start_help_msg(container_name) <<-MESSAGE Connect with: cic connect #{container_name} Stop with : cic stop #{container_name} MESSAGE end
up()
click to toggle source
# File lib/commands/cic/command.rb, line 45 def up in_cic_directory do commands = ["#{courseware_environment} docker-compose up -d --remove-orphans"] before_script = 'before' commands << "./#{before_script}" if File.exist?(before_script) after_script = 'after' commands << "./#{after_script}" if File.exist?(after_script) execute(*commands, pass_message: "Environment cic'd up :)", fail_message: 'Failed to cic up the environment see above output for details') end end