Skip to content
lolstorm92 edited this page Jul 19, 2015 · 9 revisions

Fabric

Fabric is a Python (2.5-2.7) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks. The source code for the commands can be found on the root folder in the file named fabfile.py

How to Setup Fabric

To make it easy to run on windows we did 3 bat files that you can find in the root folder of the project! run them in the following order:

1. setupfabric.bat
2. setup2.bat
3. setup3.bat

Fabric custom made commands

Before doing anything you need to be on your Virtual Environment to do it on windows you can go to your project root folder via command line and type the following command:

C:\Users\UserName\Project\ > .\.venv\Scripts\activate.bat

After you run your command line should be like this:

(venv) C:\Users\UserName\Project\ >

Now you are on your Virtual Enviroment you can start to use fabric. For now the file is coded with 6 commands.

1# The first one is to update requirements (install/update python packages you might need for the project, this command checks if its already on the last version or not!)

(.venv)lolstorm@Debian ~/r/Unamed-Rpg> fab git_all:"fab testing"
[localhost] local: git add --all
[localhost] local: git commit -m "fab testing"
[master 460a64d] fab testing
2 files changed, 4 insertions(+), 6 deletions(-)
[localhost] local: git pull --rebase
Username for 'https://github.com': lolstorm92
Password for 'https://lolstorm92@github.com': 
remote: Counting objects: 46, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 46 (delta 26), reused 18 (delta 5), pack-reused 0
Unpacking objects: 100% (46/46), done.
From https://github.com/lolstorm92/Unamed-Rpg
    cb056f1..7a70a8a  master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: fab testing
[localhost] local: git push origin master
Username for 'https://github.com': lolstorm92
Password for 'https://lolstorm92@github.com': 
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 832 bytes | 0 bytes/s, done.
Total 10 (delta 6), reused 0 (delta 0)
To https://github.com/lolstorm92/Unamed-Rpg.git
7a70a8a..2280662  master -> master
Done.

2# The second one is to performe the classic git add --all with a commit message in one command!

(.venv)lolstorm@Debian ~/r/Unamed-Rpg> fab commit:"Cool Commit Message"

3# The third one is a kind of a shortcut to the git pull --rebase

(.venv)lolstorm@Debian ~/r/Unamed-Rpg> fab pull_r

4# The fourth one is a kind of a shortcut to the git push

(.venv)lolstorm@Debian ~/r/Unamed-Rpg> fab push

5# The second one is basically a combination from the 3 above it uses git to add all, commit, pull with re-base and finally pushes, the first parameter is the commit message!:

(.venv)lolstorm@Debian ~/r/Unamed-Rpg> fab git_all:"fab testing"
[localhost] local: git add --all
[localhost] local: git commit -m "fab testing"
[master 460a64d] fab testing
 2 files changed, 4 insertions(+), 6 deletions(-)
[localhost] local: git pull --rebase
Username for 'https://github.com': lolstorm92
Password for 'https://lolstorm92@github.com': 
remote: Counting objects: 46, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 46 (delta 26), reused 18 (delta 5), pack-reused 0
Unpacking objects: 100% (46/46), done.
From https://github.com/lolstorm92/Unamed-Rpg
   cb056f1..7a70a8a  master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: fab testing
[localhost] local: git push origin master
Username for 'https://github.com': lolstorm92
Password for 'https://lolstorm92@github.com': 
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 832 bytes | 0 bytes/s, done.
Total 10 (delta 6), reused 0 (delta 0)
To https://github.com/lolstorm92/Unamed-Rpg.git
   7a70a8a..2280662  master -> master
Done.

Clone this wiki locally