Skip to content

Commit

Permalink
Merge pull request #445 from bitovi/build-cleanup
Browse files Browse the repository at this point in the history
Build cleanup
  • Loading branch information
daffl committed Jul 4, 2013
2 parents 21388f4 + bd7568d commit e48a8a0
Show file tree
Hide file tree
Showing 34 changed files with 829 additions and 662 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ standalone*
docs*
*.DS_Store
.idea
build/ci/can
build/ci/funcunit
build/ci/steal
build/gh-pages
118 changes: 82 additions & 36 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
var path = require('path');
// Returns mappings for AMDify
var getAmdifyMap = function(baseName) {
var amdifyMap = {};

amdifyMap[baseName + 'util'] = 'can/util/library';
amdifyMap[baseName] = 'can/';
amdifyMap['can/can'] = 'can';

return amdifyMap;
}

module.exports = function (grunt) {

var _ = grunt.util._;
var baseName = path.basename(__dirname) + '/';
var builderJSON = grunt.file.readJSON('builder.json');
var pkg = grunt.file.readJSON('package.json');
var banner = _.template(builderJSON.banner, {
Expand All @@ -11,25 +24,14 @@ module.exports = function (grunt) {

grunt.initConfig({
pkg: pkg,
builderJSON: builderJSON,
meta: {
out: "dist/",
beautifier: {
options: {
indentSize: 1,
indentChar: "\t"
},
exclude: [/\.min\./, /qunit\.js/]
}
},
testify: {
libs: {
template: 'test/templates/__configuration__.html.ejs',
builder: '<%= builderJSON %>',
builder: builderJSON,
root: '../',
out: 'test/',
transform: {
options: function (config) {
options: function () {
this.steal.map = (this.steal && this.steal.map) || {};
this.steal.map['*'] = this.steal.map['*'] || {};
this.steal.map['*']['can/'] = '';
Expand All @@ -39,24 +41,24 @@ module.exports = function (grunt) {
},
dist: {
template: 'test/templates/__configuration__-dist.html.ejs',
builder: '<%= builderJSON %>',
builder: builderJSON,
root: '../../',
out: 'test/dist/',
transform: {
'module': function (definition, name) {
module: function (definition) {
if (!definition.isDefault) {
return definition.name.toLowerCase();
}
return null;
},

'test': function (definition, key) {
test: function (definition, key) {
var name = key.substr(key.lastIndexOf('/') + 1);
var path = key.replace('can/', '') + '/';
return path + name + '_test.js';
},

'options': function (config) {
options: function (config) {
return {
dist: 'can.' + config
}
Expand All @@ -65,7 +67,7 @@ module.exports = function (grunt) {
},
amd: {
template: 'test/templates/__configuration__-amd.html.ejs',
builder: '<%= builderJSON %>',
builder: builderJSON,
root: '../..',
out: 'test/amd/'
}
Expand All @@ -76,8 +78,8 @@ module.exports = function (grunt) {
pluginify: {
ignore: [ /\/lib\//, /util\/dojo-(.*?).js/ ]
},
pkg: "<%= pkg %>",
builder: "<%= builderJSON %>",
pkg: pkg,
builder: builderJSON,
steal: {
map: {
'*': {
Expand All @@ -99,16 +101,22 @@ module.exports = function (grunt) {
amdify: {
options: {
steal: {
root: '../'
},
map: {
'can/util': 'can/util/library'
root: '../',
map: {
'*': {
'can/': baseName
}
}
},
map: getAmdifyMap(baseName),
banner: banner
},
all: {
options: {
ids: ['can'].concat(_.keys(grunt.file.readJSON('builder.json').modules))
ids: ['can'].concat(_.map(
_.keys(builderJSON.configurations), function(name) {
return 'can/util/' + name;
}), _.keys(builderJSON.modules))
},
files: {
'dist/amd/': '.'
Expand All @@ -128,7 +136,7 @@ module.exports = function (grunt) {
repo: 'canjs',
user: 'bitovi',
milestone: 7,
version: '<%= pkg.version %>'
version: pkg.version
}
},
connect: {
Expand All @@ -140,22 +148,38 @@ module.exports = function (grunt) {
}
},
qunit: {
all: {
steal: {
options: {
urls: [
'http://localhost:8000/test/dist/dojo.html',
'http://localhost:8000/test/dist/jquery.html',
//'http://localhost:8000/can/test/zepto.html',
'http://localhost:8000/test/dist/mootools.html',
'http://localhost:8000/test/dist/yui.html',

'http://localhost:8000/test/dojo.html',
'http://localhost:8000/test/jquery.html',
//'http://localhost:8000/can/test/zepto.html',
'http://localhost:8000/test/mootools.html',
'http://localhost:8000/test/yui.html'
]
}
},
dist: {
options: {
urls: [
'http://localhost:8000/test/dist/dojo.html',
'http://localhost:8000/test/dist/jquery.html',
//'http://localhost:8000/can/test/zepto.html',
'http://localhost:8000/test/dist/mootools.html',
'http://localhost:8000/test/dist/yui.html'
]
}
},
amd: {
options: {
urls: [
// TODO AMD & DOJO 'http://localhost:8000/test/amd/dojo.html',
'http://localhost:8000/test/amd/jquery.html',
//'http://localhost:8000/can/test/zepto.html',
'http://localhost:8000/test/amd/mootools.html',
'http://localhost:8000/test/amd/yui.html'
]
}
}
},
uglify: {
Expand All @@ -171,16 +195,38 @@ module.exports = function (grunt) {
'dist/can.yui.min.js': 'dist/can.yui.js'
}
}
},
'string-replace': {
version: {
options: {
replacements: [
{
pattern: /@EDGE/gim, //version property
replacement: pkg.version
}
]
},
files: [
{
src: 'dist/**/*.js',
dest: './',
cwd: './'
}
]
}
}
});

grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('bitovi-tools');

grunt.registerTask('build', ['builder', 'testify', 'amdify', 'uglify', 'docco']);
grunt.registerTask('test', ['connect', 'builder', 'testify', 'qunit']);
grunt.registerTask('build', ['builder', 'amdify', 'uglify', 'docco']);
grunt.registerTask('test', ['connect', 'builder', 'amdify', 'testify', 'qunit']);
grunt.registerTask('default', ['build']);

// TODO possibly use grunt-release
grunt.registerTask('release', ['build', 'string-replace', 'test']);
};
103 changes: 0 additions & 103 deletions build/build.js

This file was deleted.

11 changes: 0 additions & 11 deletions build/make/all.js

This file was deleted.

9 changes: 0 additions & 9 deletions build/make/amd.js

This file was deleted.

8 changes: 0 additions & 8 deletions build/make/dojo.js

This file was deleted.

8 changes: 0 additions & 8 deletions build/make/jquery.js

This file was deleted.

8 changes: 0 additions & 8 deletions build/make/mootools.js

This file was deleted.

8 changes: 0 additions & 8 deletions build/make/yui.js

This file was deleted.

Loading

0 comments on commit e48a8a0

Please sign in to comment.