Class: Fastlane::Actions::EnsureDockerMachineAvailableAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/docker/actions/ensure_docker_machine_available.rb

Class Method Summary collapse

Class Method Details

.authorsObject



34
35
36
# File 'lib/fastlane/plugin/docker/actions/ensure_docker_machine_available.rb', line 34

def self.authors
  ["milch"]
end

.available_optionsObject



25
26
27
28
29
30
31
32
# File 'lib/fastlane/plugin/docker/actions/ensure_docker_machine_available.rb', line 25

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :machine_name,
                                 description: "Name of the Docker Machine",
                                 default_value: "fastlane-docker")

  ]
end

.descriptionObject



21
22
23
# File 'lib/fastlane/plugin/docker/actions/ensure_docker_machine_available.rb', line 21

def self.description
  "Makes sure a docker machine is created and available for us to use"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/fastlane/plugin/docker/actions/ensure_docker_machine_available.rb', line 38

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fastlane/plugin/docker/actions/ensure_docker_machine_available.rb', line 4

def self.run(params)
  client = DockerMachineClient.new
  machine_name = params[:machine_name]

  unless client.machine_available? machine_name
    UI.message "No machine of name #{machine_name} found, creating one..."
    client.create_machine machine_name
  end

  client.start(machine_name) unless client.is_running? machine_name

  client.configure_env(machine_name)

  UI.message "Your machine is ready to go!"
  Actions.lane_context[SharedValues::DOCKER_ACTIVE_MACHINE] = machine_name
end