Class: Highway::Steps::Library::CarthageStep

Inherits:
Step
  • Object
show all
Defined in:
lib/highway/steps/library/carthage.rb

Class Method Summary collapse

Methods inherited from Step

root_parameter

Class Method Details

.nameObject



14
15
16
# File 'lib/highway/steps/library/carthage.rb', line 14

def self.name
  "carthage"
end

.parametersObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/highway/steps/library/carthage.rb', line 18

def self.parameters
  [
    Parameters::Single.new(
      name: "command",
      required: false,
      type: Types::Enum.new("bootstrap", "update"),
      default: "bootstrap",
    ),
    Parameters::Single.new(
      name: "github_token",
      required: false,
      type: Types::String.new(),
    ),
    Parameters::Single.new(
      name: "platforms",
      required: true,
      type: Types::Set.new(Types::Enum.new("macos", "ios", "tvos", "watchos")),
    ),
  ]
end

.run(parameters:, context:, report:) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/highway/steps/library/carthage.rb', line 39

def self.run(parameters:, context:, report:)

  context.assert_executable_available!("carthage")

  command = parameters["command"]
  token = parameters["github_token"]

  platform_map = {macos: "Mac", ios: "iOS", tvos: "tvOS", watchos: "watchOS"}
  platform = parameters["platforms"].to_a.map { |p| platform_map[p.to_sym] }.join(",")

  env = {
    "GITHUB_ACCESS_TOKEN" => token
  }

  context.with_modified_env(env) {
    context.run_action("carthage", options: {
      cache_builds: true,
      command: command,
      platform: platform,
    })
  }

end