mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Fixed: Divided 'jake install' into 'jake dist' and 'jake install'
'jake dist' will do everything that 'jake install' does but creating the global symlinks for the 'dist' binaries at the 'npm prefix' path.
This commit is contained in:
@@ -45,18 +45,33 @@ filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function(
|
||||
task ("CommonJS", [$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release"], function() {
|
||||
});
|
||||
|
||||
task ("install", ["CommonJS"], function()
|
||||
// Install everything in the dist directory
|
||||
task ("dist", ["CommonJS"], function()
|
||||
{
|
||||
installCopy($BUILD_CJS_OBJECTIVE_J, false);
|
||||
installCopy($BUILD_CJS_CAPPUCCINO, false);
|
||||
});
|
||||
|
||||
task ("sudo-install", ["CommonJS"], function()
|
||||
task ("sudo-dist", ["CommonJS"], function()
|
||||
{
|
||||
installCopy($BUILD_CJS_OBJECTIVE_J, true);
|
||||
installCopy($BUILD_CJS_CAPPUCCINO, true);
|
||||
});
|
||||
|
||||
// Install everything in the dist directory (task dist) and
|
||||
// create symlinks to the 'dist' binaries in the global 'npm prefix' path
|
||||
task ("install", ["dist"], function()
|
||||
{
|
||||
installGlobal($BUILD_CJS_OBJECTIVE_J, false);
|
||||
installGlobal($BUILD_CJS_CAPPUCCINO, false);
|
||||
});
|
||||
|
||||
task ("sudo-install", ["sudo-dist"], function()
|
||||
{
|
||||
installGlobal($BUILD_CJS_OBJECTIVE_J, true);
|
||||
installGlobal($BUILD_CJS_CAPPUCCINO, true);
|
||||
});
|
||||
|
||||
task ("install-symlinks", function()
|
||||
{
|
||||
installSymlink($BUILD_CJS_OBJECTIVE_J);
|
||||
|
||||
+30
-14
@@ -365,7 +365,8 @@ global.installCopy = function(sourcePath, useSudo)
|
||||
return;
|
||||
|
||||
var packageName = path.basename(sourcePath),
|
||||
targetPath = path.join(__dirname, "dist", packageName);
|
||||
targetPath = path.join(__dirname, "dist", packageName),
|
||||
binPath = path.resolve(path.join(targetPath, "bin"));
|
||||
|
||||
// create the dist directory if it does not exist
|
||||
if (!fs.existsSync(targetPath)) {
|
||||
@@ -381,12 +382,10 @@ global.installCopy = function(sourcePath, useSudo)
|
||||
|
||||
// hacky way to do a sudo copy.
|
||||
if (useSudo)
|
||||
child_process.execSync(["sudo", "cp", "-Rf", sourcePath, path.dirname(targetPath)].join(" "));
|
||||
child_process.execSync(["sudo", "cp", "-Rf", sourcePath, path.dirname(targetPath)].map(utilsFile.enquote).join(" "));
|
||||
else
|
||||
utilsFile.copyRecursiveSync(sourcePath, targetPath);
|
||||
|
||||
var binPath = path.resolve(path.join(targetPath, "bin"))
|
||||
|
||||
// create the bin directory if it does not exist
|
||||
if (!fs.existsSync(binPath)) {
|
||||
fs.mkdirSync(targetPath)
|
||||
@@ -399,19 +398,39 @@ global.installCopy = function(sourcePath, useSudo)
|
||||
var binary = path.join(binPath, name);
|
||||
|
||||
if (useSudo) {
|
||||
child_process.execSync(["sudo", "chmod", "755", binary].join(" "));
|
||||
child_process.execSync(["sudo", "chmod", "755", binary].map(utilsFile.enquote).join(" "));
|
||||
} else {
|
||||
fs.chmodSync(binary, 0o755);
|
||||
}
|
||||
});
|
||||
}
|
||||
fs.readdirSync(binPath).forEach(function (name)
|
||||
{
|
||||
var prefix = child_process.execSync("npm prefix -g").toString().trim();
|
||||
child_process.execSync( (useSudo ? "sudo " : "") + "ln -sf " + path.join(binPath, name) + " " + path.join(prefix, "bin", name));
|
||||
});
|
||||
};
|
||||
|
||||
global.installGlobal = function(sourcePath, useSudo)
|
||||
{
|
||||
if (!fs.existsSync(sourcePath))
|
||||
return;
|
||||
|
||||
var packageName = path.basename(sourcePath),
|
||||
targetPath = path.join(__dirname, "dist", packageName),
|
||||
binPath = path.resolve(path.join(targetPath, "bin"));
|
||||
|
||||
// create the dist directory if it does not exist
|
||||
if (!fs.existsSync(targetPath)) {
|
||||
fs.mkdirSync(targetPath, { recursive: true });
|
||||
}
|
||||
|
||||
var prefix = child_process.execSync("npm prefix -g").toString().trim();
|
||||
|
||||
fs.readdirSync(binPath).forEach(function (name)
|
||||
{
|
||||
var p = path.join(binPath, name),
|
||||
prefixBinPath = path.join(prefix, "bin", name);
|
||||
|
||||
stream.print("Symlink \0cyan(" + prefixBinPath + "\0) ==> \0cyan(" + p + "\0)");
|
||||
child_process.execSync( (useSudo ? "sudo " : "") + "ln -sf " + utilsFile.enquote(p) + " " + utilsFile.enquote(prefixBinPath));
|
||||
});
|
||||
}
|
||||
|
||||
global.spawnJake = function(/*String*/ aTaskName)
|
||||
{
|
||||
@@ -424,10 +443,7 @@ global.spawnJake = function(/*String*/ aTaskName)
|
||||
var normalizeCommand = function(/*Array or String*/ command)
|
||||
{
|
||||
if (Array.isArray(command))
|
||||
return command.map(function (arg)
|
||||
{
|
||||
return utilsFile.enquote(arg);
|
||||
}).join(" ");
|
||||
return command.map(utilsFile.enquote).join(" ");
|
||||
else
|
||||
return command;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user