From 64cea269a9bcc99a5ae5c806a48c271085091f22 Mon Sep 17 00:00:00 2001 From: DC* Date: Thu, 14 Aug 2014 00:08:12 -0300 Subject: [PATCH] Initial heroku integration --- .gitignore | 2 ++ Procfile | 1 + README.md | 6 ++++++ db/seed/initial_tasks.js | 22 ++++++++++++---------- package.json | 9 +++++++++ 5 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 Procfile diff --git a/.gitignore b/.gitignore index 11f1994..88206e8 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ results npm-debug.log node_modules + +*.sqlite diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..489b270 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node server.js diff --git a/README.md b/README.md index e539c5a..2562ddc 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ An open-source [Workflowy](http://workflowy.com) clone. * Run migrations and initialize the database: `sequelize-cli -m --config config/database.json` and `node db/seed/initial_tasks.js` * `node server.js` +##Heroku deploy + +* heroku create --stack cedar +* git remote add heroku URL from above +* git push heroku master + ##Controls * UP & DOWN: navigate through tasks diff --git a/db/seed/initial_tasks.js b/db/seed/initial_tasks.js index d5a39a6..cb740c0 100644 --- a/db/seed/initial_tasks.js +++ b/db/seed/initial_tasks.js @@ -1,14 +1,16 @@ var config = require('config'), - orm = require('../../orm').configure(config.get('database')), - Tasks = require('../../db/models/task').instance(orm); + orm = require('../../orm').configure(config.get('database')), + Tasks = require('../../db/models/task').instance(orm); -Tasks.bulkCreate([ - {content: 'Welcome to HackFlowy!', isCompleted: false}, - {content: 'An open-source WorkFlowy clone', isCompleted: false}, - {content: 'Built using Backbone + Socket.IO', isCompleted: false}, - {content: 'I pulled this together in a few hours to learn Backbone', isCompleted: false}, - {content: 'Feel free to try it out and hack on it', isCompleted: false}, - {content: 'Good Luck!', isCompleted: false} -]); +Tasks.destroy().success(function() { + Tasks.bulkCreate([ + {content: 'Welcome to HackFlowy!', isCompleted: false}, + {content: 'An open-source WorkFlowy clone', isCompleted: false}, + {content: 'Built using Backbone + Socket.IO', isCompleted: false}, + {content: 'I pulled this together in a few hours to learn Backbone', isCompleted: false}, + {content: 'Feel free to try it out and hack on it', isCompleted: false}, + {content: 'Good Luck!', isCompleted: false} + ]); +}); orm.sync(); diff --git a/package.json b/package.json index 6a172b5..5a8b8b4 100644 --- a/package.json +++ b/package.json @@ -10,5 +10,14 @@ "sequelize": "~1.7.9", "socket.io": "~1.0.6", "config": "~1.0.2" + }, + "engines": { + "node": "0.10.x" + }, + "scripts": { + "start": "node server.js", + "db:migrate": "./node_modules/sequelize/bin/sequelize -m --config config/database.json", + "db:seed": "node db/seed/initial_tasks.js", + "postinstall": "npm run db:migrate && npm run db:seed" } }