Skip to content

Instantly share code, notes, and snippets.

@sbertrang
Created February 15, 2014 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbertrang/9023267 to your computer and use it in GitHub Desktop.
Save sbertrang/9023267 to your computer and use it in GitHub Desktop.
rex bootstrap example
# Tell when and where things go wrong
use strict;
use warnings;
# Support for SSH agent
set connection => "OpenSSH";
my $server = "example.com";
my $path = "/source/rex-bootstrap";
desc "1. zap any trace of a previous attempt";
task "clear-previous", sub {
run "rm -rf .git";
};
desc "2. create local repository first";
task "init-local-repo", sub {
my $output = run "git init .";
say $output;
};
desc "3. add this file";
task "add-rexfile", sub {
my $output = run "git add Rexfile";
say $output;
};
desc "4. commit rexfile";
task "commit-rexfile", sub {
my $output = run "git commit -m 'initial commit' Rexfile";
say $output;
};
desc "5. create a git repository on the server";
task "create-remote", $server, sub {
my $output = run "git init --bare --shared=group $path";
say $output;
};
desc "6. add server as git remote";
task "add-remote", sub {
my $output = run "git remote add origin $server:$path";
say $output;
};
desc "7. push local git repository to remote";
task "push-remote", sub {
my $output = run "git push origin master";
say $output;
};
# Batch all tasks
batch "all",
"clear-previous",
"init-local-repo",
"add-rexfile",
"commit-rexfile",
"create-remote",
"add-remote",
"push-remote",
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment