cocoapods-pod-sign 0.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc1215d9c1fb53ce2eebc417636ab87e7d9f1475c20cf734740ba3968f79f907
4
- data.tar.gz: 2d10fa10be40dd8627fae479bf8c68bd28515ba259d81ddb61d7442d020fd386
3
+ metadata.gz: e99c59f44c5d8cb30d08012c2ec57f4c74c910ed1453105fefc8cb6f6d528d50
4
+ data.tar.gz: 58f16caf31467198dcbe09b4aeccdf6d95b0372107edf1b88ec61d2951ac91b9
5
5
  SHA512:
6
- metadata.gz: 935fdf8b485184179d33be735f742df83111fa6caf6ea23bb501da6f871596e8b0130ee5f3ee55f6d85bda75eae35325e745640bf72f19269838df6060311784
7
- data.tar.gz: 1e751b60aa71c6ce2d3029c727bc708a5b5668a75f945fd66abb60c640d4e6c7e3c0733dd4447ca4231decb1b80d22ef784ddd6ee9c70576e441c7fd16c00c5b
6
+ metadata.gz: 05a1c9e66553050aa27cb1ea1169b1e990d9088421a8676133f8c75e7899fe09990cf5fa0b4ee5f13ed29b5271d6db31d84285d1c5a446d37239c20d4d6272cb
7
+ data.tar.gz: '047687cfc3d5b7d1e54ee35b4c55f612e2b7d71d408fdc38179afdbbc73c9c9b71958182254de357026ca4d47ee7b8c8370b8122d754c26e0fb4eebdd9eabfa2'
data/README.md CHANGED
@@ -18,10 +18,28 @@ Just write the following code into the Podfile, it will automatically read the b
18
18
 
19
19
  ### Manually
20
20
 
21
- You can also manually specify the bundle identifier and team under different configs. For example, I want to set the bundle identifier of the Debug config to com.xxx.app and the team to xxooxxoo.
21
+ You can also manually specify the bundle identifier and team under different configs. For example:
22
+
23
+ > Debug
24
+ bundle identifier: com.aaa.bbb
25
+ team: ABCDEFG
26
+
27
+ > Release
28
+ bundle identifier: com.ccc.ddd
29
+ team: HIJKLMN
30
+
31
+ > Profile
32
+ bundle identifier: com.xxx.eee
33
+ team: ASDFGHJ
34
+
35
+
22
36
 
23
37
  ```
24
38
  plugin 'cocoapods-pod-sign'
25
- config_pod_bundle_id_and_team_id({'Debug' => {:bundle_id => 'com.xxx.app', :team_id => 'xxooxxoo'}})
39
+ config_pod_bundle_id_and_team_id({
40
+ 'Debug' => {:bundle_id => 'com.aaa.bbb', :team_id => 'ABCDEFG'},
41
+ 'Release' => {:bundle_id => 'com.ccc.ddd', :team_id => 'HIJKLMN'},
42
+ 'Profile' => {:bundle_id => 'com.xxx.eee', :team_id => 'ASDFGHJ'}
43
+ })
26
44
  ```
27
45
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPodSign
2
- VERSION = "0.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -6,35 +6,42 @@ module Pod
6
6
  alias_method :origin_run_podfile_post_install_hook, :run_podfile_post_install_hook
7
7
  def run_podfile_post_install_hook
8
8
 
9
- if $pod_sign_configurations_hash.empty?
10
- pod_sign_extract_bundle_id_and_team_id_from_user_project
11
- end
9
+ pod_sign_extract_bundle_id_and_team_id_from_user_project if $pod_sign_configurations_hash.empty?
12
10
 
13
- if installation_options.generate_multiple_pod_projects
14
- targets = self.pod_target_subprojects.flat_map { |p| p.targets }
15
- else
16
- targets = self.pods_project.targets
17
- end
11
+ targets = if installation_options.generate_multiple_pod_projects
12
+ pod_target_subprojects.flat_map { |p| p.targets }
13
+ else
14
+ pods_project.targets
15
+ end
18
16
  targets.each do |target|
19
17
  target.build_configurations.each do |config|
20
18
  sign_config = $pod_sign_configurations_hash[config.name]
