Skip to content

Commit

Permalink
Merge pull request #64 from korczis/master
Browse files Browse the repository at this point in the history
Cleaner Gruntfile, Added JSDoc, Building standalone vanilla lib (without deps) and many more ..
  • Loading branch information
Peter committed Aug 27, 2013
2 parents fc7b506 + 65b4fe6 commit 5d8d506
Show file tree
Hide file tree
Showing 27 changed files with 4,769 additions and 605 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.idea
.DS_Store
*.swp
node_modules
build
build/
lib/ember-table*.js
doc/
examples/*/*.js
stylesheets/ember-table.css

224 changes: 224 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
module.exports = function (grunt) {
'use strict';

var path = require('path');

var templatesDir = "./src/templates/";

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify2');
grunt.loadNpmTasks('grunt-ember-templates');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-neuter');

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

meta: {
banner: '/*! <%=pkg.name%> - v<%=pkg.version%> (build <%=pkg.build%>) - ' +
'<%=grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT")%> */'
},

browserify2: {
// Bundle containing all client scripts (WebApp, Ember.js)
table: {
entry: [
'./build/src/main.js'
],
compile: './lib/ember-table-lib.js'
}
},

neuter: {
options:{
includeSourceURL: false,
separator: "\n"
},
"lib/ember-table.js": "build/src/main.js"
},

coffee: {
srcs: {
options: {
bare: true
},
expand: true,
cwd: "src/",
src: [ "**/*.coffee" ],
dest: "build/src/",
ext: ".js"
},
examples: {
expand: true,
cwd: "examples/",
src: [ "**/*.coffee" ],
dest: "examples/",
ext: ".js"
}
},

clean: [
"./lib/ember-table.js",
"./lib/ember-table.min.js",
"./lib/ember-table-lib.js",
"./build/src/ember-table-templates.js",
"./stylesheets/ember-table.css"
],

emberTemplates: {
compile: {
options: {
templateName: function (filename) {
return filename.replace(templatesDir, '');
}
},
files: {
"./build/src/ember-table-templates.js": [
templatesDir + "**/*.hbs"
]
}
}
},

jsdoc: {
all: {
src: [
"./build/src/*.js",
"./build/src/**/*.js"
],
dest: "doc/"
}
},

jshint: {
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
globals: {
jQuery: true,
next: true,
require: true
}
},
all: ["Gruntfile.js", "build/src/**/*.js"]
},

less: {
development: {
options: {
yuicompress: true
},
files: {
"./stylesheets/ember-table.css": [
"./stylesheets/ember-table.less"
]
}
}
},

qunit: {
all: ['tests/*.html']
},

uglify: {
development: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
preserveComments: true,
beautify: true,
mangle: false,
report: 'min'
},

files: {
'./lib/ember-table.js': [
// Include lib in bundle
'./lib/ember-table-lib.js'
]
}
},

production: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
preserveComments: false,
beautify: false,
mangle: true,
report: 'min'
},

files: {
'./lib/ember-table.min.js': [
// Include lib in bundle
'./lib/ember-table-lib.js'
]
}
}
},

watch: {
scripts: {
files: ['src/**/*.coffee'],
tasks: [
'coffee',
'jshint',
'browserify2',
'uglify',
'qunit',
'jsdoc'
],

options: {
spawn: false
}
},

less: {
files: ['stylesheets/**/*.less'],
tasks: [
'less'
],

options: {
spawn: false
}
},

templates: {
files: ['src/**/*.hbs'],
tasks: [
'emberTemplates',
'browserify2',
'uglify',
'qunit'
],

options: {
spawn: false
}
}
}
});

// Default tasks.
grunt.registerTask('default', [
'clean',
'less',
'coffee',
'emberTemplates',
'jshint',
'browserify2',
'uglify',
'qunit',
'jsdoc'
]);
};
7 changes: 7 additions & 0 deletions Gruntfile.coffee → Gruntfile.old.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ module.exports = (grunt) ->
dest: "examples/"
ext: ".js"


# Browserify sources
browserify2:
lib:
entry: 'src/**/*.coffee'
compile: "lib/custom-build.js"
###
Watch files for changes.
Expand Down Expand Up @@ -134,6 +140,7 @@ module.exports = (grunt) ->
grunt.loadNpmTasks "grunt-ember-templates"
grunt.loadNpmTasks "grunt-contrib-coffee"
grunt.loadNpmTasks "grunt-contrib-less"
grunt.loadNpmTasks "grunt-browserify2"

###
A task to build the test runner html file that get place in
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $ grunt
```

### Viewing Examples
From the root directory: `$ python -m SimpleHTTPServer`.
From the root directory: `$ node examples.js`.
Hit up : `http://localhost:8000/examples`

## Dependencies
Expand Down
Empty file added doc/.gitkeepme
Empty file.
4 changes: 2 additions & 2 deletions examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var static = require('node-static');
//
var file = new static.Server('./');

var port = 8080;
var port = 8000;
console.log("Server started, visit http://localhost:" + port + "/examples");

require('http').createServer(function (request, response) {
Expand All @@ -16,4 +16,4 @@ require('http').createServer(function (request, response) {

file.serve(request, response);
}).resume();
}).listen(port);
}).listen(port);
15 changes: 14 additions & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Addepar Ember Table Examples</title>
<title>Addepar Ember Table Examples, Documentation & Tests</title>
</head>

<body>
<h1>Addepar Ember Table Examples, Documentation & Tests</h1>

<h2>Examples</h2>
<ul>
<li><a href="./table_ajax">Table Ajax</a></li>
<li><a href="./table_editable">Table Editable</a></li>
Expand All @@ -17,5 +20,15 @@
<li><a href="./table_with_sparkline">Table With Sparkline</a></li>
<li><a href="./table_with_tree_view">Table With Tree View</a></li>
</ul>

<h2>Documentation</h2>
<ul>
<li><a href="./../doc/index.html">API Documentation</a></li>
</ul>

<h2>Tests</h2>
<ul>
<li><a href="./../tests/index.html">QUnit Tests</a></li>
</ul>
</body>
</html>
Loading

0 comments on commit 5d8d506

Please sign in to comment.