Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding stuff for heroku deploy

  • Loading branch information...
commit 34a36bfa78ea2ed683a605024896e0290af46d74 1 parent c995642
Sam Breed authored
1  .gitignore
View
@@ -33,3 +33,4 @@ build/buildinfo.properties
build/config/buildinfo.properties
node_modules
+.rvmrc
2  Procfile
View
@@ -0,0 +1,2 @@
+web: node hack-bot.js
+add_users: node add_users.js
35 add_users.js
View
@@ -0,0 +1,35 @@
+var User = require('./lib/models').user,
+ u;
+
+function logger(err, doc){
+ console.log("saved");
+}
+
+u = new User({ "name" : "Collin Schaafsma", "user_id" : 600701, "avatar_url" : "http://asset0.37img.com/global/7c3e0170e2ea75dd05bc9fac18a7fb4883e3211c/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Ingrid Alongi", "user_id" : 600704, "avatar_url" : "http://asset0.37img.com/global/7ba682ed7ea7dd0b2d5201fd99b479b106f67504/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Nico Valencia", "user_id" : 612936, "avatar_url" : "http://asset0.37img.com/global/a166cebca915b54e9d0666b72cb330973a057975/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "David Aragon", "user_id" : 663660, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Ryan Cook", "user_id" : 666967, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Taylor Beseda", "user_id" : 776999, "avatar_url" : "http://asset0.37img.com/global/6fbc200d4f8c39cff9bfca96b4b94617aa6cfd8a/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Steven Hubert", "user_id" : 803088, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Jessica Dillon", "user_id" : 844756, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Brent Ertz", "user_id" : 905367, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Gerred Dillon", "user_id" : 726332, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Quick Bot", "user_id" : 794174, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Samuel Breed", "user_id" : 600703, "avatar_url" : "http://asset0.37img.com/global/e753dd30948e31968c0a1962735fdb7d71245fc4/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "Becca Gallery", "user_id" : 707812, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
+u = new User({ "name" : "John Wright", "user_id" : 856042, "avatar_url" : "http://asset0.37img.com/global/missing/avatar.png?r=3" }).save(logger);
+
2  lib/models.coffee
View
@@ -3,7 +3,7 @@ mongoose = require 'mongoose'
_ = require('underscore')._
# connect db adapter
-mongoose.connect('mongodb://localhost/quack-bot')
+mongoose.connect( process.env.MONGOHQ_URL )
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
2  lib/models.js
View
@@ -1,7 +1,7 @@
var ObjectId, Schema, mongoose, note, user, _;
mongoose = require('mongoose');
_ = require('underscore')._;
-mongoose.connect('mongodb://localhost/quack-bot');
+mongoose.connect(process.env.MONGOHQ_URL);
Schema = mongoose.Schema;
ObjectId = Schema.ObjectId;
note = {
32 scrape_users.js
View
@@ -0,0 +1,32 @@
+var _ = require('underscore')
+ , c = require('./lib/node-campfire/lib/campfire').Campfire
+ , i = new c({ ssl: true, token: "6b3a87666606cbd5d101bddfbca288de8d84ed17", account: 'quickleft' })
+ , m = require('./lib/models');
+
+
+i.room(265458, function(r){
+ r.show(function(x){
+ _.each(x.room.users, function(u){
+
+ m.user.findOne({ user_id: u.id }, function(err, doc){
+
+ if( doc !== null ) {
+ console.log(m.user.find({ user_id: u.id }));
+ //return;
+ }
+ var user = new m.user({ avatar_url: u.avatar_url, user_id: u.id, email: u.email, name: u.name });
+
+ //console.log(user);
+
+ user.save(function(s){
+ console.log('saved',s);
+ });
+
+ });
+
+ });
+
+ process.exit();
+ });
+});
+
25 spec/ReminderSpec.coffee
View
@@ -10,22 +10,23 @@ test_user = new User
describe 'Reminders', ->
- it 'should save a message with full name', ->
+ it 'should save a message with full name', ->
- test_user.save ( error, user ) ->
+ test_user.save ( error, user ) ->
- msg =
- body: "tell Test Dude whatever man"
- user_id: 794174
+ msg =
+ body: "tell Test Dude whatever man"
+ user_id: 794174
- Reminder.save msg, ( e ) ->
- Note.find { name: "Test Dude" }, ( err, doc ) ->
+ Reminder.save msg, ( e ) ->
+ Note.findOne { target_name: "Test Dude" }, ( err, doc ) ->
- expect( doc.target_name ).toEqual( "Test Dude" )
- #expect( doc.target_id ).toEqual( "Test Dude" )
+ expect( doc.target_name ).toEqual( "Test Dude" )
+ expect( doc.msg ).toEqual( "whatever man" )
- test_user.remove()
- jasmine.asyncSpecDone()
+ test_user.remove()
+ doc.remove()
+ jasmine.asyncSpecDone()
- jasmine.asyncSpecWait()
+ jasmine.asyncSpecWait()
6 spec/ReminderSpec.js
View
@@ -16,11 +16,13 @@ describe('Reminders', function() {
user_id: 794174
};
return Reminder.save(msg, function(e) {
- return Note.find({
- name: "Test Dude"
+ return Note.findOne({
+ target_name: "Test Dude"
}, function(err, doc) {
expect(doc.target_name).toEqual("Test Dude");
+ expect(doc.msg).toEqual("whatever man");
test_user.remove();
+ doc.remove();
return jasmine.asyncSpecDone();
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.