puppet-module 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.markdown +91 -0
- data/LICENSE +17 -0
- data/README.markdown +221 -0
- data/Rakefile +87 -0
- data/VERSION +1 -0
- data/bin/puppet-module +7 -0
- data/lib/puppet/module/tool.rb +124 -0
- data/lib/puppet/module/tool/applications.rb +18 -0
- data/lib/puppet/module/tool/applications/application.rb +83 -0
- data/lib/puppet/module/tool/applications/builder.rb +88 -0
- data/lib/puppet/module/tool/applications/checksummer.rb +38 -0
- data/lib/puppet/module/tool/applications/cleaner.rb +14 -0
- data/lib/puppet/module/tool/applications/freezer.rb +20 -0
- data/lib/puppet/module/tool/applications/generator.rb +117 -0
- data/lib/puppet/module/tool/applications/installer.rb +83 -0
- data/lib/puppet/module/tool/applications/registrar.rb +34 -0
- data/lib/puppet/module/tool/applications/releaser.rb +48 -0
- data/lib/puppet/module/tool/applications/searcher.rb +34 -0
- data/lib/puppet/module/tool/applications/unpacker.rb +69 -0
- data/lib/puppet/module/tool/applications/unreleaser.rb +42 -0
- data/lib/puppet/module/tool/cache.rb +56 -0
- data/lib/puppet/module/tool/checksums.rb +52 -0
- data/lib/puppet/module/tool/cli.rb +127 -0
- data/lib/puppet/module/tool/contents_description.rb +84 -0
- data/lib/puppet/module/tool/dependency.rb +26 -0
- data/lib/puppet/module/tool/metadata.rb +80 -0
- data/lib/puppet/module/tool/modulefile.rb +47 -0
- data/lib/puppet/module/tool/repository.rb +74 -0
- data/lib/puppet/module/tool/skeleton.rb +39 -0
- data/lib/puppet/module/tool/utils.rb +9 -0
- data/lib/puppet/module/tool/utils/interrogation.rb +39 -0
- data/lib/puppet/module/tool/utils/settings.rb +36 -0
- data/lib/puppet/module/tool/utils/uri.rb +16 -0
- data/spec/fixtures/releases/jamtur01-apache/Modulefile +2 -0
- data/spec/fixtures/releases/jamtur01-apache/files/httpd +24 -0
- data/spec/fixtures/releases/jamtur01-apache/files/test.vhost +18 -0
- data/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb +21 -0
- data/spec/fixtures/releases/jamtur01-apache/lib/puppet/type/a2mod.rb +12 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/dev.pp +5 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/init.pp +34 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/params.pp +17 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/php.pp +5 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp +15 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp +15 -0
- data/spec/fixtures/releases/jamtur01-apache/metadata.json +1 -0
- data/spec/fixtures/releases/jamtur01-apache/templates/vhost-default.conf.erb +20 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/apache.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/dev.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/init.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/php.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/ssl.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/vhost.pp +2 -0
- data/spec/integration/cli_spec.rb +373 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/output_support.rb +19 -0
- data/spec/support/stub_http_support.rb +14 -0
- data/spec/support/testdir_support.rb +26 -0
- data/spec/unit/application_spec.rb +25 -0
- data/spec/unit/repository_spec.rb +51 -0
- data/templates/generator/Modulefile.erb +5 -0
- data/templates/generator/README.erb +3 -0
- data/templates/generator/files/README.markdown +22 -0
- data/templates/generator/lib/puppet/facter/README.markdown +22 -0
- data/templates/generator/lib/puppet/parser/functions/README.markdown +17 -0
- data/templates/generator/lib/puppet/provider/README.markdown +14 -0
- data/templates/generator/lib/puppet/type/README.markdown +14 -0
- data/templates/generator/manifests/README.markdown +28 -0
- data/templates/generator/manifests/init.pp.erb +17 -0
- data/templates/generator/metadata.json +12 -0
- data/templates/generator/spec/README.markdown +7 -0
- data/templates/generator/spec/spec.opts +6 -0
- data/templates/generator/spec/spec_helper.rb +18 -0
- data/templates/generator/spec/unit/puppet/provider/README.markdown +4 -0
- data/templates/generator/spec/unit/puppet/type/README.markdown +4 -0
- data/templates/generator/templates/README.markdown +23 -0
- data/templates/generator/tests/init.pp.erb +1 -0
- data/vendor/facets-2.8.2-partial/lib/facets/kernel/returning.rb +23 -0
- data/vendor/facets-2.8.2-partial/lib/facets/kernel/tap.rb +39 -0
- data/vendor/multipart-post-1.0/Manifest.txt +9 -0
- data/vendor/multipart-post-1.0/README.txt +61 -0
- data/vendor/multipart-post-1.0/Rakefile +21 -0
- data/vendor/multipart-post-1.0/lib/composite_io.rb +89 -0
- data/vendor/multipart-post-1.0/lib/multipartable.rb +13 -0
- data/vendor/multipart-post-1.0/lib/net/http/post/multipart.rb +27 -0
- data/vendor/multipart-post-1.0/lib/parts.rb +66 -0
- data/vendor/multipart-post-1.0/test/net/http/post/test_multipart.rb +55 -0
- data/vendor/multipart-post-1.0/test/test_composite_io.rb +50 -0
- data/vendor/thor-852190ae/CHANGELOG.rdoc +89 -0
- data/vendor/thor-852190ae/LICENSE +20 -0
- data/vendor/thor-852190ae/README.rdoc +297 -0
- data/vendor/thor-852190ae/REVISION +1 -0
- data/vendor/thor-852190ae/Thorfile +69 -0
- data/vendor/thor-852190ae/bin/rake2thor +86 -0
- data/vendor/thor-852190ae/bin/thor +6 -0
- data/vendor/thor-852190ae/lib/thor.rb +244 -0
- data/vendor/thor-852190ae/lib/thor/actions.rb +275 -0
- data/vendor/thor-852190ae/lib/thor/actions/create_file.rb +103 -0
- data/vendor/thor-852190ae/lib/thor/actions/directory.rb +91 -0
- data/vendor/thor-852190ae/lib/thor/actions/empty_directory.rb +134 -0
- data/vendor/thor-852190ae/lib/thor/actions/file_manipulation.rb +223 -0
- data/vendor/thor-852190ae/lib/thor/actions/inject_into_file.rb +104 -0
- data/vendor/thor-852190ae/lib/thor/base.rb +540 -0
- data/vendor/thor-852190ae/lib/thor/core_ext/file_binary_read.rb +9 -0
- data/vendor/thor-852190ae/lib/thor/core_ext/hash_with_indifferent_access.rb +75 -0
- data/vendor/thor-852190ae/lib/thor/core_ext/ordered_hash.rb +100 -0
- data/vendor/thor-852190ae/lib/thor/error.rb +30 -0
- data/vendor/thor-852190ae/lib/thor/group.rb +271 -0
- data/vendor/thor-852190ae/lib/thor/invocation.rb +180 -0
- data/vendor/thor-852190ae/lib/thor/parser.rb +4 -0
- data/vendor/thor-852190ae/lib/thor/parser/argument.rb +67 -0
- data/vendor/thor-852190ae/lib/thor/parser/arguments.rb +150 -0
- data/vendor/thor-852190ae/lib/thor/parser/option.rb +128 -0
- data/vendor/thor-852190ae/lib/thor/parser/options.rb +169 -0
- data/vendor/thor-852190ae/lib/thor/rake_compat.rb +66 -0
- data/vendor/thor-852190ae/lib/thor/runner.rb +314 -0
- data/vendor/thor-852190ae/lib/thor/shell.rb +83 -0
- data/vendor/thor-852190ae/lib/thor/shell/basic.rb +239 -0
- data/vendor/thor-852190ae/lib/thor/shell/color.rb +108 -0
- data/vendor/thor-852190ae/lib/thor/task.rb +102 -0
- data/vendor/thor-852190ae/lib/thor/util.rb +230 -0
- data/vendor/thor-852190ae/lib/thor/version.rb +3 -0
- data/vendor/thor-852190ae/spec/actions/create_file_spec.rb +170 -0
- data/vendor/thor-852190ae/spec/actions/directory_spec.rb +131 -0
- data/vendor/thor-852190ae/spec/actions/empty_directory_spec.rb +91 -0
- data/vendor/thor-852190ae/spec/actions/file_manipulation_spec.rb +271 -0
- data/vendor/thor-852190ae/spec/actions/inject_into_file_spec.rb +135 -0
- data/vendor/thor-852190ae/spec/actions_spec.rb +292 -0
- data/vendor/thor-852190ae/spec/base_spec.rb +263 -0
- data/vendor/thor-852190ae/spec/core_ext/hash_with_indifferent_access_spec.rb +43 -0
- data/vendor/thor-852190ae/spec/core_ext/ordered_hash_spec.rb +115 -0
- data/vendor/thor-852190ae/spec/fixtures/application.rb +2 -0
- data/vendor/thor-852190ae/spec/fixtures/bundle/execute.rb +6 -0
- data/vendor/thor-852190ae/spec/fixtures/bundle/main.thor +1 -0
- data/vendor/thor-852190ae/spec/fixtures/doc/%file_name%.rb.tt +1 -0
- data/vendor/thor-852190ae/spec/fixtures/doc/README +3 -0
- data/vendor/thor-852190ae/spec/fixtures/doc/config.rb +1 -0
- data/vendor/thor-852190ae/spec/fixtures/group.thor +83 -0
- data/vendor/thor-852190ae/spec/fixtures/invoke.thor +112 -0
- data/vendor/thor-852190ae/spec/fixtures/script.thor +140 -0
- data/vendor/thor-852190ae/spec/fixtures/task.thor +10 -0
- data/vendor/thor-852190ae/spec/group_spec.rb +171 -0
- data/vendor/thor-852190ae/spec/invocation_spec.rb +107 -0
- data/vendor/thor-852190ae/spec/parser/argument_spec.rb +47 -0
- data/vendor/thor-852190ae/spec/parser/arguments_spec.rb +64 -0
- data/vendor/thor-852190ae/spec/parser/option_spec.rb +202 -0
- data/vendor/thor-852190ae/spec/parser/options_spec.rb +292 -0
- data/vendor/thor-852190ae/spec/rake_compat_spec.rb +68 -0
- data/vendor/thor-852190ae/spec/runner_spec.rb +202 -0
- data/vendor/thor-852190ae/spec/shell/basic_spec.rb +205 -0
- data/vendor/thor-852190ae/spec/shell/color_spec.rb +41 -0
- data/vendor/thor-852190ae/spec/shell_spec.rb +34 -0
- data/vendor/thor-852190ae/spec/spec.opts +1 -0
- data/vendor/thor-852190ae/spec/spec_helper.rb +54 -0
- data/vendor/thor-852190ae/spec/task_spec.rb +69 -0
- data/vendor/thor-852190ae/spec/thor_spec.rb +237 -0
- data/vendor/thor-852190ae/spec/util_spec.rb +167 -0
- data/vendor/thor-852190ae/thor.gemspec +120 -0
- metadata +229 -0
data/CHANGES.markdown
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
puppet-module changes
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
r0.3.0
|
|
5
|
+
------
|
|
6
|
+
|
|
7
|
+
* Renamed CLI tool and gem to `puppet-module`. Please run `gem uninstall pmt` to get rid of old versions of the program.
|
|
8
|
+
* Added 'usage' action to display the usage information for this tool.
|
|
9
|
+
* Added 'changelog' action to display the changelog for this tool.
|
|
10
|
+
|
|
11
|
+
r0.2.9
|
|
12
|
+
------
|
|
13
|
+
|
|
14
|
+
* Fixed 'generate' action to create files and directories that follow Puppet best-practices.
|
|
15
|
+
|
|
16
|
+
r0.2.8
|
|
17
|
+
------
|
|
18
|
+
|
|
19
|
+
* Fixed rake tasks so that RSpec isn't required to run those tasks that don't need it.
|
|
20
|
+
* Fixed generated dependency metadata so that version and repository values are only set if specified.
|
|
21
|
+
|
|
22
|
+
r0.2.7
|
|
23
|
+
------
|
|
24
|
+
|
|
25
|
+
* Fixed program so it'd be pure Ruby, it used to depend on the Versionomy library which required compiled extensions.
|
|
26
|
+
|
|
27
|
+
r0.2.6
|
|
28
|
+
------
|
|
29
|
+
|
|
30
|
+
* Fixed gem builder to no longer install Puppet as a dependency since users can have a non-gem version.
|
|
31
|
+
|
|
32
|
+
r0.2.5
|
|
33
|
+
------
|
|
34
|
+
|
|
35
|
+
* Added ability to specify username and password credentials for a repository URL, e.g.: http://myuser:mypassword@myrepository.com/
|
|
36
|
+
|
|
37
|
+
r0.2.4
|
|
38
|
+
------
|
|
39
|
+
|
|
40
|
+
* Improved user documentation, explained different ways to run the program.
|
|
41
|
+
|
|
42
|
+
r0.2.3
|
|
43
|
+
------
|
|
44
|
+
|
|
45
|
+
* Fixed Rakefile, readded the rspec tasks inadvertantly removed in r0.2.2.
|
|
46
|
+
* Fixed builder to extract information about Puppet providers.
|
|
47
|
+
* Fixed tool's method for getting the current repository to use Puppet's settings.
|
|
48
|
+
* Improved cli_spec, added examples describing how to build a module's checksums, dependencies and Puppet types and providers.
|
|
49
|
+
* Improved builder to produce pretty JSON that's easy for a human to read.
|
|
50
|
+
|
|
51
|
+
r0.2.2
|
|
52
|
+
------
|
|
53
|
+
|
|
54
|
+
* Fixed unpacker to use the private working directory instead of '/tmp'.
|
|
55
|
+
* Fixed installer, it now detects if a module is already installed.
|
|
56
|
+
* Fixed default repository path to 'http://forge.puppetlabs.com'
|
|
57
|
+
* Fixed README's license text to explain that GPLv2 or later is acceptable.
|
|
58
|
+
* Added `rake gem` to build a gem in the 'pkg' directory.
|
|
59
|
+
|
|
60
|
+
r0.2.1
|
|
61
|
+
------
|
|
62
|
+
|
|
63
|
+
* Fixed license to refer to 'Puppet Labs'.
|
|
64
|
+
* Added user documentation to `README.markdown`.
|
|
65
|
+
|
|
66
|
+
r0.2.0
|
|
67
|
+
------
|
|
68
|
+
|
|
69
|
+
* Fixed errors causing tool to add unwanted hyphens to ends of names.
|
|
70
|
+
* Fixed loading of 'puppet' gem conditionally, instead of failing on startup.
|
|
71
|
+
* Fixed startup to create required work directory, instead of failing on startup.
|
|
72
|
+
* Fixed repository to use a default repository URL rather than failing without arguments.
|
|
73
|
+
* Fixed setting of module's full name to ensure a valid name.
|
|
74
|
+
* Fixed generator to refuse to generate a directory with an invalid name.
|
|
75
|
+
* Fixed installer to refuse to install a file with an invalid name.
|
|
76
|
+
* Fixed unpacker to install into directory with the module's full name.
|
|
77
|
+
* Fixed installer to install files from the local filesystem.
|
|
78
|
+
* Fixed lookup of tool's root directory to use correct, simple and reliable mechanism.
|
|
79
|
+
* Fixed problematic 'autoload' calls and reorganized how libraries are loaded.
|
|
80
|
+
* Fixed and expanded README instructions.
|
|
81
|
+
* Disabled actions 'freeze', 'register', 'release' and 'unrelease' to save time, users can use the website for these.
|
|
82
|
+
* Improved cleaner, it can now be called as a library method.
|
|
83
|
+
* Added test suite, brought test code coverage up to 86%.
|
|
84
|
+
* Added documentation to most of application's methods, classes, and lightly refactored.
|
|
85
|
+
* Added libraries and methods to stub and test methods accessing remote resources.
|
|
86
|
+
* Added #tap and #returning methods to clarify code.
|
|
87
|
+
|
|
88
|
+
r0.1.0
|
|
89
|
+
------
|
|
90
|
+
|
|
91
|
+
Initial draft.
|
data/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Copyright (C) 2010 Puppet Labs Inc.
|
|
2
|
+
|
|
3
|
+
Puppet Labs can be contacted at: info@puppetlabs.com
|
|
4
|
+
|
|
5
|
+
This program and entire repository is free software; you can
|
|
6
|
+
redistribute it and/or modify it under the terms of the GNU
|
|
7
|
+
General Public License as published by the Free Software
|
|
8
|
+
Foundation; either version 2 of the License, or any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with this program; if not, write to the Free Software
|
|
17
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
data/README.markdown
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
Puppet Module Tool
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
The Puppet Module Tool, `puppet-module`, creates, installs and searches for
|
|
5
|
+
modules on the Puppet Forge at http://forge.puppetlabs.com
|
|
6
|
+
|
|
7
|
+
Dependencies
|
|
8
|
+
------------
|
|
9
|
+
|
|
10
|
+
To run `puppet-module`, you must have the following installed:
|
|
11
|
+
|
|
12
|
+
* Ruby 1.8.x: http://www.ruby-lang.org/en/downloads/
|
|
13
|
+
* RubyGems 1.3.x: http://rubygems.org/pages/download/
|
|
14
|
+
* Puppet 0.25.x: http://www.puppetlabs.com/
|
|
15
|
+
|
|
16
|
+
Soure code
|
|
17
|
+
----------
|
|
18
|
+
|
|
19
|
+
The source code for this tool is available online at
|
|
20
|
+
http://github.com/puppetlabs/puppet-module-tool
|
|
21
|
+
|
|
22
|
+
You can checkout the source code by installing the `git` distributed version
|
|
23
|
+
control system and running:
|
|
24
|
+
|
|
25
|
+
git clone git://github.com/puppetlabs/puppet-module-tool.git
|
|
26
|
+
|
|
27
|
+
Running
|
|
28
|
+
-------
|
|
29
|
+
|
|
30
|
+
There are a number of ways to run the `puppet-module` program:
|
|
31
|
+
|
|
32
|
+
1. *From a source code checkout:* Checkout the source code and from the checkout
|
|
33
|
+
directory, run:
|
|
34
|
+
|
|
35
|
+
alias puppet-module=$PWD/bin/puppet-module
|
|
36
|
+
|
|
37
|
+
2. *From a locally-built gem:* Checkout the source code and from the checkout
|
|
38
|
+
directory, run:
|
|
39
|
+
|
|
40
|
+
# Build the gem
|
|
41
|
+
rake gem
|
|
42
|
+
# Install the file produced by the above command, e.g.:
|
|
43
|
+
sudo gem install pkg/puppet-module-0.3.0.gem
|
|
44
|
+
|
|
45
|
+
3. *From an official gem:* Install it by running:
|
|
46
|
+
|
|
47
|
+
sudo gem install puppet-module
|
|
48
|
+
|
|
49
|
+
Basics
|
|
50
|
+
------
|
|
51
|
+
|
|
52
|
+
Display the program's built-in help by running:
|
|
53
|
+
|
|
54
|
+
puppet-module help
|
|
55
|
+
|
|
56
|
+
Display information on a specific command by running a command like:
|
|
57
|
+
|
|
58
|
+
puppet-module help install
|
|
59
|
+
|
|
60
|
+
Many commands will use a specific repository if you pass it to the `-r`
|
|
61
|
+
option at the end, like:
|
|
62
|
+
|
|
63
|
+
puppet-module search mymodule -r http://forge.puppetlabs.com/
|
|
64
|
+
|
|
65
|
+
Search for modules
|
|
66
|
+
------------------
|
|
67
|
+
|
|
68
|
+
Searching displays modules on the repository that match your query.
|
|
69
|
+
|
|
70
|
+
For example, search the default repository for modules whose names
|
|
71
|
+
include the substring `mymodule`:
|
|
72
|
+
|
|
73
|
+
puppet-module search mymodule
|
|
74
|
+
|
|
75
|
+
Install a module release
|
|
76
|
+
------------------------
|
|
77
|
+
|
|
78
|
+
Installing a module release from a repository downloads a special
|
|
79
|
+
archive file. This archive is then automatically unpacked into a new
|
|
80
|
+
directory under your current directory. You can then add this *module
|
|
81
|
+
directory* to your Puppet configuration files to use it.
|
|
82
|
+
|
|
83
|
+
For example, install the latest release of the module named `mymodule`
|
|
84
|
+
written by `myuser` from the default repository:
|
|
85
|
+
|
|
86
|
+
puppet-module install myuser-mymodule
|
|
87
|
+
|
|
88
|
+
Or install a specific version:
|
|
89
|
+
|
|
90
|
+
puppet-module install myuser-mymodule --version=0.0.1
|
|
91
|
+
|
|
92
|
+
Generate a module
|
|
93
|
+
-----------------
|
|
94
|
+
|
|
95
|
+
Generating a new module produces a new directory prepopulated with a
|
|
96
|
+
directory structure and files recommended for Puppet best practices.
|
|
97
|
+
|
|
98
|
+
For example, generate a new module:
|
|
99
|
+
|
|
100
|
+
puppet-module generate myuser-mymodule
|
|
101
|
+
|
|
102
|
+
The above command will create a new *module directory* called
|
|
103
|
+
`myuser-mymodule` under your current directory with the generated files.
|
|
104
|
+
|
|
105
|
+
Please read the files in this generated directory for further details.
|
|
106
|
+
|
|
107
|
+
Build a module release
|
|
108
|
+
----------------------
|
|
109
|
+
|
|
110
|
+
Building a module release processes the files in your module directory
|
|
111
|
+
and produces a special archive file that you can share or install.
|
|
112
|
+
|
|
113
|
+
For example, build a module release from within the module directory:
|
|
114
|
+
|
|
115
|
+
puppet-module build
|
|
116
|
+
|
|
117
|
+
The above command will report where it created the module release
|
|
118
|
+
archive file.
|
|
119
|
+
|
|
120
|
+
For example, if this was version `0.0.1` of `myuser-mymodule`, then this
|
|
121
|
+
would have created a `pkg/myuser-mymodule-0.0.1.tar.gz` release file.
|
|
122
|
+
|
|
123
|
+
The build process reads a `Modulefile` in your module directory and uses
|
|
124
|
+
its contents to direct its work.
|
|
125
|
+
|
|
126
|
+
The `Modulefile` is a *Ruby domain-specific language (DSL)*.
|
|
127
|
+
|
|
128
|
+
Here's an example of a `Modulefile`:
|
|
129
|
+
|
|
130
|
+
name 'myuser-mymodule'
|
|
131
|
+
version '0.0.1'
|
|
132
|
+
dependency 'otheruser-othermodule', '1.2.3'
|
|
133
|
+
|
|
134
|
+
The build process reads the `Modulefile` and uses it to build a
|
|
135
|
+
`metadata.json` file. This generated JSON file is included in the module
|
|
136
|
+
release archive so that repositories and installers can extract details
|
|
137
|
+
from your release. Do **not** edit this `metadata.json` file yourself
|
|
138
|
+
because it's clobbered each time during the build process -- you should
|
|
139
|
+
make all your changes to the `Modulefile` instead.
|
|
140
|
+
|
|
141
|
+
All the files in the `pkg` directory of your module directory are
|
|
142
|
+
artifacts of the build process. You can delete them when you're done.
|
|
143
|
+
|
|
144
|
+
Share a module
|
|
145
|
+
--------------
|
|
146
|
+
|
|
147
|
+
Sharing a module release with others helps others avoid reinventing the
|
|
148
|
+
wheel, and encourages them to help with your work by improving it. For
|
|
149
|
+
every module you share, we hope you'll find many modules by others that
|
|
150
|
+
will be useful to you.
|
|
151
|
+
|
|
152
|
+
You can share your modules at http://forge.puppetlabs.com/
|
|
153
|
+
|
|
154
|
+
Building and sharing a new module version
|
|
155
|
+
-----------------------------------------
|
|
156
|
+
|
|
157
|
+
To build and share a new module version:
|
|
158
|
+
|
|
159
|
+
1. Edit the `Modulefile` and increase the `version` number.
|
|
160
|
+
2. Run the `puppet-module build` as explained in the *Build a module release* section.
|
|
161
|
+
3. Upload the new release file as explained in the *Share a module* section.
|
|
162
|
+
|
|
163
|
+
Cleaning the cache
|
|
164
|
+
------------------
|
|
165
|
+
|
|
166
|
+
Modules that you install are saved to a cache within your `~/.puppet`
|
|
167
|
+
directory. This cache can be cleaned out by running:
|
|
168
|
+
|
|
169
|
+
puppet-module clean
|
|
170
|
+
|
|
171
|
+
Deleting a module
|
|
172
|
+
-----------------
|
|
173
|
+
|
|
174
|
+
The tool does not keep track of what modules you have installed. TO delete a
|
|
175
|
+
module just delete the directory the module was extracted into.
|
|
176
|
+
|
|
177
|
+
Get involved
|
|
178
|
+
------------
|
|
179
|
+
|
|
180
|
+
This is new and exciting for us. We have many plans for this and what
|
|
181
|
+
you see now is just the beginning. If you have ideas, please get in
|
|
182
|
+
touch. Puppet Labs can be contacted at: info@puppetlabs.com
|
|
183
|
+
|
|
184
|
+
Technical disclaimer for techies
|
|
185
|
+
--------------------------------
|
|
186
|
+
|
|
187
|
+
This tool downloads untrusted code from the Internet. Please read the
|
|
188
|
+
source code before executing it to avoid surprises. If it breaks, it's
|
|
189
|
+
not our fault -- although we encourage you to contact the authors,
|
|
190
|
+
file a bug report and send patches.
|
|
191
|
+
|
|
192
|
+
Legal disclaimer for lawyers
|
|
193
|
+
----------------------------
|
|
194
|
+
|
|
195
|
+
THE PROGRAM AND MODULES ARE DISTRIBUTED IN THE HOPE THAT THEY WILL BE
|
|
196
|
+
USEFUL, BUT WITHOUT ANY WARRANTY. THEY ARE PROVIDED "AS IS" WITHOUT
|
|
197
|
+
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
|
198
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
199
|
+
PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF
|
|
200
|
+
THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM OR MODULES PROVE DEFECTIVE,
|
|
201
|
+
YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
202
|
+
|
|
203
|
+
IN NO EVENT WILL Puppet Labs Inc. BE LIABLE TO YOU FOR DAMAGES,
|
|
204
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
|
205
|
+
ARISING OUT OF THE USE OR INABILITY TO USE THIS PROGRAM OR MODULES
|
|
206
|
+
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
|
|
207
|
+
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
|
|
208
|
+
THE PROGRAM OR MODULES TO OPERATE WITH ANY OTHER PROGRAMS OR MODULES),
|
|
209
|
+
EVEN IF Puppet Labs Inc. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
210
|
+
DAMAGES.
|
|
211
|
+
|
|
212
|
+
License
|
|
213
|
+
-------
|
|
214
|
+
|
|
215
|
+
This software is distributed under the GNU General Public License
|
|
216
|
+
version 2 or any later version. See the LICENSE file for details.
|
|
217
|
+
|
|
218
|
+
Copyright
|
|
219
|
+
---------
|
|
220
|
+
|
|
221
|
+
Copyright (C) 2010 Puppet Labs Inc.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
require 'rake/gempackagetask'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require 'ftools'
|
|
6
|
+
|
|
7
|
+
# Return filename matching an array of glob patterns, minus any ephemeral files
|
|
8
|
+
# that don't belong in the gem.
|
|
9
|
+
def sanitized_file_list(*args)
|
|
10
|
+
return FileList[*args].reject{|filename| filename =~ /\.(~|swp|tmp)\z/}
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
GEM_FILES = sanitized_file_list [
|
|
14
|
+
'CHANGES.markdown',
|
|
15
|
+
'LICENSE',
|
|
16
|
+
'README.markdown',
|
|
17
|
+
'Rakefile',
|
|
18
|
+
'VERSION',
|
|
19
|
+
'bin/**/*',
|
|
20
|
+
'lib/**/*',
|
|
21
|
+
'templates/**/*',
|
|
22
|
+
'vendor/**/*'
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
gemspec = Gem::Specification.new do |gemspec|
|
|
26
|
+
gemspec.name = 'puppet-module'
|
|
27
|
+
gemspec.files = GEM_FILES.to_a
|
|
28
|
+
gemspec.executables = ['puppet-module']
|
|
29
|
+
gemspec.version = File.read('VERSION')
|
|
30
|
+
gemspec.date = File.new('VERSION').mtime
|
|
31
|
+
gemspec.summary = 'The Puppet Module Tool manages Puppet modules'
|
|
32
|
+
gemspec.description = 'The Puppet Module Tool creates, installs and searches for Puppet modules.'
|
|
33
|
+
gemspec.author = 'Igal Koshevoy'
|
|
34
|
+
gemspec.email = 'igal@pragmaticraft.com'
|
|
35
|
+
gemspec.homepage = 'http://github.com/puppetlabs/puppet-module-tool'
|
|
36
|
+
gemspec.rdoc_options = ['--main', 'README.rdoc']
|
|
37
|
+
gemspec.require_paths = ['lib']
|
|
38
|
+
gemspec.test_files = sanitized_file_list ['spec/**/*']
|
|
39
|
+
gemspec.post_install_message = <<-POST_INSTALL_MESSAGE
|
|
40
|
+
#{'*'*78}
|
|
41
|
+
|
|
42
|
+
Thank you for installing puppet-module from Puppet Labs!
|
|
43
|
+
|
|
44
|
+
* Usage instructions: read "README.markdown" or run `puppet-module usage`
|
|
45
|
+
* Changelog: read "CHANGES.markdown" or run `puppet-module changelog`
|
|
46
|
+
* Puppet Forge: visit http://forge.puppetlabs.com/
|
|
47
|
+
|
|
48
|
+
#{'*'*78}
|
|
49
|
+
POST_INSTALL_MESSAGE
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
Rake::GemPackageTask.new(gemspec) do |pkg|
|
|
53
|
+
pkg.need_zip = true
|
|
54
|
+
pkg.need_tar = true
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
begin
|
|
58
|
+
require 'spec/rake/spectask'
|
|
59
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
|
60
|
+
spec.libs << 'lib' << 'spec'
|
|
61
|
+
spec.spec_files = ['spec/**/*_spec.rb']
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
65
|
+
spec.libs << 'lib' << 'spec'
|
|
66
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
|
67
|
+
spec.rcov = true
|
|
68
|
+
end
|
|
69
|
+
rescue LoadError
|
|
70
|
+
task :spec do
|
|
71
|
+
puts 'ERROR! RSpec not found, install it by running: sudo gem install rspec'
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
task :rcov => :spec
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
task :default => :spec
|
|
78
|
+
|
|
79
|
+
require 'rake/rdoctask'
|
|
80
|
+
Rake::RDocTask.new do |rdoc|
|
|
81
|
+
version = File.read('VERSION')
|
|
82
|
+
|
|
83
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
84
|
+
rdoc.title = "puppet-modules #{version}"
|
|
85
|
+
rdoc.rdoc_files.include('README*')
|
|
86
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
87
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.0
|
data/bin/puppet-module
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Load standard libraries
|
|
2
|
+
require 'pathname'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
# Define tool
|
|
6
|
+
module Puppet
|
|
7
|
+
class Module
|
|
8
|
+
module Tool
|
|
9
|
+
# Default repository URL.
|
|
10
|
+
REPOSITORY_URL = 'http://forge.puppetlabs.com'
|
|
11
|
+
|
|
12
|
+
# Directory names that should not be checksummed.
|
|
13
|
+
ARTIFACTS = ['pkg', /^\./, /^~/, /^#/, 'coverage']
|
|
14
|
+
|
|
15
|
+
# Is this a directory that shouldn't be checksummed?
|
|
16
|
+
#
|
|
17
|
+
# TODO: Should this be part of Checksums?
|
|
18
|
+
# TODO: Rename this method to reflect it's purpose?
|
|
19
|
+
# TODO: Shouldn't this be used when building packages too?
|
|
20
|
+
def self.artifact?(path)
|
|
21
|
+
case File.basename(path)
|
|
22
|
+
when *ARTIFACTS
|
|
23
|
+
true
|
|
24
|
+
else
|
|
25
|
+
false
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Return Pathname for the directory this tool was installed into.
|
|
30
|
+
def self.root
|
|
31
|
+
@root ||= Pathname.new(File.expand_path(File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..')))
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Return the tool's string version.
|
|
35
|
+
def self.version
|
|
36
|
+
@version ||= (root + 'VERSION').read
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Return Pathname for this tool's working directory.
|
|
40
|
+
def self.working_dir
|
|
41
|
+
@working_dir ||= Pathname.new(Puppet.settings[:puppet_module_working_dir])
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Return Repository to fetch data from based on Puppet's config file.
|
|
45
|
+
def self.repository
|
|
46
|
+
@repository ||= Repository.new(Puppet.settings[:puppet_module_repository])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
FULL_NAME_PATTERN = /\A(.+)[\/\-](.+)\z/
|
|
50
|
+
|
|
51
|
+
# Return the +username+ and +modname+ for a given +full_name+, or raise an
|
|
52
|
+
# ArgumentError if the argument isn't parseable.
|
|
53
|
+
def self.username_and_modname_from(full_name)
|
|
54
|
+
if matcher = full_name.match(FULL_NAME_PATTERN)
|
|
55
|
+
return matcher.captures
|
|
56
|
+
else
|
|
57
|
+
raise ArgumentError, "Not a valid full name: #{full_name}"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Return the filename with the usage documenation.
|
|
62
|
+
def self.usage_filename
|
|
63
|
+
return File.expand_path(File.join(self.root, 'README.markdown'))
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Return the filename with the changelog.
|
|
67
|
+
def self.changelog_filename
|
|
68
|
+
return File.expand_path(File.join(self.root, 'CHANGES.markdown'))
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Add vendored code paths to $LOAD_PATH
|
|
75
|
+
Dir[Puppet::Module::Tool.root + 'vendor/*/lib'].each do |path|
|
|
76
|
+
$LOAD_PATH.unshift(path)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Load vendored libraries
|
|
80
|
+
require 'facets/kernel/tap'
|
|
81
|
+
require 'facets/kernel/returning'
|
|
82
|
+
|
|
83
|
+
# Load rubygems, so we can load Puppet and parse version numbers
|
|
84
|
+
require 'rubygems'
|
|
85
|
+
|
|
86
|
+
# Load Puppet
|
|
87
|
+
begin
|
|
88
|
+
minimum_version = Gem::Version.new("0.25.0")
|
|
89
|
+
message = "You must have Puppet #{minimum_version} or greater installed"
|
|
90
|
+
|
|
91
|
+
begin
|
|
92
|
+
require 'puppet'
|
|
93
|
+
rescue LoadError
|
|
94
|
+
abort message
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
begin
|
|
98
|
+
current_version = Gem::Version.new(Puppet.version)
|
|
99
|
+
rescue
|
|
100
|
+
abort "#{message} -- couldn't parse version"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if current_version <= minimum_version
|
|
104
|
+
abort "#{message} -- you're running #{current_version}"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Add support for Puppet's settings file
|
|
109
|
+
require 'puppet/module/tool/utils'
|
|
110
|
+
module Puppet::Module::Tool
|
|
111
|
+
extend Utils::Settings
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Load remaining libraries
|
|
115
|
+
require 'puppet/module/tool/applications'
|
|
116
|
+
require 'puppet/module/tool/cache'
|
|
117
|
+
require 'puppet/module/tool/checksums'
|
|
118
|
+
require 'puppet/module/tool/cli'
|
|
119
|
+
require 'puppet/module/tool/contents_description'
|
|
120
|
+
require 'puppet/module/tool/dependency'
|
|
121
|
+
require 'puppet/module/tool/metadata'
|
|
122
|
+
require 'puppet/module/tool/modulefile'
|
|
123
|
+
require 'puppet/module/tool/repository'
|
|
124
|
+
require 'puppet/module/tool/skeleton'
|