-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-repl.js
55 lines (47 loc) · 1.89 KB
/
my-repl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var repl = require('repl');
var env = process.env.NODE_ENV || 'development';
var db = require("./knexfile");
var knex = require('knex')(db[env]);
var config = require('./config/config')
var jwt = require('jwt-simple');
var moment = require('moment');
var bluebird = require('bluebird');
var TinderClient = require('./services/tinder-client');
var myProfile = require('./spec/fixtures/my_profile.json');
var myUpdates = require('./spec/fixtures/new_updates.json');
var oldUpdates = require('./spec/fixtures/my_updates.json');
var FakeAccount = require('./models/fake_account')();
var Target = require('./models/target');
var Photo = require('./models/photos');
var Conversation = require('./models/conversations');
var lodash = require('lodash');
var replServer = repl.start({
prompt: 'cassanova :> '
});
replServer.context.repl = repl;
replServer.context.knex = knex;
replServer.context.env = env;
replServer.context.jwt = jwt;
replServer.context.config = config;
replServer.context.moment = moment;
replServer.context.bluebird = bluebird;
replServer.context.myProfile = myProfile;
replServer.context.myUpdates = myUpdates;
replServer.context.oldUpdates = oldUpdates;
replServer.context.FakeAccount = FakeAccount;
replServer.context.TinderClient = TinderClient;
replServer.context.Target = Target;
replServer.context.Photo = Photo;
replServer.context.Conversation = Conversation;
replServer.context.lodash = lodash;
// https://www.facebook.com/connect/login_success.html#access_token=CAAGm0PX4ZCpsBAF3pZAVWX45YJQEVahOlsSOIiwrbwhIeHmAZCDtGaIjJW6jJir6QTIZCt1WpByCULWUs2zKCFks2uuUlBaZBHeIrs6algJmXP3QGEs31kZCRD3QHVYKCksj3LZBJexmHBZCC8wDkzZCAjJN7x9WVvJhGCrSpKLJDcZCLMTKhthdRHVSyfOMil2cZC0rOrFS25b6QZDZD&expires_in=3969
function getFakeAccounts() {
return new Promise(function(resolve,reject) {
knex('fake_accounts')
.then(function(fks) {
resolve(fks);
}).catch(function(err) {
reject(err);
});
})
}