(a.k.a. The Things You Do For Money)
Working as a developer in a non-tech company can be challenging since usually the corporate IT infrastructure and regulations aren't designed for developer tasks but for day-to-day office business. So when I took over some new responsibilities at work and had the chance to finally include Polymer in some internal web projects (with the biggest stopping point of IE8 finally gone) I had some hurdles to overcome to make use of the full Polymer-related tool chain I've come to love for my private projects.
1. Microsoft Windows
The main OS in big corporations (at least in Austria) is still Microsoft Windows and usually you can't just install another OS on company hardware. However, as it turns out, all the tools needed are readily available on Windows, so it might be a unfair to list it among the problems. Consider this part mainly as a summary of what I use for developing with Polymer.Node.js (with all web development tools being Node-based these days) is pretty well supported across all platforms. It comes with npm as package manager that lets you install other tools you will need like Bower or Gulp.
Git (for fetching Bower dependencies) has a Windows installation that also comes with a bash emulator, that is so much nicer to use than the Windows command prompt.
As for text editors you have a wide variety to choose from, personally I like Sublime Text but have also used Notepad++ quite frequently.
2. Group Policies
Having installation files available for Windows is nice, but you might not actually be allowed to install non-standard applications on your PC thanks to all settings and permissions being managed through Active Directory and Group Policies. If you are nice to your local IT department they might make an exception and give you local administrator rights or install custom applications for you, and luckily I have a very nice local IT department ;)But in many cases not even the local IT department can help you, depending themselves on a global team that manages all permissions, and then you will have to start looking at portable solutions that you can simply put anywhere you want without having to install anything.
Here's one possible approach to put your whole development environment on an USB stick.
- Download the latest version of PortableGit and "install" = extract it to any location you want.
- Create a
usr/local/bin
folder in the same location - Download the latest node.exe (from win-x64 or win-x86), which is all that Node.js needs to run, and put it in
usr/local/bin
folder you just created. - Download the latest npm release and extract it into
usr/local/bin/node_modules/npm/
- Copy
npm
andnpm.cmd
fromusr/local/bin/node_modules/npm/bin/
tousr/local/bin
Your final folder structure should look something like this:
When you run
git-bash
now you can already use npm to install Bower and any other node modules you may want to use with npm install -g bower
$HOME
which defaults to C:/Users/YourUser
To solve this issue you will need to create a
You can have different settings for different usernames that way, or if you prefer hard-code the username in the batch file so it will always refer to the same home folder.
Some bower commands (especially bower init) and probably others sometimes have problems with Mintty that the current version of git-bash uses as terminal emulator, so sometimes you might have to use bash.exe directly. You can use another batch file for that.
/home/YourUser
folder in your PortableGit location. To prevent messing around with the default config scripts (which will be overwritten when updating PortableGit) you can create a batch file to temporarily (so we don't mess up other applications that need the %HOME% environment variable) set HOME to that folder before starting git-bash.setlocal set HOME=%~dp0home\%USERNAME% git-bash.exe endlocal
You can have different settings for different usernames that way, or if you prefer hard-code the username in the batch file so it will always refer to the same home folder.
Some bower commands (especially bower init) and probably others sometimes have problems with Mintty that the current version of git-bash uses as terminal emulator, so sometimes you might have to use bash.exe directly. You can use another batch file for that.
setlocal set HOME=%~dp0home\%USERNAME% bin\bash.exe -login -i endlocal
3. Corporate Firewall
With all of this set up, you might already have stumbled across another problem in the previous step when trying to runnpm install -g bower
since the corporate firewall most likely blocked that request.
git, bower and npm all observe the http_proxy
and
https_proxy
environment variables so once you know which proxy to use (easiest by looking at the Internet options IE) you can set those withexport http_proxy=http://company-proxy:port export https_proxy=http://company-proxy:port
And so you don't have to do this every time you should create a
.bashrc
file in your /home/YourUser
folder and put the commands in that file, which will be executed everytime you start bash.
Hint: since Windows gets easily confused with dot-files the easiest way to do this is via git-bash like this:
cd ~ touch .bashrc notepad .bashrc
And with this I'm all set to bring Polymer goodness to the company, let's see where this journey takes me. I'll expect some more blogposts along the way :)