Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 610B5FF36 for ; Mon, 22 Apr 2013 20:18:38 +0000 (UTC) Received: (qmail 78559 invoked by uid 500); 22 Apr 2013 20:18:38 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 78505 invoked by uid 500); 22 Apr 2013 20:18:38 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 78126 invoked by uid 99); 22 Apr 2013 20:18:37 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Apr 2013 20:18:37 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 6C00981DD06; Mon, 22 Apr 2013 20:18:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: filmaj@apache.org To: commits@cordova.apache.org Date: Mon, 22 Apr 2013 20:18:49 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [13/15] git commit: moar tests moar tests Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/9e4033ca Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/9e4033ca Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/9e4033ca Branch: refs/heads/future Commit: 9e4033cac1500b7d752c21fd2ae87a855ea1cf8b Parents: e29b023 Author: Fil Maj Authored: Fri Apr 19 17:20:25 2013 -0700 Committer: Fil Maj Committed: Fri Apr 19 17:20:25 2013 -0700 ---------------------------------------------------------------------- README.md | 2 +- spec/install.spec.js | 89 ++ spec/plugins/ChildBrowser/plugin.xml | 95 ++ .../ChildBrowser/src/android/ChildBrowser.java | 19 + .../src/ios/ChildBrowser.bundle/arrow_left.png | Bin 0 -> 2946 bytes .../src/ios/ChildBrowser.bundle/arrow_left@2x.png | Bin 0 -> 2946 bytes .../src/ios/ChildBrowser.bundle/arrow_right.png | Bin 0 -> 2946 bytes .../src/ios/ChildBrowser.bundle/arrow_right@2x.png | Bin 0 -> 2946 bytes .../src/ios/ChildBrowser.bundle/but_refresh.png | Bin 0 -> 3369 bytes .../src/ios/ChildBrowser.bundle/but_refresh@2x.png | Bin 0 -> 3369 bytes .../src/ios/ChildBrowser.bundle/compass.png | Bin 0 -> 3035 bytes .../src/ios/ChildBrowser.bundle/compass@2x.png | Bin 0 -> 3035 bytes .../ChildBrowser/src/ios/ChildBrowserCommand.h | 49 + .../ChildBrowser/src/ios/ChildBrowserCommand.m | 86 ++ .../src/ios/ChildBrowserViewController.h | 73 ++ .../src/ios/ChildBrowserViewController.m | 239 ++++ .../src/ios/ChildBrowserViewController.xib | 875 +++++++++++++++ spec/plugins/ChildBrowser/src/ios/TargetDirTest.h | 20 + spec/plugins/ChildBrowser/src/ios/TargetDirTest.m | 1 + .../src/ios/preserveDirs/PreserveDirsTest.h | 20 + .../src/ios/preserveDirs/PreserveDirsTest.m | 1 + spec/plugins/ChildBrowser/www/childbrowser.js | 19 + .../ChildBrowser/www/childbrowser/image.jpg | 1 + .../ChildBrowser/www/childbrowser_file.html | 1 + spec/plugins/FaultyPlugin/plugin.xml | 3 +- spec/plugins/VariablePlugin/plugin.xml | 37 + spec/remove.spec.js | 30 + src/platforms/android.js | 8 +- src/platforms/blackberry.js | 2 +- src/platforms/ios.js | 2 +- 30 files changed, 1666 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index f9c6b03..622aee1 100644 --- a/README.md +++ b/README.md @@ -444,7 +444,7 @@ plugman can request users to specify variables required by a plugin. For example A preference tag will need to be present inside the platform tag to make the variable mandatory like so: - + plugman should check that these required preferences are passed in, and if not, should warn the user on how to pass the variable in and exit with a non-zero code. http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/install.spec.js ---------------------------------------------------------------------- diff --git a/spec/install.spec.js b/spec/install.spec.js index e69de29..d368111 100644 --- a/spec/install.spec.js +++ b/spec/install.spec.js @@ -0,0 +1,89 @@ +var install = require('../src/install'), + android = require('../src/platforms/android'), + plugman = require('../plugman'), + fs = require('fs'), + os = require('osenv'), + path = require('path'), + shell = require('shelljs'), + temp = path.join(os.tmpdir(), 'plugman'), + childbrowser = path.join(__dirname, 'plugins', 'ChildBrowser'), + variableplugin = path.join(__dirname, 'plugins', 'VariablePlugin'), + faultyplugin = path.join(__dirname, 'plugins', 'FaultyPlugin'), + android_one_project = path.join(__dirname, 'projects', 'android_one', '*'); + plugins_dir = path.join(temp, 'cordova', 'plugins'); + +describe('install', function() { + var copied_plugin_path = path.join(temp,'ChildBrowser'); + + beforeEach(function() { + shell.mkdir('-p', temp); + shell.mkdir('-p', plugins_dir); + }); + afterEach(function() { + shell.rm('-rf', temp); + }); + + describe('success', function() { + beforeEach(function() { + shell.cp('-rf', android_one_project, temp); + shell.cp('-rf', childbrowser, plugins_dir); + }); + + it('should call prepare after a successful install', function() { + var s = spyOn(plugman, 'prepare'); + console.log(path.resolve(path.join(plugins_dir, 'ChildBrowser', 'src', 'android'))); + install('android', temp, 'ChildBrowser', plugins_dir, {}); + //expect(s).toHaveBeenCalled(); + }); + it('on an Android project should call into Android module\'s handleInstall'); + it('on a BlackBerry project should call into BlackBerry module\'s handleInstall'); + it('on an iOS project should call into iOS module\'s handleInstall'); + }); + + describe('failure', function() { + it('should throw if platform is unrecognized', function() { + expect(function() { + install('atari', temp, 'SomePlugin', plugins_dir, {}); + }).toThrow('atari not supported.'); + }); + it('should throw if variables are missing', function() { + shell.cp('-rf', variableplugin, plugins_dir); + expect(function() { + install('android', temp, 'VariablePlugin', plugins_dir, {}); + }).toThrow('Variable(s) missing: API_KEY'); + }); + it('should throw if installation failed', function() { + shell.cp('-rf', android_one_project, temp); + shell.cp('-rf', faultyplugin, plugins_dir); + var didThrow = false; + try { + install('android', temp, 'FaultyPlugin', plugins_dir, {}); + } catch(e) { + didThrow = true; + expect(e.message).toMatch(/does not exist/); + } + expect(didThrow).toBe(true); + }); + it('should revert changes if installation failed', function() { + shell.cp('-rf', android_one_project, temp); + shell.cp('-rf', faultyplugin, plugins_dir); + var s = spyOn(android, 'forceUninstall'); + expect(function() { + install('android', temp, 'FaultyPlugin', plugins_dir, {}); + }).toThrow(); + expect(s).toHaveBeenCalled(); + }); + it('should throw an extra-long error if both installation and reversion failed', function() { + shell.cp('-rf', android_one_project, temp); + shell.cp('-rf', faultyplugin, plugins_dir); + var didThrow = false; + try { + install('android', temp, 'FaultyPlugin', plugins_dir, {}); + } catch(e) { + didThrow = true; + expect(e.message).toMatch(/reverting changes also caused issues!/); + } + expect(didThrow).toBe(true); + }); + }); +}); http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/plugin.xml ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/plugin.xml b/spec/plugins/ChildBrowser/plugin.xml new file mode 100644 index 0000000..9c87b06 --- /dev/null +++ b/spec/plugins/ChildBrowser/plugin.xml @@ -0,0 +1,95 @@ + + + + + + Child Browser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Please make sure you read this because it is very important to complete the installation of your plugin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/android/ChildBrowser.java ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/android/ChildBrowser.java b/spec/plugins/ChildBrowser/src/android/ChildBrowser.java new file mode 100644 index 0000000..5263b0c --- /dev/null +++ b/spec/plugins/ChildBrowser/src/android/ChildBrowser.java @@ -0,0 +1,19 @@ +/* + * + * Copyright 2013 Anis Kadri + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_left.png ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_left.png b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_left.png new file mode 100644 index 0000000..530e12b Binary files /dev/null and b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_left.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_left@2x.png ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_left@2x.png b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_left@2x.png new file mode 100644 index 0000000..530e12b Binary files /dev/null and b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_left@2x.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_right.png ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_right.png b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_right.png new file mode 100644 index 0000000..8b3d855 Binary files /dev/null and b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_right.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_right@2x.png ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_right@2x.png b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_right@2x.png new file mode 100644 index 0000000..8b3d855 Binary files /dev/null and b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/arrow_right@2x.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/but_refresh.png ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/but_refresh.png b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/but_refresh.png new file mode 100644 index 0000000..309b6bd Binary files /dev/null and b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/but_refresh.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/but_refresh@2x.png ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/but_refresh@2x.png b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/but_refresh@2x.png new file mode 100644 index 0000000..309b6bd Binary files /dev/null and b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/but_refresh@2x.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/compass.png ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/compass.png b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/compass.png new file mode 100644 index 0000000..46a8901 Binary files /dev/null and b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/compass.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/compass@2x.png ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/compass@2x.png b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/compass@2x.png new file mode 100644 index 0000000..46a8901 Binary files /dev/null and b/spec/plugins/ChildBrowser/src/ios/ChildBrowser.bundle/compass@2x.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowserCommand.h ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowserCommand.h b/spec/plugins/ChildBrowser/src/ios/ChildBrowserCommand.h new file mode 100644 index 0000000..6a23ab6 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/ChildBrowserCommand.h @@ -0,0 +1,49 @@ +/* + * + * Copyright 2013 Anis Kadri + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +// +// PhoneGap ! ChildBrowserCommand +// +// +// Created by Jesse MacFadyen on 10-05-29. +// Copyright 2010 Nitobi. All rights reserved. +// + +#import +#ifdef PHONEGAP_FRAMEWORK + #import +#else + #import "PGPlugin.h" +#endif +#import "ChildBrowserViewController.h" + + + +@interface ChildBrowserCommand : PGPlugin { + + ChildBrowserViewController* childBrowser; +} + +@property (nonatomic, retain) ChildBrowserViewController *childBrowser; + + +- (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; +-(void) onChildLocationChange:(NSString*)newLoc; + +@end http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowserCommand.m ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowserCommand.m b/spec/plugins/ChildBrowser/src/ios/ChildBrowserCommand.m new file mode 100644 index 0000000..38aaf64 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/ChildBrowserCommand.m @@ -0,0 +1,86 @@ +// + +// +// +// Created by Jesse MacFadyen on 10-05-29. +// Copyright 2010 Nitobi. All rights reserved. +// Copyright (c) 2011, IBM Corporation +// Copyright 2011, Randy McMillan +// + +#import "ChildBrowserCommand.h" + +#ifdef PHONEGAP_FRAMEWORK + #import +#else + #import "PhoneGapViewController.h" +#endif + + +@implementation ChildBrowserCommand + +@synthesize childBrowser; + +- (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url +{ + + if(childBrowser == NULL) + { + childBrowser = [[ ChildBrowserViewController alloc ] initWithScale:FALSE ]; + childBrowser.delegate = self; + } + +/* // TODO: Work in progress + NSString* strOrientations = [ options objectForKey:@"supportedOrientations"]; + NSArray* supportedOrientations = [strOrientations componentsSeparatedByString:@","]; +*/ + PhoneGapViewController* cont = (PhoneGapViewController*)[ super appViewController ]; + childBrowser.supportedOrientations = cont.supportedOrientations; + + if ([cont respondsToSelector:@selector(presentViewController)]) { + //Reference UIViewController.h Line:179 for update to iOS 5 difference - @RandyMcMillan + [cont presentViewController:childBrowser animated:YES completion:nil]; + } else { + [ cont presentModalViewController:childBrowser animated:YES ]; + } + + NSString *url = (NSString*) [arguments objectAtIndex:0]; + + [childBrowser loadURL:url ]; + +} + +-(void) close:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url +{ + [ childBrowser closeBrowser]; + +} + +-(void) onClose +{ + NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onClose();",@""]; + [self.webView stringByEvaluatingJavaScriptFromString:jsCallback]; +} + +-(void) onOpenInSafari +{ + NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onOpenExternal();",@""]; + [self.webView stringByEvaluatingJavaScriptFromString:jsCallback]; +} + + +-(void) onChildLocationChange:(NSString*)newLoc +{ + + NSString* tempLoc = [NSString stringWithFormat:@"%@",newLoc]; + NSString* encUrl = [tempLoc stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + + NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onLocationChange('%@');",encUrl]; + [self.webView stringByEvaluatingJavaScriptFromString:jsCallback]; + +} + + + + +@end http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.h ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.h b/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.h new file mode 100644 index 0000000..d6fc139 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.h @@ -0,0 +1,73 @@ +/* + * + * Copyright 2013 Anis Kadri + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +// +// ChildBrowserViewController.h +// +// Created by Jesse MacFadyen on 21/07/09. +// Copyright 2009 Nitobi. All rights reserved. +// + +#import + +@protocol ChildBrowserDelegate + + + +/* + * onChildLocationChanging:newLoc + * + * Discussion: + * Invoked when a new page has loaded + */ +-(void) onChildLocationChange:(NSString*)newLoc; +-(void) onOpenInSafari; +-(void) onClose; +@end + + +@interface ChildBrowserViewController : UIViewController < UIWebViewDelegate > { + IBOutlet UIWebView* webView; + IBOutlet UIBarButtonItem* closeBtn; + IBOutlet UIBarButtonItem* refreshBtn; + IBOutlet UILabel* addressLabel; + IBOutlet UIBarButtonItem* backBtn; + IBOutlet UIBarButtonItem* fwdBtn; + IBOutlet UIBarButtonItem* safariBtn; + IBOutlet UIActivityIndicatorView* spinner; + BOOL scaleEnabled; + BOOL isImage; + NSString* imageURL; + NSArray* supportedOrientations; + id delegate; +} + +@property (nonatomic, retain)id delegate; +@property (nonatomic, retain) NSArray* supportedOrientations; +@property(retain) NSString* imageURL; +@property(assign) BOOL isImage; + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation; +- (ChildBrowserViewController*)initWithScale:(BOOL)enabled; +- (IBAction)onDoneButtonPress:(id)sender; +- (IBAction)onSafariButtonPress:(id)sender; +- (void)loadURL:(NSString*)url; +-(void)closeBrowser; + +@end http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.m ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.m b/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.m new file mode 100644 index 0000000..167ef98 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.m @@ -0,0 +1,239 @@ +// +// ChildBrowserViewController.m +// +// Created by Jesse MacFadyen on 21/07/09. +// Copyright 2009 Nitobi. All rights reserved. +// Copyright (c) 2011, IBM Corporation +// Copyright 2011, Randy McMillan +// + +#import "ChildBrowserViewController.h" + + +@implementation ChildBrowserViewController + +@synthesize imageURL; +@synthesize supportedOrientations; +@synthesize isImage; +@synthesize delegate; + +/* + // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { + if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { + // Custom initialization + } + return self; +} +*/ + ++ (NSString*) resolveImageResource:(NSString*)resource +{ + NSString* systemVersion = [[UIDevice currentDevice] systemVersion]; + BOOL isLessThaniOS4 = ([systemVersion compare:@"4.0" options:NSNumericSearch] == NSOrderedAscending); + + // the iPad image (nor retina) differentiation code was not in 3.x, and we have to explicitly set the path + if (isLessThaniOS4) + { + return [NSString stringWithFormat:@"%@.png", resource]; + } + + return resource; +} + + +- (ChildBrowserViewController*)initWithScale:(BOOL)enabled +{ + self = [super init]; + + + scaleEnabled = enabled; + + return self; +} + +// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. +- (void)viewDidLoad { + [super viewDidLoad]; + + refreshBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/but_refresh"]]; + backBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_left"]]; + fwdBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_right"]]; + safariBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/compass"]]; + + webView.delegate = self; + webView.scalesPageToFit = TRUE; + webView.backgroundColor = [UIColor whiteColor]; + NSLog(@"View did load"); +} + + + + + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; + NSLog(@"View did UN-load"); +} + + +- (void)dealloc { + + webView.delegate = nil; + + [webView release]; + [closeBtn release]; + [refreshBtn release]; + [addressLabel release]; + [backBtn release]; + [fwdBtn release]; + [safariBtn release]; + [spinner release]; + [ supportedOrientations release]; + [super dealloc]; +} + +-(void)closeBrowser +{ + + if(delegate != NULL) + { + [delegate onClose]; + } + if ([self respondsToSelector:@selector(presentingViewController)]) { + //Reference UIViewController.h Line:179 for update to iOS 5 difference - @RandyMcMillan + [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil]; + } else { + [[self parentViewController] dismissModalViewControllerAnimated:YES]; + } +} + +-(IBAction) onDoneButtonPress:(id)sender +{ + [ self closeBrowser]; + + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]; + [webView loadRequest:request]; +} + + +-(IBAction) onSafariButtonPress:(id)sender +{ + + if(delegate != NULL) + { + [delegate onOpenInSafari]; + } + + if(isImage) + { + NSURL* pURL = [[ [NSURL alloc] initWithString:imageURL ] autorelease]; + [ [ UIApplication sharedApplication ] openURL:pURL ]; + } + else + { + NSURLRequest *request = webView.request; + [[UIApplication sharedApplication] openURL:request.URL]; + } + + +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation +{ + BOOL autoRotate = [self.supportedOrientations count] > 1; // autorotate if only more than 1 orientation supported + if (autoRotate) + { + if ([self.supportedOrientations containsObject: + [NSNumber numberWithInt:interfaceOrientation]]) { + return YES; + } + } + + return NO; +} + + + + +- (void)loadURL:(NSString*)url +{ + NSLog(@"Opening Url : %@",url); + + if( [url hasSuffix:@".png" ] || + [url hasSuffix:@".jpg" ] || + [url hasSuffix:@".jpeg" ] || + [url hasSuffix:@".bmp" ] || + [url hasSuffix:@".gif" ] ) + { + [ imageURL release ]; + imageURL = [url copy]; + isImage = YES; + NSString* htmlText = @""; + htmlText = [ htmlText stringByReplacingOccurrencesOfString:@"IMGSRC" withString:url ]; + + [webView loadHTMLString:htmlText baseURL:[NSURL URLWithString:@""]]; + + } + else + { + imageURL = @""; + isImage = NO; + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; + [webView loadRequest:request]; + } + webView.hidden = NO; +} + + +- (void)webViewDidStartLoad:(UIWebView *)sender { + addressLabel.text = @"Loading..."; + backBtn.enabled = webView.canGoBack; + fwdBtn.enabled = webView.canGoForward; + + [ spinner startAnimating ]; + +} + +- (void)webViewDidFinishLoad:(UIWebView *)sender +{ + NSURLRequest *request = webView.request; + NSLog(@"New Address is : %@",request.URL.absoluteString); + addressLabel.text = request.URL.absoluteString; + backBtn.enabled = webView.canGoBack; + fwdBtn.enabled = webView.canGoForward; + [ spinner stopAnimating ]; + + if(delegate != NULL) + { + [delegate onChildLocationChange:request.URL.absoluteString]; + } + +} + +- (void)webView:(UIWebView *)wv didFailLoadWithError:(NSError *)error { + NSLog (@"webView:didFailLoadWithError"); + [spinner stopAnimating]; + addressLabel.text = @"Failed"; + if (error != NULL) { + UIAlertView *errorAlert = [[UIAlertView alloc] + initWithTitle: [error localizedDescription] + message: [error localizedFailureReason] + delegate:nil + cancelButtonTitle:@"OK" + otherButtonTitles:nil]; + [errorAlert show]; + [errorAlert release]; + } +} + + +@end http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.xib ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.xib b/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.xib new file mode 100644 index 0000000..cc8dd65 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/ChildBrowserViewController.xib @@ -0,0 +1,875 @@ + + + + 768 + 10K540 + 851 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 141 + + + YES + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 292 + + YES + + + -2147483374 + {480, 229} + + + + 1 + MCAwIDAAA + + YES + YES + IBCocoaTouchFramework + 1 + YES + + + + 266 + {{0, 256}, {480, 44}} + + + NO + NO + IBCocoaTouchFramework + 1 + + YES + + IBCocoaTouchFramework + 1 + + 0 + + + IBCocoaTouchFramework + + 5 + + + IBCocoaTouchFramework + + + + IBCocoaTouchFramework + + 5 + + + IBCocoaTouchFramework + 32 + + + + IBCocoaTouchFramework + + 5 + + + IBCocoaTouchFramework + 32 + + + + IBCocoaTouchFramework + + 5 + + + IBCocoaTouchFramework + 32 + + + + IBCocoaTouchFramework + + 5 + + + + + + 270 + {{5, 230}, {418, 21}} + + + + 4 + MC42NjY2NjY2OSAwAA + + NO + YES + NO + IBCocoaTouchFramework + Loading... + + Helvetica + 13 + 16 + + + 3 + MQA + + + 1 + NO + 10 + + + + -2147483383 + {{454, 231}, {20, 20}} + + NO + NO + NO + IBCocoaTouchFramework + + + {{0, 20}, {480, 300}} + + + 3 + MC41AA + + 2 + + + + + 3 + + IBCocoaTouchFramework + + + + + YES + + + webView + + + + 17 + + + + addressLabel + + + + 18 + + + + backBtn + + + + 19 + + + + fwdBtn + + + + 22 + + + + refreshBtn + + + + 23 + + + + onDoneButtonPress: + + + + 26 + + + + reload + + + + 27 + + + + goBack + + + + 28 + + + + goForward + + + + 29 + + + + onSafariButtonPress: + + + + 31 + + + + view + + + + 35 + + + + spinner + + + + 36 + + + + safariBtn + + + + 40 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + + + 6 + + + YES + + + + + + + + + + + + + + + 7 + + + + + 8 + + + Bar Button Item (Reload) + + + 9 + + + Bar Button Item (Go Back) + + + 10 + + + Bar Button Item (Go Forward) + + + 11 + + + Bar Button Item (Safari) + + + 13 + + + + + 14 + + + + + 15 + + + + + 32 + + + + + 37 + + + + + 38 + + + + + 39 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 10.IBPluginDependency + 11.IBPluginDependency + 13.IBPluginDependency + 13.IBViewBoundsToFrameTransform + 14.IBPluginDependency + 15.IBPluginDependency + 32.IBPluginDependency + 32.IBViewBoundsToFrameTransform + 37.IBPluginDependency + 38.IBPluginDependency + 39.IBPluginDependency + 4.IBPluginDependency + 4.IBViewBoundsToFrameTransform + 6.IBPluginDependency + 6.IBViewBoundsToFrameTransform + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + ChildBrowserViewController + UIResponder + {{250, 643}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCoAAAwygAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABD5gAAw3kAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABB8AAAwwUAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAw10AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 40 + + + + YES + + ChildBrowserViewController + UIViewController + + YES + + YES + onDoneButtonPress: + onSafariButtonPress: + + + YES + id + id + + + + YES + + YES + onDoneButtonPress: + onSafariButtonPress: + + + YES + + onDoneButtonPress: + id + + + onSafariButtonPress: + id + + + + + YES + + YES + addressLabel + backBtn + closeBtn + delegate + fwdBtn + refreshBtn + safariBtn + spinner + webView + + + YES + UILabel + UIBarButtonItem + UIBarButtonItem + id + UIBarButtonItem + UIBarButtonItem + UIBarButtonItem + UIActivityIndicatorView + UIWebView + + + + YES + + YES + addressLabel + backBtn + closeBtn + delegate + fwdBtn + refreshBtn + safariBtn + spinner + webView + + + YES + + addressLabel + UILabel + + + backBtn + UIBarButtonItem + + + closeBtn + UIBarButtonItem + + + delegate + id + + + fwdBtn + UIBarButtonItem + + + refreshBtn + UIBarButtonItem + + + safariBtn + UIBarButtonItem + + + spinner + UIActivityIndicatorView + + + webView + UIWebView + + + + + IBProjectSource + Plugins/ChildBrowser/ChildBrowserViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIActivityIndicatorView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIActivityIndicatorView.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIToolbar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIToolbar.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + MediaPlayer.framework/Headers/MPMoviePlayerViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + UIWebView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIWebView.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + + 3 + 141 + + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/TargetDirTest.h ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/TargetDirTest.h b/spec/plugins/ChildBrowser/src/ios/TargetDirTest.h new file mode 100644 index 0000000..60a1403 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/TargetDirTest.h @@ -0,0 +1,20 @@ +/* + * + * Copyright 2013 Anis Kadri + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/TargetDirTest.m ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/TargetDirTest.m b/spec/plugins/ChildBrowser/src/ios/TargetDirTest.m new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/TargetDirTest.m @@ -0,0 +1 @@ + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/preserveDirs/PreserveDirsTest.h ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/preserveDirs/PreserveDirsTest.h b/spec/plugins/ChildBrowser/src/ios/preserveDirs/PreserveDirsTest.h new file mode 100644 index 0000000..60a1403 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/preserveDirs/PreserveDirsTest.h @@ -0,0 +1,20 @@ +/* + * + * Copyright 2013 Anis Kadri + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/src/ios/preserveDirs/PreserveDirsTest.m ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/src/ios/preserveDirs/PreserveDirsTest.m b/spec/plugins/ChildBrowser/src/ios/preserveDirs/PreserveDirsTest.m new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/spec/plugins/ChildBrowser/src/ios/preserveDirs/PreserveDirsTest.m @@ -0,0 +1 @@ + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/www/childbrowser.js ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/www/childbrowser.js b/spec/plugins/ChildBrowser/www/childbrowser.js new file mode 100644 index 0000000..5263b0c --- /dev/null +++ b/spec/plugins/ChildBrowser/www/childbrowser.js @@ -0,0 +1,19 @@ +/* + * + * Copyright 2013 Anis Kadri + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/www/childbrowser/image.jpg ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/www/childbrowser/image.jpg b/spec/plugins/ChildBrowser/www/childbrowser/image.jpg new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/spec/plugins/ChildBrowser/www/childbrowser/image.jpg @@ -0,0 +1 @@ +foo http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/ChildBrowser/www/childbrowser_file.html ---------------------------------------------------------------------- diff --git a/spec/plugins/ChildBrowser/www/childbrowser_file.html b/spec/plugins/ChildBrowser/www/childbrowser_file.html new file mode 100644 index 0000000..6de7b8c --- /dev/null +++ b/spec/plugins/ChildBrowser/www/childbrowser_file.html @@ -0,0 +1 @@ +This is a test file. http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/FaultyPlugin/plugin.xml ---------------------------------------------------------------------- diff --git a/spec/plugins/FaultyPlugin/plugin.xml b/spec/plugins/FaultyPlugin/plugin.xml index 26473d2..d7e21e9 100644 --- a/spec/plugins/FaultyPlugin/plugin.xml +++ b/spec/plugins/FaultyPlugin/plugin.xml @@ -50,7 +50,8 @@ value="com.phonegap.plugins.faultyplugin.FaultyPlugin"/> - + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/plugins/VariablePlugin/plugin.xml ---------------------------------------------------------------------- diff --git a/spec/plugins/VariablePlugin/plugin.xml b/spec/plugins/VariablePlugin/plugin.xml new file mode 100644 index 0000000..580c329 --- /dev/null +++ b/spec/plugins/VariablePlugin/plugin.xml @@ -0,0 +1,37 @@ + + + + + + Use Variables + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/spec/remove.spec.js ---------------------------------------------------------------------- diff --git a/spec/remove.spec.js b/spec/remove.spec.js index e69de29..444f420 100644 --- a/spec/remove.spec.js +++ b/spec/remove.spec.js @@ -0,0 +1,30 @@ +var remove = require('../src/remove'), + fetch = require('../src/fetch'), + fs = require('fs'), + os = require('osenv'), + path = require('path'), + shell = require('shelljs'), + temp = path.join(os.tmpdir(), 'plugman'), + test_plugin = path.join(__dirname, 'plugins', 'ChildBrowser'); + +describe('remove', function() { + var copied_plugin_path = path.join(temp,'ChildBrowser'); + + beforeEach(function() { + shell.mkdir('-p', temp); + }); + afterEach(function() { + try{shell.rm('-rf', temp);}catch(e){} + }); + + it('should remove symbolically-linked plugins', function() { + fetch(test_plugin, temp, true); + remove('ChildBrowser', temp); + expect(fs.readdirSync(temp).length).toEqual(0); + }); + it('should remove non-linked plugins', function() { + fetch(test_plugin, temp, false); + remove('ChildBrowser', temp); + expect(fs.readdirSync(temp).length).toEqual(0); + }); +}); http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/src/platforms/android.js ---------------------------------------------------------------------- diff --git a/src/platforms/android.js b/src/platforms/android.js index ac5bd3a..73b0b3a 100644 --- a/src/platforms/android.js +++ b/src/platforms/android.js @@ -200,9 +200,13 @@ function handlePlugin(action, project_dir, plugin_dir, plugin_et, variables) { } } - +// TODO: resolvePath, and should be used everywhere (even across platform impls) function srcPath(pluginPath, filename) { - return path.resolve(pluginPath, filename); + var file = path.resolve(pluginPath, filename); + if (!fs.existsSync(path)) { + throw new Error('Path "' + file + '" does not exist.'); + } + return file; } // reads the package name out of the Android Manifest file http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/src/platforms/blackberry.js ---------------------------------------------------------------------- diff --git a/src/platforms/blackberry.js b/src/platforms/blackberry.js index 0dff562..75b3c3a 100644 --- a/src/platforms/blackberry.js +++ b/src/platforms/blackberry.js @@ -43,7 +43,7 @@ module.exports = { } }; -function handlePlugin = (action, project_dir, plugin_dir, plugin_et, variables) { +function handlePlugin(action, project_dir, plugin_dir, plugin_et, variables) { var plugin_id = plugin_et._root.attrib['id'] , version = plugin_et._root.attrib['version'] , external_hosts = [] http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9e4033ca/src/platforms/ios.js ---------------------------------------------------------------------- diff --git a/src/platforms/ios.js b/src/platforms/ios.js index d0fa2a2..3a23558 100644 --- a/src/platforms/ios.js +++ b/src/platforms/ios.js @@ -47,7 +47,7 @@ module.exports = { } }; -function handlePlugin (action, project_dir, plugin_dir, plugin_et, variables) { +function handlePlugin(action, project_dir, plugin_dir, plugin_et, variables) { var plugin_id = plugin_et._root.attrib['id'] , version = plugin_et._root.attrib['version'] , i = 0