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, sh, step_text

Class Method Details

.authorsObject



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

def self.authors
  ["NeoNachoSoto"]
end

.available_optionsObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 21

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|
                                   raise "No URL for InstallXcodePluginAction given, pass using `url: 'url'`".red if value.to_s.length == 0
                                   raise "URL doesn't use HTTPS".red unless value.start_with?("https://")
                                 end)
  ]
end

.descriptionObject



17
18
19
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 17

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.outputObject



33
34
# File 'lib/fastlane/actions/install_xcode_plugin.rb', line 33

def self.output
end

.return_valueObject



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

def self.return_value
end

.run(params) ⇒ Object



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

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

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