diff --git a/Makefile b/Makefile deleted file mode 100644 index 728f4239..00000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -publish-docs: - git checkout -b gh-pages - rm -rf node_modules - rm -rf site/node_modules - rm -rf docs - rm -rf guides - $(MAKE) -C site build - npm install - ./node_modules/.bin/documentjs --f - git add -f docs/ - git add -f guides/ - git add -f site/static/ - git add -f examples/ - git add -f index.html - git add -f CNAME - git commit -m "Publish docs" - git push -f origin gh-pages - git checkout - - git branch -D gh-pages diff --git a/doc/guides/contribute.md b/doc/guides/contribute.md index 1afd0c6d..72c9df7e 100644 --- a/doc/guides/contribute.md +++ b/doc/guides/contribute.md @@ -60,7 +60,7 @@ a half day task. `~34` might take a week of experimentation. ## Suggest a feature -FuncUnit uses [Github Issues](https://github.com/bitovi/funcunit/issues/new) to track feature requests. +FuncUnit uses [Github Issues](https://github.com/bitovi/funcunit/issues/new) to track feature requests. When creating an feature issue, it's very helpful to include: @@ -210,8 +210,8 @@ The following details the directory structure of FuncUnit: ├── .jshintrc - Configures JSHint ├── .npmignore - Tells npm publish to ignore certain files ├── .travis.yml - Travis CI configuration +├── publish-docs.js - Publishes the documentation to gh-pages ├── readme.md - Automatically generated readme -├── Makefile - Publishes the doumentation to gh-pages ├── test.html - Main test page ├── test/ - Test files | ├── test.js - Main test file @@ -303,11 +303,11 @@ The FuncUnit theme is in `funcunit/site/theme` Once the docs look right locally, commit your changes, then run: -``` -> make +```shell +npm run document:publish ``` -The make script will generate the documentation again and push out the `gh-pages` branch. +The `publish-docs.js` script will generate the documentation again and push out the `gh-pages` branch. ### Writing API documentation @@ -414,7 +414,7 @@ use section because it's covered in [can-component]. #### For individual modules -FuncUnit has the same structure as all CanJS individual modules which allows making releases through NPM scripts. +FuncUnit has the same structure as all CanJS individual modules which allows making releases through NPM scripts. All versions should follow the [Semantic Versioning](http://semver.org/) guidelines in the form of `MAJOR.MINOR.PATCH` for - `MAJOR` version when you make incompatible API changes, @@ -443,4 +443,4 @@ This will run the tests, build, bump the version number accordingly and publish #### Travis -All repositories automatically run their tests in [Travis CI](https://travis-ci.org/) using the `npm test` command (browser tests use Firefox as their target browser). \ No newline at end of file +All repositories automatically run their tests in [Travis CI](https://travis-ci.org/) using the `npm test` command (browser tests use Firefox as their target browser). diff --git a/package.json b/package.json index e9d3478a..766cc24a 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,8 @@ "release:major": "npm version major && npm publish", "build": "node build.js", "document": "./node_modules/.bin/documentjs", + "document:force": "./node_modules/.bin/documentjs --f", + "document:publish": "node publish-docs.js", "develop": "done-serve --static --develop --port 8080", "release:pre": "npm version prerelease && npm publish" }, @@ -47,16 +49,17 @@ "syn": "^0.10.0" }, "devDependencies": { - "less": "^1.7.0", - "documentjs": "^0.3.0-pre.4", "can-define": "^0.8.0", "can-zone": "^0.4.4", "chai": "^3.5.0", + "documentjs": "^0.3.0-pre.4", "done-serve": "^0.2.5", "donejs-cli": "^0.9.5", "generator-donejs": "^0.9.0", "jasmine": "^2.5.2", "jshint": "^2.9.1", + "less": "^1.7.0", + "shelljs": "^0.7.8", "steal": "^0.16.35", "steal-jasmine": "0.0.3", "steal-mocha": "0.0.3", diff --git a/pub-docs.js b/pub-docs.js deleted file mode 100644 index e13d446c..00000000 --- a/pub-docs.js +++ /dev/null @@ -1,50 +0,0 @@ -var shell = require('shelljs'); - -if (!shell.which('git')) { - shell.echo('Sorry, this script requires git'); - shell.exit(1); -} - -// git checkout -b gh-pages -checkResultCode(shell.exec('git checkout -b gh-pages')); -// rm -rf node_modules -checkResultCode(shell.rm('-rf', 'node_modules')); -// rm -rf site/node_modules -checkResultCode(shell.rm('-rf', 'site/node_modules')); -// rm -rf docs -checkResultCode(shell.rm('-rf', 'docs')); -// rm -rf guides -checkResultCode(shell.rm('-rf', 'guides')); -// TODO figure out if this is needed -// $(MAKE) -C site build -// npm install -checkResultCode(shell.exec('npm install')); -// ./node_modules/.bin/documentjs --f -checkResultCode(shell.exec('./node_modules/.bin/documentjs --f')); -// git add -f docs/ -checkResultCode(shell.exec('git add -f docs/')); -// git add -f guides/ -checkResultCode(shell.exec('git add -f guides/')); -// git add -f site/static/ -checkResultCode(shell.exec('git add -f site/static/')); -// git add -f examples/ -checkResultCode(shell.exec('git add -f examples/')); -// git add -f index.html -checkResultCode(shell.exec('git add -f index.html')); -// git add -f CNAME -checkResultCode(shell.exec('git add -f CNAME')); -// git commit -m "Publish docs" -checkResultCode(shell.exec('git commit -m "Publish docs"')); -// git push -f origin gh-pages -checkResultCode(shell.exec('git push -f origin gh-pages')); -// git checkout - -checkResultCode(shell.exec('git checkout -')); -// git branch -D gh-pages -checkResultCode(shell.exec('git branch -D gh-pages')); - -function checkResultCode(code) { - if(code){ - shell.echo('Build failed at'); - shell.exit(code); - } -} \ No newline at end of file diff --git a/publish-docs.js b/publish-docs.js new file mode 100644 index 00000000..46541d9e --- /dev/null +++ b/publish-docs.js @@ -0,0 +1,66 @@ +var shell = require('shelljs'); + +if (!shell.which('git')) { + shell.echo('Sorry, this script requires git'); + shell.exit(1); +} + +console.info('Running git checkout -b gh-pages'); +checkResultCode(shell.exec('git checkout -b gh-pages')); + +console.info('Running rm -rf node_modules'); +checkResultCode(shell.rm('-rf', 'node_modules')); + +console.info('Running rm -rf site/node_modules'); +checkResultCode(shell.rm('-rf', 'site/node_modules')); + +console.info('Running rm -rf docs'); +checkResultCode(shell.rm('-rf', 'docs')); + +console.info('Running rm -rf guides'); +checkResultCode(shell.rm('-rf', 'guides')); + +console.info('Running $(MAKE) -C site build'); +checkResultCode(shell.exec('cd site && npm install --no-shrinkwrap && npm run build && cd ..')); + +console.info('Running npm install --no-shrinkwrap'); +checkResultCode(shell.exec('npm install --no-shrinkwrap')); + +console.info('Running npm run document:force'); +checkResultCode(shell.exec('npm run document:force')); + +console.info('Running git add -f docs/'); +checkResultCode(shell.exec('git add -f docs/')); + +console.info('Running git add -f guides/'); +checkResultCode(shell.exec('git add -f guides/')); + +console.info('Running git add -f site/static/'); +checkResultCode(shell.exec('git add -f site/static/')); + +console.info('Running git add -f examples/'); +checkResultCode(shell.exec('git add -f examples/')); + +console.info('Running git add -f index.html'); +checkResultCode(shell.exec('git add -f index.html')); + +console.info('Running git add -f CNAME'); +checkResultCode(shell.exec('git add -f CNAME')); + +console.info('Running git commit -m "Publish docs"'); +checkResultCode(shell.exec('git commit -m "Publish docs"')); + +console.info('Running git push -f origin gh-pages'); +checkResultCode(shell.exec('git push -f origin gh-pages')); + +console.info('Running git checkout -'); +checkResultCode(shell.exec('git checkout -')); + +console.info('Running git branch -D gh-pages'); +checkResultCode(shell.exec('git branch -D gh-pages')); + +function checkResultCode(result) { + if (result.code !== 0) { + shell.exit(result.code); + } +} diff --git a/site/Makefile b/site/Makefile deleted file mode 100644 index 0f0dc435..00000000 --- a/site/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -build: - npm install - npm run build \ No newline at end of file