Skip to content

Commit 1eecf38

Browse files
committedFeb 4, 2019
Merge branch 'develop'
2 parents 38812e4 + 535dad3 commit 1eecf38

25 files changed

+956
-113
lines changed
 

‎README.md

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Download Vagrant Manager from the [GitHub Releases Page](https://github.com/lana
1616
* Currently, vagrant machines must already be initialized in order for Vagrant Manager to detect them. Make sure you have run vagrant init on any machine you want to appear in Vagrant Manager. Once Vagrant Manager has detected a machine, you can bookmark it so that it will not disappear when you destroy the machine. You can also manually add a bookmark and specify the path to your Vagrantfile.
1717
* Vagrant Manager requires OS X 10.8 Mountain Lion or higher
1818

19+
## Building DMG
20+
* Use [appdmg](https://github.com/LinusU/node-appdmg) to build the distribution DMG.
21+
* Put the `Vagrant Manager.app` file in the `dmg` foler
22+
* Run `appdmg dmg/appdmg.json <outputfile>`
23+
1924
## Contributing to Vagrant Manager
2025

2126
We love code contributions! If you would like to contribute, here are some notes and guidlines:

‎Vagrant Manager.xcodeproj/project.pbxproj

+36
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@
105105
B150013319249FFD000A76E7 /* status_icon_off@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B150013119249FFD000A76E7 /* status_icon_off@2x.png */; };
106106
B150013419249FFD000A76E7 /* status_icon_on@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B150013219249FFD000A76E7 /* status_icon_on@2x.png */; };
107107
B15001361924A02C000A76E7 /* status_icon_suspended@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B15001351924A02C000A76E7 /* status_icon_suspended@2x.png */; };
108+
B15C0D3D22077EA900755337 /* ManageCustomProvidersWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = B15C0D3A22077EA800755337 /* ManageCustomProvidersWindow.m */; };
109+
B15C0D3E22077EA900755337 /* ManageCustomProvidersWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = B15C0D3C22077EA900755337 /* ManageCustomProvidersWindow.xib */; };
110+
B15C0D4422077FA600755337 /* CustomProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = B15C0D4022077FA600755337 /* CustomProvider.m */; };
111+
B15C0D4522077FA600755337 /* CustomProviderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B15C0D4322077FA600755337 /* CustomProviderManager.m */; };
112+
B15C0D512207B1C600755337 /* VagrantInstanceCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B15C0D502207B1C600755337 /* VagrantInstanceCache.m */; };
108113
B1761B3D1A00C0140056582F /* NativeMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = B1761B3C1A00C0140056582F /* NativeMenuItem.m */; };
109114
B17AA18B1887A75300B4C274 /* Util.m in Sources */ = {isa = PBXBuildFile; fileRef = B17AA18A1887A75300B4C274 /* Util.m */; };
110115
B17AA18F1887CA4600B4C274 /* PreferencesWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = B17AA18D1887CA4600B4C274 /* PreferencesWindow.m */; };
@@ -277,6 +282,15 @@
277282
B150013119249FFD000A76E7 /* status_icon_off@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "status_icon_off@2x.png"; sourceTree = "<group>"; };
278283
B150013219249FFD000A76E7 /* status_icon_on@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "status_icon_on@2x.png"; sourceTree = "<group>"; };
279284
B15001351924A02C000A76E7 /* status_icon_suspended@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "status_icon_suspended@2x.png"; sourceTree = "<group>"; };
285+
B15C0D3A22077EA800755337 /* ManageCustomProvidersWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ManageCustomProvidersWindow.m; sourceTree = "<group>"; };
286+
B15C0D3B22077EA800755337 /* ManageCustomProvidersWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManageCustomProvidersWindow.h; sourceTree = "<group>"; };
287+
B15C0D3C22077EA900755337 /* ManageCustomProvidersWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ManageCustomProvidersWindow.xib; sourceTree = "<group>"; };
288+
B15C0D4022077FA600755337 /* CustomProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomProvider.m; sourceTree = "<group>"; };
289+
B15C0D4122077FA600755337 /* CustomProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomProvider.h; sourceTree = "<group>"; };
290+
B15C0D4222077FA600755337 /* CustomProviderManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomProviderManager.h; sourceTree = "<group>"; };
291+
B15C0D4322077FA600755337 /* CustomProviderManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomProviderManager.m; sourceTree = "<group>"; };
292+
B15C0D4F2207B1C600755337 /* VagrantInstanceCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VagrantInstanceCache.h; sourceTree = "<group>"; };
293+
B15C0D502207B1C600755337 /* VagrantInstanceCache.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VagrantInstanceCache.m; sourceTree = "<group>"; };
280294
B1761B3B1A00C0140056582F /* NativeMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeMenuItem.h; sourceTree = "<group>"; };
281295
B1761B3C1A00C0140056582F /* NativeMenuItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NativeMenuItem.m; sourceTree = "<group>"; };
282296
B17AA1891887A75300B4C274 /* Util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Util.h; sourceTree = "<group>"; };
@@ -376,6 +390,9 @@
376390
837A30861A5D0D5500E12A40 /* ManageCustomCommandsWindow.h */,
377391
837A30871A5D0D5500E12A40 /* ManageCustomCommandsWindow.m */,
378392
837A30881A5D0D5500E12A40 /* ManageCustomCommandsWindow.xib */,
393+
B15C0D3B22077EA800755337 /* ManageCustomProvidersWindow.h */,
394+
B15C0D3A22077EA800755337 /* ManageCustomProvidersWindow.m */,
395+
B15C0D3C22077EA900755337 /* ManageCustomProvidersWindow.xib */,
379396
832B4C3A1A5FA24B0027A3BA /* BaseWindowController.h */,
380397
832B4C3B1A5FA24B0027A3BA /* BaseWindowController.m */,
381398
);
@@ -442,6 +459,7 @@
442459
children = (
443460
2609ECF31BC89CEA00E4B44E /* NFSScanner.h */,
444461
2609ECF41BC89CEA00E4B44E /* NFSScanner.m */,
462+
B15C0D3F22077EF700755337 /* Custom Providers */,
445463
837A308B1A5D170D00E12A40 /* Custom Commands */,
446464
83F5BBB41983B8FB00ACE853 /* Vagrant Manager */,
447465
83F5BBB51983B90800ACE853 /* Providers */,
@@ -464,6 +482,8 @@
464482
83E7CAB31928C2E9001C86F6 /* VirtualMachineInfo.m */,
465483
830BAC331A0F278D00AE5F9C /* VagrantGlobalStatusScanner.h */,
466484
830BAC341A0F278D00AE5F9C /* VagrantGlobalStatusScanner.m */,
485+
B15C0D4F2207B1C600755337 /* VagrantInstanceCache.h */,
486+
B15C0D502207B1C600755337 /* VagrantInstanceCache.m */,
467487
);
468488
name = "Vagrant Manager";
469489
sourceTree = "<group>";
@@ -623,6 +643,17 @@
623643
name = "Supporting Files";
624644
sourceTree = "<group>";
625645
};
646+
B15C0D3F22077EF700755337 /* Custom Providers */ = {
647+
isa = PBXGroup;
648+
children = (
649+
B15C0D4122077FA600755337 /* CustomProvider.h */,
650+
B15C0D4022077FA600755337 /* CustomProvider.m */,
651+
B15C0D4222077FA600755337 /* CustomProviderManager.h */,
652+
B15C0D4322077FA600755337 /* CustomProviderManager.m */,
653+
);
654+
name = "Custom Providers";
655+
sourceTree = "<group>";
656+
};
626657
B1761B3A1A00BE580056582F /* Native */ = {
627658
isa = PBXGroup;
628659
children = (
@@ -733,6 +764,7 @@
733764
B150013419249FFD000A76E7 /* status_icon_on@2x.png in Resources */,
734765
8339DCA2187E756B0036E162 /* TaskOutputWindow.xib in Resources */,
735766
83C4CDE41A060B3600611DCC /* reload.png in Resources */,
767+
B15C0D3E22077EA900755337 /* ManageCustomProvidersWindow.xib in Resources */,
736768
2609ECF91BC8A05100E4B44E /* rdp.png in Resources */,
737769
B17AA1901887CA4600B4C274 /* PreferencesWindow.xib in Resources */,
738770
B150012E19249CA2000A76E7 /* vagrant_logo_on-flat@2x.png in Resources */,
@@ -857,15 +889,19 @@
857889
buildActionMask = 2147483647;
858890
files = (
859891
83DB673719288DD90008CB57 /* VagrantInstance.m in Sources */,
892+
B15C0D4522077FA600755337 /* CustomProviderManager.m in Sources */,
860893
83103A571982180C00B340BB /* ParallelsServiceProvider.m in Sources */,
894+
B15C0D4422077FA600755337 /* CustomProvider.m in Sources */,
861895
83E7CAB41928C2E9001C86F6 /* VirtualMachineInfo.m in Sources */,
862896
83FD354819827545002EEA2D /* BookmarkManager.m in Sources */,
863897
83DB673A1928AC0C0008CB57 /* VagrantMachine.m in Sources */,
898+
B15C0D3D22077EA900755337 /* ManageCustomProvidersWindow.m in Sources */,
864899
837A30911A5D177A00E12A40 /* CustomCommandManager.m in Sources */,
865900
B1357A84187CEB3B00811CBC /* AppDelegate.m in Sources */,
866901
83103A5A19821A9E00B340BB /* ParallelsMachineInfo.m in Sources */,
867902
8360A05A18C2B39B002EA89B /* Environment.m in Sources */,
868903
8308E14018869FAC001E0B45 /* Bookmark.m in Sources */,
904+
B15C0D512207B1C600755337 /* VagrantInstanceCache.m in Sources */,
869905
83DB673D1928B3510008CB57 /* VagrantManager.m in Sources */,
870906
8308E132188662BD001E0B45 /* AboutWindow.m in Sources */,
871907
B1761B3D1A00C0140056582F /* NativeMenuItem.m in Sources */,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

‎Vagrant Manager/AppDelegate.m

+53-36
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import "VagrantInstance.h"
1212
#import "BookmarkManager.h"
1313
#import "CustomCommandManager.h"
14+
#import "CustomProviderManager.h"
1415

1516
@implementation AppDelegate {
1617
BOOL isRefreshingVagrantMachines;
@@ -58,6 +59,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
5859

5960
[[BookmarkManager sharedManager] loadBookmarks];
6061
[[CustomCommandManager sharedManager] loadCustomCommands];
62+
[[CustomProviderManager sharedManager] loadCustomProviders];
6163

6264
//initialize updates
6365
[[SUUpdater sharedUpdater] setDelegate:self];
@@ -423,9 +425,9 @@ - (void)checkForVagrantUpdates:(BOOL)showAlert {
423425

424426
- (void)editHostsFile {
425427
NSString *terminalEditorName = [[NSUserDefaults standardUserDefaults] valueForKey:@"terminalEditorPreference"];
426-
427428
NSString *terminalEditor;
428-
if([@[@"vim", @"emacs", @"nano"] containsObject:terminalEditorName]) {
429+
430+
if([@[@"vim", @"emacs", @"nano", @"micro"] containsObject:terminalEditorName]) {
429431
terminalEditor = terminalEditorName;
430432
} else {
431433
terminalEditor = @"nano";
@@ -612,42 +614,44 @@ - (void)runTerminalCommand:(NSString*)command {
612614
NSString *s;
613615
if ([terminalName isEqualToString:@"iTerm"]) {
614616
s = [NSString stringWithFormat:
615-
@"set v2_script to \"\n"
616-
"tell application \\\"iTerm\\\"\n"
617-
"tell current terminal\n"
618-
"launch session \\\"Default Session\\\"\n"
619-
"delay 0.15\n"
620-
"activate\n"
621-
"tell the last session\n"
622-
"write text \\\"%@\\\"\n"
623-
"end tell\n"
624-
"end tell\n"
625-
"end tell\"\n"
626-
"set v3_script to \"\n"
627-
"tell application \\\"iTerm\\\"\n"
628-
"activate\n"
629-
"tell current window\n"
630-
"create tab with default profile\n"
631-
"tell current session\n"
632-
"write text \\\"%@\\\"\n"
633-
"end tell\n"
634-
"end tell\n"
635-
"end tell\"\n"
636-
637-
"if application \"iTerm\"'s version >= \"2.9\" then\n"
638-
"run script v3_script\n"
639-
"else\n"
640-
"run script v2_script\n"
641-
"end\n", command, command];
617+
@"if application \"iTerm\" is running then\n"
618+
"tell application \"iTerm\"\n"
619+
"tell current window\n"
620+
"create tab with default profile\n"
621+
"end tell\n"
622+
"end tell\n"
623+
"end if\n"
624+
"tell application \"iTerm\"\n"
625+
"activate\n"
626+
"tell current session of current window\n"
627+
"write text \"%@\"\n"
628+
"end tell\n"
629+
"end tell", command];
630+
} else if ([terminalName isEqualToString:@"Hyper"]) {
631+
s = [NSString stringWithFormat:
632+
@"tell application \"Hyper\"\n"
633+
"activate\n"
634+
"delay 2\n"
635+
"tell application \"System Events\"\n"
636+
"keystroke \"%@\"\n"
637+
"key code 36\n"
638+
"end tell\n"
639+
"end tell\n", command];
642640
} else {
643-
s = [NSString stringWithFormat:@"tell application \"Terminal\"\n"
644-
"activate\n"
645-
"do script \"%@\"\n"
641+
s = [NSString stringWithFormat:
642+
@"tell application \"Terminal\"\n"
643+
"activate\n"
644+
"do script \"%@\"\n"
646645
"end tell\n", command];
647646
}
648647

649648
NSAppleScript *as = [[NSAppleScript alloc] initWithSource: s];
650-
[as executeAndReturnError:nil];
649+
NSDictionary *errors = nil;
650+
[as executeAndReturnError:&errors];
651+
652+
if (errors) {
653+
[[NSAlert alertWithMessageText:@"There was an error performing the command" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", errors[NSAppleScriptErrorMessage]] runModal];
654+
}
651655
}
652656

653657
#pragma mark - Window management
@@ -662,18 +666,27 @@ - (void)addOpenWindow:(id)window {
662666
- (void)removeOpenWindow:(id)window {
663667
@synchronized(openWindows) {
664668
[openWindows removeObject:window];
665-
[self updateProcessType];
669+
[self updateProcessType:NO];
666670
}
667671
}
668672

669673
- (void)updateProcessType {
670-
if([[NSUserDefaults standardUserDefaults] boolForKey:@"haltOnExit"] || [openWindows count] > 0) {
674+
[self updateProcessType:YES];
675+
}
676+
677+
- (void)updateProcessType:(BOOL)bringToFront {
678+
if([[NSUserDefaults standardUserDefaults] boolForKey:@"haltOnExit"] || [openWindows count]) {
671679
ProcessSerialNumber psn = { 0, kCurrentProcess };
672680
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
673-
SetFrontProcess(&psn);
681+
[[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyRegular];
682+
683+
if (bringToFront) {
684+
SetFrontProcess(&psn);
685+
}
674686
} else {
675687
ProcessSerialNumber psn = { 0, kCurrentProcess };
676688
TransformProcessType(&psn, kProcessTransformToBackgroundApplication);
689+
[[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyAccessory];
677690
}
678691
}
679692

@@ -785,6 +798,10 @@ - (void)updaterDidNotFindUpdate:(SUUpdater *)update {
785798
[[NSNotificationCenter defaultCenter] postNotificationName:@"vagrant-manager.update-available" object:nil userInfo:@{@"is_update_available": [NSNumber numberWithBool:NO]}];
786799
}
787800

801+
- (void)updaterWillShowModalAlert:(SUUpdater *)updater {
802+
[NSApp activateIgnoringOtherApps:YES];
803+
}
804+
788805
- (id<SUVersionComparison>)versionComparatorForUpdater:(SUUpdater *)updater {
789806
return [[VersionComparison alloc] init];
790807
}

0 commit comments

Comments
 (0)
Please sign in to comment.