Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions Console/node/asset_builder.js

This file was deleted.

16 changes: 0 additions & 16 deletions Console/node/asset_environment.js

This file was deleted.

12 changes: 0 additions & 12 deletions Console/node/asset_server.js

This file was deleted.

9 changes: 0 additions & 9 deletions Console/node/run_tests.js

This file was deleted.

103 changes: 60 additions & 43 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,58 @@
var fs = require('fs');

module.exports = function(grunt) {
var includePaths = [ 'webroot/js', 'webroot/css' ];

var changedFiles = {};
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
files: [
'!Lib/Cake/**',
'!Vendor/**',
'!tmp/**',
'!.git/**/*.php',
'**/*.php'
],
tasks: 'null'
},
server: {

less: {
dev: {
port: 3333,
path: '/assets',
include: includePaths
options: {
paths: ["webroot/css"]
},
files: {
"webroot/css/global.css": "webroot/less/global.less",
"webroot/css/public.css": "webroot/less/public.less",
"webroot/css/admin.css": "webroot/less/admin.less"
}
}
},
build: {
prod: {
include: includePaths,
files: ['application.css', 'application.js'],
dest: 'webroot/assets'

watch: {
php: {
files: [
'!Lib/Cake/**',
'!Vendor/**',
'!tmp/**',
'!.git/**/*.php',
'**/*.php'
],
tasks: 'null',
// tasks: 'phptestfile',
options: {
spawn: false
}
},
less: {
files: [
'webroot/less/**/*.{css,less}'
],
tasks: 'less'
}
}
});

grunt.registerTask('null', function() {});
grunt.registerTask('default', ['watch']);

grunt.event.on('watch', function(action, filepath) {
// console.log(action, filepath, this);
// if (this.name != 'watch:php') {
// return false;
// }
var CakeTestRunner = require('./Console/node/cake_test_runner'),
file = new CakeTestRunner(filepath);

Expand All @@ -44,30 +63,28 @@ module.exports = function(grunt) {
file.exists(function() { file.run(); });
});

grunt.registerTask('dev', ['server', 'watch']);

grunt.registerTask('null', function() {});

grunt.registerMultiTask('server', 'Run a development asset compilation server.', function() {
var assetServer = require('./Console/node/asset_server');
assetServer(this.data.port, this.data.path, this.data.include);
});

grunt.registerMultiTask('build', 'Build assets to static files.', function() {
var assetBuilder = require('./Console/node/asset_builder');
assetBuilder(this.data.dest, this.data.files, this.data.include, this.async());
});

grunt.registerTask('test', 'Run the browser tests in command line', function(protocol, url) {
var path = require('path'),
runTests = require('./Console/node/run_tests');
if (!protocol && !url) {
url = 'localhost/' + path.basename(__dirname) + '/testjs';
} else if (/http/.test(protocol)) {
url = url.replace('//', '');
} else {
url = protocol;
}
runTests('http://' + url, this.async());
});
// grunt.event.on('watch', function(action, filepath) {
// if (this.name === 'watch:php') {
// changedFiles[filepath] = action;
// }
// });
//
// grunt.registerMultiTask('phptestfile', function() {
// console.log(changedFiles);
// return true;
//
// var filepath = '?';
// var CakeTestRunner = require('./Console/node/cake_test_runner');
// var file = new CakeTestRunner(filepath);
//
// if (fs.existsSync('.vagrant')) { //@TODO: This doesn't work because the folder shows up inside the VM too.
// file.vagrantHost = true;
// }
//
// file.exists(function() { file.run(); });
// });
};
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"name": "_PROJECT_NAME_",
"name": "@TODO:_PROJECT_NAME_",
"scripts": {
"start": "grunt dev"
},
"dependencies": {
"grunt": "~0.4.1",
"grunt-contrib-watch": "~0.3.1",
"mincer": "~0.4.5",
"connect": "~2.7.4",
"async": "~0.2.6",
"coffee-script": "~1.6.2",
"less": "~1.3.3",
"connect": "~2.7.4",
"csso": "~1.3.7",
"uglify-js": "~2.2.5",
"async": "~0.2.6",
"mocha-phantomjs": "~2.0.1"
"grunt": "~0.4.5",
"grunt-contrib-less": "~0.11.4",
"grunt-contrib-watch": "~0.3.1",
"less": "~1.3.3",
"mincer": "~0.4.5",
"mocha-phantomjs": "~2.0.1",
"uglify-js": "~2.2.5"
}
}
Empty file added webroot/less/app.less
Empty file.