Permalink
Browse files

Making destination path configurable

  • Loading branch information...
1 parent 4ae877c commit 92af72774f5a9d3d6420f3f2cb4155346eb80857 @neyric committed Nov 29, 2012
View
@@ -34,24 +34,32 @@ var yproject = {
/**
* Create command to create a project from templates/project
*/
- createProject: function (projectName, templatePath) {
+ createProject: function (projectName, destPath, templatePath) {
yproject.log('log', "Creating project " + projectName);
if (!templatePath) {
templatePath = path.join(__dirname, '..', 'templates', 'project');
}
- yproject.copyDirSyncRecursive( templatePath, projectName, {projectName: projectName});
+ if (!destPath) {
+ destPath = process.cwd();
+ }
+
+ yproject.copyDirSyncRecursive( templatePath, path.join(destPath, projectName), {projectName: projectName});
},
/**
* Create command to create a module from templates/module
*/
- createModule: function(moduleName, options, templatePath) {
+ createModule: function(moduleName, options, projectPath, templatePath) {
yproject.log('log', "Creating module " + moduleName);
+ if (!projectPath) {
+ projectPath = process.cwd();
+ }
+
// Lookup for project
- var projectInfos = yproject.projectLookup();
+ var projectInfos = yproject.projectLookup(projectPath);
if (projectInfos === false) {
yproject.log('err', "Unable to find yuidoc.json or package.json in any parent directory !");
yproject.log('err', "Cannot create module " + moduleName + ": project not found !");
View
@@ -11,6 +11,7 @@
"engines": {
"node" : ">=0.4.0"
},
+ "main": "lib/yproject",
"bin" : {
"yproject" : "./bin/yproject.js",
"ymodule" : "./bin/ymodule.js"
@@ -13,14 +13,14 @@ var <%= moduleName.camelize() %> = function() {};
<%= moduleName.camelize() %>.prototype = {
- /**
- * Just a dummy method
+ /**
+ * Just a dummy method
* @method someFunc
- */
- someFunc: function() {
- return true;
- }
-
+ */
+ someFunc: function() {
+ return true;
+ }
+
};
Y.<%= moduleName.camelize() %> = <%= moduleName.camelize() %>;
@@ -1,3 +1,3 @@
{
- <%= moduleName.camelize(true) %>Title: "<%= moduleName %>"
+ <%= moduleName.camelize(true) %>Title: "<%= moduleName %>"
}
@@ -1,3 +1,3 @@
{
- <%= moduleName.camelize(true) %>Title: "<%= moduleName %>"
+ <%= moduleName.camelize(true) %>Title: "<%= moduleName %>"
}

0 comments on commit 92af727

Please sign in to comment.