יום שישי, 23 בינואר 2015

sweet lightweight automation tools for ruby and python - fabric and rye.

well i know its redundant since ruby and python are basically alternatives to one another, but what can i do , each of those languages has a sweet spot in my heart and each time i find a new cool feature in one language i have to look for it in the other (dont tell python but ruby is the prettier child :P)

anyways i dont like much elaboration so lets cut to the chance with some self explaining code snippets:

ruby:
this baby is called rye, its a library that automates tasks for you in a safe way , mostly remote task oriented and can be contained in a simple script in the following way



python
this awesome little library is called fabric, it automates tasks just as well with little code, the downside ive seen is that its files have to be named fabfile and they are executed globally using the cli fab utility, but that is just at first glance, i need to see if i can contain it all easily as i did with ruby in one py file
here is a code that does the same thing as the ruby code but this time on a local machine, could be executed on a remote machine as well

a little update on fabric:

filename can be set with the -f flag when invoking fab and remote hosts can be set in the following way: