Fixed: added options -m for objj. This option allows you to make objj on several files

This commit is contained in:
Alexandre Wilhelm
2014-11-04 13:23:54 -08:00
parent 58f2d7117a
commit ad82b0064a
4 changed files with 28 additions and 22 deletions
+17 -10
View File
@@ -68,6 +68,8 @@ with (window)
// runs the objj repl or file provided in args
exports.run = function(args)
{
var multipleFiles = false;
if (args)
{
// we expect args to be in the format:
@@ -91,13 +93,24 @@ exports.run = function(args)
print(" -v, --version print the current version of objj");
print(" -I, --objj-include-paths include a specific framework paths")
print(" -h, --help print this help");
print(" -m, --multifiles launch objj on several files")
return;
}
while (argv.length && argv[0] == "-I" || argv[0] == "--objj-include-paths")
while (argv.length && argv[0].indexOf('-') === 0)
{
argv.shift();
OBJJ_INCLUDE_PATHS.unshift.apply(OBJJ_INCLUDE_PATHS, argv.shift().split(":"));
switch (argv[0])
{
case "-I":
argv.shift();
OBJJ_INCLUDE_PATHS.unshift.apply(OBJJ_INCLUDE_PATHS, argv.shift().split(":"));
break;
case "-m":
argv.shift();
multipleFiles = true;
break
}
}
}
@@ -112,12 +125,6 @@ exports.run = function(args)
exports.make_narwhal_factory(mainFilePath)(require, { }, module, system, print);
if (argv[0] == "--")
{
endCommand = true;
argv.shift();
}
if (typeof main === "function")
{
main([arg0].concat(argv));
@@ -126,7 +133,7 @@ exports.run = function(args)
require("browser/timeout").serviceTimeouts();
if (endCommand)
if (!multipleFiles || endCommand)
break;
ObjectiveJ.Executable.resetCachedFileExecutableSearchers();
+1 -1
View File
@@ -3,5 +3,5 @@
var execPath = require("file").path(module.path);
var mainPath = execPath.dirname().dirname().join("lib", execPath.basename(), "main.j");
var args = ["objj", String(mainPath), "--"].concat(system.args.slice(1));
var args = ["objj", String(mainPath)].concat(system.args.slice(1));
require("objective-j").run(args);
+1 -1
View File
@@ -33,7 +33,7 @@ function cleanup() {
status = OS.system(["objj", "ToolsTestApp/AppController.j"]);
[self assert:0 equals:status message:"objj failed"];
status = OS.system(["objj", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"]);
status = OS.system(["objj", "-m", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"]);
[self assert:0 equals:status message:"objj failed with several files"];
status = OS.system(["objj", "-I", "ToolsTestApp/Frameworks", "ToolsTestApp/AppController.j"]);
@@ -44,7 +44,7 @@
return;
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
NSDictionary *info = @{ @"projectId":self.projectId, @"path":self.sourcePath };
[center postNotificationName:XCCConversionDidStartNotification object:self userInfo:info];
@@ -72,7 +72,6 @@
launchPath = self.xcc.executablePaths[@"objj"];
arguments = @[
self.xcc.parserPath,
@"--",
self.projectPath,
self.sourcePath
];
@@ -85,21 +84,21 @@
return;
[self.xcc performSelectorOnMainThread:@selector(computeIgnoredPaths) withObject:nil waitUntilDone:NO];
notificationTitle = @"Parsed .xcodecapp-ignore";
notificationMessage = @"Ignored paths updated";
}
// Run the task and get the response if needed
NSInteger status = 0;
if (arguments)
{
if (self.isCancelled)
return;
DDLogVerbose(@"Running processing task: %@", launchPath);
NSDictionary *taskResult = [self.xcc runTaskWithLaunchPath:launchPath
arguments:arguments
returnType:kTaskReturnTypeAny];
@@ -121,7 +120,7 @@
notificationTitle = @"Error converting xib";
NSString *message = [NSString stringWithFormat:@"%@\n%@", self.sourcePath.lastPathComponent, response];
NSDictionary *info =
@{
@"projectId":self.projectId,
@@ -132,7 +131,7 @@
if (self.isCancelled)
return;
[center postNotificationName:XCCConversionDidGenerateErrorNotification object:self userInfo:info];
}
else
@@ -153,14 +152,14 @@
[self postErrorNotificationForPath:self.sourcePath line:0 message:response status:status];
}
}
if ([self.xcc shouldShowErrorNotification])
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
}
else if (!self.xcc.isLoadingProject)
{
BOOL showFinalNotification = YES;
if ([self.xcc shouldProcessWithCappLint])
{
showFinalNotification = [self.xcc checkCappLintForPath:[NSArray arrayWithObject:self.sourcePath]];
@@ -168,7 +167,7 @@
if (!showFinalNotification)
[self.xcc showCappLintErrors];
}
if (showFinalNotification)
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
}