Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated package requirements

  • Loading branch information...
commit 9e6e2725c8a07482bc6c77a9866cc59c83f632ff 1 parent bda2a8d
@DamonOehlman authored
View
10 bin/docstar
@@ -1,3 +1,11 @@
#!/usr/bin/env node
-require('scaffolder').create(module).run('build');
+var path = require('path'),
+ repl = require('climate').repl('docstar>');
+
+// load the actions and run
+repl
+ .history()
+ .loadActions(path.resolve(__dirname, '../lib/actions'), function() {
+ repl.run(process.argv.slice(2).join(' '));
+ });
View
4 docs/conf.py
@@ -31,8 +31,8 @@
# built documents.
#
# The short X.Y version.
-version = '0.0.2'
-release = '0.0.2'
+version = '0.1.0'
+release = '0.1.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
View
2  lib/actions/build.js
@@ -1,5 +1,5 @@
var docstar = require('../docstar');
-module.exports = function(opts, extraArgs, callback) {
+module.exports = function(opts, callback) {
console.log(opts);
};
View
54 lib/actions/config.js
@@ -1,63 +1,67 @@
var docstar = require('../docstar'),
events = require('events'),
debug = require('debug')('docstar'),
+ pkginfo = require('pkginfo'),
path = require('path'),
- util = require('util');
+ util = require('util'),
+ out = require('out');
function ConfigHelper() {
};
-ConfigHelper.prototype.create = function(docstar, scaffolder) {
+ConfigHelper.prototype.create = function(docstar, repl) {
var helper = this;
path.exists(docstar.getConfigPath(), function(exists) {
// TODO: if the file exists, check that the user wants to overwrite
if (exists) {
- scaffolder.error('There is an existing configuration, please remove before attempting to create a new config.');
+ out('!{red}There is an existing configuration, please remove before attempting to create a new config.');
+ return;
}
- scaffolder.copyAssets(
- 'config',
+ repl.generator.copy(
+ 'assets/config',
+ docstar.path,
function() {
// now call the update method
helper.sync(docstar, scaffolder);
- },
- docstar.path
+ }
);
});
};
-ConfigHelper.prototype.sync = function(docstar, scaffolder) {
- scaffolder.loadPackageData(function(err, data) {
- if (! err) {
- docstar.tweakConfig({
- copyright: (new Date().getFullYear()) + ', ' + data.author,
- project: data.name,
- version: data.version
- });
- }
- });
+ConfigHelper.prototype.sync = function(docstar, repl) {
+ var data = pkginfo.read(null, path.resolve('package.json'))['package'];
+
+ if (data) {
+ docstar.tweakConfig({
+ copyright: (new Date().getFullYear()) + ', ' + data.author,
+ project: data.name,
+ version: data.version
+ });
+ }
+
+ repl.run('quit');
};
-module.exports = function(opts, extraArgs, callback) {
- var scaffolder = this;
+module.exports = function(action) {
+ var repl = this;
- docstar.init(opts, function(err, instance) {
+ docstar.init(function(err, instance) {
if (err) {
- scaffolder.out(err);
+ out(err);
}
else {
// create the config helper
- var helper = new ConfigHelper(),
- action = extraArgs[0];
+ var helper = new ConfigHelper();
// if the config helper supports the action, then call it
if (typeof helper[action] == 'function') {
- helper[action].call(helper, instance, scaffolder);
+ helper[action].call(helper, instance, repl);
}
else {
- scaffolder.out('Do not know how to \'config ' + action + '\'');
+ out('Do not know how to \'config ' + action + '\'');
}
}
});
View
2  lib/actions/scaffold.js
@@ -18,7 +18,7 @@ function _sync(docstar, scaffolder, callback) {
});
};
-module.exports = function(opts, extraArgs, callback) {
+module.exports = function(opts, callback) {
var scaffolder = this;
docstar.init(opts, function(err, instance) {
View
2  lib/actions/sync.js
@@ -18,7 +18,7 @@ function _sync(docstar, scaffolder, callback) {
});
};
-module.exports = function(opts, extraArgs, callback) {
+module.exports = function(opts, callback) {
var scaffolder = this;
docstar.init(opts, function(err, instance) {
View
2  lib/actions/theme.js
@@ -29,7 +29,7 @@ ThemeHelper.prototype.use = function(docstar, scaffolder, extraArgs) {
);
};
-module.exports = function(opts, extraArgs, callback) {
+module.exports = function(opts, callback) {
var scaffolder = this;
docstar.init(opts, function(err, instance) {
View
12 lib/docstar.js
@@ -1,7 +1,7 @@
var fs = require('fs'),
path = require('path'),
debug = require('debug')('docstar'),
- miniglob = require('miniglob'),
+ glob = require('glob'),
SPHINX_CONFIG_FILE = 'conf.py',
tweakRegexes = {
copyright: /^(copyright).*/m,
@@ -14,8 +14,8 @@ var fs = require('fs'),
project: true
};
-function DocStar(docpath, opts) {
- this.path = path.join(opts.targetPath, docpath || 'docs');
+function DocStar(docpath) {
+ this.path = path.resolve(docpath || 'docs');
debug('docpath set to ' + this.path);
};
@@ -68,10 +68,10 @@ DocStar.prototype.writeConfig = function(data, callback) {
});
};
-exports.init = function(opts, callback) {
+exports.init = function(callback) {
var pattern = '**/' + SPHINX_CONFIG_FILE;
- miniglob(pattern, { cwd: opts.targetPath }, function(err, matches) {
+ glob(pattern, function(err, matches) {
// iterate through the matches and filter out those in the node_modules
// and assets directories
matches = matches.filter(function(matchPath) {
@@ -79,7 +79,7 @@ exports.init = function(opts, callback) {
});
if (matches.length <= 1) {
- callback(null, new DocStar(matches[0] ? path.dirname(matches[0]) : '', opts));
+ callback(null, new DocStar(matches[0] ? path.dirname(matches[0]) : ''));
}
else {
callback('Too many possible documentation directories, please review');
View
9 package.json
@@ -7,7 +7,7 @@
"docs",
"sphinx"
],
- "version": "0.0.5",
+ "version": "0.1.0",
"main": "index.js",
"bin": {
"docstar": "./bin/docstar"
@@ -16,10 +16,13 @@
"node": ">= 0.4.x < 0.7.0"
},
"dependencies": {
+ "climate": "0.2.x",
"debug": "*",
- "scaffolder": "0.3.x",
+ "scaffolder": "0.4.x",
"attachmate": "0.1.x",
- "miniglob": "https://github.com/isaacs/miniglob/tarball/master"
+ "glob": "3.x.x",
+ "out": "*",
+ "pkginfo": "0.2.x"
},
"devDependencies": {
},
Please sign in to comment.
Something went wrong with that request. Please try again.