Permalink
Browse files

#3860: Tool should be renamed to 'puppet-module'.

  • Loading branch information...
igal committed May 27, 2010
1 parent 4174a1d commit 0ddf987c98fff45e49bd79322b01c169abd7b233
View
@@ -1,10 +1,17 @@
-puppet-module-tool changes
-==========================
+puppet-module changes
+=====================
+
+r0.3.0
+------
+
+* Renamed CLI tool and gem to `puppet-module`. Please run `gem uninstall pmt` to get rid of old versions of the program.
+* Added 'usage' action to display the usage information for this tool.
+* Added 'changelog' action to display the changelog for this tool.
r0.2.9
------
-* Fixed `pmt generate` files and directories to follow Puppet best-practices.
+* Fixed 'generate' action to create files and directories that follow Puppet best-practices.
r0.2.8
------
View
@@ -1,13 +1,13 @@
Puppet Module Tool
==================
-The Puppet Module Tool, `pmt`, helps you author, publish, and manage
-Puppet modules.
+The Puppet Module Tool, `puppet-module`, creates, installs and searches for
+modules on the Puppet Forge at http://forge.puppetlabs.com
Dependencies
------------
-To run `pmt`, you must have the following installed:
+To run `puppet-module`, you must have the following installed:
* Ruby 1.8.x: http://www.ruby-lang.org/en/downloads/
* RubyGems 1.3.x: http://rubygems.org/pages/download/
@@ -27,41 +27,40 @@ control system and running:
Running
-------
-There are a number of ways to run the `pmt` program:
+There are a number of ways to run the `puppet-module` program:
1. *From a source code checkout:* Checkout the source code and from the checkout
directory, run:
- alias pmt=$PWD/bin/pmt
+ alias puppet-module=$PWD/bin/puppet-module
2. *From a locally-built gem:* Checkout the source code and from the checkout
directory, run:
# Build the gem
rake gem
# Install the file produced by the above command, e.g.:
- sudo gem install pkg/pmt-0.2.4.gem
+ sudo gem install pkg/puppet-module-0.3.0.gem
3. *From an official gem:* Install it by running:
- # FIXME: THIS DOES NOT WORK, WE HAVEN'T PUBLISHED THE GEM YET!
- sudo gem install pmt
+ sudo gem install puppet-module
Basics
------
Display the program's built-in help by running:
- pmt help
+ puppet-module help
Display information on a specific command by running a command like:
- pmt help install
+ puppet-module help install
Many commands will use a specific repository if you pass it to the `-r`
option at the end, like:
- pmt search mymodule -r http://forge.puppetlabs.com/
+ puppet-module search mymodule -r http://forge.puppetlabs.com/
Search for modules
------------------
@@ -71,7 +70,7 @@ Searching displays modules on the repository that match your query.
For example, search the default repository for modules whose names
include the substring `mymodule`:
- pmt search mymodule
+ puppet-module search mymodule
Install a module release
------------------------
@@ -84,11 +83,11 @@ directory* to your Puppet configuration files to use it.
For example, install the latest release of the module named `mymodule`
written by `myuser` from the default repository:
- pmt install myuser-mymodule
+ puppet-module install myuser-mymodule
Or install a specific version:
- pmt install myuser-mymodule --version=0.0.1
+ puppet-module install myuser-mymodule --version=0.0.1
Generate a module
-----------------
@@ -98,7 +97,7 @@ directory structure and files recommended for Puppet best practices.
For example, generate a new module:
- pmt generate myuser-mymodule
+ puppet-module generate myuser-mymodule
The above command will create a new *module directory* called
`myuser-mymodule` under your current directory with the generated files.
@@ -113,7 +112,7 @@ and produces a special archive file that you can share or install.
For example, build a module release from within the module directory:
- pmt build
+ puppet-module build
The above command will report where it created the module release
archive file.
@@ -150,16 +149,15 @@ wheel, and encourages them to help with your work by improving it. For
every module you share, we hope you'll find many modules by others that
will be useful to you.
-You can share your modules at
-[http://forge.puppetlabs.com/](http://forge.puppetlabs.com/)
+You can share your modules at http://forge.puppetlabs.com/
Building and sharing a new module version
-----------------------------------------
To build and share a new module version:
1. Edit the `Modulefile` and increase the `version` number.
-2. Run the `pmt build` as explained in the *Build a module release* section.
+2. Run the `puppet-module build` as explained in the *Build a module release* section.
3. Upload the new release file as explained in the *Share a module* section.
Cleaning the cache
@@ -168,7 +166,7 @@ Cleaning the cache
Modules that you install are saved to a cache within your `~/.puppet`
directory. This cache can be cleaned out by running:
- pmt clean
+ puppet-module clean
Deleting a module
-----------------
View
@@ -4,29 +4,52 @@ require 'rake/gempackagetask'
require 'fileutils'
require 'ftools'
-GEM_FILES = FileList[
- '[A-Z]*',
+# Return filename matching an array of glob patterns, minus any ephemeral files
+# that don't belong in the gem.
+def sanitized_file_list(*args)
+ return FileList[*args].reject{|filename| filename =~ /\.(~|swp|tmp)\z/}
+end
+
+GEM_FILES = sanitized_file_list [
+ 'CHANGES.markdown',
+ 'LICENSE',
+ 'README.markdown',
+ 'Rakefile',
+ 'VERSION',
'bin/**/*',
'lib/**/*',
'templates/**/*',
'vendor/**/*'
]
-spec = Gem::Specification.new do |spec|
- spec.name = 'pmt'
- spec.files = GEM_FILES.to_a
- spec.executables = 'pmt'
- spec.version = File.read('VERSION')
- spec.summary = 'The Puppet Module Tool manages modules in the Puppet Forge'
- spec.description = 'The Puppet Module Tool can adds, delete and manage modules in the Puppet Forge.'
- spec.author = 'Igal Koshevoy'
- spec.email = 'igal@pragmaticraft.com'
- spec.homepage = 'http://github.com/reductivelabs/puppet-module-tool'
- spec.rdoc_options = ["--main", "README.rdoc"]
- spec.require_paths = ["lib"]
+gemspec = Gem::Specification.new do |gemspec|
+ gemspec.name = 'puppet-module'
+ gemspec.files = GEM_FILES.to_a
+ gemspec.executables = ['puppet-module']
+ gemspec.version = File.read('VERSION')
+ gemspec.date = File.new('VERSION').mtime
+ gemspec.summary = 'The Puppet Module Tool manages Puppet modules'
+ gemspec.description = 'The Puppet Module Tool creates, installs and searches for Puppet modules.'
+ gemspec.author = 'Igal Koshevoy'
+ gemspec.email = 'igal@pragmaticraft.com'
+ gemspec.homepage = 'http://github.com/puppetlabs/puppet-module-tool'
+ gemspec.rdoc_options = ['--main', 'README.rdoc']
+ gemspec.require_paths = ['lib']
+ gemspec.test_files = sanitized_file_list ['spec/**/*']
+ gemspec.post_install_message = <<-POST_INSTALL_MESSAGE
+#{'*'*78}
+
+ Thank you for installing puppet-module from Puppet Labs!
+
+ * Usage instructions: read "README.markdown" or run `puppet-module usage`
+ * Changelog: read "CHANGES.markdown" or run `puppet-module changelog`
+ * Puppet Forge: visit http://forge.puppetlabs.com/
+
+#{'*'*78}
+ POST_INSTALL_MESSAGE
end
-Rake::GemPackageTask.new(spec) do |pkg|
+Rake::GemPackageTask.new(gemspec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
@@ -35,7 +58,7 @@ begin
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:spec) do |spec|
spec.libs << 'lib' << 'spec'
- spec.spec_files = FileList['spec/**/*_spec.rb']
+ spec.spec_files = ['spec/**/*_spec.rb']
end
Spec::Rake::SpecTask.new(:rcov) do |spec|
@@ -45,7 +68,7 @@ begin
end
rescue LoadError
task :spec do
- puts "ERROR! RSpec not found, install it by running: sudo gem install rspec"
+ puts 'ERROR! RSpec not found, install it by running: sudo gem install rspec'
end
task :rcov => :spec
@@ -55,7 +78,7 @@ task :default => :spec
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
+ version = File.read('VERSION')
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "puppet-modules #{version}"
View
@@ -1 +1 @@
-0.2.9
+0.3.0
File renamed without changes.
View
@@ -37,13 +37,13 @@ def self.version
end
# Return Pathname for this tool's working directory.
- def self.pmtdir
- @pmtdir ||= Pathname.new(Puppet.settings[:pmtdir])
+ def self.working_dir
+ @working_dir ||= Pathname.new(Puppet.settings[:puppet_module_working_dir])
end
# Return Repository to fetch data from based on Puppet's config file.
def self.repository
- @repository ||= Repository.new(Puppet.settings[:modulerepository])
+ @repository ||= Repository.new(Puppet.settings[:puppet_module_repository])
end
FULL_NAME_PATTERN = /\A(.+)[\/\-](.+)\z/
@@ -57,6 +57,16 @@ def self.username_and_modname_from(full_name)
raise ArgumentError, "Not a valid full name: #{full_name}"
end
end
+
+ # Return the filename with the usage documenation.
+ def self.usage_filename
+ return File.expand_path(File.join(self.root, 'README.markdown'))
+ end
+
+ # Return the filename with the changelog.
+ def self.changelog_filename
+ return File.expand_path(File.join(self.root, 'CHANGES.markdown'))
+ end
end
end
end
@@ -18,7 +18,7 @@ def initialize(options = {})
end
def repository
- @repository ||= Repository.new(Puppet.settings[:modulerepository])
+ @repository ||= Repository.new(Puppet.settings[:puppet_module_repository])
end
def run
@@ -22,7 +22,7 @@ def run
gzip
relative = Pathname.new(File.join(@pkg_path, filename('tar.gz'))).relative_path_from(Pathname.new(Dir.pwd))
# TODO Implement "release" feature.
- ### say "Done. Now you probably want to:\n $ pmt release #{relative}"
+ ### say "Done. Now you probably want to:\n $ puppet-module release #{relative}"
say "Done. Built: #{relative}"
end
@@ -43,7 +43,7 @@ def path
# Return the base Pathname for all the caches.
def self.base_path
- return(Puppet::Module::Tool.pmtdir + 'cache')
+ return(Puppet::Module::Tool.working_dir + 'cache')
end
# Clean out all the caches.
@@ -6,7 +6,7 @@
# = CLI
#
-# This class is used by the `bin/pmt` program to dispatch actions.
+# This class is used by the command-line program to dispatch actions.
class Puppet::Module::Tool::CLI < Thor
include Thor::Actions
@@ -15,7 +15,7 @@ class Puppet::Module::Tool::CLI < Thor
class_option :config, :aliases => '-c', :default => Puppet.settings[:config], :desc => "Configuration file"
def self.method_option_repository
- method_option :modulerepository, :aliases => '-r', :default => Puppet.settings[:modulerepository], :desc => "Module repository to use"
+ method_option :puppet_module_repository, :aliases => '-r', :default => Puppet.settings[:puppet_module_repository], :desc => "Module repository to use"
end
desc "version", "Show the version information for this tool"
@@ -90,7 +90,27 @@ def changes(path = nil)
desc "repository", "Show currently configured repository"
def repository
Puppet::Module::Tool.prepare_settings(options)
- say Puppet.settings[:modulerepository]
+ say Puppet.settings[:puppet_module_repository]
+ end
+
+ desc "usage", "Display detailed usage documentation for this tool"
+ def usage
+ Puppet::Module::Tool.prepare_settings(options)
+ if ENV['PAGER']
+ exec ENV['PAGER'], Puppet::Module::Tool.usage_filename
+ else
+ puts File.read(Puppet::Module::Tool.usage_filename)
+ end
+ end
+
+ desc "changelog", "Display the changelog for this tool"
+ def changelog
+ Puppet::Module::Tool.prepare_settings(options)
+ if ENV['PAGER']
+ exec ENV['PAGER'], Puppet::Module::Tool.changelog_filename
+ else
+ puts File.read(Puppet::Module::Tool.changelog_filename)
+ end
end
no_tasks do
@@ -26,7 +26,7 @@ def paths
# Return Pathname of custom templates directory.
def custom_path
- Puppet::Module::Tool.pmtdir + 'skeleton'
+ Puppet::Module::Tool.working_dir + 'skeleton'
end
# Return Pathname of default template directory.
@@ -12,18 +12,17 @@ def prepare_settings(options = {})
Puppet.settings.send(:set_value, :config, options[:config], :cli)
end
- Puppet.setdefaults(:pmt,
- :modulerepository => [Puppet::Module::Tool::REPOSITORY_URL, "The module repository"],
- :pmtdir => ['$vardir/pmt', "The directory in which module tool data is stored"])
+ Puppet.setdefaults(:puppet_module,
+ :puppet_module_repository => [Puppet::Module::Tool::REPOSITORY_URL, "The module repository"],
+ :puppet_module_working_dir => ['$vardir/puppet-module', "The directory in which module tool data is stored"])
- # Create directory for pmt's use inside ~/.puppet
- Puppet::Module::Tool.pmtdir.mkpath
+ Puppet::Module::Tool.working_dir.mkpath
- Puppet.settings.use(:pmt)
+ Puppet.settings.use(:puppet_module)
Puppet.settings.parse
- [:modulerepository].each do |key|
+ [:puppet_module_repository].each do |key|
if options[key]
Puppet.settings.send(:set_value, key, options[key], :cli)
end
Oops, something went wrong.

0 comments on commit 0ddf987

Please sign in to comment.