Windows Junctions – Great for mirroring a project to a PhoneGap Folder

Link

Windows Junctions – Great for mirroring a project to a PhoneGap Folder

I have been recently working on project in my visual studio projects folder and needed to keep coping them over to my andoid workspace in eclipse for building my phonegap project in the www folder. This was a pain, so i found a sysinterals tool to make symbolic links in windows. What a time saver!

Github service hooks with Appharbor – Dev and Prod Workflows

Standard

In my previous post I talked about deploying a Github project’s dev branch to a dev web server and the master branch to a prod server on Appharbor. Here is how you set that up.

Prod Hook

  1. Create a new project in Appharbor.
  2. Click “Configure GitHub to deploy to AppHarbor”
  3. Choose the application
  4. This should create the bridge and you can now commit and push to your master repo on Github and your prod app will be deployed to Appharbor.

Dev Hook

  1. Create a new dev project in Appharbor
  2. Click “Configure GitHub to deploy to AppHarbor”
  3. Choose the application
  4. This should create the bridge. Now you must tell Appharbor to only deploy dev branch changes.
  5. Click “settings” and scroll down to tracking branch. Change this to dev (or whatever the branch name is)
  6. Now you should be able to push a change to the dev branch to Github and the hook will deploy it to your dev Appharbor app.

Github – How to create a dev branch

Standard

Recently I have been using github alot for simple apps. So far I have only used the master branch. I want to switch my workflow and have only production ready code on the master and do all of my development on the “dev” branch. The key concept is to never modify any code on the master branch, all code will be modified on the dev branch then merged with the prod branch after it has been tested.

First navigate to the repo in git bash and make sure your master branch is up to date and all your latest commits are psuhed to github.

Master up to date?

git status
git add .
git commit -m “adding dev branch”
git push origin master

Next create a dev branch.

Create Branch

git branch dev
git checkout dev

Now you are in the “dev” branch. Modify some code, all the changes will be made to the dev branch. The goal is to commit changes locally and push to the Github repo periodically. It would be nice to set up an Appharbor (or whatever provider) hook to deploy the dev branch to a dev web server and the master branch to a prod web server.

After a file is modified in the repo, add the change to the dev branch.

Add change to Dev Branch

git add changedFile.txt
git commit -m “changed file in dev”

Push to the dev branch on Github

git push origin dev

At this point an Appharbor hook could deploy the code to the dev server. Then testing would occur. If the dev code looks good then merge and push the new feature to the master (prod).

Add new Dev feature (merge) to Master and push to Github

git checkout master
git merge dev
git commit -m “Added a new feature from dev”
git push origin master

If you completely messed up, you can delete the dev branch and start a new branch from scratch. You accomplish this by switching to the master branch and force delete the dev branch locally, then on Github.

Delete entire branch

git checkout master
git branch -D dev
git push origin –delete dev

Resources: http://rogerdudler.github.com/git-guide/

Git Bash on Windows – How to use curl from a windows prompt to make a REST http call

Standard

First create a shell script.

‘c:\Program Files (x86)\Git\etc\curl.sh’

“c:\Program Files (x86)\Git\bin\curl.exe” -i -k -H “Authorization: Basic INSERTbase64HASHhere” -H “Content-Type: application/json” -H “Accept: application/json” -X POST -d ‘{ data: “yay”}’ ¬†https://domain/rest/api/values

Now run the shell script from a windows command prompt

c:\Program Files (x86)\Git\bin>sh.exe ../etc/curl.sh