app-tools 1.17.1 → 1.17.2

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
  SHA1:
3
- metadata.gz: b34b424ddeb15d71514e98ce3ae3a933a5cd2a52
4
- data.tar.gz: 6489173a6908582776d84c477d74db162ade76d7
3
+ metadata.gz: d7418181eed0d491751761e1f201aafeef3a2388
4
+ data.tar.gz: 7d7f8acce95ab2aa638a935308eb81a7cfa00b94
5
5
  SHA512:
6
- metadata.gz: c073d7766f8b3c6ff87dc8183e3937b9419c2f69992e29748ca1b013fd1fd0085e8fc42bd5e2645891c484bc9ea5a00580eb44da3d253bfb75fe81d61895bf68
7
- data.tar.gz: 73f390a0af3dedb0405eb5eb5b7660d215624b212823dccd06fef5f3a319611e2e62cf10d9e960b3af0e75d2ef6c09f9f4af3822d491ee4a886713c7fb7a7edc
6
+ metadata.gz: a5111ed8303cf29a017dd7e6f0fbac5fd82c0c14ca98b667be43443121ba7e234ce06f6b6dcac1a7849e7d60edb634edda9477074f9618d8d68acb7fab867cad
7
+ data.tar.gz: ca8a9158c1229f9c0ab0aece3cb412700265d20966084f7f7c45760af94a8319f649c9513470dc060455340089893bd8bd490011b94cd71098fcf14698a0dc4a
data/bin/resignipa CHANGED
@@ -31,21 +31,20 @@ module AppTools
31
31
  exit_now! "Must supply a valid provisioning profile"
32
32
  end
33
33
 
34
- ## Extract the entitlements from the provisioning profile
34
+ info('Extract the entitlements from the provisioning profile')
35
35
  cms_xml = `security cms -D -i "#{profile_path}"`
36
36
  cms_data = CFPropertyList.native_types(CFPropertyList::List.new(:data => cms_xml).value)
37
37
  entitlements_data = cms_data["Entitlements"]
38
38
 
39
- ## Get the app PList
39
+ info('Extracting the app .plist information from the IPA')
40
40
  ipa_plist_data = nil
41
-
42
41
  Zip::File.open(ipa_path) do |zip_file|
43
42
  entry = zip_file.glob('Payload/*/Info.plist').first
44
43
  plist = CFPropertyList::List.new(:data => entry.get_input_stream.read)
45
44
  ipa_plist_data = CFPropertyList.native_types(plist.value)
46
45
  end
47
46
 
48
- ## Make sure app id and entitlements id match
47
+ info('Checking to make sure app id and entitlements id match')
49
48
  entitlements_app_id = entitlements_data["application-identifier"]
50
49
  ipa_app_id = ipa_plist_data["CFBundleIdentifier"]
51
50
 
@@ -53,25 +52,24 @@ module AppTools
53
52
  exit_now!("Entitlements app id #{entitlements_app_id} doesn't match Info.plist identifier #{ipa_app_id}")
54
53
  end
55
54
 
56
- ## Creating a temp dir to work in
57
55
  temp_dir = File.join(File.dirname(ipa_path), ipa_basename[0...-4] + '.resignipa.tmp')
58
- contents_dir = File.join(temp_dir, "Contents")
59
-
60
56
  FileUtils.rm_rf temp_dir
61
57
  FileUtils.mkdir temp_dir
58
+ info("Created a temp dir #{temp_dir}")
59
+
60
+ contents_dir = File.join(temp_dir, "Contents")
62
61
 
63
- ## Unzip the existing IPA into the temp dir
64
62
  `unzip #{ipa_path} -d #{contents_dir}`
63
+ info("Unzipped the existing IPA into #{contents_dir}")
65
64
 
66
- ## Get all dirs to be signed
67
- # See http://www.xgiovio.com/blog-photos-videos-other/blog/resign-your-ios-ipa-frameworks-and-plugins-included/
68
65
  payload_dir = File.join(contents_dir, "Payload")
