lib/puppetry/cli.rb in puppetry_toolbox-0.0.5 vs lib/puppetry/cli.rb in puppetry_toolbox-0.0.6.rc1
- old
+ new
@@ -9,19 +9,36 @@
desc "version", "Print application's version"
def version
output.puts "Puppetry v#{Puppetry::Version}"
end
- desc "new NAME", "Create a new module called NAME"
+ desc "new DEST", "Create a new module in DEST"
+ long_desc <<-EOS
+ `puppetry new DEST` will initialize a new module in the DEST directory.
+
+ The name of the module is calculated from the basename of DEST (i.e. the
+ latest segment of the path), so all the following will create a module
+ named `apache`:
+ > puppetry new apache
+ > puppetry new ~/code/puppet/apache
+ EOS
def new(name)
repo = Grit::Repo.init(name)
repo.remote_add 'skeleton', 'https://github.com/stefanozanella/puppet-skeleton'
FileUtils.cd name do
# No support for push/pull in Grit?
`git pull skeleton master`
Bundler.with_clean_env do
system "bundle install --path vendor/bundle"
+ end
+
+ spec_module_dir = File.join("spec", "fixtures", "modules", File.basename(name))
+ FileUtils.mkdir spec_module_dir
+ FileUtils.cd spec_module_dir do
+ ["manifests", "lib", "templates", "files"].each do |dir|
+ File.symlink File.join(*Array.new(4, '..'), dir), dir
+ end
end
end
end
no_commands do