Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

conf.py file updater coming along nicely...

  • Loading branch information...
commit fa322442f1244381d6d336504c4c689d84c039a2 1 parent da4d83c
@DamonOehlman authored
View
153 assets/docs/conf.py
@@ -1 +1,152 @@
-blah
+# -*- coding: utf-8 -*-
+import sys, os
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Docstar Template'
+copyright = u'2012, Authors'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.0.0'
+release = '0.0.0'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'trac'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'mocha'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+html_theme_path = ['_theme']
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+#htmlhelp_basename = 'htmlhelp_base'
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}
View
9 bin/docstar
@@ -1,10 +1,3 @@
#!/usr/bin/env node
-var path = require('path'),
- builder = require('scaffolder').create(path.resolve(__dirname, '../'));
-
-builder.once('ready', function(action) {
- (action || builder.build).call(builder, builder, function() {
- // done
- });
-});
+require('scaffolder').create(module).run('build');
View
153 docs/conf.py
@@ -1 +1,152 @@
-blah
+# -*- coding: utf-8 -*-
+import sys, os
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Docstar Template'
+copyright = '2012, Damon Oehlman <damon.oehlman@sidelab.com>'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.0.1'
+release = '0.0.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'trac'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'mocha'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+html_theme_path = ['_theme']
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+#htmlhelp_basename = 'htmlhelp_base'
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}
View
2  lib/actions/build.js
@@ -1,5 +1,5 @@
var docstar = require('../docstar');
-module.exports = function(opts, callback) {
+module.exports = function(opts, extraArgs, callback) {
console.log(opts);
};
View
75 lib/actions/config.js
@@ -0,0 +1,75 @@
+var docstar = require('../docstar'),
+ events = require('events'),
+ debug = require('debug')('docstar'),
+ path = require('path'),
+ util = require('util'),
+ reVersion = /^(version|release).*/mg,
+ reCopyright = /^(copyright).*/m;
+
+function ConfigHelper() {
+
+};
+
+ConfigHelper.prototype.create = function(docstar, scaffolder) {
+ 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.');
+ }
+
+ scaffolder.copyAssets(
+ 'docs',
+ function() {
+ // now call the update method
+ helper.update(docstar, scaffolder);
+ },
+ docstar.path
+ );
+ });
+};
+
+ConfigHelper.prototype.update = function(docstar, scaffolder) {
+ docstar.readConfig(function(err, config) {
+ scaffolder.loadPackageData(function(pkgErr, data) {
+ if (!err && !pkgErr) {
+ config = config
+ // replace version strings
+ .replace(reVersion, '$1 = \'' + data.version + '\'')
+
+ // replace copyright section
+ .replace(reCopyright, '$1 = \'' + (new Date().getFullYear()) + ', ' + data.author + '\'');
+
+ // save the config
+ docstar.writeConfig(config);
+ }
+ else {
+ scaffolder.error(err);
+ }
+ });
+ });
+};
+
+module.exports = function(opts, extraArgs, callback) {
+ var scaffolder = this;
+
+ docstar.init(opts, function(err, instance) {
+ if (err) {
+ scaffolder.out(err);
+ }
+ else {
+ // create the config helper
+ var helper = new ConfigHelper(),
+ action = extraArgs[0];
+
+ // if the config helper supports the action, then call it
+ if (typeof helper[action] == 'function') {
+ helper[action].call(helper, instance, scaffolder);
+ }
+ else {
+ scaffolder.out('Do not know how to \'config ' + action + '\'');
+ }
+ }
+ });
+};
View
16 lib/actions/create.js
@@ -2,7 +2,7 @@ var docstar = require('../docstar'),
debug = require('debug')('docstar'),
path = require('path');
-module.exports = function(opts, callback) {
+module.exports = function(opts, extraArgs, callback) {
var scaffolder = this;
docstar.init(opts, function(err, instance) {
@@ -10,20 +10,6 @@ module.exports = function(opts, callback) {
scaffolder.out(err);
}
else {
- path.exists(path.join(instance.path, 'conf.py'), function(exists) {
- if (! exists) {
- scaffolder.copyAssets(
- 'docs',
- function() {
- callback(instance);
- },
- instance.path
- );
- }
- else {
- callback(instance);
- }
- });
}
});
};
View
17 lib/docstar.js
@@ -1,15 +1,28 @@
var fs = require('fs'),
path = require('path'),
debug = require('debug')('docstar'),
- miniglob = require('miniglob');
+ miniglob = require('miniglob'),
+ SPHINX_CONFIG_FILE = 'conf.py';
function DocStar(docpath, opts) {
this.path = path.join(opts.targetPath, docpath || 'docs');
debug('docpath set to ' + this.path);
};
+DocStar.prototype.getConfigPath = function() {
+ return path.join(this.path, SPHINX_CONFIG_FILE);
+};
+
+DocStar.prototype.readConfig = function(callback) {
+ fs.readFile(this.getConfigPath(), 'utf8', callback);
+};
+
+DocStar.prototype.writeConfig = function(data, callback) {
+ fs.writeFile(this.getConfigPath(), data, 'utf8', callback);
+};
+
exports.init = function(opts, callback) {
- var pattern = '**/conf.py';
+ var pattern = '**/' + SPHINX_CONFIG_FILE;
miniglob(pattern, { cwd: opts.targetPath }, function(err, matches) {
// iterate through the matches and filter out those in the node_modules
View
3  package.json
@@ -19,7 +19,8 @@
"debug": "*",
"scaffolder": "*",
"attachmate": "0.1.x",
- "miniglob": "https://github.com/isaacs/miniglob/tarball/master"
+ "miniglob": "https://github.com/isaacs/miniglob/tarball/master",
+ "pkginfo": "0.2.x"
},
"devDependencies": {
},
Please sign in to comment.
Something went wrong with that request. Please try again.