incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: [CB-1166] Remove dependency on VERSION file
Date Wed, 01 Aug 2012 09:49:34 GMT
Updated Branches:
  refs/heads/master 3c940378f -> 446d456a5


[CB-1166] Remove dependency on VERSION file


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/446d456a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/446d456a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/446d456a

Branch: refs/heads/master
Commit: 446d456a5de6a6125860f265d7961706eab62248
Parents: 3c94037
Author: Shazron Abdullah <shazron@apache.org>
Authored: Wed Aug 1 02:48:37 2012 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Wed Aug 1 02:48:37 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDV.h               |    1 +
 CordovaLib/Classes/CDVAvailability.h   |    5 +++++
 CordovaLib/Classes/CDVDevice.m         |   27 ++-------------------------
 CordovaLib/Classes/CDVViewController.m |    2 --
 4 files changed, 8 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/446d456a/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index c056b4e..f93b53b 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -35,6 +35,7 @@
 #import "CDVCordovaView.h"
 #import "CDVDebug.h"
 #import "CDVDebugConsole.h"
+#import "CDVDevice.h"
 #import "CDVFile.h"
 #import "CDVFileTransfer.h"
 #import "CDVLocation.h"

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/446d456a/CordovaLib/Classes/CDVAvailability.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVAvailability.h b/CordovaLib/Classes/CDVAvailability.h
index b6eec83..c980ff8 100644
--- a/CordovaLib/Classes/CDVAvailability.h
+++ b/CordovaLib/Classes/CDVAvailability.h
@@ -55,3 +55,8 @@
  */
 #define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch]
!= NSOrderedAscending)
 
+/* Return the string version of the decimal version */
+#define CDV_VERSION  [NSString stringWithFormat:@"%d.%d.%d", \
+                        (CORDOVA_VERSION_MIN_REQUIRED / 10000), \
+                        (CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100, \
+                        (CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100 ]

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/446d456a/CordovaLib/Classes/CDVDevice.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVDevice.m b/CordovaLib/Classes/CDVDevice.m
index deff8b9..b076a0a 100644
--- a/CordovaLib/Classes/CDVDevice.m
+++ b/CordovaLib/Classes/CDVDevice.m
@@ -18,9 +18,7 @@
  */
 
 
-#import "CDVDevice.h"
-#import "CDVViewController.h"
-#import "UIDevice+Extensions.h"
+#import "CDV.h"
 
 @interface CDVDevice () {
 }
@@ -73,30 +71,9 @@
     return devReturn;
 }
 
-/**
- Returns the current version of Cordova as read from the VERSION file
- This only touches the filesystem once and stores the result in the class variable cdvVersion
- */
-static NSString* cdvVersion;
 + (NSString*) cordovaVersion
 {
-#ifdef CDV_VERSION
-    cdvVersion = SYMBOL_TO_NSSTRING(CDV_VERSION);
-#else
-	
-    if (cdvVersion == nil) {
-        NSBundle *mainBundle = [NSBundle mainBundle];
-        NSString *filename = [mainBundle pathForResource:@"VERSION" ofType:nil];
-        // read from the filesystem and save in the variable
-        // first, separate by new line
-        NSString* fileContents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding
error:NULL];
-        NSArray* all_lines = [fileContents componentsSeparatedByCharactersInSet:[NSCharacterSet
newlineCharacterSet]];
-        NSString* first_line = [all_lines objectAtIndex:0];        
-        
-        cdvVersion = [first_line retain];
-    }
-#endif
-    return cdvVersion;
+    return CDV_VERSION;
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/446d456a/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 63b2de0..7b9feaa 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -19,8 +19,6 @@
 
 #import "CDV.h"
 
-#define SYMBOL_TO_NSSTRING_HELPER(x) @#x
-#define SYMBOL_TO_NSSTRING(x) SYMBOL_TO_NSSTRING_HELPER(x)
 #define degreesToRadian(x) (M_PI * (x) / 180.0)
 
 @interface CDVViewController ()


Mime
View raw message