Add REG_MULTI_SZ (type => array) implementation

Without this patch applied the registry type and provider do not have an
implementation for the following resource declaration.

    registry_value { 'HKLM\Software\Vendor\Bar\value_array':
      ensure => present,
      type   => array,
      data   => [ 'one', 'two', 'three' ],
    }

The `type => array` in the Puppet DSL maps to the REG_MULTI_SZ [1] data type.
This is basically an ordered list of null terminated strings with two null
bytes to denote the end of the list.

In Puppet we've implemented this as simply accepting an array for the data
property.  This implementation also works well with `puppet resource`:

    PS C:\> puppet resource registry_value HKLM\Software\Vendor\Bar\somearray
    registry_value { 'HKLM\Software\Vendor\Bar\somearray':
      ensure => 'present',
      data   => ['one', 'two', 'three'],
      type   => 'array',
    }

The change_to_s method on the data property has also been overriden to
display messages in the form of:

    data changed 'one,three,two,four' to 'one,two,three'

[1] http://msdn.microsoft.com/en-us/library/windows/desktop/ms724884.aspx
Merge branch 'feature/master/multi_sz' of github.com:jeffmccune/puppetlabs-registry

* 'feature/master/multi_sz' of github.com:jeffmccune/puppetlabs-registry:
  Add REG_MULTI_SZ (type => array) implementation
Add registry::service defined resource example

Without this patch we don't have any easy to use examples of how to use
the registry types and providers.

This patch fixes the problem by including a defined resource type named
registry::service and an example class named registry::service_example.
After installing the registry module, the end user need only include
this class and the appropriate registry keys and values will be managed.

The current implementation requires a reboot for the services created by
these registry entries to show up in the Service Control Manager
(`services.msc`).

An example of how to use this new defined resource is:

      registry::service { 'PuppetExample1':
        display_name => "Puppet Example 1",
        description  => "Puppet Example Service 1",
        command      => 'C:\PuppetExample1.bat',
        start        => 'disabled',
      }
Update README with info about the types provided

The README file didn't contain very good information about how to use
this module or how to use the types provided.  This patch provides
information about how to install the module and some examples of how to
use the `registry_key` and `registry_value` type.
Merge branch 'feature/master/service_example'

* feature/master/service_example:
  Update README with info about the types provided
  Add registry::service defined resource example
Allow values associated with a registry key to be purged

Previously, puppet could only manage registry values as a 'minimal' set,
but not as an 'inclusive' set.

This commit adds a `purge_values` parameter to the registry_key type. If
set to true, puppet will purge all registry values associated with the
key that are not being managed by puppet. For example, if a key `foo`
contains values `bar`, `baz`, and puppet is only managing `baz` and
`qux`, then `bar` would be purged (deleted).

This patch does not purge registry keys that are children of a registry
key resource being managed.  It only purges values.

  registry_key { 'hklm\software\foo':
    ensure       => present,
    purge_values => true
  }
  registry_value { 'hklm\software\baz':
    ensure => present,
    type   => string,
    data   => 'val1'
  }
  registry_value { 'hklm\software\qux':
    ensure => present,
    type   => string,
    data   => 'val2'
  }

This commit satisfies the use-case where the user wants to specify the
exact set of values for a key and ensure that no other values exist
(without having to know what their names might be).

Add registry::purge_example class

This patch adds a class to the registry module to make it easier for the
user to see the behavior of the purge_values registry_key property.

The user needs to include the registry::purge_example class in the node
catalog, then set the following environment variables:

    PS C:\> $env:FACTER_PURGE_EXAMPLE_MODE = 'setup'
    PS C:\> puppet agent --test

This command will configure a registry key with a sub key and values
associated with the key.

    PS C:\> $env:FACTER_PURGE_EXAMPLE_MODE = 'purge'
    PS C:\> puppet agent --test

This command will configure a registry key with purge_values => true and
manage only half of the registry_value resources managed in the setup
phase.
Merge branch 'feature/master/registry_key_purge_values'

* feature/master/registry_key_purge_values:
  Allow values associated with a registry key to be purged
Add registry::compliance_example class to test compliance

Without this patch the registry module does not have a clear example of
how to use the `audit` metaparameter with `puppet inspect` and the
compliance feature of Puppet Enterprise.

This patch fixes the problem by including a
`registry::compliance_example` class the user may include in their
catalog.

Simply including the class will create a nested structure of registry
keys, subkeys, and values.  Once created, the resources should then be
switched into audit mode by setting
`$env:FACTER_REGISTRY_COMPLIANCE_EXAMPLE_MODE = 'audit'` and then
running `puppet agent --test` to obtain the new catalog with resources
set to audit mode rather than enforcement mode.
Merge branch 'feature/master/compliance_example'

* feature/master/compliance_example:
  Add registry::compliance_example class to test compliance
