class Fastlane::Actions::ScipioAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/scipio/actions/scipio_action.rb, line 38
def self.authors
  ["evandcoleman"]
end
available_commands() click to toggle source
# File lib/fastlane/plugin/scipio/actions/scipio_action.rb, line 42
def self.available_commands
  %w(build upload help version)
end
available_options() click to toggle source
# File lib/fastlane/plugin/scipio/actions/scipio_action.rb, line 46
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :binary_path,
                                 env_name: "FL_SCIPIO_BINARY_PATH",
                                 description: "Scipio binary path",
                                 optional: true,
                                 default_value: `which scipio`),
    FastlaneCore::ConfigItem.new(key: :command,
                                 env_name: "FL_SCIPIO_COMMAND",
                                 description: "Scipio command (one of: #{available_commands.join(', ')})",
                                 default_value: ""),
    FastlaneCore::ConfigItem.new(key: :verbose,
                                 env_name: "FL_SCIPIO_VERBOSE",
                                 description: "Enable verbose logging",
                                 is_string: false,
                                 optional: true,
                                 default_value: false,
                                 verify_block: proc do |value|
                                   UI.user_error!("Please pass a valid value for verbose. Use one of the following: true, false") unless value.kind_of?(TrueClass) || value.kind_of?(FalseClass)
                                 end),
    FastlaneCore::ConfigItem.new(key: :packages,
                                 env_name: "FL_SCIPIO_PACKAGES",
                                 description: "Package name or names to build/upload",
                                 default_value: [],
                                 is_string: false,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :config_path,
                                 env_name: "FL_SCIPIO_CONFIG_PATH",
                                 description: "The path to the scipio.yml to use or a directory containing it. Defaults to the \"scipio.yml\" in the current directory",
                                 optional: true,
                                 is_string: true),
    FastlaneCore::ConfigItem.new(key: :build_path,
                                 env_name: "FL_SCIPIO_BUILD_PATH",
                                 description: "The path to store build artifacts",
                                 optional: true,
                                 is_string: true),
    FastlaneCore::ConfigItem.new(key: :skip_clean,
                                 env_name: "FL_SCIPIO_SKIP_CLEAN",
                                 description: "Skips cleaning the build directory",
                                 is_string: false,
                                 optional: true,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :force,
                                 env_name: "FL_SCIPIO_FORCE",
                                 description: "Force build and upload packages",
                                 is_string: false,
                                 optional: true,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :force_build,
                                 env_name: "FL_SCIPIO_FORCE_BUILD",
                                 description: "Force build packages",
                                 is_string: false,
                                 optional: true,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :force_upload,
                                 env_name: "FL_SCIPIO_FORCE_UPLOAD",
                                 description: "Force upload packages",
                                 is_string: false,
                                 optional: true,
                                 default_value: false),
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/scipio/actions/scipio_action.rb, line 34
def self.description
  "A fastlane plugin for Scipio - a cache tool for Swift Package Manager"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/scipio/actions/scipio_action.rb, line 109
def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end
run(params) click to toggle source
# File lib/fastlane/plugin/scipio/actions/scipio_action.rb, line 7
def self.run(params)
  cmd = [params[:binary_path].chomp]
  command_name = params[:command]

  if command_name == "version"
    cmd << "--version"
  elsif command_name == "help"
    cmd << "--help"
  else
    cmd << command_name
  end

  cmd << "--config #{params[:config_path]}" if params[:config_path]
  cmd << "--build-path #{params[:build_path]}" if params[:build_path]
  cmd << "--skip-clean" if params[:skip_clean] == true
  cmd << "--force" if params[:force] == true
  cmd << "--force-upload" if params[:force_upload] == true
  cmd << "--force-build" if params[:force_build] == true
  cmd << "--verbose " if params[:verbose]

  if params[:packages].length > 0
    cmd << params[:packages].join(",")
  end

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