Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

windows (client) support #16

Open
wants to merge 2 commits into from

2 participants

@abrkn
PS C:\Users\Andy\git\striim> fleet deploy
Everything up-to-date

[5662dd1f] already at latest
PS C:\Users\Andy\git\striim> fleet exec -- echo "Works"
[5662dd1f#cfde1e] Works
(5662dd1f#cfde1e exited)
PS C:\Users\Andy\git\striim>
  • changed path manipulations (split, join) to work with windows paths c:\folder/folder\folder
  • replaced the bash scripts with node scripts (some dirty argv manipulations in the bin folder to avoid refactoring)
  • changed script format in package.json from "bin/file.ext" to "./bin/file.ext" to make npm's windows batch file generator happy
  • couldn't figure out how to do fleet exec node dogs.js --bark=yes without having optimist steal the bark option, so i added *--
Andreas Brekken and others added some commits
@contra

+1 to this - looking to use this to deploy .NET apps on windows systems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 27, 2012
  1. fix win32 compat

    Andreas Brekken authored
  2. @abrkn
This page is out of date. Refresh to see the latest.
View
7 bin/command.js
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+var path = require('path'), argv = require('optimist').argv;
+var cmd = argv._.length ? argv._[0] : 'help';
+
+if (!path.existsSync(path.join(__dirname, cmd) + '.js')) cmd = 'help';
+
+require(path.join(__dirname, cmd) + '.js');
View
6 bin/command.sh
@@ -1,6 +0,0 @@
-#!/bin/bash
-if test -z "$*"; then
- fleet-help
-else
- fleet-$*
-fi
View
1  bin/drone.js
@@ -1,5 +1,6 @@
#!/usr/bin/env node
var argv = require('optimist').argv;
+argv._.splice(0, 1);
var propagit = require('propagit');
var drone = propagit(argv).drone();
View
3  bin/exec.js
@@ -13,6 +13,9 @@ p.on('error', function (err) {
});
p.hub(function (hub) {
+ // translate *--escaped into --escaped
+ argv._ = argv._.map(function(x) { return x.replace(/^\*--/, '--'); });
+
var opts = {
drone : argv.drone,
drones : argv.drones,
View
8 bin/help.js
@@ -0,0 +1,8 @@
+#!/usr/bin/env node
+var path = require('path'), fs = require('fs'), argv = require('optimist').argv;
+var page = !argv._[1] || argv._[1] == 'commands' ? 'commands' : argv._[1];
+var fn = path.join(__dirname, '../doc', page) + (page == 'commands' ? '' : '.markdown');
+
+if (!path.existsSync(fn)) fn = path.join(__dirname, '../doc/commands');
+
+console.error(fs.readFileSync(fn, 'utf8'));
View
10 bin/help.sh
@@ -1,10 +0,0 @@
-#!/bin/bash
-rootdir=$(fleet rootdir)
-
-if test -z "$1" || test "$1" = "commands"; then
- cat "$rootdir/doc/commands"
-elif test -e "$rootdir/man1/$1.1"; then
- man "$rootdir/man1/$1.1"
-else
- echo "No manual entry for fleet $1"
-fi
View
2  bin/hub.js
@@ -1,10 +1,10 @@
#!/usr/bin/env node
var propagit = require('propagit');
var argv = require('optimist').argv;
+argv._.splice(0, 1);
var cport = argv.cport || argv.port || argv._[0];
var gport = argv.gport || cport + 1;
-
var prop = propagit(argv).listen(cport, gport);
var subs = {};
View
1  bin/remote.js
@@ -1,5 +1,6 @@
#!/usr/bin/env node
var argv = require('optimist').argv;
+argv._.splice(0, 1);
var fs = require('fs');
var path = require('path');
View
3  bin/spawn.js
@@ -11,6 +11,9 @@ p.on('error', function (err) {
});
p.hub(function (hub) {
+ // translate *--escaped into --escaped
+ argv._ = argv._.map(function(x) { return x.replace(/^\*--/, '--'); });
+
var opts = {
drone : argv.drone,
drones : argv.drones,
View
1  lib/argv.js
@@ -1,5 +1,6 @@
var remote = require('./remote');
var argv = module.exports = require('optimist').argv;
+argv._.splice(0, 1);
// bare args with a leading + are remotes
var args = argv._.reduce(function (acc, arg) {
View
19 lib/git.js
@@ -39,16 +39,25 @@ exports.push = function push (remote, branch, cb) {
exports.repoName = function () {
var dir = exports.dir()
+
+ if (process.platform === 'win32') {
+ return dir.match(/[^\\\/]+$/)[0];
+ }
+
return dir.split('/').slice(-1)[0];
};
exports.dir = function (cwd) {
- var ps = (cwd || process.cwd()).split('/');
- for (var i = ps.length; i > 0; i--) {
- var dir = ps.slice(0, i).join('/');
- if (path.existsSync(dir + '/.git')) {
- return dir;
+ if (!cwd) cwd = process.cwd();
+
+ while (true) {
+ if (path.existsSync(path.join(cwd, '.git'))) {
+ return path.normalize(cwd);
}
+
+ var dir = path.join(cwd, '..');
+ if (dir == cwd) return;
+ cwd = dir;
}
};
View
24 package.json
@@ -8,18 +8,18 @@
},
"main" : "index.js",
"bin" : {
- "fleet" : "bin/command.sh",
- "fleet-rootdir" : "bin/rootdir.js",
- "fleet-help" : "bin/help.sh",
- "fleet-remote" : "bin/remote.js",
- "fleet-deploy" : "bin/deploy.js",
- "fleet-drone" : "bin/drone.js",
- "fleet-hub" : "bin/hub.js",
- "fleet-ps" : "bin/ps.js",
- "fleet-monitor" : "bin/monitor.js",
- "fleet-spawn" : "bin/spawn.js",
- "fleet-stop" : "bin/stop.js",
- "fleet-exec" : "bin/exec.js"
+ "fleet" : "./bin/command.js",
+ "fleet-rootdir" : "./bin/rootdir.js",
+ "fleet-help" : "./bin/help.js",
+ "fleet-remote" : "./bin/remote.js",
+ "fleet-deploy" : "./bin/deploy.js",
+ "fleet-drone" : "./bin/drone.js",
+ "fleet-hub" : "./bin/hub.js",
+ "fleet-ps" : "./bin/ps.js",
+ "fleet-monitor" : "./bin/monitor.js",
+ "fleet-spawn" : "./bin/spawn.js",
+ "fleet-stop" : "./bin/stop.js",
+ "fleet-exec" : "./bin/exec.js"
},
"keywords" : [
"cluster",
Something went wrong with that request. Please try again.