refactoring of build code alongwith using TravisEnv type
new helper functions addded for type TravisEnv
refactoring and fixup of some functions
using getEnvironment instead of lookupEnv (base >= 4.6.0.0)
small fixes: indentation and trailing spaces in travis build script