66
+ info("Created payload directory #{payload_dir}")
69
67
 
70
- ## Embed the new provisioning profile
68
+ info("Embedding the new provisioning profile #{profile_path}")
71
69
  app_dir = `find -d #{payload_dir} -name \\*.app`.split("\n")
72
70
  FileUtils.cp profile_path, File.join(app_dir, "embedded.mobileprovision")
73
71
 
74
- ## Get the app entitlements if any
72
+ info("Getting associated-domain app entitlements, if any")
75
73
  app_path = `find -d #{payload_dir} -name \\*.app`.chomp
76
74
  app_entitlements_xml = `codesign -d --entitlements :- #{app_path}`
77
75
 
@@ -81,16 +79,20 @@ module AppTools
81
79
  # TODO: What about other values?
82
80
  if entitlements_data.has_key? "com.apple.developer.associated-domains"
83
81
  entitlements_data["com.apple.developer.associated-domains"] = app_entitlements_data["com.apple.developer.associated-domains"]
82
+ info("Found and added associated-domain entitlements")
84
83
  end
84
+ else
85
+ info("No associated-domain entitlements found")
85
86
  end
86
87
 
87
- ## Write the entitlements file
88
88
  entitlements_path = File.join(temp_dir, "entitlements.plist")
89
89
  File.write(entitlements_path,
90
90
  entitlements_data.to_plist(:plist_format => CFPropertyList::List::FORMAT_XML))
91
+ info("Wrote the entitlements file #{entitlements_path}")
91
92
 
92
- ## Resign all the frameworks and libraries first ...
93
- # http://stackoverflow.com/questions/25297638/how-do-i-codesign-a-swift-app-via-the-commandline
93
+ info("Resigning all the frameworks and libraries")
94
+ # See http://www.xgiovio.com/blog-photos-videos-other/blog/resign-your-ios-ipa-frameworks-and-plugins-included/
95
+ # and http://stackoverflow.com/questions/25297638/how-do-i-codesign-a-swift-app-via-the-commandline
94
96
  `find -d #{payload_dir} \\( -name \\*.framework -o -name \\*.dylib \\)`.split("\n").each do |sign_dir|
95
97
  # See https://github.com/fastlane/sigh/blob/master/lib/assets/resign.sh#L412
96
98
  pid = Process.spawn("codesign", "-f", "-s", certificate_name, sign_dir)
@@ -100,18 +102,18 @@ module AppTools
100
102
  end
101
103
  end
102
104
 
103
- ## ... then resign the app
105
+ info("Resigning the app")
104
106
  pid = Process.spawn("codesign", "-f", "-s", certificate_name, "--entitlements", entitlements_path, app_path)
105
107
  Process.wait(pid)
106
108
  unless $?.exitstatus == 0
107
109
  exit_now! "Failed to sign #{sign_dir}"
108
110
  end
109
111
 
110
- ## Repack
111
112
  new_ipa_dir = File.join(File.dirname(ipa_path), ipa_basename + '.' + [*('a'..'z'),*('0'..'9')].shuffle[0,8].join)
112
113
  new_ipa_path = File.expand_path(File.join(new_ipa_dir, File.basename(ipa_path)))
113
114
  FileUtils.rm_rf new_ipa_dir
114
115
  FileUtils.mkdir new_ipa_dir
116
+ info("Repacking #{new_ipa_path}")
115
117
 
116
118
  # NOTE: The zip tool...
117
119
  `cd #{contents_dir}; zip -r #{new_ipa_path} *`
@@ -1,3 +1,3 @@
1
1
  module AppTools
2
- VERSION = "1.17.1"
2
+ VERSION = "1.17.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.1
4
+ version: 1.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Lyon-Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-22 00:00:00.000000000 Z
11
+ date: 2016-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler