wtapack 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/wtapack/PlistManager.h +18 -0
- data/ext/wtapack/PlistManager.m +91 -0
- data/ext/wtapack/main.m +16 -4
- data/ext/wtapack/updateBundleID.h +1 -0
- data/lib/wtapack.rb +7 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 413f8bf6f6637084f59551cd1ec7a35cf2d1a28b
|
4
|
+
data.tar.gz: c64eb0a95247d0fc1f137897b7ef333d8bbd27c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cbb05c8a39e23ada0922b94ce43a70d1e075c16426667d0c66a8d5123754f3a9ff8943567d6407c2dcea35c6f858edc263270d85989331d0e7c7c95af772d09
|
7
|
+
data.tar.gz: 95683b033d7691d413d2cc200f97d47e86e24ffa8067ad7d1c4c671c2acfb1422f1ab35dc9223030085f18756009aa449fe7066fe9a6509d48fdfbae444bacaf
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//
|
2
|
+
// PlistManager.h
|
3
|
+
// WTAPackageApplication
|
4
|
+
//
|
5
|
+
// Created by Robert Thompson on 10/29/14.
|
6
|
+
// Copyright (c) 2014 WillowTree Apps. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
@import Foundation;
|
10
|
+
|
11
|
+
@interface PlistManager : NSObject
|
12
|
+
- (void)updateBundleID:(NSString*)newBundleID;
|
13
|
+
- (void)updateDisplayName:(NSString*)displayName;
|
14
|
+
|
15
|
+
- (void)commit;
|
16
|
+
|
17
|
+
- (instancetype)initWithURL:(NSURL*)bundleURL;
|
18
|
+
@end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
//
|
2
|
+
// PlistManager.m
|
3
|
+
// WTAPackageApplication
|
4
|
+
//
|
5
|
+
// Created by Robert Thompson on 10/13/14.
|
6
|
+
// Copyright (c) 2014 WillowTree Apps. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "PlistManager.h"
|
10
|
+
#import "ErrorHandler.h"
|
11
|
+
|
12
|
+
@interface PlistManager ()
|
13
|
+
@property (strong, nonatomic) NSMutableDictionary* infoPlist;
|
14
|
+
@property (strong, nonatomic) NSURL* bundleURL;
|
15
|
+
@property (nonatomic) BOOL needsSaving;
|
16
|
+
@property (nonatomic) NSPropertyListFormat format;
|
17
|
+
@end
|
18
|
+
|
19
|
+
@implementation PlistManager
|
20
|
+
- (instancetype)initWithURL:(NSURL*)bundleURL
|
21
|
+
{
|
22
|
+
self = [super init];
|
23
|
+
if (self)
|
24
|
+
{
|
25
|
+
NSFileManager* fm = [NSFileManager defaultManager];
|
26
|
+
|
27
|
+
NSURL* infoPlistURL = [bundleURL URLByAppendingPathComponent:@"Info.plist"];
|
28
|
+
NSData* infoPlistData = [fm contentsAtPath:infoPlistURL.path];
|
29
|
+
NSError* error = nil;
|
30
|
+
_infoPlist = [NSPropertyListSerialization propertyListWithData:infoPlistData
|
31
|
+
options:NSPropertyListMutableContainersAndLeaves
|
32
|
+
format:&_format
|
33
|
+
error:&error];
|
34
|
+
if (error)
|
35
|
+
{
|
36
|
+
[ErrorHandler fatalErrorWithError:error
|
37
|
+
additionalMessage:[NSString stringWithFormat:@"Failed to deserialize Info.plist in %@",
|
38
|
+
bundleURL.path]];
|
39
|
+
}
|
40
|
+
|
41
|
+
_needsSaving = NO;
|
42
|
+
_bundleURL = bundleURL;
|
43
|
+
}
|
44
|
+
|
45
|
+
return self;
|
46
|
+
}
|
47
|
+
|
48
|
+
- (void)updateBundleID:(NSString*)newBundleID
|
49
|
+
{
|
50
|
+
self.infoPlist[@"CFBundleIdentifier"] = newBundleID;
|
51
|
+
self.needsSaving = YES;
|
52
|
+
}
|
53
|
+
|
54
|
+
- (void)updateDisplayName:(NSString*)newDisplayName
|
55
|
+
{
|
56
|
+
self.infoPlist[@"CFBundleDisplayName"] = newDisplayName;
|
57
|
+
self.needsSaving = YES;
|
58
|
+
}
|
59
|
+
|
60
|
+
- (void)commit
|
61
|
+
{
|
62
|
+
if (self.needsSaving)
|
63
|
+
{
|
64
|
+
NSError* error = nil;
|
65
|
+
|
66
|
+
NSData* infoPlistData = [NSPropertyListSerialization dataWithPropertyList:self.infoPlist
|
67
|
+
format:self.format
|
68
|
+
options:0
|
69
|
+
error:&error];
|
70
|
+
if (error)
|
71
|
+
{
|
72
|
+
[ErrorHandler fatalErrorWithError:error
|
73
|
+
additionalMessage:[NSString stringWithFormat:@"Failed to serialize new Info.plist for %@",
|
74
|
+
self.bundleURL.path]];
|
75
|
+
}
|
76
|
+
|
77
|
+
NSURL* infoPlistURL = [self.bundleURL URLByAppendingPathComponent:@"Info.plist"];
|
78
|
+
|
79
|
+
BOOL success = [infoPlistData writeToURL:infoPlistURL
|
80
|
+
atomically:YES];
|
81
|
+
|
82
|
+
if (!success)
|
83
|
+
{
|
84
|
+
NSString* errorString = [NSString stringWithFormat:@"Failed to write new Info.plist in %@",
|
85
|
+
self.bundleURL.path];
|
86
|
+
[ErrorHandler fatalErrorWithMessage:errorString
|
87
|
+
exitCode:EX_CANTCREAT];
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
@end
|
data/ext/wtapack/main.m
CHANGED
@@ -9,9 +9,9 @@
|
|
9
9
|
@import Foundation;
|
10
10
|
#import "ProfileManager.h"
|
11
11
|
#import "CodeSigner.h"
|
12
|
-
#import "updateBundleID.h"
|
13
12
|
#import "NSArray+WTAMap.h"
|
14
13
|
#import "ErrorHandler.h"
|
14
|
+
#import "PlistManager.h"
|
15
15
|
#ifndef WTA_STANDALONE
|
16
16
|
#import <ruby.h>
|
17
17
|
#endif
|
@@ -136,12 +136,21 @@ int main(int argc, const char* argv[]) {
|
|
136
136
|
// therein.
|
137
137
|
ProfileManager* mainProfileManager = [[ProfileManager alloc] initWithKey:@"profile"
|
138
138
|
bundleURL:destApp];
|
139
|
+
PlistManager* appPlistManager = [[PlistManager alloc] initWithURL:destApp];
|
139
140
|
if (newBundleID)
|
140
141
|
{
|
141
142
|
// Sometimes we may not be changing the bundle ID
|
142
|
-
updateBundleID
|
143
|
+
[appPlistManager updateBundleID:newBundleID];
|
143
144
|
}
|
144
|
-
|
145
|
+
|
146
|
+
NSString* newDisplayName = [standardDefaults stringForKey:@"displayName"];
|
147
|
+
if (newDisplayName)
|
148
|
+
{
|
149
|
+
[appPlistManager updateDisplayName:newDisplayName];
|
150
|
+
}
|
151
|
+
|
152
|
+
[appPlistManager commit];
|
153
|
+
|
145
154
|
[mainProfileManager replaceEntitlements];
|
146
155
|
|
147
156
|
[mainProfileManager replaceProfile];
|
@@ -168,8 +177,11 @@ int main(int argc, const char* argv[]) {
|
|
168
177
|
{
|
169
178
|
NSString* extensionBundleName = [extension stringByReplacingOccurrencesOfString:@" " withString:@"-"];
|
170
179
|
NSString* newExtensionBundleID = [newBundleID stringByAppendingString:[NSString stringWithFormat:@".%@", extensionBundleName]];
|
180
|
+
PlistManager* extensionPlistManager = [[PlistManager alloc] initWithURL: extensionURL];
|
181
|
+
|
182
|
+
[extensionPlistManager updateBundleID: newExtensionBundleID];
|
171
183
|
|
172
|
-
|
184
|
+
[extensionPlistManager commit];
|
173
185
|
}
|
174
186
|
|
175
187
|
[extensionProfileManager replaceEntitlements];
|
data/lib/wtapack.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path('../wtapack.bundle', __FILE__)
|
|
2
2
|
|
3
3
|
module Wtapack
|
4
4
|
class Packer
|
5
|
-
attr_accessor :profile, :extensions, :input, :sign, :bundleID, :extension_profiles, :output
|
5
|
+
attr_accessor :profile, :extensions, :input, :sign, :bundleID, :displayName, :extension_profiles, :output
|
6
6
|
|
7
7
|
def pack
|
8
8
|
argv = ["wtapack", "-profile", "#{self.profile}", "-sign", "#{self.sign}", "-input", "\"#{self.input}\"", "-output", "\"#{self.output}\"", "-bundleID", "#{self.bundleID}"]
|
@@ -21,9 +21,13 @@ module Wtapack
|
|
21
21
|
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
unless self.displayName.nil?
|
26
|
+
argv = argv + ["-displayName", "\"#{self.displayName}\""]
|
26
27
|
end
|
28
|
+
# if self.extensions.nil?
|
29
|
+
# self.extensions = []
|
30
|
+
# end
|
27
31
|
|
28
32
|
argc = argv.count
|
29
33
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wtapack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Thompson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -39,6 +39,8 @@ files:
|
|
39
39
|
- ext/wtapack/ErrorHandler.m
|
40
40
|
- ext/wtapack/NSArray+WTAMap.h
|
41
41
|
- ext/wtapack/NSArray+WTAMap.m
|
42
|
+
- ext/wtapack/PlistManager.h
|
43
|
+
- ext/wtapack/PlistManager.m
|
42
44
|
- ext/wtapack/ProfileManager.h
|
43
45
|
- ext/wtapack/ProfileManager.m
|
44
46
|
- ext/wtapack/extconf.rb
|
@@ -68,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
70
|
version: '0'
|
69
71
|
requirements: []
|
70
72
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.
|
73
|
+
rubygems_version: 2.2.2
|
72
74
|
signing_key:
|
73
75
|
specification_version: 4
|
74
76
|
summary: Codesigning and ipa packaging
|