From d20a8a65e49422feaa68281adb31d0564013df44 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 5 Feb 2015 15:57:39 +0100 Subject: [PATCH] Add a webserver for serving files during development. --- Makefile | 56 +++++++++++++++++++++++++++++++--------------------- Makefile.win | 16 +++++++++++---- package.json | 1 + 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 70f87a7ce..3ce775767 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,14 @@ # You can set these variables from the command line. BOWER ?= node_modules/.bin/bower -BUILDDIR = ./docs -PAPER = +BUILDDIR = ./docs +PAPER = PHANTOMJS ?= ./node_modules/.bin/phantomjs -SPHINXBUILD ?= ./bin/sphinx-build -SPHINXOPTS = -PO2JSON ?= ./node_modules/.bin/po2json -SASS ?= sass +SPHINXBUILD ?= ./bin/sphinx-build +SPHINXOPTS = +PO2JSON ?= ./node_modules/.bin/po2json +SASS ?= sass GRUNT ?= ./node_modules/.bin/grunt +HTTPSERVE ?= ./node_modules/.bin/http-server # Internal variables. ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source @@ -19,18 +20,27 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source all: dev help: - @echo "Please use \`make ' where is one of" - @echo " dev to set up the development environment" + @echo "Please use \`make ' where is one of the following" @echo " build create minified builds containing converse.js and all its dependencies" - @echo " gettext to make PO message catalogs of the documentation" - @echo " html to make standalone HTML files of the documentation" - @echo " pot to generate a gettext POT file to be used for translations" - @echo " po to generate gettext PO files for each i18n language" - @echo " po2json to generate JSON files from the language PO files" - @echo " release to make a new minified release" - @echo " linkcheck to check all documentation external links for integrity" - @echo " epub to export the documentation to epub" - @echo " changes to make an overview of all changed/added/deprecated items added to the documentation" + @echo " changes make an overview of all changed/added/deprecated items added to the documentation" + @echo " css generate CSS from the Sass files" + @echo " dev set up the development environment" + @echo " epub export the documentation to epub" + @echo " gettext make PO message catalogs of the documentation" + @echo " html make standalone HTML files of the documentation" + @echo " linkcheck check all documentation external links for integrity" + @echo " cssmin minify the CSS files" + @echo " po generate gettext PO files for each i18n language" + @echo " po2json generate JSON files from the language PO files" + @echo " pot generate a gettext POT file to be used for translations" + @echo " release make a new minified release" + @echo " serve serve this directory via a webserver on port 8000" + +######################################################################## +## Miscellaneous + +serve: dev + $(HTTPSERVE) -p 8000 ######################################################################## ## Translation machinery @@ -49,12 +59,6 @@ po2json: ######################################################################## ## Release management -jsmin: - ./node_modules/requirejs/bin/r.js -o src/build.js && ./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-website.js - -cssmin: - $(GRUNT) cssmin - release: sed -i s/Project-Id-Version:\ Converse\.js\ [0-9]\.[0-9]\.[0-9]/Project-Id-Version:\ Converse.js\ $(VERSION)/ locale/converse.pot sed -i s/\"version\":\ \"[0-9]\.[0-9]\.[0-9]\"/\"version\":\ \"$(VERSION)\"/ bower.json @@ -95,6 +99,12 @@ dev: clean css:: $(SASS) sass/converse.scss > css/converse.css +jsmin: + ./node_modules/requirejs/bin/r.js -o src/build.js && ./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-website.js + +cssmin: + $(GRUNT) cssmin + build:: $(GRUNT) jst $(GRUNT) minify diff --git a/Makefile.win b/Makefile.win index c929d7b37..1082d6842 100644 --- a/Makefile.win +++ b/Makefile.win @@ -1,19 +1,27 @@ # You can set these variables from the command line. -GRUNT ?= node_modules\.bin\grunt.cmd +GRUNT ?= node_modules\.bin\grunt.cmd BOWER ?= node_modules\.bin\bower PHANTOMJS ?= node_modules\.bin\phantomjs SASS ?= sass -RMRF ?= rmdir /q /s -RMF ?= del /q +RMRF ?= rmdir /q /s +RMF ?= del /q +HTTPSERVE ?= ./node_modules/.bin/http-server .PHONY: all help clean css minjs build all: dev help: - @echo "Please use \`make ' where is one of" + @echo "Please use \`make ' where is one of the following" @echo " dev to set up the development environment" @echo " build create minified builds containing converse.js and all its dependencies" + @echo " serve to serve this directory via a webserver on port 8000" + +######################################################################## +## Miscellaneous + +serve: + $(HTTPSERVE) -p 8000 ######################################################################## ## Install dependencies diff --git a/package.json b/package.json index 06262c101..ed22b5907 100755 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "grunt-contrib-requirejs": "~0.4.3", "grunt-json": "^0.1.3", "grunt-touch": "^0.1.0", + "http-server": "^0.7.4", "less": "~1.7.0", "phantom-jasmine": "0.1.8", "phantomjs": "~1.9.7-1",