Class: Fastlane::Actions::SetupAppFeedbackSdkAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::SetupAppFeedbackSdkAction
- Defined in:
- lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .build_settings(params) ⇒ Object
- .build_settings_command(params) ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .parse_build_settings(output) ⇒ Object
- .plist_path(params) ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
102 103 104 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 102 def self. ["Yahoo! Japan"] end |
.available_options ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 114 def self. [ FastlaneCore::ConfigItem.new(key: :slack_api_token, env_name: "SLACK_API_TOKEN", description: "Slack API token", sensitive: true, optional: false, type: String), FastlaneCore::ConfigItem.new(key: :slack_channel, env_name: "APP_FEEDBACK_SDK_SLACK_CHANNEL", description: "Slack channel", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :project, env_name: 'APP_FEEDBACK_SDK_PROJECT', description: 'Path to your Xcode project', type: String, optional: false, verify_block: proc do |value| UI.user_error!('Please pass the path to the project, not the workspace') if value.end_with?('.xcworkspace') UI.user_error!('Could not find Xcode project') unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :scheme, env_name: 'APP_FEEDBACK_SDK_SCHEME', description: 'Scheme of info plist', type: String, optional: false), FastlaneCore::ConfigItem.new(key: :configuration, env_name: 'APP_FEEDBACK_SDK_CONFIGURATION', description: 'Configuration of info plist', type: String, optional: false) ] end |
.build_settings(params) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 70 def self.build_settings(params) command = build_settings_command(params) output = FastlaneCore::Project.run_command(command, timeout: FastlaneCore::Project.xcode_build_settings_timeout, retries: FastlaneCore::Project.xcode_build_settings_retries, print: FastlaneCore::Globals.verbose?) parse_build_settings(output) end |
.build_settings_command(params) ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 79 def self.build_settings_command(params) params = { '-project' => params[:project], '-target' => params[:target], '-configuration' => params[:configuration] } params_str = params.map { |k, v| "#{k} #{v.shellescape}" }.join(' ') "xcodebuild clean -showBuildSettings #{params_str}" end |
.description ⇒ Object
98 99 100 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 98 def self.description "Setup the Info.plist for App Feedback SDK" end |
.details ⇒ Object
110 111 112 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 110 def self.details "This fastlane plugin helps with App Feedback SDK integration for CI services" end |
.is_supported?(platform) ⇒ Boolean
149 150 151 152 153 154 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 149 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # [:ios].include?(platform) end |
.parse_build_settings(output) ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 89 def self.parse_build_settings(output) settings = {} output.lines.each do |line| m = line.match(/^\s*(\S+)\s*=\s*(.+)$/) settings[m[1]] = m[2] if m end settings end |
.plist_path(params) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 22 def self.plist_path(params) require 'xcodeproj' project_path = params[:project] shared_data_dir = Xcodeproj::XCScheme.shared_data_dir(project_path) scheme_path = File.join(shared_data_dir, params[:scheme] + '.xcscheme') UI.verbose("scheme_path = #{scheme_path}") scheme = Xcodeproj::XCScheme.new(scheme_path) build_action = scheme.build_action archive_entries = build_action.entries.select(&:build_for_archiving?) target_names = archive_entries.flat_map { |entry| entry.buildable_references.map(&:target_name) } UI.verbose("target_names = #{target_names}") project = Xcodeproj::Project.open(project_path) # select iOS Target target = project.native_targets.detect do |t| target_names.include?(t.name) && t.platform_name == :ios && t.product_type == 'com.apple.product-type.application' end UI.user_error!("Couldn't find iOS target for scheme '#{params[:scheme]}'") unless target UI.verbose("target = #{target}") config = target.build_configurations.detect { |c| c.name == params[:configuration] } UI.user_error!("Couldn't find configuration named '#{params[:configuration]}'") unless config plist = config.build_settings['INFOPLIST_FILE'] UI.user_error!("Couldn't find INFOPLIST_FILE") unless plist # Use showBuildSettings when plist path contains variable. # ( showBuildSettings is slow ) if plist.include?('$') settings = build_settings(project: params[:project], configuration: params[:configuration], target: target.name) plist = settings['INFOPLIST_FILE'] UI.user_error!("Couldn't find INFOPLIST_FILE in showBuildSettings") unless plist end plist = File.join(File.dirname(params[:project]), plist) if Pathname.new(plist).relative? UI.user_error!("Couldn't find plist file at path '#{plist}'") unless File.exist?(plist) plist = File.(plist) UI.verbose("plist path = #{plist}") plist end |
.return_value ⇒ Object
106 107 108 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 106 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fastlane/plugin/setup_app_feedback_sdk/actions/setup_app_feedback_sdk_action.rb', line 7 def self.run(params) require 'xcodeproj' require 'shellwords' require 'pathname' plist = plist_path(params) SetInfoPlistValueAction.run(key: 'AppFeedback_SlackApiToken', value: params[:slack_api_token], path: plist) SetInfoPlistValueAction.run(key: 'AppFeedback_SlackChannel', value: params[:slack_channel], path: plist) if other_action.git_branch SetInfoPlistValueAction.run(key: 'AppFeedback_Branch', value: other_action.git_branch, path: plist) end end |