berkshelf/berkshelf — pull request #1021 by sethvargo (2014-02-18 22:18:02+00:00)
Title: Make locations autoloadable and extensible

:construction: :warning: :red_circle:

This is mostly just a proof of concept PR for discussion. A few things I'm proposing in the form of code:

1. "Remove" mercurial support (see item 2)
2. Provide an API for users to specify Berkshelf extensions (like `berkshelf-hg`) that get loaded at runtime. That plugin would declare it's own Location class (or any other extension):

```ruby
# berkshelf-hg/lib/berkshelf/hg.rb
module Berkshelf
autoload :HgLocation, 'berkshelf/locations/hg'
end
```

```ruby
# berkshelf-hg/lib/berkshelf/locations/hg.rb
module Berkshelf
class HgLocation < BaseLocation
# code here to do magic
end
end
```

And then the user would specify that they _want_ this extension in their `Berksfile`:

```ruby
extension 'hg'
```

It's the user's responsibility to install these extensions.

3. Make Location objects auto-loadable (so keys are based off of class names, not a user_defined key). In benchmarking, this saved an average of 0.3s. Although this may not seem significant in the grand scheme of things...