Switch to rake from make

This commit is contained in:
Radek Stepan 2014-11-02 21:22:33 -07:00
parent d81ead5c5b
commit 2185eec390
6 changed files with 115 additions and 119 deletions

View File

@ -1,71 +0,0 @@
BROWSERIFY = ./node_modules/.bin/browserify
WATCHIFY = ./node_modules/.bin/watchify
LESS = ./node_modules/.bin/lessc
WATCH = ./node_modules/.bin/watch
SERVER = ./node_modules/.bin/static
MOCHA = ./node_modules/.bin/mocha
COVERALLS = ./node_modules/.bin/coveralls
GRUNT = grunt
# Install dependencies.
install:
npm install
watch:
${MAKE} watch-js & ${MAKE} watch-css
# Watch the app.
watch-js:
${WATCHIFY} -e ./src/app.coffee -o public/js/app.bundle.js -d -v
# Watch the styles.
watch-css:
${MAKE} build-css
${WATCH} "${MAKE} build-css" src/styles
# Serve locally.
serve:
${SERVER} public -H '{"Cache-Control": "no-cache, must-revalidate"}'
# Make a minified package.
build:
${GRUNT} init
${MAKE} build-js
${MAKE} build-css
${GRUNT} minify
build-js:
${BROWSERIFY} -e ./src/app.coffee -o public/js/app.bundle.js
# Use less on index style.
build-css:
${LESS} src/styles/burnchart.less > public/css/app.bundle.css
# Publish to GitHub Pages.
publish:
${GRUNT} pages
OPTS = --compilers coffee:coffee-script/register --ui exports
# Run mocha test.
test:
${MOCHA} ${OPTS} --reporter spec
# Run code coverage.
coverage:
${MOCHA} ${OPTS} --reporter html-cov --require blanket > docs/COVERAGE.html
# Run code coverage and publish to coveralls.
coveralls:
${MOCHA} ${OPTS} --reporter mocha-lcov-reporter --require blanket | COVERALLS_REPO_TOKEN=$(TOKEN) COVERALLS_SERVICE_NAME=MOCHA ${COVERALLS}
M = :speech_balloon:
# Build app and make a commit with latest changes.
commit:
${MAKE} build
git add -A
git commit -am "${M}"
git push -u origin master
.PHONY: test

View File

@ -42,52 +42,23 @@ If you specify `LABELS` above, this is the place to set a regex used to parse a
"size_label": /^size (\d+)$/
```
##Build
The app is built using [Node](http://nodejs.org/). To install dev dependencies:
```bash
$ make install
```
###Development
##Commands
Read the [Architecture](docs/ARCHITECTURE.md) document when contributing code.
To create an unminified package with source maps for debugging:
```bash
$ make watch
```
You can then start a local http server on port `8080` with:
```bash
$ make serve
```
To test your changes run:
```bash
$ make test
```
And finally for code coverage:
```bash
$ make coverage
```
###Production
To make a minified package for production:
```bash
$ make build
```
You can then publish the contents of the `public` folder to `gh-pages` branch with:
```bash
$ make publish
rake build # Build everything & minify
rake build:css # Build the styles with LESS
rake build:js # Build the app with Browserify
rake build:minify # Minify build for production
rake commit[message] # Build app and make a commit with latest changes
rake install # Install dependencies with NPM
rake publish # Publish to GitHub Pages
rake serve # Start a web server on port 8080
rake test # Run tests with mocha
rake test:coverage # Run code coverage, mocha with Blanket.js
rake test:coveralls[token] # Run code coverage and publish to Coveralls
rake watch # Watch everything
rake watch:css # Watch the styles
rake watch:js # Watch the app
```

96
Rakefile Normal file
View File

@ -0,0 +1,96 @@
GRUNT = "grunt"
task :default => "build"
desc "Install dependencies with NPM"
task :install do
sh "npm install"
end
desc "Build everything & minify"
task :build => [ "build:js", "build:css", "build:minify" ] do end
desc "Watch everything."
multitask :watch => [ "watch:js", "watch:css" ]
desc "Run tests with mocha"
task :test do
sh "#{MOCHA} #{OPTS} --reporter spec"
end
desc "Start a web server on port 8080"
task :serve do
SERVER = "./node_modules/.bin/static"
sh "#{SERVER} public -H '{\"Cache-Control\": \"no-cache, must-revalidate\"}'"
end
desc "Publish to GitHub Pages"
task :publish do
sh "#{GRUNT} pages"
end
desc "Build app and make a commit with latest changes"
task :commit, [ :message ] => [ "build" ] do |t, args|
args.with_defaults(:message => ":speech_balloon")
sh "git add -A"
sh "git commit -am \"#{args.message}\""
sh "git push -u origin master"
end
namespace :watch do
WATCHIFY = "./node_modules/.bin/watchify"
WATCH = "./node_modules/.bin/watch"
desc "Watch the app"
task :js do
sh "#{WATCHIFY} -e ./src/app.coffee -o public/js/app.bundle.js -d -v"
end
desc "Watch the styles"
task :css => [ "build:css" ] do
sh "#{WATCH} \"rake build:css\" src/styles"
end
end
namespace :build do
BROWSERIFY = "./node_modules/.bin/browserify"
LESS = "./node_modules/.bin/lessc"
desc "Build the app with Browserify"
task :js do
sh "#{BROWSERIFY} -e ./src/app.coffee -o public/js/app.bundle.js"
end
desc "Build the styles with LESS"
task :css do
sh "#{LESS} src/styles/burnchart.less > public/css/app.bundle.css"
end
desc "Minify build for production"
task :minify do
sh "#{GRUNT} minify"
end
end
namespace :test do
MOCHA = "./node_modules/.bin/mocha"
COVERALLS = "./node_modules/.bin/coveralls"
OPTS = "--compilers coffee:coffee-script/register --ui exports"
desc "Run code coverage, mocha with Blanket.js"
task :coverage do
sh "#{MOCHA} #{OPTS} --reporter html-cov --require blanket > docs/COVERAGE.html"
end
desc "Run code coverage and publish to Coveralls"
task :coveralls, :token do |t, args|
args.with_defaults(:token => "ABC")
a = "#{MOCHA} #{OPTS} --reporter mocha-lcov-reporter --require blanket"
b = "COVERALLS_REPO_TOKEN=#{args.token} COVERALLS_SERVICE_NAME=MOCHA #{COVERALLS}"
sh "#{a} | #{b}"
end
end

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
##Notes
- *payment gateways* in Canada: [Shopify](http://www.shopify.com/payment-gateways/canada), [Chargify](http://chargify.com/payment-gateways/) list; I get free processing on first $1000 with [Stripe](https://education.github.com/pack/offers)
- [credit card form](http://designmodo.com/ux-credit-card-payment-form/) ux from Designmodo
- [credit card form](http://designmodo.com/ux-credit-card-payment-form/) ux from Designmodo or [here](https://d13yacurqjgara.cloudfront.net/users/79914/screenshots/1048397/attachments/127794/payments_page.jpg).
- workers: using a free instance of IronWorker and assuming 5s runtime each time gives us a poll every 6 minutes. Zapier would poll every 15 minutes but already integrates Stripe and FB.
- $2.5 Node.js PaaS via Gandi with promo code `PAASLAUNCH-C50E-B077-A317`.

View File

@ -16,8 +16,8 @@
"url": "git://github.com/asm-products/burnchart.git"
},
"scripts": {
"start": "make serve",
"test": "make test"
"start": "rake serve",
"test": "rake test"
},
"dependencies": {
"async": "~0.9.0",