Class: DeployGate::Xcode::Analyze
- Inherits:
-
Object
- Object
- DeployGate::Xcode::Analyze
- Defined in:
- lib/deploygate/xcode/analyze.rb
Defined Under Namespace
Classes: BundleIdentifierDifferentError
Constant Summary collapse
- BASE_WORK_DIR_NAME =
'project.xcworkspace'
- DEFAULT_BUILD_CONFIGURATION =
'Release'
- PROVISIONING_STYLE_AUTOMATIC =
'Automatic'
- PROVISIONING_STYLE_MANUAL =
'Manual'
Instance Attribute Summary collapse
-
#build_workspace ⇒ Object
readonly
Returns the value of attribute build_workspace.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#scheme_workspace ⇒ Object
readonly
Returns the value of attribute scheme_workspace.
-
#workspaces ⇒ Object
readonly
Returns the value of attribute workspaces.
Instance Method Summary collapse
- #convert_bundle_identifier(bundle_identifier) ⇒ String
- #initialize(workspaces, build_configuration = nil, target_scheme = nil) ⇒ DeployGate::Xcode::Analyze constructor
- #provisioning_style ⇒ Object
- #provisioning_team ⇒ Object
-
#target_bundle_identifier ⇒ String
Support Xcode7 more.
- #target_xcode_setting_provisioning_profile_uuid ⇒ String
Constructor Details
#initialize(workspaces, build_configuration = nil, target_scheme = nil) ⇒ DeployGate::Xcode::Analyze
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/deploygate/xcode/analyze.rb', line 19 def initialize(workspaces, build_configuration = nil, target_scheme = nil) @workspaces = workspaces @build_configuration = build_configuration || DEFAULT_BUILD_CONFIGURATION @scheme_workspace = find_scheme_workspace(workspaces) @build_workspace = find_build_workspace(workspaces) @xcodeproj = File.dirname(@scheme_workspace) config = FastlaneCore::Configuration.create(Gym::Options., { workspace: @scheme_workspace }) project = FastlaneCore::Project.new(config) if project.schemes.length > 1 && target_scheme && project.schemes.include?(target_scheme) project.[:scheme] = target_scheme else project.select_scheme end @scheme = project.[:scheme] end |
Instance Attribute Details
#build_workspace ⇒ Object (readonly)
Returns the value of attribute build_workspace.
4 5 6 |
# File 'lib/deploygate/xcode/analyze.rb', line 4 def build_workspace @build_workspace end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
4 5 6 |
# File 'lib/deploygate/xcode/analyze.rb', line 4 def scheme @scheme end |
#scheme_workspace ⇒ Object (readonly)
Returns the value of attribute scheme_workspace.
4 5 6 |
# File 'lib/deploygate/xcode/analyze.rb', line 4 def scheme_workspace @scheme_workspace end |
#workspaces ⇒ Object (readonly)
Returns the value of attribute workspaces.
4 5 6 |
# File 'lib/deploygate/xcode/analyze.rb', line 4 def workspaces @workspaces end |
Instance Method Details
#convert_bundle_identifier(bundle_identifier) ⇒ String
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/deploygate/xcode/analyze.rb', line 73 def convert_bundle_identifier(bundle_identifier) new_bundle_identifier = bundle_identifier.gsub(/\$\(([^\)]+)\)|\${([^}]+)}/) { custom_id = $1 || $2 if custom_id == 'TARGET_NAME' target_project_setting.name else target_build_configration.build_settings[custom_id] end } # bail out if the result identical to the original return bundle_identifier if new_bundle_identifier == bundle_identifier convert_bundle_identifier(new_bundle_identifier) end |
#provisioning_style ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/deploygate/xcode/analyze.rb', line 94 def provisioning_style target = target_provisioning_info build_settings = target_build_configration.build_settings style = PROVISIONING_STYLE_MANUAL if target # Manual or Automatic or nil (Xcode7 below) begin style = target['ProvisioningStyle'] || build_settings['CODE_SIGN_STYLE'] rescue # Not catch error end end style end |
#provisioning_team ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/deploygate/xcode/analyze.rb', line 111 def provisioning_team target = target_provisioning_info team = nil if target begin team = target['DevelopmentTeam'] rescue # Not catch error end end team end |
#target_bundle_identifier ⇒ String
Support Xcode7 more
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 69 |
# File 'lib/deploygate/xcode/analyze.rb', line 39 def target_bundle_identifier begin product_name = target_product_name product_bundle_identifier = target_build_configration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] product_bundle_identifier = convert_bundle_identifier(product_bundle_identifier) info_plist_file_path = target_build_configration.build_settings['INFOPLIST_FILE'] root_path = DeployGate::Xcode::Ios.project_root_path(@scheme_workspace) plist_bundle_identifier = File.open(File.join(root_path, info_plist_file_path)) do |file| plist = Plist.parse_xml file.read plist['CFBundleIdentifier'] end plist_bundle_identifier = convert_bundle_identifier(plist_bundle_identifier) bundle_identifier = if plist_bundle_identifier.blank? product_bundle_identifier else plist_bundle_identifier end bundle_identifier.gsub!(/\$\(PRODUCT_NAME:.+\)/, product_name) rescue BundleIdentifierDifferentError => e raise e rescue => e cli = HighLine.new puts I18n.t('xcode.analyze.target_bundle_identifier.prompt') bundle_identifier = cli.ask(I18n.t('xcode.analyze.target_bundle_identifier.ask')) { |q| q.validate = /^(\w+)\.(\w+).*\w$/ } end bundle_identifier end |
#target_xcode_setting_provisioning_profile_uuid ⇒ String
89 90 91 92 |
# File 'lib/deploygate/xcode/analyze.rb', line 89 def target_xcode_setting_provisioning_profile_uuid uuid = target_build_configration.build_settings['PROVISIONING_PROFILE'] UUID.validate(uuid) ? uuid : nil end |