From 07ec6782c7d4b7312fa391d927552823e2caa9fb Mon Sep 17 00:00:00 2001 From: Benjamin Lupton Date: Sat, 17 May 2014 21:13:57 +1000 Subject: [PATCH] updated base files --- .gitignore | 30 +++--- .npmignore | 36 +++++-- .travis.yml | 9 +- CONTRIBUTING.md | 81 +++++++++++++++ Cakefile | 209 ++++++++++++++++++++++++++++----------- Contributing.md | 36 ------- History.md => HISTORY.md | 0 LICENSE.md | 18 +++- package.json | 27 ++++- 9 files changed, 321 insertions(+), 125 deletions(-) create mode 100644 CONTRIBUTING.md delete mode 100644 Contributing.md rename History.md => HISTORY.md (100%) diff --git a/.gitignore b/.gitignore index 8214ca0..5d8a5a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,18 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz +# v1.3.10 December 10, 2013 +# https://github.com/bevry/base -pids -logs -results +# Temp Files +**/*.log +**/.docpad.db -node_modules -npm-debug.log +# Build Files +build/ +components/ +bower_components/ +node_modules/ +out/ -test/out/ -out/ \ No newline at end of file +# ===================================== +# CUSTOM MODIFICATIONS + +# None diff --git a/.npmignore b/.npmignore index 13558a6..91caedf 100644 --- a/.npmignore +++ b/.npmignore @@ -1,10 +1,32 @@ +# v1.3.10 December 10, 2013 +# https://github.com/bevry/base + +# Temp Files +**/*.log +**/.docpad.db + +# Build Files +build/ +components/ +bower_components/ +node_modules/ + +# Development Files .travis* -Makefile Cakefile -History.md +Makefile +BACKERS.md +CONTRIBUTING.md +HISTORY.md +**/src/ +**/test/ + +# Other Package Definitions +template.js +component.json +bower.json + +# ===================================== +# CUSTOM MODIFICATIONS -src/ -out/*.tester.* -out/*.test.* -out/test/ -test/ \ No newline at end of file +# None diff --git a/.travis.yml b/.travis.yml index 27c18d1..54f953e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,18 @@ -# v1.3.2 October 26, 2013 +# v1.3.14 February 6, 2014 # https://github.com/bevry/base language: node_js -install: "npm install; npm install docpad; cd ./node_modules/docpad; npm install; cd ../.." +install: "npm install; ./node_modules/.bin/cake install" before_script: "./node_modules/.bin/cake compile" script: "npm test" node_js: - "0.8" - "0.10" +cache: + directories: + - node_modules notifications: irc: - "irc.freenode.org#bevry-dev" email: recipients: - - travisci@bevry.me \ No newline at end of file + - travisci@bevry.me diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6dc12e4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,81 @@ + + + +# Contribute + + +## Resources + +- [Coding Standards](http://bevry.me/bevry/coding-standards) +- [Documentation Guidelines](http://bevry.me/bevry/documentation-guidelines) +- [Support Guidelines](http://bevry.me/bevry/support-guidelines) + + +## Development + +For developers and contributors + +1. Fork project and clone your fork + +2. Install global dependencies + + ``` bash + npm install -g coffee-script + ``` + +3. Install local dependencies + + ``` bash + cake install + ``` + +4. Compile project + + ``` bash + # Only once + cake compile + + # On every change + cake watch + ``` + +5. Run tests + + ``` bash + cake test + ``` + + +## Publishing + +For project maintainers + +1. Update meta files with latest information + + ``` bash + cake prepublish + ``` + +2. Add a changelog entry to `HISTORY.md` with change information + + ``` + v2.0.0 April 17, 2013 + - Something that changes + ``` + +3. Update `version` entry in `package.json` with new version number + +4. Commit changes + + ``` bash + git commit -a -m "A message about what changed" + ``` + +5. Publish new version + + ``` bash + cake publish + ``` diff --git a/Cakefile b/Cakefile index 0b1317c..07c73ce 100644 --- a/Cakefile +++ b/Cakefile @@ -1,4 +1,4 @@ -# v1.3.1 October 26, 2013 +# v1.3.15 May 16, 2014 # https://github.com/bevry/base @@ -12,32 +12,48 @@ pathUtil = require('path') # ===================================== # Variables -WINDOWS = process.platform.indexOf('win') is 0 -NODE = process.execPath -NPM = (if WINDOWS then process.execPath.replace('node.exe', 'npm.cmd') else 'npm') -EXT = (if WINDOWS then '.cmd' else '') -APP_DIR = process.cwd() -PACKAGE_PATH = pathUtil.join(APP_DIR, "package.json") -PACKAGE_DATA = require(PACKAGE_PATH) -DOCS_DIR = pathUtil.join(APP_DIR, "docs") -DOCS_INPUT = pathUtil.join(APP_DIR, "src", "lib", "*") -SRC_DIR = pathUtil.join(APP_DIR, "src") -OUT_DIR = pathUtil.join(APP_DIR, "out") -TEST_DIR = pathUtil.join(APP_DIR, "test") -MODULES_DIR = pathUtil.join(APP_DIR, "node_modules") -BIN_DIR = pathUtil.join(MODULES_DIR, ".bin") -GIT = "git" -CAKE = pathUtil.join(BIN_DIR, "cake#{EXT}") -COFFEE = pathUtil.join(BIN_DIR, "coffee#{EXT}") -PROJECTZ = pathUtil.join(BIN_DIR, "projectz#{EXT}") -DOCCO = pathUtil.join(BIN_DIR, "docco#{EXT}") +WINDOWS = process.platform.indexOf('win') is 0 +NODE = process.execPath +NPM = (if WINDOWS then process.execPath.replace('node.exe', 'npm.cmd') else 'npm') +EXT = (if WINDOWS then '.cmd' else '') +GIT = "git" + +APP_PATH = process.cwd() +PACKAGE_PATH = pathUtil.join(APP_PATH, "package.json") +PACKAGE_DATA = require(PACKAGE_PATH) + +MODULES_PATH = pathUtil.join(APP_PATH, "node_modules") +DOCPAD_PATH = pathUtil.join(MODULES_PATH, "docpad") +BIN_PATH = pathUtil.join(MODULES_PATH, ".bin") +CAKE = pathUtil.join(BIN_PATH, "cake" + EXT) +COFFEE = pathUtil.join(BIN_PATH, "coffee" + EXT) +PROJECTZ = pathUtil.join(BIN_PATH, "projectz" + EXT) +DOCCO = pathUtil.join(BIN_PATH, "docco" + EXT) +DOCPAD = pathUtil.join(BIN_PATH, "docpad" + EXT) + +config = {} +config.TEST_PATH = "test" +config.DOCCO_SRC_PATH = null +config.DOCCO_OUT_PATH = "docs" +config.COFFEE_SRC_PATH = null +config.COFFEE_OUT_PATH = "out" +config.DOCPAD_SRC_PATH = null +config.DOCPAD_OUT_PATH = "out" + +for own key,value of (PACKAGE_DATA.cakeConfiguration or {}) + config[key] = value + +for own key,value of config + config[key] = pathUtil.resolve(APP_PATH, value) if value # ===================================== # Generic -{exec,spawn} = require('child_process') +{spawn, exec} = require('child_process') + safe = (next,fn) -> + next ?= (err) -> console.log(err.stack ? err) fn ?= next # support only one argument return (err) -> # success status code @@ -64,9 +80,14 @@ finish = (err) -> actions = clean: (opts,next) -> + # Prepare (next = opts; opts = {}) unless next? - args = ['-Rf', OUT_DIR] - for path in [APP_DIR, TEST_DIR] + + # Add compilation paths + args = ['-Rf', config.COFFEE_OUT_PATH, config.DOCPAD_OUT_PATH, config.DOCCO_OUT_PATH] + + # Add common ignore paths + for path in [APP_PATH, config.TEST_PATH] args.push( pathUtil.join(path, 'build') pathUtil.join(path, 'components') @@ -75,70 +96,140 @@ actions = pathUtil.join(path, '*out') pathUtil.join(path, '*log') ) + # rm - spawn('rm', args, {stdio:'inherit', cwd:APP_DIR}).on('close', safe next) + console.log('clean') + spawn('rm', args, {stdio:'inherit', cwd:APP_PATH}).on('close', safe next) install: (opts,next) -> + # Prepare (next = opts; opts = {}) unless next? + + # Steps step1 = -> - # npm install (for app) - spawn(NPM, ['install'], {stdio:'inherit', cwd:APP_DIR}).on('close', safe next, step2) + console.log('npm install (for app)') + spawn(NPM, ['install'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step2) step2 = -> - fsUtil.exists TEST_DIR, (exists) -> - return next() unless exists - # npm install (for test) - spawn(NPM, ['install'], {stdio:'inherit', cwd:TEST_DIR}).on('close', safe next) + return step3() if !config.TEST_PATH or !fsUtil.existsSync(config.TEST_PATH) + console.log('npm install (for test)') + spawn(NPM, ['install'], {stdio:'inherit', cwd:config.TEST_PATH}).on('close', safe next, step3) + step3 = -> + return step4() if !fsUtil.existsSync(DOCPAD_PATH) + console.log('npm install (for docpad tests)') + spawn(NPM, ['install'], {stdio:'inherit', cwd:DOCPAD_PATH}).on('close', safe next, step4) + step4 = next + + # Start step1() compile: (opts,next) -> + # Prepare (next = opts; opts = {}) unless next? - # cake install - actions.install opts, safe next, -> - # coffee compile - spawn(COFFEE, ['-co', OUT_DIR, SRC_DIR], {stdio:'inherit', cwd:APP_DIR}).on('close', safe next) + + # Steps + step1 = -> + console.log('cake install') + actions.install(opts, safe next, step2) + step2 = -> + return step3() if !config.COFFEE_SRC_PATH or !fsUtil.existsSync(COFFEE) + console.log('coffee compile') + spawn(COFFEE, ['-co', config.COFFEE_OUT_PATH, config.COFFEE_SRC_PATH], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3) + step3 = -> + return step4() if !config.DOCPAD_SRC_PATH or !fsUtil.existsSync(DOCPAD) + console.log('docpad generate') + spawn(DOCPAD, ['generate'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step4) + step4 = next + + # Start + step1() watch: (opts,next) -> + # Prepare (next = opts; opts = {}) unless next? - # cake install - actions.install opts, safe next, -> - # coffee watch - spawn(COFFEE, ['-wco', OUT_DIR, SRC_DIR], {stdio:'inherit', cwd:APP_DIR}).on('close', safe next) + + # Steps + step1 = -> + console.log('cake install') + actions.install(opts, safe next, step2) + step2 = -> + return step3() if !config.COFFEE_SRC_PATH or !fsUtil.existsSync(COFFEE) + console.log('coffee watch') + spawn(COFFEE, ['-wco', config.COFFEE_OUT_PATH, config.COFFEE_SRC_PATH], {stdio:'inherit', cwd:APP_PATH}).on('close', safe) # background + step3() # continue while coffee runs in background + step3 = -> + return step4() if !config.DOCPAD_SRC_PATH or !fsUtil.existsSync(DOCPAD) + console.log('docpad run') + spawn(DOCPAD, ['run'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe) # background + step4() # continue while docpad runs in background + step4 = next + + # Start + step1() test: (opts,next) -> + # Prepare (next = opts; opts = {}) unless next? - # cake compile - actions.compile opts, safe next, -> - # npm test - spawn(NPM, ['test'], {stdio:'inherit', cwd:APP_DIR}).on('close', safe next) + + # Steps + step1 = -> + console.log('cake compile') + actions.compile(opts, safe next, step2) + step2 = -> + console.log('npm test') + spawn(NPM, ['test'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3) + step3 = next + + # Start + step1() prepublish: (opts,next) -> + # Prepare (next = opts; opts = {}) unless next? + + # Steps step1 = -> - # cake compile + console.log('cake compile') actions.compile(opts, safe next, step2) step2 = -> - # project compile - fsUtil.exists PROJECTZ, (exists) -> - return step3() unless exists - spawn(PROJECTZ, ['compile'], {stdio:'inherit', cwd:APP_DIR}).on('close', safe next, step3) + return step3() if !fsUtil.existsSync(PROJECTZ) + console.log('projectz compile') + spawn(PROJECTZ, ['compile'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3) step3 = -> - # docco compile - fsUtil.exists DOCCO, (exists) -> - return step4() unless exists - exec("#{DOCCO} -o #{DOCS_DIR} #{DOCS_INPUT}", {stdio:'inherit', cwd:APP_DIR}, safe next, step4) + return step4() if !config.DOCCO_SRC_PATH or !fsUtil.existsSync(DOCCO) + console.log('docco compile') + exec("#{DOCCO} -o #{config.DOCCO_OUT_PATH} #{config.DOCCO_SRC_PATH}", {stdio:'inherit', cwd:APP_PATH}, safe next, step4) step4 = -> - # npm test - actions.test(opts, safe next) + console.log('cake test') + actions.test(opts, safe next, step5) + step5 = next + + # Start step1() publish: (opts,next) -> + # Prepare (next = opts; opts = {}) unless next? - # cake prepublish - actions.prepublish opts, safe next, -> - # npm publish - spawn(NPM, ['publish'], {stdio:'inherit', cwd:APP_DIR}).on 'close', safe next, -> - # git tag - spawn(GIT, ['tag', 'v'+PACKAGE_DATA.version, '-a'], {stdio:'inherit', cwd:APP_DIR}).on('close', safe next) + + # Steps + step1 = -> + console.log('cake prepublish') + actions.prepublish(opts, safe next, step2) + step2 = -> + console.log('npm publish') + spawn(NPM, ['publish'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step3) + step3 = -> + console.log('git tag') + spawn(GIT, ['tag', 'v'+PACKAGE_DATA.version, '-a'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step4) + step4 = -> + console.log('git push origin master') + spawn(GIT, ['push', 'origin', 'master'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step5) + step5 = -> + console.log('git push tags') + spawn(GIT, ['push', 'origin', '--tags'], {stdio:'inherit', cwd:APP_PATH}).on('close', safe next, step6) + step6 = next + + # Start + step1() # ===================================== diff --git a/Contributing.md b/Contributing.md deleted file mode 100644 index 6e73ca2..0000000 --- a/Contributing.md +++ /dev/null @@ -1,36 +0,0 @@ -# Contributing - -## Support - -[Post your question on StackOverflow with the `docpad` tag](http://stackoverflow.com/questions/tagged/docpad) - - -## Bug reports - -[Post your bug report on the GitHub Issue Tracker for this project](https://github.com/docpad/docpad-plugin-yourpluginname/issues) - - -## Development - -### Install dependencies - -``` bash -npm install; npm install -g coffee-script -``` - -### Setup for development - -``` bash -cake setup -``` - -### Watch and compile - -``` bash -cake watch -``` - - -## Testing - -No tests yet! diff --git a/History.md b/HISTORY.md similarity index 100% rename from History.md rename to HISTORY.md diff --git a/LICENSE.md b/LICENSE.md index 2c6ad50..b2e01f5 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1 +1,17 @@ -Your plugin's license should go here \ No newline at end of file + + + +# License + +Copyright © Copyright holders name (copyright holder's website url) + +## The MIT License +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + diff --git a/package.json b/package.json index 8e4105f..2f44d38 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,14 @@ "Your name (your github url)" ], "contributors": [ - "Your name (your github url)" + "balupton (https://github.com/balupton)" ], "bugs": { - "url": "https://github.com/yourgithubusername/docpad-plugin-yourpluginname/issues" + "url": "https://github.com/docpad/docpad-plugin-yourpluginname/issues" }, "repository": { "type": "git", - "url": "https://github.com/yourgithubusername/docpad-plugin-yourpluginname.git" + "url": "https://github.com/docpad/docpad-plugin-yourpluginname.git" }, "engines": { "node": ">=0.8" @@ -31,10 +31,29 @@ }, "dependencies": {}, "devDependencies": { - "coffee-script": "~1.6.3" + "coffee-script": "~1.6.3", + "docpad": "6", + "projectz": "~0.3.13" }, "main": "./out/yourpluginname.plugin.js", "scripts": { "test": "node ./out/yourpluginname.test.js" + }, + "license": { + "type": "MIT" + }, + "badges": { + "travis": true, + "npm": true, + "david": true, + "daviddev": true, + "gittip": "docpad", + "flattr": "344188/balupton-on-Flattr", + "paypal": "QB8GQPZAH84N6", + "bitcoin": "https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a", + "wishlist": "http://amzn.com/w/2F8TXKSNAFG4V" + }, + "cakeConfiguration": { + "COFFEE_SRC_PATH": "src" } } \ No newline at end of file