Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

convert Makefile to a shelljs makefile

  • Loading branch information...
commit 52149636dc35a2af4891187cda74ef7e58b22183 1 parent 3862828
@XhmikosR XhmikosR authored
View
4 .gitignore
@@ -1,5 +1,7 @@
-build/
*.pyc
+/*.log
+/build/
+/node_modules/
# gedit backup files
*.*~
View
19 LICENSE.md
@@ -0,0 +1,19 @@
+Copyright (C) 2013 MPC-HC Team
+
+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.
View
76 Makefile
@@ -1,76 +0,0 @@
-BUILDDIR = ./build
-BLDDIR_WEB = $(BUILDDIR)/website
-SRC = ./source
-
-# Internal variables
-SPHINXOPTS = -d $(BUILDDIR)/doctrees $(SRC)
-
-# Targets
-all: website
-
-build: all
-
-server:
- @echo ; echo "Starting webserver..."
- @cd $(BLDDIR_WEB) && python -m SimpleHTTPServer
-
-clean:
- @echo cleaning...
- -@rm -rf $(BUILDDIR)/
-
-rebuild: clean build
-
-distclean: clean
-
-website:
- @echo ; echo "Building posts..."
- @python sphinxblog/gen.py
-
- @echo ; echo "Building site..."; echo
- @sphinx-build -b dirhtml $(SPHINXOPTS) $(BLDDIR_WEB)
-
- @echo ; echo "Removing files we don't need..."
- -@rm -rf $(BLDDIR_WEB)/.buildinfo \
- $(BLDDIR_WEB)/_static/*.css \
- $(BLDDIR_WEB)/_static/*.gif \
- $(BLDDIR_WEB)/_static/*.js \
- $(BLDDIR_WEB)/_static/*.png \
- $(BLDDIR_WEB)/_static/css/*.css \
- $(BLDDIR_WEB)/_static/js/*.js \
- $(BLDDIR_WEB)/genindex \
- $(BLDDIR_WEB)/objects.inv \
- $(BLDDIR_WEB)/search \
- $(BLDDIR_WEB)/searchindex.js
-
- @echo ; echo "Copying files..."
- @cp $(SRC)/.htaccess $(SRC)/version.txt $(SRC)/robots.txt $(BLDDIR_WEB)
- @cp $(SRC)/_static/js/jquery-*.min.js $(BLDDIR_WEB)/_static/js
- @cp $(SRC)/_static/apple-touch-icon*.png $(BLDDIR_WEB)
- @cp $(SRC)/_static/favicon.ico $(BLDDIR_WEB)
-
- @echo ; echo "Combining css files..."
- @cat $(SRC)/_static/css/bootstrap.css \
- $(SRC)/_static/css/bootstrap-responsive.css \
- $(SRC)/_static/css/jquery.fancybox.css \
- $(SRC)/_static/css/jquery.fancybox-thumbs.css \
- $(SRC)/_static/css/style.css \
- | cleancss --s0 -o $(BLDDIR_WEB)/_static/css/pack.css
-
- @echo ; echo "Combining js files..."
- @uglifyjs $(SRC)/_static/js/plugins.js \
- $(SRC)/_static/js/bootstrap.js \
- $(SRC)/_static/js/jquery.mousewheel.js \
- $(SRC)/_static/js/jquery.fancybox.js \
- $(SRC)/_static/js/jquery.fancybox-thumbs.js \
- -o $(BLDDIR_WEB)/_static/js/pack.js --compress --mangle
-
- @echo ; echo "Build finished. The HTML pages are in $(BLDDIR_WEB)."
-
-help:
- @echo "Please use \"make <target>\" where <target> is one of:"
- @echo " server to start the webserver"
- @echo " website to build the website"
- @echo " clean to clean the built website"
- @echo " help to show this help message"
-
-.PHONY: clean help server
View
10 Readme.md
@@ -1,6 +1,3 @@
-README
-======
-
Getting started
---------------
@@ -9,9 +6,8 @@ Getting started
* Install [Python pip](http://www.pip-installer.org/en/latest/installing.html#alternative-installation-procedures)
* Install Sphinx: `pip install Sphinx`
* Install [node.js](http://nodejs.org/download/)
-* Install [clean-css](https://github.com/GoalSmashers/clean-css) by running: `npm install -g clean-css`
-* Install [uglify-js](https://github.com/mishoo/UglifyJS2) by running: `npm install -g uglify-js`
+* Install the dependencies: `npm install`
* On Windows: `SET PATH=C:\Python27;C:\Python27\Scripts;%PATH%`
-* Run `make` or `make website` to build the static site
-* Run the Python webserver to test your changes: `make server`
+* Run `node make` or `node make website` to build the static site
+* Run the Python webserver to test your changes: `node make server`
(http://localhost:8000/)
View
169 make.js
@@ -0,0 +1,169 @@
+/**!
+ * make.js, script to build the website for MPC-HC
+ * Released under the terms of MIT license
+ *
+ * https://github.com/mpc-hc/website
+ *
+ * Copyright (C) 2013 MPC-HC Team
+ */
+
+/* jshint forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true,
+ camelcase:true, trailing:true, strict:true, boss:true, unused:true,
+ curly:true, indent:4, maxerr:100 */
+/*global cd, cp, target, echo, cat, exec, pushd, popd, rm, require, __dirname */
+
+(function () {
+ 'use strict';
+
+ require('shelljs/make');
+ var fs = require('fs');
+ var cleanCSS = require('clean-css');
+ var UglifyJS = require('uglify-js');
+
+ var ROOT_DIR = __dirname + '/', // absolute path to project's root
+ BUILD_DIR = ROOT_DIR + 'build/',
+ BUILD_TARGET = BUILD_DIR + 'website/',
+ SRC_DIR = ROOT_DIR + 'source/',
+ SPHINXOPTS = '-d' + ' ' + BUILD_DIR + '/doctrees' + ' ' + SRC_DIR + ' ' + BUILD_TARGET;
+
+ //
+ // make all
+ //
+ target.all = function () {
+ target.website();
+ };
+
+ //
+ // make website
+ //
+ target.website = function () {
+ cd(ROOT_DIR);
+ echo();
+ echo("### Building posts...");
+ exec('python -u sphinxblog/gen.py');
+
+ echo();
+ echo("### Building site...");
+ exec('sphinx-build -b dirhtml' + ' ' + SPHINXOPTS);
+
+
+ echo();
+ echo("### Removing files we don't need...");
+
+ pushd(BUILD_TARGET);
+
+ var filesToRemoveFromDist = [
+ '.buildinfo',
+ '_static/*.css',
+ '_static/*.gif',
+ '_static/*.js',
+ '_static/*.png',
+ '_static/css/*.css',
+ '_static/favicon.ico',
+ '_static/js/*.js',
+ 'genindex',
+ 'objects.inv',
+ 'search',
+ 'searchindex.js'];
+
+ rm('-rf', filesToRemoveFromDist);
+
+ popd();
+
+
+ echo();
+ echo("### Copying files...");
+
+ pushd(SRC_DIR);
+
+ cp('-f', '.htaccess', BUILD_TARGET);
+ cp('-f', '_static/apple-touch-icon*.png', BUILD_TARGET);
+ cp('-f', '_static/favicon.ico', BUILD_TARGET);
+ cp('-f', '_static/js/jquery-*.min.js', BUILD_TARGET + '_static/js');
+ cp('-f', 'robots.txt', BUILD_TARGET);
+ cp('-f', 'version.txt', BUILD_TARGET);
+
+ echo();
+ echo("### Combining css files...");
+
+ var inCss = cat(['_static/css/bootstrap.css',
+ '_static/css/bootstrap-responsive.css',
+ '_static/css/jquery.fancybox.css',
+ '_static/css/jquery.fancybox-thumbs.css',
+ '_static/css/style.css']);
+
+ var outCss = BUILD_TARGET + '_static/css/pack.css';
+ var minifiedCss = cleanCSS.process(inCss, {
+ removeEmpty: true,
+ keepSpecialComments: 0});
+
+ fs.writeFileSync(outCss, minifiedCss, 'utf8');
+
+ //exec('cleancss -o' + ' ' + outCss + ' ' + inCss + ' ' + '--s0');
+
+ echo();
+ echo("### Combining js files...");
+
+ var inJs = ['_static/js/plugins.js',
+ '_static/js/bootstrap.js',
+ '_static/js/jquery.mousewheel.js',
+ '_static/js/jquery.fancybox.js',
+ '_static/js/jquery.fancybox-thumbs.js'];
+
+ var outJs = BUILD_TARGET + '_static/js/pack.js';
+ var minifiedJs = UglifyJS.minify(inJs, {
+ warnings: false,
+ mangle: true});
+
+ fs.writeFileSync(outJs, minifiedJs.code, 'utf8');
+ //exec('uglifyjs' + ' ' + inJs.join(' ') + ' -o' + ' ' + outJs + --compress --mangle');
+
+
+ echo();
+ echo('### Build finished. The HTML pages are in' + ' ' + BUILD_TARGET + '.');
+
+ popd();
+ };
+
+ //
+ // make clean
+ //
+ target.clean = function () {
+ cd(ROOT_DIR);
+ echo();
+ echo('### Cleaning build...');
+ rm('-rf', BUILD_DIR);
+ };
+
+ //
+ // make rebuild
+ //
+ target.rebuild = function () {
+ target.clean();
+ target.website();
+ };
+
+ //
+ // make server
+ //
+ target.server = function () {
+ cd(ROOT_DIR);
+ echo();
+ echo('### Starting webserver...');
+ cd(BUILD_TARGET);
+ exec('python -u -m SimpleHTTPServer', {async: true});
+ };
+
+ //
+ // make help
+ //
+ target.help = function () {
+ echo("Available targets:");
+ echo(" website builds the website");
+ echo(" server starts the webserver");
+ echo(" clean cleans the built website");
+ echo(" rebuild rebuilds the website");
+ echo(" help shows this help message");
+ };
+
+}());
View
23 package.json
@@ -0,0 +1,23 @@
+{
+ "name": "mpc-hc-website",
+ "version": "0.1.0",
+ "readme": "Readme.md",
+ "author": {
+ "name": "MPC-HC Team",
+ "url": "https://github.com/mpc-hc/website"
+ },
+ "description": "The dependencies to build MPC-HC's website",
+ "homepage": "https://github.com/mpc-hc/website",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mpc-hc/website.git"
+ },
+ "devDependencies": {
+ "clean-css": "~0.9.1",
+ "shelljs": "~0.1.1",
+ "uglify-js": "~2.2.3"
+ },
+ "engines": {
+ "node": "~0.8.0"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.