puppetlabs/Razor — pull request #232 by daniel-pittman (2012-10-31 17:25:23+00:00)
Title: Cleaner code for a cleaner life!

This series of patches makes a set of improvements to the code quality and compliance with Puppet Labs coding standards:

Hoist `Slice::Base` into a `Slice` class, and derive directly, rather than using a peer class. This makes two things more uniform: inheritance of slices, through the Liskov substitution principle, and handling of "what is a slice", since you no longer need to understand any special-case around the base instance.

Ensure that `filename to constant` and `constant to filename` mappings follow Ruby standards, which changed `Slice::Active_model` to `Slice::ActiveModel`.

Move the CLI script into a class, and invoke that. This ensures that all the logic lives under `lib/project_razor`, and is a step toward easier unit testing of the CLI interactions.

Implement "best practice" version handling. Instead of a hard-coded version, we implement two strategies for versioning:
* releases will have the version burned into them before shipping
* versions from git check using `git describe`, or fall back to manually parsing git metadata
* failing any of that, announce an unknown version

The series also includes some general code changes to bring it closer to Puppet Labs usual Ruby coding standards.

It was intended to be part of a smaller series that did some additional cleanup over logging, and command invocation, but it grew large and old enough to submit separately.