Update Modulefile CHANGELOG for 0.0.1
Add watchr script to automatically run tests

Without this patch the registry module isn't really setup to run the
test suite in an automated way.

This patch adds a copy of the watchr.rb file from the stdlib module.  We
might consider including this in the spec helper repository itself.

To use:

    watchr spec/watchr.rb

Then simply edit any ruby file in the module and the tests will
automatically run.  You might also need to setup
`~/.watchr_images/failed.png` and `~/.watchr_images/passed.png` to get
pretty Growl integration.

Issuing CTRL-\ will run the test suite on demand.
Separate the implementation of the type and provider

Without this patch, the Win32 library and API are tangled up in both the
type and provider.  The type should not have any Win32 specific logic,
as this code is meant to be run on the Puppet Master and compiler nodes.

This patch fixes the problem by separating out helper methods into two
separate modules.

This patch introduces two new classes, RegistryValuePath and
RegistryKeyPath.  These two classes have slightly different semantics
for what a subkey is.  These classes are strictly meant to perform
manipulation of a registry path string.

This patch separates out the Win32 API into
Puppet::Modules::Registry::ProviderBase which implements instance
methods meant to be mixed into the provider classes.

The patch removes all of the Win32 API logic hanging off of the path
parameter instance itself.  All of this logic is moved into instance
methods of the provider itself instead of the parameter.  This is
necessary to separate out the behavior from the type instances itself,
which share the parameter instances.

Without this patch the spec tests do not pass on a Unix system.  Since
all of the Win32 specific logic is removed from the type by this patch
the spec tests now pass on Unix systems.
Update type description strings

Without this patch not all of the properties and parameters are
documented.  This patch fixes the problem by adding desc strings to all
of the parameters for both the key and value registry types.
Merge pull request #11 from jeffmccune/fix/master/refactor_type_and_provider_helper_methods

Separate the implementation of the type and provider
Add acceptance tests for the registry type

Without this patch there are no acceptance tests for the Puppet Labs
registry module.  This is a problem because we need to ensure the
registry_key and registry_value providers actually manage the registry
as expected.

This patch partially fixes the problem by adding a single acceptance
test.  This is a partial fix because I want to lay all of the groundwork
for additional acceptance tests first, then add additional tests in
subsequent patches.

This patch introduces a Ruby module named Systest::Util::Registry.  This
module is meant to be mixed into the eigenclass of a specific test case.
All of the helper methods will then be available to the test case
instance.

A single test case example is provided to help illustrate how to add
additional acceptance tests.  Please copy registry/should_pluginsync.rb
to additional files to create additional tests.
Add registry_key creation acceptance test

This patch adds an acceptance test to make sure that a registry_key
resource is created the first time puppet is run.  The test also makes
sure Puppet is idempotent by doing a second run and making sure the
created message is not in the output.
Fix cannot alias error when managing 32 and 64 bit versions of a key

Without this patch applied the Registry module is not able to manage
both the 32 and 64 bit copies of the same-named registry subkey.

The acceptance test accompanied by this patch illustrates this failure.
Without the change to the way keys are canonically named with the path
namevar the following error message is shown:

    err: Failed to apply catalog: Cannot alias \
      Registry_key[32:HKLM\Software\Vendor\PuppetLabsTest_tYEtHVZl\SubKey1]
      to
      ["hklm\\Software\\Vendor\\PuppetLabsTest_tYEtHVZl\\SubKey1"]

This patch fixes the error by playing the 32: substring prefix in the
canonical string path returned by the path parameter munging block.

TODO: Add a spec test.
Add Registry_key ensure => absent and purge_values coverage

This patch adds test coverage for the following two behaviors of the
Registry_key type:

 * The purge_values => true parameter.
 * The ensure => absent parameter.

The patch implements this by running a series of Puppet agent runs with
the same Puppet Master running.  The behavior is dependent on the
FACT_PHASE facter fact set by the harness using the environment option.
Memoize the filter_path method for performance

Josh pointed out we repeatedly parse the path given to the
RegistryValuePath and RegistryKeyPath class instances.  This is
concerning because of the number of regular expressions we perform in
the filtering of the input path.

This patch provides a small optimization that simply stores the result
of a filter_path method call and re-uses this result on any subsequent
calls.

This is a simple fix because the only want to "set" the input path is to
instantiate a new instance of the class, passing a new path to the
initializer.
Eliminate RegistryPathBas#(default?,valuename) from base class

Josh pointed out that the current implementation doesn't actually use
the RegistryPathBase#default? and RegistryPathBase#valuename instance
methods.  These methods are specific to the implementation of the
RegistryKeyPath or RegistryValuePath instances.

This patch simply removes the methods from the base class and adds them
explicitly to the ancestors to make it clear where the method being
called is defined any why it's there.