class Fastlane::Actions::XcodegenAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb, line 32
def self.authors
  ["Michael Ruhl"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb, line 51
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :executable,
                                 env_name: "XCODEGEN_EXECUTABLE",
                                 description: "The path to the `xcodegen` executable",
                                 optional: true),
    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
description() click to toggle source
# File lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb, line 28
def self.description
  "Runs `xcodegen` for the project"
end
details() click to toggle source
# 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) click to toggle source
# File lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb, line 86
def self.is_supported?(platform)
  platform == :ios
end
return_type() click to toggle source
# File lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb, line 43
def self.return_type
  :string
end
return_value() click to toggle source
# File lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb, line 47
def self.return_value
  "Raw shell output of `xcodegen` command."
end
run(params) click to toggle source
# 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) unless params[:executable]

  cmd = [params[:executable] || "xcodegen"]
  cmd += ["--spec", File.expand_path(params[:spec])] if params[:spec]
  cmd += ["--project", File.expand_path(params[:project])] if params[:project]
  cmd << "--quiet" if params[:quiet]
  cmd << "--use-cache" if params[:use_cache]
  cmd += ["--cache-path", File.expand_path(params[:cache_path])] if params[:cache_path]
  cmd += ["--project-root", File.expand_path(params[:project_root])] if params[:project_root]

  Actions.sh(*cmd)
end