Class: Fastlane::Actions::XcodegenAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



32
33
34
# File 'lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb', line 32

def self.authors
  ["Michael Ruhl"]
end

.available_optionsObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb', line 43

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :spec,
                                 env_name: "XCODEGEN_SPEC",
                                 description: "The path to the project spec file",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :project,
                                env_name: "XCODEGEN_PROJECT",
                                description: "The path to the folder where the project should be generated",
                                optional: true),
    FastlaneCore::ConfigItem.new(key: :quiet,
                                env_name: "XCODEGEN_QUIET",
                                description: "Whether to suppress informational and success messages",
                                optional: true,
                                is_string: false),
    FastlaneCore::ConfigItem.new(key: :use_cache,
                                env_name: "XCODEGEN_USE_CACHE",
                                description: "Used to prevent unnecessarily generating the project",
                                optional: true,
                                is_string: false),
    FastlaneCore::ConfigItem.new(key: :cache_path,
                                env_name: "XCODEGEN_CACHE_PATH",
                                description: "A custom path to use for your cache file",
                                optional: true),
    FastlaneCore::ConfigItem.new(key: :project_root,
                                env_name: "XCODEGEN_PROJECT_ROOT",
                                description: "The path to the project root directory",
                                optional: true)
  ]
end

.descriptionObject



28
29
30
# File 'lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb', line 28

def self.description
  "Runs `xcodegen` for the project"
end

.detailsObject



36
37
38
39
40
41
# File 'lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb', line 36

def self.details
  [
    "Will be installed with `brew` if not available",
    "Runs `xcodegen` for the project."
  ].join("\n")
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb', line 74

def self.is_supported?(platform)
  platform == :ios
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb', line 7

def self.run(params)
  require 'fastlane/plugin/brew'

  Actions.sh("which xcodegen", log: false, error_callback: proc do |error_output|
    UI.message("Installing XcodeGen")

    Actions::BrewAction.run(command: "tap yonaskolb/XcodeGen https://github.com/yonaskolb/XcodeGen.git")
    Actions::BrewAction.run(command: "install XcodeGen")
  end)

  cmd = ["xcodegen"]
  cmd << "--spec #{params[:spec]}" if params[:spec]
  cmd << "--project #{params[:project]}" if params[:project]
  cmd << "--quiet" if params[:quiet]
  cmd << "--use-cache" if params[:use_cache]
  cmd << "--cache-path #{params[:cache_path]}" if params[:cache_path]
  cmd << "--project-root #{params[:project_root]}" if params[:project_root]

  Actions.sh(cmd.join(' '))
end