class Fastlane::Actions::DockerMachineClient

Public Instance Methods

configure_env(machine_name) click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_machine_client.rb, line 31
def configure_env(machine_name)
  instructions = (Actions.sh "docker-machine env #{machine_name} --shell sh").lines
  instructions.map!(&:strip).select! { |i| i =~ /^export/ }
  instructions.each do |i|
    key, value = i.split(" ").last.split("=")
    ENV[key] = value.chomp("\"").reverse.chomp("\"").reverse
  end
end
create_machine(name) click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_machine_client.rb, line 27
def create_machine(name)
  Actions.sh "docker-machine create -d virtualbox #{name.shellescape} 1> /dev/null"
end
is_running?(machine_name) click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_machine_client.rb, line 19
def is_running?(machine_name)
  Actions.sh("docker-machine status #{machine_name}").strip == "Running"
end
list() click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_machine_client.rb, line 7
      def list
        script = <<SCRIPT
        docker-machine ls | tail -n +2 | tr -s " " "," | cut -f 1 -d ","
SCRIPT
        machines = Actions.sh script.strip
        return machines.lines.map(&:strip)
      end
machine_available?(machine_name) click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_machine_client.rb, line 15
def machine_available?(machine_name)
  return list.include? machine_name
end
start(machine_name) click to toggle source
# File lib/fastlane/plugin/docker/actions/docker_machine_client.rb, line 23
def start(machine_name)
  Actions.sh("docker-machine start #{machine_name}")
end