class Fastlane::Actions::UpdateXcodeprojAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/update_xcodeproj/actions/update_xcodeproj_action.rb, line 35 def self.available_options [ FastlaneCore::ConfigItem.new(key: :xcodeproj, env_name: "UPDATE_XCODEPROJ_XCODEPROJ", description: "Path to your Xcode project", optional: true, default_value: Dir['*.xcodeproj'].first, type: String, verify_block: proc do |value| UI.user_error!("Please pass the path to the project, not the workspace") unless value.end_with?(".xcodeproj") UI.user_error!("Could not find Xcode project") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :options, env_name: "UPDATE_XCODEPROJ_OPTIONS", description: "Key & Value pair that you will update xcode project", optional: false, type: Hash) ] end
description()
click to toggle source
# File lib/fastlane/plugin/update_xcodeproj/actions/update_xcodeproj_action.rb, line 27 def self.description "Update Xcode projects" end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/update_xcodeproj/actions/update_xcodeproj_action.rb, line 55 def self.is_supported?(platform) [:ios, :mac].include?(platform) end
run(params)
click to toggle source
# File lib/fastlane/plugin/update_xcodeproj/actions/update_xcodeproj_action.rb, line 6 def self.run(params) require 'xcodeproj' options = params[:options] project_path = params[:xcodeproj] project = Xcodeproj::Project.open(project_path) options.each do |key, value| configs = project.objects.select { |obj| obj.isa == 'XCBuildConfiguration' && !obj.build_settings[key.to_s].nil? } UI.user_error!("Xcodeproj does not use #{key}") if configs.count.zero? configs.each do |c| c.build_settings[key.to_s] = value end end project.save UI.success("Updated #{params[:xcodeproj]} 💾.") end