Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
before(function (done)
{
// Hook will timeout in 10 seconds
this.timeout(11000);
// Attempt to lift sails
Sails().lift({
hooks : {
// Load the hook
"sails-hook-schedule" : require('../'), // Skip grunt (unless your hook uses it)
"grunt" : false
}, log : {level : "error"}
}, function (err, _sails)
{
if (err)
{
return done(err);
}
sails = _sails;
return done();
});
});
before(function (done) {
// Hook will timeout in 10 seconds
this.timeout(13000);
// Attempt to lift sails
Sails().lift({
hooks: {
// Load the hook
"sails-hook-jsonwebtoken": require('../'),
// Skip grunt (unless your hook uses it)
"grunt": false
},
log: { level: "info" }
}, function (err, _sails) {
if (err) return done(err);
sails = _sails;
return done();
});
});
before(function (done) {
// Hook will timeout in 10 seconds
this.timeout(30000);
// change the working dir to test so we load test app
process.chdir('./test/fixtures/app');
// Attempt to lift sails
Sails().load({
port: 1300,
log: {
// level: 'debug',
level: 'verbose',
custom: console,
inspect: false,
},
hooks: {
// load this hook before sails ORM
"beforeORM": require('../fixtures/sails-hook-before-orm'),
// load the ORM
"orm": require('sails-hook-orm'),
// Load this hook after sails ORM
"afterORM": require('../fixtures/sails-hook-after-orm'),
},
delayedLog(50)('Synchronizing app with Treeline mothership...'.grey);
delayedLog(450)('Calibrating machines...'.grey);
delayedLog(2500)('Hold tight, this can take a moment...'.grey);
// Give up after 30 seconds
delayedLog.timers.push(setTimeout(function () {
log.error('The preview server isn\'t starting...');
log.error('Please try again later. If the problem persists, check @treelineHQ for updates.');
for (var i in delayedLog.timers) {
clearTimeout(delayedLog.timers[i]);
}
return;
}, 30000));
var sails = new Sails();
var watch = watcher(sails);
var treelineCliConfig = {
src: {
secret: conf.credentials.secret,
baseURL: conf.config.treelineURL,
url: conf.config.treelineURL + '/' + conf.targetProject.id + '/modules',
projectId: conf.targetProject.id,
protocol: 'https://',
host: 'api.treeline.io',
port: 443,
prefix: '',
endpoint: '/modules'
}
};
var options = conf.targetProject.options || {};
function loadSails (done, fixtures) {
if (!fixtures) {
fixtures = require('./helpers/fixtures');
}
//link node modules to the app dir
try {
fs.symlinkSync(path.join(__dirname, '../node_modules'), path.join(__dirname, 'helpers/sampleApp/node_modules'), 'file');
} catch (e1) {
if (e1.code !== 'EEXIST') {
throw e1;
}
}
console.info('Loading Sails');
//Try to lift
new Sails().load({
appPath: path.join(__dirname, 'helpers/sampleApp'),
hooks: {
'fixtures': require('../lib'),
'grunt': false,
'views': false,
'blueprints': false,
},
log: {
level: 'info'
},
connections: {
test: {
adapter: 'sails-mongo',
host:'localhost',
port: 27017,
database: 'sails-hook-fixtures-testdb'
before(function(done) {
console.log(__dirname);
//set 10sec timeout
this.timeout(10000);
//Try to lift
new Sails().load({
hooks: {
'fixtures': require('../lib'),
'grunt': false
},
log: {
level: 'error'
}
}, function (err, _sails) {
if (err) { return done(err); }
sails = _sails;
return done();
});
});
describe('sails-backbone', function () {
var schema;
var app = new SailsApp();
var config = {
appPath: path.dirname(require.resolve('hashware-api')),
hooks: {
grunt: false
}
};
before(function (done) {
this.timeout(60 * 1000);
app.load(config, function (error, sails) {
app = sails;
done(error);
});
});
var Sails = require('sails').Sails,
app = Sails(),
argv = require('yargs').argv,
striptags = require('striptags'),
moment = require('moment'),
urlLibrary = require('url'),
async = require('async');
var initialData = {
'Design': [
{'name': 'Designer News', 'rss': 'https://www.designernews.co/?format=rss'},
{'name': 'Dribbble', 'rss': 'https://dribbble.com/shots/popular.rss'},
{'name': 'A List Apart', 'rss': 'http://alistapart.com/main/feed'},
{'name': 'Smashing Magazine', 'rss': 'https://www.smashingmagazine.com/feed/'},
{'name': 'Invision', 'rss': 'http://blog.invisionapp.com/feed/'}
],
'Startups': [
{'name': 'On Startups', 'rss': 'http://onstartups.com/rss.xml'},
const Sails = require('sails').Sails,
app = Sails(),
striptags = require('striptags'),
moment = require('moment'),
async = require('async'),
cheerio = require('cheerio'),
kue = require('kue')
var argv = require('yargs')
.usage('Usage: $0 [options]')
.command('scrape_feeds', 'Scrape all RSS feeds that we didn\'t update in the past 5 minutes')
.example('$0 -f -c 50', 'Scrape all feeds, 50 at the time')
.example('$0 -q cnn -a 1', 'Get 1 article from CNN')
.alias('l', 'live')
.boolean('l')
.default('l', false)
.describe('l', 'keeps the process alive')
.alias('f', 'force')
var Sails = require('sails').Sails,
app = Sails(),
striptags = require('striptags'),
moment = require('moment'),
request = require('request'),
async = require('async'),
cheerio = require('cheerio')
var scrapingErrors = {}
app.load({
hooks: { grunt: false },
log: { level: 'warn' }
}, function sailsReady(err) {
if (err) {
sails.log.warn('Error loading app:', err)