Class: Fastlane::Actions::InstallXcodePluginAction

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

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, details, method_missing, other_action, sh, step_text

Class Method Details

.authorsObject



43
44
45
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 43

def self.authors
  ["NeoNachoSoto"]
end

.available_optionsObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 25

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :url,
                                 env_name: "FL_XCODE_PLUGIN_URL",
                                 description: "URL for Xcode plugin ZIP file",
                                 verify_block: proc do |value|
                                   UI.user_error!("No URL for InstallXcodePluginAction given, pass using `url: 'url'`") if value.to_s.length == 0
                                   UI.user_error!("URL doesn't use HTTPS") unless value.start_with?("https://")
                                 end)
  ]
end

.descriptionObject



21
22
23
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 21

def self.description
  "Install an Xcode plugin for the current user"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 47

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

.outputObject



37
38
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 37

def self.output
end

.return_valueObject



40
41
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 40

def self.return_value
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 4

def self.run(params)
  require 'fileutils'

  zip_path = File.join(Dir.tmpdir, 'plugin.zip')
  sh "curl -Lso #{zip_path} #{params[:url]}"
  plugins_path = "#{ENV['HOME']}/Library/Application Support/Developer/Shared/Xcode/Plug-ins"
  FileUtils.mkdir_p(plugins_path)
  Action.sh "unzip -qo '#{zip_path}' -d '#{plugins_path}'"

  UI.success("Plugin #{File.basename(params[:url], '.zip')} installed successfully")
  UI.message("Please restart Xcode to use the newly installed plugin")
end