puppetlabs/puppet — pull request #244 by kelseyhightower (2011-12-05 17:41:30+00:00)
Title: Ticket/2.7.x/7656 module tool should be a face

commit 0c611869ef9442060128f7695de1103feebff757
Author: Kelsey Hightower
Date: Mon Dec 5 09:31:39 2011 -0500

(#7656) Port PMT codebase into Puppet core

Before this patch, the Puppet Module Tool (PMT) codebase lived in it's
own project.

This patch ports the PMT codebase, mainly everything under the former
`lib/puppet/module` directory, into core Puppet with the following major
changes and refactorings:

The PMT codebase lives under `lib/puppet/` and `lib/puppet/module_tool`
in Puppet core.

The following files are being renamed:

* `lib/puppet/module/tool/tool.rb`

`tool.rb` is being renamed to `module_tool.rb`

The following files are not being ported over:

* `lib/puppet/module/tool/utils/settings.rb`
* `lib/puppet/module/tool/cli.rb`
* `lib/puppet/module/tool/applications/freezer.rb`
* `lib/puppet/module/tool/applications/registrar.rb`
* `lib/puppet/module/tool/applications/releaser.rb`
* `lib/puppet/module/tool/applications/unreleaser.rb`

`settings.rb` is not being ported over in favor of using core Puppet
settings logic.

`cli.rb` is not being ported over in favor of using the Puppet faces
API.

`freezer.rb`, `registrar.rb`, `releaser.rb` , and `unreleaser.rb` are
not being ported over as the features they support are not implemented.

The following PMT sub-commands are being removed:

* `version`
* `repository`
* `usage`
* `changelog`

The `version`, `repository`, `usage`, and `changelog` PMT sub-commands
are being removed in favor of using core Puppet settings logic,
versioning scheme, and help commands.

All ported applications: builder, checksummer, cleaner, generator,
installer, searcher, and unpacker, now return either status hashes,
Pathname objects, or an array of file paths. This change is to support
the faces API, each face action should return a value that can be used
in Ruby code, or printed to the console.

PMT tests and generator templates will be ported into core Puppet in
separate commits.

commit ce218efd5b8261ad174abbd33e52049ed964ba0b
Author: Kelsey Hightower
Date: Mon Dec 5 09:54:07 2011 -0500

(#7656) Port PMT generator templates into core

Before this patch, the Puppet Module Tool (PMT) generator templates
lived in the PMT codebase -- in a separate project.

This patch ports the Puppet Module Tool (PMT) generator templates into
core Puppet with the following major changes and refactorings:

The PMT generator templates now live under the
`lib/puppet/module_tool/skeleton/templates` directory. This is a
change from the previous location as the `template` directory lived at
the root of the PMT project. This change is being made to remain
consistent with the current core Puppet codebase and project layout.

The ported version of `lib/puppet/module_tool/skeleton.rb` has been
updated to reference generator templates in the
`lib/puppet/module_tool/skeleton/templates/` directory.

commit eb617e5d9093834588732e78f42e865c814b982b
Author: Kelsey Hightower
Date: Mon Dec 5 09:57:57 2011 -0500

(#7656) Add new PMT settings to core Puppet

Before this patch, Puppet core did not support any settings for the
Puppet Module Tool (PMT).

This patch adds two (2) new settings to core Puppet:

* module_repository
* module_working_dir

The module_repository setting is used to specify the remote module
repository used for searching and installing modules; module_repository
has a default value of 'http://forge.puppetlabs.com'.

The module_working_dir setting is used to specify the directory into
which module tool data is stored; module_working_dir has a default value
of: '$vardir/puppet-module'.

commit ee4dbf4d15207f84107ae5b0fb287b5425b3ebd9
Author: Kelsey Hightower
Date: Mon Dec 5 10:14:38 2011 -0500

(#7656) Port PMT test fixtures into Puppet core

Before this patch, the Puppet Module Tool (PMT) test fixtures lived in
the PMT codebase -- in a separate project.

This patch ports the PMT test fixtures into core Puppet. There are no
major changes or refactorings. This patch places the PMT test fixtures
under the `spec/fixtures` directory; the same relative location of the
previous codebase.

commit bce8e43298744be8cced7d995931524b636ed57f
Author: Kelsey Hightower
Date: Mon Dec 5 10:31:02 2011 -0500

(#7656) Port PMT unit test into Puppet core

Before this patch, the Puppet Module Tool (PMT) unit tests lived in the
PMT codebase -- in a separate project.

This patch ports the PMT unit tests into core Puppet with the following
major changes and refactorings.

All spec tests are being updated to require modules located in their new
location in the core Puppet codebase: `lib/puppet/module_tool`.

The following tests are being removed:

* `spec/unit/application_spec.rb`

`application_spec.rb` is being removed because the tests are no longer
valid, all examples are related to custom settings code that is not
being ported over.

The following tests are being renamed:

* `spec/unit/tool_spec.rb`

`tool_spec.rb` is being renamed to `module_tool_spec.rb`. This change
is being made in order to match the new name of the module
under test: `module_tool.rb`

The following tests are being relocated:

* `spec/unit/repository_spec.rb`
* `spec/unit/semver_spec.rb`

Both `repository_spec.rb` and `semver_spec.rb` are being relocated under
the `spec/unit/module_tool` directory in core Puppet. This change is
being made to match the new locations of the modules under test.

commit bf9e847d2bc1169993566cab441fcf6cad627f54
Author: Kelsey Hightower
Date: Mon Dec 5 10:48:56 2011 -0500

(#7656) Port PMT integration test into Puppet core

Before this patch, the Puppet Module Tool (PMT) integration tests lived
in the PMT codebase -- in a separate project.

This patch ports the PMT integration tests into core Puppet with the
following major changes and refactorings.

All temp file and directory management logic is being removed in favor
of using the existing helper methods in `PuppetSpec::Files`. This change
has the added benefit of not leaving around temp files or directories
after tests are run.

The following helper methods are being merged into `module_tool_spec.rb`

* `stub_repository_read`
* `stub_installer_read`
* `stub_cache_read`
* `testdir`
* `mktestdircd`
* `rmtestdir`

This change is being made because each of the above methods are only
used by `module_tool_spec.rb`. This also removes the need to add another
set of "global" helper functions to the code base. As a result of this
change the `spec/support/output_support.rb`,
`spec/support/stub_http_support.rb`, and `testdir_support.rb` modules
are not being ported over.

Tests have been updated to test the new return values of the generate,
build, search, install, clean, and changes applications. This change is
being made to reflect the new behavior of those actions, which now
return either status hashes, Pathname objects, or an array of file
paths.

The following tests are being removed:

* `repository`

The single test for the `repository` sub-command is being removed
because it is no longer valid. The `repository` sub-command is not being
ported over.

All tests are being updated to use the full name of the application
under test, for example:

`Puppet::Module::Tool::Applications::Generator.run`

This change is being made to reflect the fact that the
`lib/puppet/module/tool/cli.rb` module is not being ported over, so the
abstraction provided by `Puppet::Module::Tool::CLI.new` is no longer
available.

This patch also renames the integration test from `cli_spec.rb` to
`module_tool_spec.rb` in order to match the module name under test.

commit 7df5303b9f3613193cb4c092c57b4e8a5177e647
Author: Kelsey Hightower
Date: Mon Dec 5 11:21:39 2011 -0500

(#7656) Port PMT to faces, bundle in Puppet core

Before this patch, Puppet did not have the ability to interact with the
Puppet Module Forge (PMF).

This patch is one of many patches that add a new module_tool face to
core Puppet. This patch provides the foundation bits which setup the
ground work for adding additional actions and features.

commit da4a2361c65f5b48558384927d8e65a50914bda0
Author: Kelsey Hightower
Date: Mon Dec 5 11:45:29 2011 -0500

(#7656) Add build action to module_tool face

Before this patch, the module_tool face did not have the ability to
build module release archives, and there was no test coverage for the
module_tool build action.

This patch adds support for building module release archives to the
module_tool face.

Example usage:

$ puppet module_tool build /path/to/module

This patch includes unit tests for the module_tool build action.

commit 5e77157895601598b1650b6e15bd6565da694afb
Author: Kelsey Hightower
Date: Mon Dec 5 11:47:21 2011 -0500

(#7656) Add changes action to module_tool face

Before this patch, the module_tool face did not have the ability to
show modified files of an installed module, and there was no test
coverage for the module_tool changes action.

This patch adds support for showing modified files of an installed
module to the module_tool face.

Example usage:

$ puppet module_tool changes /path/to/module

This patch includes unit tests for the module_tool changes action.

commit 626d876fa5907522123b52623b97def8cc570e86
Author: Kelsey Hightower
Date: Mon Dec 5 11:49:17 2011 -0500

(#7656) Add clean action to module_tool face

Before this patch, the module_tool face did not have the ability to
clean the module download cache, and there was no test coverage for the
module_tool clean action.

This patch adds support for cleaning the module download cache to the
module_tool face.

Example usage:

$ puppet module_tool clean

This patch includes unit tests for the module_tool clean action.

commit 6d2fc99f0f8f30a3cfe59dfbbeb431d446eefca2
Author: Kelsey Hightower
Date: Mon Dec 5 11:52:06 2011 -0500

(#7656) Add generate action to module_tool face

Before this patch, the module_tool face did not have the ability to
generate boilerplate for a new module, and there was no test coverage
for the module_tool generate action.

This patch adds support for generating boilerplate for a new module to
the module_tool face.

Example usage:

$ puppet module_tool generate username-modulename

This patch includes unit tests for the module_tool generate action.

commit 41d10344f952e3be81ed40d50468651e44995bd9
Author: Kelsey Hightower
Date: Mon Dec 5 12:06:14 2011 -0500

(#7656) Add install action to module_tool face

Before this patch, the module_tool face did not have the ability to
install a module from a repository or release archive, and there was no
test coverage for the module_tool install action.

This patch adds support for installing a module from a repository or
release archive to the module_tool face.

Example usage:

# Install a module from the default repository:
$ puppet module_tool install username-modulename

# Install a specific module version from a repository:
$ puppet module_tool install username-modulename --version=0.0.1

# Install a module into a specific directory:
$ puppet module_tool install username-modulename --install-dir=path

# Install a module from a release archive:
$ puppet module_tool install username-modulename-0.0.1.tar.gz

This patch includes unit tests for the module_tool install action.

commit bdeb3b77525bb3932ada6b5fa0c09289df7d8f48
Author: Kelsey Hightower
Date: Mon Dec 5 12:07:02 2011 -0500

(#7656) Add search action to module_tool face

Before this patch, the module_tool face did not have the ability to
search a repository for a module, and there was no test coverage for the
module_tool search action.

This patch adds support for searching a repository for a module to the
module_tool face.

Example usage:

$ puppet module_tool search modulename

This patch includes unit tests for the module_tool search action.