Permalink
Browse files

[dist] New Rant and moved to grunt -> 0.4

  • Loading branch information...
1 parent 06cbfd7 commit 8be66dd04d3d3cf33b553b2e3c132ad7db0b80a2 alejandro committed Feb 21, 2013
View
@@ -3,6 +3,7 @@ module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
+ // Task configuration.
jshint: {
options: {
curly: true,
@@ -13,20 +14,45 @@ module.exports = function(grunt) {
noarg: true,
sub: true,
undef: true,
+ unused: true,
boss: true,
- eqnull: true
+ eqnull: true,
+ globals: {
+ jQuery: true
+ }
},
- globals: {}
+ gruntfile: {
+ src: 'Gruntfile.js'
+ },
+ lib_test: {
+ src: ['lib/**/*.js', 'test/**/*.js']
+ }
+ },
+ nodeunit: {
+ files: ['test/**/*_test.js']
+ },
+ watch: {
+ gruntfile: {
+ files: '<%= jshint.gruntfile.src %>',
+ tasks: ['jshint:gruntfile']
+ },
+ lib_test: {
+ files: '<%= jshint.lib_test.src %>',
+ tasks: ['jshint:lib_test', 'nodeunit']
+ }
}
});
- // Default task.
- grunt.registerTask('default', 'list');
+ // These plugins provide necessary tasks.
+
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('list','make the list of rants', function (){
var files = require('fs').readdirSync('./')
, path = require('path')
- , rants =[]
+ , rants = []
, ignore = ['.git', '.gitignore']
+
files.forEach(function (item){
if (path.extname(item) === '' && ignore.indexOf(item) < 0) {
rants.push(item)
@@ -40,8 +66,11 @@ module.exports = function(grunt) {
return ' - [' + rant + '](http://github.com/alejandro/rants/blob/master/' + rant + ')'
})
- grunt.file.write('./README.md', grunt.template.process(readme, {rants: rants.join('\n')}))
- console.log('done')
+ grunt.file.write('./README.md', grunt.template.process(readme, {data: {rants: rants.join('\n')}}))
+
+ grunt.log.write('done')
})
+ // Default task.
+ grunt.registerTask('default', ['jshint', 'nodeunit']);
};
View
@@ -10,7 +10,9 @@ Small chunks of code by myself.
- [bins](http://github.com/alejandro/rants/blob/master/bins)
- [continuable](http://github.com/alejandro/rants/blob/master/continuable)
- [ee](http://github.com/alejandro/rants/blob/master/ee)
+ - [fwe](http://github.com/alejandro/rants/blob/master/fwe)
- [node-ls](http://github.com/alejandro/rants/blob/master/node-ls)
+ - [node_modules](http://github.com/alejandro/rants/blob/master/node_modules)
## License
View
Binary file not shown.
View
@@ -0,0 +1,10 @@
+# Restaurante - Ordenes
+
+Este código es parte de ['Fire up Ember.js'](https://peepcode.com/products/emberjs).
+
+### Ejecución
+
+ $ git clone git://github.com/alejandro/rants
+ $ cd rants/fwe && ./server
+
+Ve ahora a [http://localhost:8000]() y listo.
View
@@ -0,0 +1,173 @@
+var App = Em.Application.create()
+
+// === Rutas ===
+App.Router.map(function(){
+ this.resource('tables', function (){
+ this.resource('table', { path: ':table_id' })
+ })
+})
+
+App.ApplicationRoute = Ember.Route.extend({
+ setupController: function (){
+ this.controllerFor('food').set('model', App.Food.find())
+ }
+})
+
+App.IndexRoute = Em.Route.extend({
+ redirect: function (){
+ return this.replaceWith('tables')
+ }
+})
+
+App.TablesRoute = Em.Route.extend({
+ model: function(){
+ return App.Table.find()
+ }
+})
+
+// App.TableRoute = Em.Route.extend({
+// model: function(params){
+// return App.Table.find(params.table_id)
+// }
+// })
+// === Data Store ===
+App.Store = DS.Store.extend({
+ revision: 11,
+ adapter: 'DS.FixtureAdapter'
+})
+
+// === Controladores ===
+App.TablesController = Ember.ArrayController.extend()
+App.TableController = Ember.ObjectController.extend()
+
+App.FoodController = Ember.ArrayController.extend({
+ addFood: function (food){
+ var table = this.controllerFor('table').get('model')
+ , tabItems = table.get('tab.tabItems')
+
+ tabItems.createRecord({
+ food: food,
+ cents: food.get('cents')
+ })
+ }
+})
+
+// App.TabController = Ember.ObjectController.extend()
+
+// === Helpers ===
+Ember.Handlebars.registerBoundHelper('money', function (val){
+ return (val % 100 === 0 ?
+ (val / 100) + '.00':
+ val / 100)
+})
+
+// === Modelos ===
+App.Table = DS.Model.extend({
+ tab: DS.belongsTo('App.Tab')
+})
+
+App.Tab = DS.Model.extend({
+ tabItems: DS.hasMany('App.TabItem'),
+ cents: function (){
+ return this.get('tabItems').getEach('cents').reduce(function (ac, i){
+ return ac + i
+ }, 0)
+ }.property('tabItems.@each.cents')
+})
+
+App.TabItem = DS.Model.extend({
+ cents: DS.attr('number'),
+ food: DS.belongsTo('App.Food')
+})
+
+App.Food = DS.Model.extend({
+ name: DS.attr('string'),
+ imageUrl: DS.attr('string'),
+ cents: DS.attr('number')
+})
+
+// === App termina aquí, dummy data ===
+
+
+App.Table.FIXTURES = [
+ { id: 1, tab: 1 },
+ { id: 2, tab: 2 },
+ { id: 3, tab: 3 },
+ { id: 4, tab: 4 },
+ { id: 5, tab: 5 },
+ { id: 6, tab: 6 }
+]
+App.Tab.FIXTURES = [{
+ id: 1,
+ tabItems:[]
+},{
+ id: 2,
+ tabItems:[]
+},{
+ id: 3,
+ tabItems:[]
+},{
+ id: 4,
+ tabItems:[400,401,403,404]
+},{
+ id: 5,
+ tabItems:[]
+},{
+ id: 6,
+ tabItems:[]
+}]
+
+
+App.TabItem.FIXTURES = [{
+ id: 400,
+ cents: 1500,
+ food: 1
+}, {
+ id: 401,
+ cents: 300,
+ food: 2
+}, {
+ id: 402,
+ cents: 700,
+ food: 3
+}, {
+ id: 403,
+ cents: 950,
+ food: 4
+}, {
+ id: 404,
+ cents: 2000,
+ food: 5
+}]
+
+App.Food.FIXTURES = [{
+ id: 1,
+ name: 'Pizza',
+ imageUrl: '/img/pizza.png',
+ cents: 1500
+},{
+ id: 2,
+ name: 'Pancakes',
+ imageUrl: '/img/pancakes.png',
+ cents: 300
+},{
+ id: 3,
+ name: 'Papas Fritas',
+ imageUrl: '/img/fries.png',
+ cents: 700
+},{
+ id: 4,
+ name: 'Hot Dog',
+ imageUrl: '/img/hotdog.png',
+ cents: 950
+},{
+ id: 5,
+ name: 'Pastel',
+ imageUrl: '/img/birthdaycake.png',
+ cents: 305
+},{
+ id: 6,
+ name: 'Pizza',
+ imageUrl: '/img/pizza.png',
+ cents: 1500
+}]
View
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "ember": "~1.0.0-rc.1"
+ }
+}
@@ -0,0 +1,20 @@
+{
+ "name": "ember",
+ "version": "1.0.0-rc.1",
+ "main": [
+ "./ember.js",
+ "./ember.min.js"
+ ],
+ "dependencies": {
+ "jquery": "~1.9.0",
+ "handlebars": "~1.0.0"
+ },
+ "gitHead": "daa4be2212e47af0561c62527a8bd487840a1154",
+ "_id": "ember@1.0.0-rc.1",
+ "readme": "ERROR: No README.md file found!",
+ "description": "ERROR: No README.md file found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/components/ember"
+ }
+}
Oops, something went wrong.

0 comments on commit 8be66dd

Please sign in to comment.