21
- if sign_config.instance_of?(Hash)
22
- config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = sign_config[:bundle_id]
23
- config.build_settings['DEVELOPMENT_TEAM'] = sign_config[:team_id]
24
- end
19
+ next unless sign_config.instance_of?(Hash)
20
+
21
+ config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = sign_config[:bundle_id]
22
+ config.build_settings['DEVELOPMENT_TEAM'] = sign_config[:team_id]
23
+ config.build_settings['CODE_SIGN_STYLE'] = if sign_config[:sign_style]
24
+ sign_config[:sign_style]
25
+ else
26
+ config.type == :debug ? 'Automatic' : 'Manual'
27
+ end
28
+ config.build_settings['CODE_SIGN_IDENTITY'] = if sign_config[:sign_identity]
29
+ sign_config[:sign_identity]
30
+ else
31
+ config.type == :debug ? 'Apple Development' : 'Apple Distribution'
32
+ end
25
33
  end
26
34
  end
27
35
 
28
36
  origin_run_podfile_post_install_hook
29
- return true
37
+ true
30
38
  end
31
39
 
32
40
  private
33
41
 
34
42
  def pod_sign_extract_bundle_id_and_team_id_from_user_project
35
- target = self.aggregate_targets.first.user_project.root_object.targets.first;
36
- if target
37
- target.build_configurations.each do |config|
43
+ target = aggregate_targets.first.user_project.root_object.targets.first
44
+ target&.build_configurations&.each do |config|
38
45
  xcconfig_hash ||=
39
46
  if config.base_configuration_reference.real_path.exist?
40
47
  Xcodeproj::Config.new(config.base_configuration_reference.real_path).to_hash
@@ -44,15 +51,20 @@ module Pod
44
51
  pod_sign_extract_bundle_id_and_team_id(xcconfig_hash, config.name)
45
52
  pod_sign_extract_bundle_id_and_team_id(config.build_settings, config.name)
46
53
  end
47
- end
48
54
  end
49
55
 
50
56
  def pod_sign_extract_bundle_id_and_team_id(build_settings, config_name)
51
57
  bundle_id = build_settings['PRODUCT_BUNDLE_IDENTIFIER']
52
58
  team_id = build_settings['DEVELOPMENT_TEAM']
53
- if bundle_id and team_id and config_name
54
- $pod_sign_configurations_hash[config_name] = {:bundle_id => bundle_id, :team_id => team_id}
55
- end
59
+ sign_style = build_settings['CODE_SIGN_STYLE']
60
+ sign_identity = build_settings['CODE_SIGN_IDENTITY']
61
+ return unless bundle_id && team_id && config_name
62
+
63
+ $pod_sign_configurations_hash[config_name] = { bundle_id: bundle_id,
64
+ team_id: team_id,
65
+ sign_style: sign_style,
66
+ sign_identity: sign_identity }
67
+
56
68
  end
57
69
  end
58
70
  end
@@ -7,20 +7,20 @@ module Pod
7
7
 
8
8
  def config_pod_bundle_id_and_team_id(configurations)
9
9
  unless configurations.instance_of?(Hash)
10
- UI.info "config_pod_bundle_id_and_team_id parameters not hash".red
10
+ UI.info 'config_pod_bundle_id_and_team_id parameters not hash'.red
11
11
  return
12
12
  end
13
13
  configurations.each do |name, configuration|
14
14
  unless configuration.instance_of?(Hash)
15
- UI.info "config_pod_bundle_id_and_team_id parameters not hash".red
15
+ UI.info 'config_pod_bundle_id_and_team_id parameters not hash'.red
16
16
  return
17
17
  end
18
- unless configuration[:bundle_id] and configuration[:team_id]
19
- UI.info "config_pod_bundle_id_and_team_id parameters parameters error".red
18
+ unless configuration[:bundle_id] && configuration[:team_id]
19
+ UI.info 'config_pod_bundle_id_and_team_id parameters parameters error'.red
20
20
  return
21
21
  end
22
22
  end
23
- UI.info "config_pod_bundle_id_and_team_id parameters setup success"
23
+ UI.info 'config_pod_bundle_id_and_team_id parameters setup success'
24
24
  $pod_sign_configurations_hash = configurations
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-pod-sign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - wosicuanqi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-04 00:00:00.000000000 Z
11
+ date: 2022-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler