Class: Match::Setup

Inherits:
Object
  • Object
show all
Defined in:
match/lib/match/setup.rb

Instance Method Summary collapse

Instance Method Details

#run(path, is_swift_fastfile: false) ⇒ Object


6
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
# File 'match/lib/match/setup.rb', line 6

def run(path, is_swift_fastfile: false)
  if is_swift_fastfile
    template = File.read("#{Match::ROOT}/lib/assets/MatchfileTemplate.swift")
  else
    template = File.read("#{Match::ROOT}/lib/assets/MatchfileTemplate")
  end

  storage_mode = UI.select(
    "fastlane match supports multiple storage modes, please select the one you want to use:",
    self.storage_options
  )

  storage = Storage.for_mode(storage_mode, {})

  specific_content = storage.generate_matchfile_content
  UI.crash!("Looks like `generate_matchfile_content` was `nil` for `#{storage_mode}`") if specific_content.nil?
  specific_content += "\n\n" if specific_content.length > 0
  specific_content += "storage_mode(\"#{storage_mode}\")"

  template.gsub!("[[CONTENT]]", specific_content)

  File.write(path, template)
  UI.success("Successfully created '#{path}'. You can open the file using a code editor.")

  UI.important("You can now run `fastlane match development`, `fastlane match adhoc`, `fastlane match enterprise` and `fastlane match appstore`")
  UI.message("On the first run for each environment it will create the provisioning profiles and")
  UI.message("certificates for you. From then on, it will automatically import the existing profiles.")
  UI.message("For more information visit https://docs.fastlane.tools/actions/match/")
end

#storage_optionsObject


36
37
38
# File 'match/lib/match/setup.rb', line 36

def storage_options
  return ["git", "google_cloud"]
end