Class: Fastlane::Actions::ScipioAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



38
39
40
# File 'lib/fastlane/plugin/scipio/actions/scipio_action.rb', line 38

def self.authors
  ["evandcoleman"]
end

.available_commandsObject



42
43
44
# File 'lib/fastlane/plugin/scipio/actions/scipio_action.rb', line 42

def self.available_commands
  %w(build upload help version)
end

.available_optionsObject



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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# 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

.descriptionObject



34
35
36
# 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) ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/fastlane/plugin/scipio/actions/scipio_action.rb', line 109

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

.run(params) ⇒ Object



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 '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