Factor out shared Pub/Bower code to abstract PackageManager, use it wherever possible

@keertip

This is part 1 of generalization of package management. Part 2 will be: introduce a composition template with MetaPackageManager extending the same abstract PackageManager, but delegating each abstract API call to underlying PubManager and BowerManager objects (and potentially other package managers in the future).

Sorry for the large diff: it was a significant refactoring.

Don't pay attention to the commits related to transitive dependency fetching: I checked in that support but then rolled it back to keep the CL single-purposed.