…or any other DropBox enabled tablet...
I was trying to locate a Git client for iOS to allow easy editing of OpenShift repositories from my iPad but did not manage to find anything but some barebone github viewers.
Instead I started playing around with Hazel, DropBox, OpenShift and my iPad and I managed to create a little “Cloud IDE” to enable editing and deployment to OpenShift from my iPad.
Note, I use Hazel and an iPad in this blog which unfortunately makes it Mac/OSX specific but you should be able to do this on any OS and tablet as long as you have something similar to Hazel that can execute commands based on changes to a directory and your tablet have an DropBox enabled editor. If you have such a setup on a another OS/tablet combo I would love to hear about it in the comments.
Finally, in this blog I assume you already have git installed to be used from your machine. How you setup your OpenShift application, wether with JBoss Tools or command line clients is not relevant for this usecase - only necessary to have git working for this.
Once you have that the remaining steps are as follows:
DropBox should be installed on a machine that is “always” online or at least while you want edits done on your iPad to take effect.
Then git clone your favorite OpenShift application into a sub-directory within your DropBox, i.e. here is what I did to get my app named
code on my DropBox:
cd ~/DropBox/code git clone ssh://email@example.com/~/git/super.git/
If you do not know your git URL you can use
rhc-user-info to find it.
Once you have the content on DropBox verify that it is possible to deploy to OpenShift from the machine. Edit a file and execute
git commit -a -m "1-2-3 testing" git push origin
If that completes without errors your DropBox machine is ready to run.
Download Hazel on the same machine as you have DropBox setup and running on and add a rule that looks like the following for the directory where you want the script to be executed:
The conditions are:
- Extension is
- “Date Last Modified” “is after” “Date Last Matched”
and when it finds a file matching these criteria then setup an action that does the following:
“Run Shell Script ”embedded Script":
touch $1.running sh $1 &> $1.log rm $1.running touch $1.log exit 0
The Hazel rule is straight forward. It executes any updated .sh files on the machine and in the process it creates a temporary ‘.running’ marker file to let you know it process is running and then pipe all the log output to a .log file and finally exit with status 0 since the actual script could fail but that should not be treated by Hazel as an error.
Add ‘short-cut’ scripts
To avoid too much annoying typing on your tablet I suggest you create a
commitpublish.sh with the steps necessary to do a commit and push for your OpenShift application.
super app I created a
commitpublish.sh with the following content:
cd super git commit -a -m "Committing via DropBox" git push origin
You can also add other useful shortcuts such as an status.sh that gives you latest log for your app:
rhc-ctl-app -c status -a super -p <yourpassword>
Edit & Deploy via iPad
For the actual editing and deployment you should be able to use any DropBox enabled editor such as DropText, PlainText, etc. but I ended up using Koder since it was the only one I could find that had nice syntax highlighting and a good and fully functional DropBox integration.
Once you have configured a DropBox project in Koder you cans simply edit the content.
Once you are ready to publish it to OpenShift simply edit the
commitpublish.sh file and make sure to Upload the file to DropBox and Hazel will take action and get it published.
Once the command and publish have completed you should be able to refresh in Koder and see a ‘commitpublish.sh.log’ file with the output.
If it completed succesfully you should now be able to see the result in a browser for your OpenShift application.
Have fun and do leave a comment if it works out for you or if you got an alternative for the above.
Happy New Year!