Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boilerplate #1

Merged
merged 11 commits into from Mar 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions .gitignore
@@ -0,0 +1,28 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
bower_components
build
client
249 changes: 249 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,249 @@
module.exports = function(grunt) {

require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);

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

bower: {
install: {
options: {
targetDir: 'client/requires',
layout: 'byComponent'
}
}
},

clean: {
build: ['build'],
dev: {
src: ['build/app.js', 'build/<%= pkg.name %>.css', 'build/<%= pkg.name %>.js']
},
prod: ['dist']
},

browserify: {
vendor: {
src: ['client/requires/**/*.js'],
dest: 'build/vendor.js',
options: {
shim: {
jquery: {
path: 'client/requires/jquery/js/jquery.js',
exports: '$'
},
underscore: {
path: 'client/requires/underscore/js/underscore.js',
exports: '_'
},
backbone: {
path: 'client/requires/backbone/js/backbone.js',
exports: 'Backbone',
depends: {
underscore: 'underscore'
}
},
'backbone.marionette': {
path: 'client/requires/backbone.marionette/js/backbone.marionette.js',
exports: 'Marionette',
depends: {
jquery: '$',
backbone: 'Backbone',
underscore: '_'
}
}
}
}
},
app: {
files: {
'build/app.js': ['client/src/main.js']
},
options: {
transform: ['hbsfy'],
external: ['jquery', 'underscore', 'backbone', 'backbone.marionette']
}
},
test: {
files: {
'build/tests.js': [
'client/spec/**/*.test.js'
]
},
options: {
transform: ['hbsfy'],
external: ['jquery', 'underscore', 'backbone', 'backbone.marionette']
}
}
},

less: {
transpile: {
files: {
'build/<%= pkg.name %>.css': [
'client/styles/reset.css',
'client/requires/*/css/*',
'client/styles/less/main.less'
]
}
}
},

concat: {
'build/<%= pkg.name %>.js': ['build/vendor.js', 'build/app.js']
},

copy: {
dev: {
files: [{
src: 'build/<%= pkg.name %>.js',
dest: 'public/js/<%= pkg.name %>.js'
}, {
src: 'build/<%= pkg.name %>.css',
dest: 'public/css/<%= pkg.name %>.css'
}, {
src: 'client/img/*',
dest: 'public/img/'
}]
},
prod: {
files: [{
src: ['client/img/*'],
dest: 'dist/img/'
}]
}
},

// CSS minification.
cssmin: {
minify: {
src: ['build/<%= pkg.name %>.css'],
dest: 'dist/css/<%= pkg.name %>.css'
}
},

// Javascript minification.
uglify: {
compile: {
options: {
compress: true,
verbose: true
},
files: [{
src: 'build/<%= pkg.name %>.js',
dest: 'dist/js/<%= pkg.name %>.js'
}]
}
},

// for changes to the front-end code
watch: {
scripts: {
files: ['client/templates/*.hbs', 'client/src/**/*.js'],
tasks: ['clean:dev', 'browserify:app', 'concat', 'copy:dev']
},
less: {
files: ['client/styles/**/*.less'],
tasks: ['less:transpile', 'copy:dev']
},
test: {
files: ['build/app.js', 'client/spec/**/*.test.js'],
tasks: ['browserify:test']
},
karma: {
files: ['build/tests.js'],
tasks: ['jshint:test', 'karma:watcher:run']
}
},

// for changes to the node code
nodemon: {
dev: {
options: {
file: 'server.js',
nodeArgs: ['--debug'],
watchedFolders: ['controllers', 'app'],
env: {
PORT: '3300'
}
}
}
},

// server tests
simplemocha: {
options: {
globals: ['expect', 'sinon'],
timeout: 3000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
},

server: {
src: ['spec/spechelper.js', 'spec/**/*.test.js']
}
},

// mongod server launcher
shell: {
mongo: {
command: 'mongod',
options: {
async: true
}
}
},

concurrent: {
dev: {
tasks: ['nodemon:dev', 'shell:mongo', 'watch:scripts', 'watch:less', 'watch:test'],
options: {
logConcurrentOutput: true
}
},
test: {
tasks: ['watch:karma'],
options: {
logConcurrentOutput: true
}
}
},

// for front-end tdd
karma: {
options: {
configFile: 'karma.conf.js'
},
watcher: {
background: true,
singleRun: false
},
test: {
singleRun: true
}
},

jshint: {
all: ['Gruntfile.js', 'client/src/**/*.js', 'client/spec/**/*.js'],
dev: ['client/src/**/*.js'],
test: ['client/spec/**/*.js']
}
});

grunt.registerTask('init:dev', ['clean', 'bower', 'browserify:vendor']);

grunt.registerTask('build:dev', ['clean:dev', 'browserify:app', 'browserify:test', 'jshint:dev', 'less:transpile', 'concat', 'copy:dev']);
grunt.registerTask('build:prod', ['clean:prod', 'browserify:vendor', 'browserify:app', 'jshint:all', 'less:transpile', 'concat', 'cssmin', 'uglify', 'copy:prod']);

grunt.registerTask('heroku', ['init:dev', 'build:dev']);

grunt.registerTask('server', ['build:dev', 'concurrent:dev']);
grunt.registerTask('test:server', ['simplemocha:server']);

grunt.registerTask('test:client', ['karma:test']);
grunt.registerTask('tdd', ['karma:watcher:start', 'concurrent:test']);

grunt.registerTask('test', ['test:server', 'test:client']);
};
1 change: 1 addition & 0 deletions Procfile
@@ -0,0 +1 @@
web: node server.js
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
Nipponline
==========

En construcción...
Under construction...