mysigner 0.1.2 → 0.1.4

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.githooks/pre-commit +15 -0
  3. data/.githooks/pre-push +21 -0
  4. data/.github/workflows/ci.yml +29 -0
  5. data/.gitignore +4 -0
  6. data/.rubocop.yml +55 -0
  7. data/.rubocop_todo.yml +126 -0
  8. data/CHANGELOG.md +96 -0
  9. data/Gemfile +5 -3
  10. data/Gemfile.lock +38 -8
  11. data/README.md +14 -16
  12. data/Rakefile +5 -3
  13. data/bin/console +4 -3
  14. data/bin/setup +3 -0
  15. data/certificate_.cer +0 -0
  16. data/exe/mysigner +19 -2
  17. data/iOS_App_Store_Profile.mobileprovision +1 -0
  18. data/iOS_Distribution_Certificate.cer +1 -0
  19. data/lib/mysigner/build/android_executor.rb +83 -63
  20. data/lib/mysigner/build/android_parser.rb +33 -40
  21. data/lib/mysigner/build/configurator.rb +17 -16
  22. data/lib/mysigner/build/detector.rb +39 -50
  23. data/lib/mysigner/build/error_analyzer.rb +70 -68
  24. data/lib/mysigner/build/executor.rb +30 -37
  25. data/lib/mysigner/build/parser.rb +18 -18
  26. data/lib/mysigner/cleanup/private_keys_purger.rb +41 -0
  27. data/lib/mysigner/cli/auth_commands.rb +771 -764
  28. data/lib/mysigner/cli/build_commands.rb +962 -796
  29. data/lib/mysigner/cli/concerns/actionable_suggestions.rb +208 -154
  30. data/lib/mysigner/cli/concerns/api_helpers.rb +46 -54
  31. data/lib/mysigner/cli/concerns/error_handlers.rb +247 -237
  32. data/lib/mysigner/cli/concerns/helpers.rb +44 -1
  33. data/lib/mysigner/cli/diagnostic_commands.rb +667 -636
  34. data/lib/mysigner/cli/resource_commands.rb +1153 -985
  35. data/lib/mysigner/cli/validate_commands.rb +25 -25
  36. data/lib/mysigner/cli.rb +11 -1
  37. data/lib/mysigner/client.rb +27 -19
  38. data/lib/mysigner/config.rb +161 -60
  39. data/lib/mysigner/export/exporter.rb +38 -37
  40. data/lib/mysigner/signing/certificate_checker.rb +18 -23
  41. data/lib/mysigner/signing/gradle_signing_injector.rb +67 -0
  42. data/lib/mysigner/signing/keystore_manager.rb +81 -61
  43. data/lib/mysigner/signing/validator.rb +38 -40
  44. data/lib/mysigner/signing/wizard.rb +329 -342
  45. data/lib/mysigner/upload/app_store_automation.rb +96 -49
  46. data/lib/mysigner/upload/app_store_submission.rb +87 -92
  47. data/lib/mysigner/upload/asc_rest_uploader.rb +119 -0
  48. data/lib/mysigner/upload/play_store_uploader.rb +164 -144
  49. data/lib/mysigner/upload/uploader.rb +136 -115
  50. data/lib/mysigner/version.rb +3 -1
  51. data/lib/mysigner.rb +13 -11
  52. data/mysigner.gemspec +36 -33
  53. data/profile_.mobileprovision +0 -0
  54. data/test_manual.rb +37 -36
  55. metadata +44 -17
  56. data/.DS_Store +0 -0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xcodeproj'
2
4
 
3
5
  module Mysigner
@@ -32,8 +34,8 @@ module Mysigner
32
34
  def extension_targets
33
35
  @project.targets.select do |target|
34
36
  target.product_type&.include?('app-extension') ||
35
- target.product_type&.include?('widget-extension') ||
36
- target.product_type == 'com.apple.product-type.watchkit2-extension'
37
+ target.product_type&.include?('widget-extension') ||
38
+ target.product_type == 'com.apple.product-type.watchkit2-extension'
37
39
  end
38
40
  end
39
41
 
@@ -55,7 +57,7 @@ module Mysigner
55
57
  # Get detailed info about a target
56
58
  def target_info(target_name, configuration = 'Release')
57
59
  target = find_target(target_name)
