Jean-Yves Didier

added options to arcsm

......@@ -23,12 +23,14 @@ const usage = function(idx) {
'Usage:',
path.basename(process.argv[0]),
path.basename(process.argv[1]),
"[-r repository_location] [-h] [-l] [-s keyword]"
"[-r repository_location] [-h] [-l] [-s keyword] [-i library_name] [-c library_name]"
);
console.log("\t-h or --help displays usage");
console.log("\t-r <repository location> sets the location of the repository json file or url");
console.log("\t-l lists available component libraries");
console.log("\t-s <keyword> searches for components with the given keyword");
console.log("\t-i <library name> installs the given library or component");
console.log("\t-c <library name> checks the given library or component and install its dependencies");
process.exit(0);
return 0;
};
......@@ -119,6 +121,34 @@ const processRecipe = function(recipe, projectPath) {
fs.writeFileSync(outPath, outContents, 'utf8');
};
const solveLibraryName = function(name) {
};
const check = function(name) {
let components = repository.components;
let libraries = repository.libraries;
let library = (libraries[name]?name:null) || components[name]?.library;
let lib = libraries[library];
if (lib === undefined) { return ; }
if (lib.dependencies !== undefined) {
console.log("Installing dependencies");
lib.dependencies.forEach((dep) => {
execSync(`npm install ${dep}`, {stdio: 'inherit'});
});
}
if (lib.recipes !== undefined) {
console.log("Processing recipes")
lib.recipes.forEach((recipe) => {
processRecipe(recipe, project);
});
}
}
const install = function(name) {
let components = repository.components;
let libraries = repository.libraries;
......@@ -202,8 +232,10 @@ const helpers ={
'-i' : function(idx) {
actions.push([install, [process.argv[idx+1]]]);
return 1;
},
'-c' : function(idx) {
actions.push([check, [process.argv[idx+1]]]);
}
}
/** list of helpers that are needed
......@@ -212,6 +244,7 @@ const helpers ={
* -i: install library or component
* -l: list libraries
* -r: repository url
* -c: check dependencies for component or library
*
*/
......