Skip to content

Commit 7e3043c

Browse files
committed
realese 0.0.6 fix bug relating to folder merge on update
1 parent f640bea commit 7e3043c

File tree

4 files changed

+65
-32
lines changed

4 files changed

+65
-32
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To make your own nonky
1919
- Download the app
2020
- Open it
2121
- Click on the pin icon
22-
- select "Templates Directory..."
22+
- select "Templates Folder..."
2323
- Create a new folder with the \<name of your template\>
2424
- make the powerhouse index.html, style.css, script.js
2525
- create your design - follow the examples
@@ -29,7 +29,7 @@ To make your own nonky
2929
# the API
3030

3131
# RESTFull API
32-
There is a RESTFull API to get sistem information
32+
There is a RESTFull API to get system information
3333

3434
/api/cpus/:samplesNumber/:sampleTimeInMiliseconds
3535

@@ -97,7 +97,7 @@ It is very tempting adding an API for arbitrary shell command, its very easy to
9797

9898
# Building from source
9999

100-
# Install Dependencies
100+
# Dependencies
101101

102102
brew - https://brew.sh/
103103

appcast.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<channel>
33
<title>nonky</title>
44
<item>
5-
<title>0.0.5</title>
5+
<title>0.0.6</title>
66
<sparkle:releaseNotesLink>
7-
https://github.com/0i0/nonky/releases/tag/v0.0.5
7+
https://github.com/0i0/nonky/releases/tag/v0.0.6
88
</sparkle:releaseNotesLink>
99
<pubDate>Sat, 14 Oct 2017 23:50:11 +0300</pubDate>
1010
<sparkle:minimumSystemVersion>10.10</sparkle:minimumSystemVersion>
11-
<enclosure url="https://github.com/0i0/nonky/releases/download/v0.0.5/nonky-0.0.5.zip" sparkle:version="3" sparkle:shortVersionString="0.0.5" length="15788677" type="application/octet-stream" sparkle:dsaSignature="MCwCFGNei1KYGnv3oLBDqUirCTX6v7lGAhRn2PxuCdmjLV/5lGobZLMLd/e0hw=="/>
11+
<enclosure url="https://github.com/0i0/nonky/releases/download/v0.0.6/nonky-0.0.6.zip" sparkle:version="4" sparkle:shortVersionString="0.0.6" length="15788677" type="application/octet-stream" sparkle:dsaSignature="MCwCFDGt9mNhZG6W4EpeKko8VISH/52GAhRmBEe/pUCqSLXXtd5zpU80gkSLEQ=="/>
1212
</item>
1313
</channel></rss>

nonky/Info.plist

+23-23
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,44 @@
44
<dict>
55
<key></key>
66
<string></string>
7+
<key>CFBundleDevelopmentRegion</key>
8+
<string>$(DEVELOPMENT_LANGUAGE)</string>
9+
<key>CFBundleExecutable</key>
10+
<string>$(EXECUTABLE_NAME)</string>
11+
<key>CFBundleIconFile</key>
12+
<string></string>
713
<key>CFBundleIdentifier</key>
814
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
915
<key>CFBundleInfoDictionaryVersion</key>
1016
<string>6.0</string>
17+
<key>CFBundleName</key>
18+
<string>$(PRODUCT_NAME)</string>
19+
<key>CFBundlePackageType</key>
20+
<string>APPL</string>
1121
<key>CFBundleShortVersionString</key>
12-
<string>0.0.5</string>
22+
<string>0.0.6</string>
23+
<key>CFBundleVersion</key>
24+
<string>4</string>
1325
<key>LSBackgroundOnly</key>
1426
<false/>
15-
<key>CFBundleVersion</key>
16-
<string>1</string>
17-
<key>CFBundleExecutable</key>
18-
<string>$(EXECUTABLE_NAME)</string>
27+
<key>LSMinimumSystemVersion</key>
28+
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
29+
<key>LSUIElement</key>
30+
<true/>
1931
<key>NSAppTransportSecurity</key>
2032
<dict>
2133
<key>NSAllowsArbitraryLoads</key>
2234
<true/>
2335
</dict>
24-
<key>SUPublicDSAKeyFile</key>
25-
<string>dsa_pub.pem</string>
26-
<key>NSPrincipalClass</key>
27-
<string>NSApplication</string>
28-
<key>CFBundlePackageType</key>
29-
<string>APPL</string>
30-
<key>CFBundleIconFile</key>
31-
<string></string>
32-
<key>LSUIElement</key>
33-
<true/>
36+
<key>NSHumanReadableCopyright</key>
37+
<string>Copyright © 2017 Lior hakim.</string>
3438
<key>NSMainNibFile</key>
3539
<string>MainMenu</string>
36-
<key>LSMinimumSystemVersion</key>
37-
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
40+
<key>NSPrincipalClass</key>
41+
<string>NSApplication</string>
3842
<key>SUFeedURL</key>
3943
<string>https://raw.githubusercontent.com/0i0/nonky/master/appcast.xml</string>
40-
<key>CFBundleDevelopmentRegion</key>
41-
<string>$(DEVELOPMENT_LANGUAGE)</string>
42-
<key>NSHumanReadableCopyright</key>
43-
<string>Copyright © 2017 Lior hakim.</string>
44-
<key>CFBundleName</key>
45-
<string>$(PRODUCT_NAME)</string>
44+
<key>SUPublicDSAKeyFile</key>
45+
<string>dsa_pub.pem</string>
4646
</dict>
4747
</plist>