58
-
60
+
59
61
  {
60
62
  name: target.name,
61
63
  type: product_type(target_name),
@@ -78,17 +80,18 @@ module Mysigner
78
80
  def target_platform(target_name = nil)
79
81
  target = find_target(target_name)
80
82
  sdk = target.sdk
81
-
83
+
82
84
  return :macos if sdk&.include?('macosx')
83
85
  return :tvos if sdk&.include?('appletvos')
84
86
  return :watchos if sdk&.include?('watchos')
85
- :ios # default
87
+
88
+ :ios # default
86
89
  end
87
90
 
88
91
  # Detect product type (app, framework, library)
89
92
  def product_type(target_name = nil)
90
93
  target = find_target(target_name)
91
-
94
+
92
95
  case target.product_type
93
96
  when 'com.apple.product-type.application'
94
97
  :app
@@ -114,9 +117,9 @@ module Mysigner
114
117
  def build_settings(target_name = nil, configuration = 'Release')
115
118
  target = find_target(target_name)
116
119
  config = target.build_configurations.find { |c| c.name == configuration }
117
-
120
+
118
121
  raise "Configuration '#{configuration}' not found" unless config
119
-
122
+
120
123
  config.build_settings
121
124
  end
122
125
 
@@ -160,7 +163,7 @@ module Mysigner
160
163
  def signing_configured?(target_name = nil, configuration = 'Release')
161
164
  profile = provisioning_profile(target_name, configuration)
162
165
  identity = code_sign_identity(target_name, configuration)
163
-
166
+
164
167
  !profile.to_s.empty? && !identity.to_s.empty?
165
168
  end
166
169
 
@@ -172,13 +175,11 @@ module Mysigner
172
175
 
173
176
  # Find a target by name (public method for use by other classes)
174
177
  def find_target(target_name)
175
- if target_name.nil?
176
- return main_target
177
- end
178
+ return main_target if target_name.nil?
178
179
 
179
180
  target = @project.targets.find { |t| t.name == target_name }
180
181
  raise "Target '#{target_name}' not found" unless target
181
-
182
+
182
183
  target
183
184
  end
184
185
 
@@ -187,13 +188,13 @@ module Mysigner
187
188
  # Workspace contains multiple projects
188
189
  # Get the main project (not Pods)
189
190
  workspace = Xcodeproj::Workspace.new_from_xcworkspace(@project_info[:path])
190
-
191
+
191
192
  project_ref = workspace.file_references.find do |ref|
192
193
  !ref.path.include?('Pods') && ref.path.end_with?('.xcodeproj')
193
194
  end
194
-
195
- raise "No main project found in workspace" unless project_ref
196
-
195
+
196
+ raise 'No main project found in workspace' unless project_ref
197
+
197
198
  project_path = File.join(File.dirname(@project_info[:path]), project_ref.path)
198
199
  Xcodeproj::Project.open(project_path)
199
200
  else
@@ -203,4 +204,3 @@ module Mysigner
203
204
  end
204
205
  end
205
206
  end
206
-
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module Mysigner
6
+ module Cleanup
7
+ class PrivateKeysPurger
8
+ LEGACY_DIRS = [
9
+ '~/.private_keys',
10
+ '~/.appstoreconnect/private_keys'
11
+ ].freeze
12
+
13
+ def marker_path
14
+ File.expand_path('~/.mysigner/.private_keys_purged')
15
+ end
16
+
17
+ def call
18
+ return if ENV['MYSIGNER_USE_LEGACY_ASC'] == '1'
19
+ return if File.exist?(marker_path)
20
+
21
+ LEGACY_DIRS.each do |dir|
22
+ expanded = File.expand_path(dir)
23
+ Dir.glob(File.join(expanded, 'AuthKey_*.p8')).each do |path|
24
+ File.delete(path)
25
+ warn "mysigner: deleted legacy private key #{path}" if ENV['MYSIGNER_VERBOSE'] == '1'
26
+ rescue Errno::ENOENT
27
+ # Raced with another process — already gone.
28
+ rescue Errno::EACCES, Errno::EPERM => e
29
+ # Owned by another user. Skip this file but keep going so the
30
+ # marker still gets written — otherwise the purger retries on
31
+ # every CLI invocation and keeps failing on the same file.
32
+ warn "mysigner: could not delete #{path} (#{e.class}); skipping" if ENV['MYSIGNER_VERBOSE'] == '1'
33
+ end
34
+ end
35
+
36
+ FileUtils.mkdir_p(File.dirname(marker_path))
37
+ FileUtils.touch(marker_path)
38
+ end
39
+ end
40
+ end
41
+ end