create package

This commit is contained in:
ekatek
2014-05-29 14:32:56 -07:00
parent dd3b1605f9
commit 7af3ba9a82
3 changed files with 40 additions and 1 deletions

View File

@@ -293,7 +293,7 @@ main.registerCommand({
maxArgs: 1,
options: {
list: { type: Boolean },
example: { type: String }
example: { type: String },
}
}, function (options) {
// Suppose you have an app A, and from some directory inside that
@@ -392,6 +392,35 @@ main.registerCommand({
" meteor\n");
});
// For now, this literally drops a package into a directory.
main.registerCommand({
name: 'create-package',
hidden: true,
maxArgs: 1
}, function (options) {
var appPath;
if (options.args.length === 1)
appPath = options.args[0];
else if (options.example)
appPath = options.example;
else
throw new main.ShowUsage;
if (fs.existsSync(appPath)) {
process.stderr.write(appPath + ": Already exists\n");
return 1;
}
files.cp_r(path.join(__dirname, 'skel-pack'), appPath);
process.stderr.write(appPath + ": created");
process.stderr.write(".\n\n");
return 0;
});
///////////////////////////////////////////////////////////////////////////////
// update
///////////////////////////////////////////////////////////////////////////////

1
tools/skel-pack/hello.js Normal file
View File

@@ -0,0 +1 @@
console.log("hello world");

View File

@@ -0,0 +1,9 @@
Package.describe({
summary: "Hello world!",
version: "1.0.0",
name: "hello"
});
Package.on_use(function(api) {
api.add_files('hello.js');
});