nonky/NOAppDelegate.m

+36-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
static NSString *const qBaseUrlValue = @"http://localhost:26498";
1515
static NSString *const qDefaultTemplates = @"default-templates";
1616

17+
static NSString *const qWasUpdated = @"was-updated";
18+
1719
@interface NOAppDelegate ()
1820

1921
@end
@@ -37,11 +39,12 @@ @implementation NOAppDelegate{
3739

3840
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
3941
templatesPath = [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @"/Library/Application Support/nonky/public/templates/"];
42+
userDefaults = [NSUserDefaults standardUserDefaults];
43+
[self setDefaultsIfNecessary];
4044
[self createAppDirectory];
4145
[self startServer];
4246
windows = [[NSMutableDictionary alloc] initWithCapacity:10];
43-
userDefaults = [NSUserDefaults standardUserDefaults];
44-
[self setDefaultsIfNecessary];
47+
4548
defaultTemplates = [[userDefaults objectForKey:qDefaultTemplates] mutableCopy];
4649
statusItem = [self addStatusItemToMenu: statusMenu];
4750
preferences = [[NOPreferencesController alloc]initWithWindowNibName:@"Preferences"];
@@ -53,6 +56,10 @@ -(void)setDefaultsIfNecessary{
5356
if ([userDefaults objectForKey:qDefaultTemplates] == nil) {
5457
NSDictionary *DefaultTemplates = [[NSDictionary alloc] initWithObjectsAndKeys:@"YES",@"jquery", nil];
5558
[userDefaults setObject:DefaultTemplates forKey:qDefaultTemplates];
59+
60+
}
61+
if ([userDefaults objectForKey:qWasUpdated] == nil) {
62+
[userDefaults setBool:NO forKey:qWasUpdated];
5663
}
5764
}
5865
- (NSStatusItem*)addStatusItemToMenu:(NSMenu*)menu
@@ -85,10 +92,36 @@ -(void)createAppDirectory{
8592
NSLog(@"Error: Create folder failed %@", userpath);
8693
userpath = [userpath stringByAppendingPathComponent:executableName]; // The file will go in this directory
8794
NSString *savePath = [userpath stringByAppendingPathComponent:@"public"];
95+
NSString *srcPath = [thisBundle pathForResource:@"public" ofType:nil];
8896

8997
if ([fileManager fileExistsAtPath:userpath] == NO){
9098
[fileManager createDirectoryAtPath:userpath withIntermediateDirectories:YES attributes:nil error:nil];
91-
[fileManager copyItemAtPath:[thisBundle pathForResource:@"public" ofType:nil] toPath:savePath error:NULL];
99+
[fileManager copyItemAtPath:srcPath toPath:savePath error:NULL];
100+
}else{
101+
if(![userDefaults boolForKey:qWasUpdated]){
102+
NSDirectoryEnumerator *de = [fileManager enumeratorAtPath:[thisBundle pathForResource:@"public" ofType:nil]];
103+
NSString *subPath;
104+
while ((subPath = [de nextObject])) {
105+
106+
NSLog(@" subPath: %@", subPath);
107+
NSString *srcFullPath = [srcPath stringByAppendingPathComponent:subPath];
108+
NSString *potentialDstPath = [savePath stringByAppendingPathComponent:subPath];
109+
110+
// Need to also check if file exists because if it doesn't, value of `isDirectory` is undefined.
111+
BOOL isDirectory = ([[NSFileManager defaultManager] fileExistsAtPath:srcFullPath isDirectory:&isDirectory] && isDirectory);
112+
113+
// Create directory, if doesn't exist
114+
if (isDirectory && [fileManager fileExistsAtPath:potentialDstPath] == NO) {
115+
NSLog(@" create directory");
116+
[fileManager createDirectoryAtPath:potentialDstPath withIntermediateDirectories:YES attributes:nil error:NULL];
117+
}
118+
if (!isDirectory && ![fileManager fileExistsAtPath:potentialDstPath]) {
119+
[fileManager copyItemAtPath:srcFullPath toPath:potentialDstPath error:NULL];
120+
121+
}
122+
}
123+
[userDefaults setBool:YES forKey:qWasUpdated];
124+
}
92125
}
93126
}
94127
-(void)startServer{

0 commit comments

Comments
 (0)