Class: Fastlane::Actions::SetupTravisAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/setup_travis.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



64
65
66
# File 'fastlane/lib/fastlane/actions/setup_travis.rb', line 64

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



54
55
56
57
58
59
60
61
62
# File 'fastlane/lib/fastlane/actions/setup_travis.rb', line 54

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :force,
                                 env_name: "FL_SETUP_TRAVIS_FORCE",
                                 description: "Force setup, even if not executed by travis",
                                 is_string: false,
                                 default_value: false)
  ]
end

.categoryObject



78
79
80
# File 'fastlane/lib/fastlane/actions/setup_travis.rb', line 78

def self.category
  :misc
end

.descriptionObject



38
39
40
# File 'fastlane/lib/fastlane/actions/setup_travis.rb', line 38

def self.description
  "Setup the keychain and match to work with Travis CI"
end

.detailsObject



42
43
44
45
46
47
48
49
50
51
52
# File 'fastlane/lib/fastlane/actions/setup_travis.rb', line 42

def self.details
  list = <<-LIST.markdown_list(true)
    Creates a new temporary keychain for use with match
    Switches match to `readonly` mode to not create new profiles/cert on CI
  LIST

  [
    list,
    "This action helps with Travis integration. Add this to the top of your Fastfile if you use Travis."
  ].join("\n")
end

.example_codeObject



72
73
74
75
76
# File 'fastlane/lib/fastlane/actions/setup_travis.rb', line 72

def self.example_code
  [
    'setup_travis'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



68
69
70
# File 'fastlane/lib/fastlane/actions/setup_travis.rb', line 68

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.run(params) ⇒ Object



4
5
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
# File 'fastlane/lib/fastlane/actions/setup_travis.rb', line 4

def self.run(params)
  # Stop if not executed by CI
  if !Helper.ci? && !params[:force]
    UI.message("Currently not running on CI system, skipping travis setup")
    return
  end

  # Create a temporary keychain
  password = "" # we don't need a password, as the keychain gets removed after each run anyway
  keychain_name = "fastlane_tmp_keychain"
  ENV["MATCH_KEYCHAIN_NAME"] = keychain_name
  ENV["MATCH_KEYCHAIN_PASSWORD"] = password

  UI.message("Creating temporary keychain: \"#{keychain_name}\".")
  Actions::CreateKeychainAction.run(
    name: keychain_name,
    default_keychain: true,
    unlock: true,
    timeout: 3600,
    lock_when_sleeps: true,
    password: password
  )

  # Enable readonly mode for match by default
  # we don't want to generate new identities and
  # profiles on Travis usually
  UI.message("Enabling readonly mode for Travis")
  ENV["MATCH_READONLY"] = true.to_s
end