From 46c3a101250c28cb9d0b40931dcbde21644135a3 Mon Sep 17 00:00:00 2001 From: ozinthecloud Date: Sun, 24 May 2015 22:00:27 +1000 Subject: [PATCH] change fork with clone, and import with export, also change some button and message text to improve clarity --- .../ACGitRepositoryTests.m | 2 +- .../Classes/ACGitRepository.h | 2 +- .../Classes/ACGitRepository.m | 2 +- .../DataStores/ACCodeSnippetGitDataStore.m | 6 +- ...tRepositoryConfigurationWindowController.h | 2 +- ...tRepositoryConfigurationWindowController.m | 24 +++---- ...epositoryConfigurationWindowController.xib | 62 +++++++------------ README.md | 8 +-- 8 files changed, 47 insertions(+), 61 deletions(-) diff --git a/ACCodeSnippetRepository Tests/ACGitRepositoryTests.m b/ACCodeSnippetRepository Tests/ACGitRepositoryTests.m index 01c7061..3734921 100644 --- a/ACCodeSnippetRepository Tests/ACGitRepositoryTests.m +++ b/ACCodeSnippetRepository Tests/ACGitRepositoryTests.m @@ -23,7 +23,7 @@ - (void)testExample { ACGitRepository *git = [[ACGitRepository alloc] initWithLocalRepositoryDirectory:gitPath]; - //[git forkRemoteRepositoryWithURL:gitURL inDirectory:gitPath]; + //[git cloneRemoteRepositoryWithURL:gitURL inDirectory:gitPath]; //[git removeLocalRepository]; //NSLog(@"%@", [git identifierForCurrentCommit]); //NSLog(@"%@", [git changedFilesSinceCommitWithIdentifier:@"HEAD~6"]); diff --git a/ACCodeSnippetRepository/Classes/ACGitRepository.h b/ACCodeSnippetRepository/Classes/ACGitRepository.h index c16c951..9c84169 100644 --- a/ACCodeSnippetRepository/Classes/ACGitRepository.h +++ b/ACCodeSnippetRepository/Classes/ACGitRepository.h @@ -29,7 +29,7 @@ extern NSString * const ACGitRepositoryFileChangeUnmergedKey; - (void)initializeLocalRepository; - (void)initializeLocalRepositoryInDirectory:(NSString*)localRepositoryPath; -- (void)forkRemoteRepositoryWithURL:(NSURL*)remoteRepositoryURL inDirectory:(NSString*)localRepositoryPath; +- (void)cloneRemoteRepositoryWithURL:(NSURL*)remoteRepositoryURL inDirectory:(NSString*)localRepositoryPath; - (NSString*)identifierForCurrentCommit; diff --git a/ACCodeSnippetRepository/Classes/ACGitRepository.m b/ACCodeSnippetRepository/Classes/ACGitRepository.m index dd6a579..5329f2d 100644 --- a/ACCodeSnippetRepository/Classes/ACGitRepository.m +++ b/ACCodeSnippetRepository/Classes/ACGitRepository.m @@ -86,7 +86,7 @@ - (void)initializeLocalRepositoryInDirectory:(NSString*)localRepositoryPath { } } -- (void)forkRemoteRepositoryWithURL:(NSURL*)remoteRepositoryURL inDirectory:(NSString*)localRepositoryPath { +- (void)cloneRemoteRepositoryWithURL:(NSURL*)remoteRepositoryURL inDirectory:(NSString*)localRepositoryPath { if ( ![[NSFileManager defaultManager] fileExistsAtPath:localRepositoryPath] && remoteRepositoryURL) { diff --git a/ACCodeSnippetRepository/Classes/DataStores/ACCodeSnippetGitDataStore.m b/ACCodeSnippetRepository/Classes/DataStores/ACCodeSnippetGitDataStore.m index 588b553..adecf17 100644 --- a/ACCodeSnippetRepository/Classes/DataStores/ACCodeSnippetGitDataStore.m +++ b/ACCodeSnippetRepository/Classes/DataStores/ACCodeSnippetGitDataStore.m @@ -21,7 +21,7 @@ - (instancetype)init { - (id)initWithRemoteRepositoryURL:(NSURL*)remoteRepositoryURL { ACGitRepository *gitRepository = [[ACGitRepository alloc] initWithLocalRepositoryDirectory:self.localRepositoryPath]; if (remoteRepositoryURL && !gitRepository.localRepositoryExists) { - [gitRepository forkRemoteRepositoryWithURL:remoteRepositoryURL inDirectory:self.localRepositoryPath]; + [gitRepository cloneRemoteRepositoryWithURL:remoteRepositoryURL inDirectory:self.localRepositoryPath]; } return [self initWithGitRepository:gitRepository]; } @@ -58,7 +58,7 @@ - (void)setRemoteRepositoryURL:(NSURL *)remoteRepositoryURL { - (void)dataStoreWillAdd { NSLog(@"%@ dataStoreWillAdd", self); if (![self.gitRepository localRepositoryExists]) { - [self.gitRepository forkRemoteRepositoryWithURL:self.remoteRepositoryURL inDirectory:self.localRepositoryPath]; + [self.gitRepository cloneRemoteRepositoryWithURL:self.remoteRepositoryURL inDirectory:self.localRepositoryPath]; } } @@ -158,7 +158,7 @@ - (void)exportAllCodeSnippets { for (IDECodeSnippet *snippet in codeSnippetRepository.codeSnippets) { [self addFileInLocalRepositoryForSnippet:snippet overwrite:NO]; } - [self.gitRepository commitWithMessage:@"Imported user code snippets"]; + [self.gitRepository commitWithMessage:@"Pushed user code snippets"]; [self.gitRepository push]; } diff --git a/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.h b/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.h index 1c60f22..596a4b9 100644 --- a/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.h +++ b/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.h @@ -24,7 +24,7 @@ extern NSString * const ACCodeSnippetRepositoryUpdateRegularlyKey; @property (nonatomic, weak) id delegate; @property (nonatomic, weak) IBOutlet NSTextField *remoteRepositoryTextfield; -@property (nonatomic, weak) IBOutlet NSButton *forkRemoteRepositoryButton; +@property (nonatomic, weak) IBOutlet NSButton *cloneRemoteRepositoryButton; @property (nonatomic, weak) IBOutlet NSButton *importButton; @property (nonatomic, weak) IBOutlet NSPanel *progressPanel; diff --git a/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.m b/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.m index 104a5d1..5483705 100644 --- a/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.m +++ b/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.m @@ -58,9 +58,9 @@ - (void)controlTextDidChange:(NSNotification *)notification { NSTextField *textField = [notification object]; if (![[NSURL URLWithString:textField.stringValue] isEqualTo:self.gitDataStore.remoteRepositoryURL]) { - self.forkRemoteRepositoryButton.enabled = YES; + self.cloneRemoteRepositoryButton.enabled = YES; } else { - self.forkRemoteRepositoryButton.enabled = NO; + self.cloneRemoteRepositoryButton.enabled = NO; } if ([textField.stringValue length]) { @@ -77,13 +77,13 @@ - (IBAction)updateCheckboxAction:(NSButton*)button { } -- (IBAction)forkRemoteRepositoryAction:(id)sender { - - NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:@"Do you want to fork %@?", self.remoteRepositoryTextfield.stringValue] - defaultButton:@"Fork" +- (IBAction)cloneRemoteRepositoryAction:(id)sender { + + NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:@"Do you want to clone %@?", self.remoteRepositoryTextfield.stringValue] + defaultButton:@"Clone" alternateButton:@"Cancel" otherButton:nil - informativeTextWithFormat:@"This will remove all snippets from the current git repository and replace them with snippets from the new fork."]; + informativeTextWithFormat:@"All snippets from the current git repository will be removed from Xcode and replaced with snippets from the new cloned repository."]; __weak typeof(self)weakSelf = self; [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) { @@ -121,7 +121,7 @@ - (IBAction)forkRemoteRepositoryAction:(id)sender { [weakSelf.progressIndicator stopAnimation:weakSelf]; }); - [weakSelf importUserSnippetsAction:weakSelf]; + [weakSelf exportUserSnippetsAction:weakSelf]; }); break; @@ -155,12 +155,12 @@ - (void)backupUserSnippets { } } -- (IBAction)importUserSnippetsAction:(id)sender { - NSAlert *alert = [NSAlert alertWithMessageText:@"Do you want to import your existing user code snippets in the repository?" - defaultButton:@"Import" +- (IBAction)exportUserSnippetsAction:(id)sender { + NSAlert *alert = [NSAlert alertWithMessageText:@"Do you want to export (push) your existing user code snippets to the repository?" + defaultButton:@"Export" alternateButton:@"Cancel" otherButton:nil - informativeTextWithFormat:@"This will import all your user code snippets in the current git repository. System code snippets will not be imported."]; + informativeTextWithFormat:@"This will export all your user code snippets to the current git repository."]; __weak typeof(self)weakSelf = self; diff --git a/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.xib b/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.xib index f87b810..e2f0cd0 100644 --- a/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.xib +++ b/ACCodeSnippetRepository/Controllers/ACCodeSnippetRepositoryConfigurationWindowController.xib @@ -1,12 +1,13 @@ - + - + + - + @@ -16,18 +17,17 @@ - + - - + + - + - @@ -35,8 +35,7 @@ - - + @@ -51,7 +50,6 @@ - - + @@ -70,8 +67,7 @@ - - + Don't hesitate to contribute by submitting pull requests at @@ -81,8 +77,7 @@ https://github.com/acoomans/ACCodeSnippetRepositoryPlugin - - + @@ -90,8 +85,7 @@ https://github.com/acoomans/ACCodeSnippetRepositoryPlugin - @@ -169,8 +157,7 @@ https://github.com/acoomans/ACCodeSnippetRepositoryPlugin @@ -229,19 +215,19 @@ https://github.com/acoomans/ACCodeSnippetRepositoryPlugin + - + - diff --git a/README.md b/README.md index b86219b..f2e01bf 100644 --- a/README.md +++ b/README.md @@ -26,17 +26,17 @@ There should be a `Plug-ins` item in the xcode menu: ![screenshots](Screenshots/screenshot01.png) -First configure the plugin by forking a remote repository: +First configure the plugin by cloning a remote repository: ![screenshots](Screenshots/screenshot02.png) -When you fork, all snippets from the repository (with the right format, see below _Format_) will be imported in Xcode. Your existing snippets, that do not belong to any repository yet, will not be affected. +When you clone, all snippets from the repository (with the right format, see below _Format_) will be imported in Xcode. Your existing snippets, that do not belong to any repository yet, will not be affected. -After forking, you will given the choice to import (user) snippets from Xcode to the repository. +After cloning, you will given the choice to import (user) snippets from Xcode to the repository. Also, you can remove the system snippets if you don't use them. -In case of any problem (see below, _Bugs and limitations_), you can go to the user snippets folder and backup your user snippets. Note that user snippets are automatically backed up before any fork. +In case of any problem (see below, _Bugs and limitations_), you can go to the user snippets folder and backup your user snippets. Note that user snippets are automatically backed up before any clone. ## Usage