Restore 'gear build' functionality on normal gears

Restore 'gear build' functionality on normal gears.

If building from Jenkins, use $GIT_BRANCH as the git ref.

If building in a normal gear, call ApplicationRepository#archive to
replace the contents of app-root/runtime/repo with the ref to build.

Exclude .git when rsyncing the repo content from the Jenkins builder
gear to the upstream gear.

Bug 1022361
Improve error handling in gear script

Add UsageException

Switch puts/raise 255 to raise UsageException
Merge pull request #3971 from ncdc/bz1022361

Merged by openshift-bot