ability to build executables
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
var celery = require('../lib');
|
||||
|
||||
celery.prompt('Username: ', function(user)
|
||||
{
|
||||
celery.password('Password: ', function(pass)
|
||||
{
|
||||
console.log('user: %s'.green, user);
|
||||
console.log('pass: %s'.green, pass);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
celery.open();
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
var celery = require('../lib');
|
||||
|
||||
celery.open({
|
||||
|
||||
//required for middleware / or statements
|
||||
//delimiter: '/',
|
||||
});
|
||||
|
||||
|
||||
var credentials;
|
||||
|
||||
|
||||
|
||||
celery.on('login OR login :user :pass', function(data)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
function onAuth(creds)
|
||||
{
|
||||
if(creds.user != 'user' || creds.pass != 'pass')
|
||||
{
|
||||
return console.log("Incorrect user / pass".red);
|
||||
}
|
||||
|
||||
self.user = creds.user;
|
||||
|
||||
//cache the credentials so the user doesn't have to login each time
|
||||
credentials = creds;
|
||||
|
||||
if(!self.next()) console.log("Logged in as %s", creds.user.green);
|
||||
}
|
||||
|
||||
|
||||
//user already logged in? pass!
|
||||
if(credentials)
|
||||
{
|
||||
onAuth(credentials);
|
||||
}
|
||||
|
||||
//otherwise check if the user is passed in the route
|
||||
else
|
||||
if(data.user && data.pass)
|
||||
{
|
||||
onAuth(data);
|
||||
}
|
||||
|
||||
//or prompt for authentication
|
||||
else
|
||||
{
|
||||
celery.auth(function(user, pass)
|
||||
{
|
||||
onAuth({ user: user, pass: pass });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* private account into
|
||||
*/
|
||||
|
||||
celery.on('login -> account', function()
|
||||
{
|
||||
console.log('Here\'s your account info %s!', this.user.green);
|
||||
});
|
||||
|
||||
|
||||
celery.parse(process.argv);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
var celery = require('../lib');
|
||||
|
||||
celery.confirm('Do you want to continue?', function(yes)
|
||||
{
|
||||
if(yes)
|
||||
{
|
||||
console.log("YES!".green);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("NO!".red);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
celery.open();
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
var celeri = require('../lib');
|
||||
|
||||
|
||||
celeri.exec('ls', ['-help'], {
|
||||
exit: function()
|
||||
{
|
||||
console.log("DONE");
|
||||
}
|
||||
});
|
||||
|
||||
celeri.open();
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
var celery = require('../lib');
|
||||
|
||||
celery.open({
|
||||
prefix: 'hello > '
|
||||
});
|
||||
celery.on('hello :name', function(data)
|
||||
{
|
||||
console.log('hello %s, how are you doing?', data.name);
|
||||
});
|
||||
|
||||
celery.on('download/:file', function(data)
|
||||
{
|
||||
console.log("starting");
|
||||
|
||||
var i = 0;
|
||||
|
||||
data.file = decodeURIComponent(data.file);
|
||||
|
||||
var interval = setInterval(function()
|
||||
{
|
||||
|
||||
celery.progress('Downloading '+data.file+':', i++);
|
||||
|
||||
if(i > 100)
|
||||
{
|
||||
clearInterval(interval);
|
||||
celery.newLine('done!');
|
||||
}
|
||||
}, 10);
|
||||
});
|
||||
|
||||
|
||||
celery.on(['timeout :ttl','timeout :ttl :status'], function(data)
|
||||
{
|
||||
var loader = celery.loading('timeout for '+data.ttl+' seconds: ');
|
||||
|
||||
setTimeout(function()
|
||||
{
|
||||
if(data.status != undefined)
|
||||
{
|
||||
loader.done(data.status == 'success');
|
||||
}
|
||||
else
|
||||
{
|
||||
loader.done();
|
||||
}
|
||||
|
||||
}, Number(data.ttl) * 1000);
|
||||
});
|
||||
|
||||
|
||||
celery.parse(process.argv);
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
var celery = require('../lib');
|
||||
|
||||
celery.on('delay :seconds', function(data)
|
||||
{
|
||||
console.log("delaying for %s seconds", data.seconds);
|
||||
|
||||
setTimeout(function(self)
|
||||
{
|
||||
if(!self.next()) console.log("done!");
|
||||
}, Number(data.seconds) * 1000, this);
|
||||
});
|
||||
|
||||
|
||||
celery.on('delay 1 -> say hello :name', function(data)
|
||||
{
|
||||
console.log('hello %s!', data.name);
|
||||
});
|
||||
|
||||
celery.open();
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
var celery = require('../lib');
|
||||
|
||||
var objects = [
|
||||
|
||||
{
|
||||
name: 'Craig',
|
||||
age: 21,
|
||||
bio: 'Cras dictum convallis fermentum. Quisque ut urna velit, at porta nibh. Nam iaculis dignissim nisl, non elementum tortor iaculis et. Curabitur vulputate, sapien eget'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
name: 'Tim',
|
||||
age: 21,
|
||||
bio: 'Praesent ligula est, pellentesque vel euismod vitae, condimentum convallis odio. Suspendisse potenti. Fusce lacus arcu, bibendum in gravida at, dictum vitae mauris. Cras viverra, dui ac elementum fringilla, purus mauris rutrum nibh, id ultrices diam magna id ante. Integer elit ligula, cursus at accumsan in, scelerisque at dui. Sed pellentesque justo sit amet nibh sodales sed malesuada nulla cursus. Maecenas eu felis leo, a volutpat sapien. Duis eget porta urna. Maecenas ligula elit, vulputate ac bibendum eu, dapibus ut lacus. Fusce ac tincidunt eros. Pellentesque ut turpis ac ante interdum rutrum. Suspendisse tempor lobortis semper.'
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Michael',
|
||||
age: 23,
|
||||
bio: 'Vestibulum ligula elit, vehicula a lacinia at, aliquet sed felis. In rutrum pulvinar ultrices. Donec interdum ullamcorper neque ut pretium. Donec varius massa vitae ipsum feugiat feugiat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Fusce a nulla a odio congue hendrerit in non tellus. Cras gravida vestibulum augue vitae dapibus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce porttitor rutrum faucibus. Vivamus interdum porta orci, vitae fermentum nunc vestibulum at. Maecenas porttitor sollicitudin pharetra. Ut risus mauris, tincidunt vitae laoreet quis, rhoncus eget risus'
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Sarah',
|
||||
age: 19,
|
||||
bio: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin fringilla interdum nibh eget luctus. In facilisis varius lacus, ut adipiscing turpis posuere a. Nunc id sapien eu urna'
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
|
||||
celery.drawTable(objects, {
|
||||
columns: {
|
||||
name: 15,
|
||||
age: 5,
|
||||
bio: 30
|
||||
},
|
||||
|
||||
horz: ' ',
|
||||
|
||||
});
|
||||
|
||||
celery.open();
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
var celery = require('../lib');
|
||||
|
||||
var objects = [ { name: 'bean.cupboard.scaffold',
|
||||
hasUpdates: '',
|
||||
published: 'published: 2 hours agofdsfsafsfadffdsf afsd fasf as fsd fsdf sdf sdf sd ' },
|
||||
{ name: 'teamdigest',
|
||||
hasUpdates: '',
|
||||
published: 'published: 2 hours ago' }];
|
||||
|
||||
console.log(celery.columns())
|
||||
|
||||
celery.drawTable(objects, {
|
||||
columns: [{
|
||||
width: 15,
|
||||
minWidth:20,
|
||||
name: 'name'
|
||||
},
|
||||
{
|
||||
name: 'published',
|
||||
width:15,
|
||||
align:'right'
|
||||
}],
|
||||
|
||||
horz: ' ',
|
||||
vert: '|'
|
||||
|
||||
});
|
||||
|
||||
celery.open();
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
var celery = require('../lib');
|
||||
|
||||
var objects = [ { command: 'init',
|
||||
desc: 'Adds a project in cwd to cupboard.' },
|
||||
{ command: 'remove <proj>',
|
||||
desc: 'Removes project from cupboard.' },
|
||||
{ command: '<cmd> <proj>',
|
||||
desc: 'Calls custom command specified in project cupboard config.' },
|
||||
{ command: 'untouch <proj>',
|
||||
desc: 'Flags given project as updated.' },
|
||||
{ command: 'publish <proj>',
|
||||
desc: 'Publishes target project.' },
|
||||
{ command: 'updates',
|
||||
desc: 'List all projects with updates.' },
|
||||
{ command: 'list',
|
||||
desc: 'List all projects in cupboard organized by most recently updated.' },
|
||||
{ command: 'install <cupboard plugin>',
|
||||
desc: 'Installs a third-party cupboard plugin.' },
|
||||
{ command: 'uninstall <cupboard plugin>',
|
||||
desc: 'Uninstalls a third-party cupboard plugin.' },
|
||||
{ command: 'plugins',
|
||||
desc: 'Lists all third-party plugins.' },
|
||||
{ command: 'scaffold <type>',
|
||||
desc: 'Initializes target scaffold in cwd' },
|
||||
{ command: 'github <proj>',
|
||||
desc: 'Open github page of target project' },
|
||||
{ command: 'github-issues <proj>',
|
||||
desc: 'Open github issues of target project.' },
|
||||
{ command: 'help', desc: 'Shows the help menu.' },
|
||||
{ command: 'dir <proj>',
|
||||
desc: 'Returns the project path.' },
|
||||
{ command: 'details <proj>',
|
||||
desc: 'Returns details about the given project such as modified files, and number of updates.' } ];
|
||||
|
||||
|
||||
celery.drawTable(objects, {
|
||||
columns: [ {
|
||||
minWidth: 25,
|
||||
width: 20,
|
||||
name: 'command'
|
||||
},
|
||||
{
|
||||
name: 'desc',
|
||||
width: 80,
|
||||
align: 'left'
|
||||
} ],
|
||||
|
||||
pad: {
|
||||
left: 10,
|
||||
right: 10,
|
||||
top: 2,
|
||||
bottom: 2
|
||||
},
|
||||
|
||||
ellipsis: true
|
||||
|
||||
});
|
||||
|
||||
celery.open();
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
var celeri = require('../lib');
|
||||
|
||||
celeri.drawTree({
|
||||
'home/':{
|
||||
'network/':{
|
||||
'apps/' :[
|
||||
"cliqly",
|
||||
"clove",
|
||||
"team digest"
|
||||
],
|
||||
'public/': {
|
||||
'git/':{
|
||||
'some-project':[
|
||||
'index.js'
|
||||
]
|
||||
},
|
||||
'npm/':{
|
||||
'some-project':['index.js']
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'downloads/': {
|
||||
'libcpp': [
|
||||
'makefile'
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
//celeri.drawTree(celeri);
|
||||
|
||||
|
||||
celeri.open();
|
||||
Reference in New Issue
Block a user