Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add symlinks when "tusk clone"-ing

  • Loading branch information...
commit d42bea9cd1521c88d8aba1384b6e7ed6b00da61d 1 parent 3a96af9
Tom Robinson authored
7 lib/narwhal/tusk/commands/clone.js
View
@@ -43,6 +43,7 @@ exports.clone = function (options, names) {
});
names.forEach(function (name) {
var source = util.get(sources, name);
+ var targetPath = packagesDirectory.join(name);
var githubName = util.get(source, 'name', name);
var user = options.user || source.user;
var command = [
@@ -57,7 +58,7 @@ exports.clone = function (options, names) {
'git://github.com/' +
user + '/' + githubName + '.git'
),
- packagesDirectory.join(name)
+ targetPath
];
self.print('\0cyan(' + command.map(function (term) {
var enquoted = os.enquote(term);
@@ -65,7 +66,9 @@ exports.clone = function (options, names) {
return enquoted;
return term;
}).join(' ') + '\0)');
- os.system(command);
+ if (os.system(command))
+ throw "'" + command.join(" ") + "' failed";
+ require("./install").finishInstall(targetPath);
});
};
44 lib/narwhal/tusk/commands/install.js
View
@@ -117,9 +117,7 @@ exports.install = function (options, names) {
// for book keeping.
var notes = tusk.readNotes();
names.forEach(function (name) {
- if (!notes[name]) {
- notes[name] = {};
- }
+ notes[name] = notes[name] || {};
notes[name].requester = "user";
});
tusk.writeNotes(notes);
@@ -183,12 +181,9 @@ exports.install = function (options, names) {
// install missing packages
missing.forEach(function (name) {
- if (!notes[name])
- notes[name] = {}
- if (!notes[name].files)
- notes[name].files = [];
- if (!notes[name].requester)
- notes[name].requester = "module";
+ notes[name] = notes[name] || {}
+ notes[name].files = notes[name].files || [];
+ notes[name].requester = notes[name].requester || "module";
try {
var targetPath = tusk.getDirectory().join('packages', name);
if (targetPath.exists()) {
@@ -244,20 +239,7 @@ exports.install = function (options, names) {
{'charset': 'UTF-8'}
);
- // make bins executable and make symlinks
- // in $SEA/bin
- var bin = targetPath.join('bin');
- if (bin.isDirectory())
- bin.list().forEach(function (name) {
- var target = targetPath.join('bin', name);
- target.chmod(0755);
- var sea = tusk.getDirectory().join('bin');
- var source = sea.join(name);
- var relative = sea.to(target);
- if (!source.linkExists() && !source.exists()) {
- target.symlink(source);
- }
- });
+ exports.finishInstall(targetPath);
notes[name].finished = true;
} catch (exception) {
@@ -318,3 +300,19 @@ exports.missing = function (catalog, names) {
});
};
+exports.finishInstall = function(targetPath) {
+ // make bins executable and make symlinks
+ // in $SEA/bin
+ var bin = targetPath.join('bin');
+ if (bin.isDirectory())
+ bin.list().forEach(function (name) {
+ var target = targetPath.join('bin', name);
+ target.chmod(0755);
+ var sea = tusk.getDirectory().join('bin');
+ var source = sea.join(name);
+ var relative = sea.to(target);
+ if (!source.linkExists() && !source.exists()) {
+ target.symlink(source);
+ }
+ });
+};
Please sign in to comment.
Something went wrong with that request. Please try again.