lib/chef/knife/cookbook_create_extension.rb in knife-skeleton-0.5.0 vs lib/chef/knife/cookbook_create_extension.rb in knife-skeleton-0.5.1
- old
+ new
@@ -13,40 +13,40 @@
short: '-o PATH',
long: '--cookbook-path PATH',
description: <<-eos
The directory where the cookbook will be created
eos
- )
+ )
option(:readme_format,
short: '-r FORMAT',
long: '--readme-format FORMAT',
description: <<-eos
Format of the README file, supported formats are 'md', 'rdoc' and 'txt'
eos
- )
+ )
option(:cookbook_license,
short: '-I LICENSE',
long: '--license LICENSE',
description: <<-eos
License apachev2, gplv2, gplv3, mit or none
eos
- )
+ )
option(:cookbook_copyright,
short: '-C COPYRIGHT',
long: '--copyright COPYRIGHT',
description: <<-eos
Name of Copyright holder
eos
- )
+ )
option(:cookbook_email,
short: '-m EMAIL',
long: '--email EMAIL',
description: <<-eos
Email address of cookbook maintainer
eos
- )
+ )
# Public: Knife skeleton create runner
#
# @return [Void]
#
@@ -74,14 +74,12 @@
license: cookbook_license,
license_name: cookbook_license_name,
readme_format: cookbook_readme_format
}
- create_cookbook_directories(
- params[:cookbook_path],
- params[:cookbook_name]
- )
+ create_cookbook_directories(params[:cookbook_path],
+ params[:cookbook_name])
create_cookbook_files(params[:cookbook_path], params[:cookbook_name])
create_cookbook_templates(params)
end
# Public: Retrieve license name
@@ -137,12 +135,11 @@
resources
spec
files/default
templates/default
test/integration/default/serverspec).each do |dir|
- FileUtils.mkdir_p(File.join(
- cookbook_path,
+ FileUtils.mkdir_p(File.join(cookbook_path,
cookbook_name,
dir))
end
end
@@ -157,11 +154,11 @@
#
def create_cookbook_templates(params)
params[:license_content] = File.read(File.join(files_directory,
'licenses',
params[:license])
- ) if params[:license] != 'none'
+ ) if params[:license] != 'none'
params[:license_content] = '' unless params[:license] != 'none'
%W(
metadata.rb
@@ -222,12 +219,11 @@
if File.exist?(dst)
ui.warn("'#{file_name}' already exists")
else
ui.msg("** Create '#{file_name}'")
FileUtils.cp(File
- .join(
- files_directory,
+ .join(files_directory,
file_name.gsub(/^\./, '')),
dst)
end
end
@@ -250,11 +246,10 @@
ui.warn("'#{file_name}' already exists")
else
ui.msg("** Create '#{file_name}'")
File.open(dst, 'w+') do |file|
file.write(KnifeSkeleton::Template
- .render(File.read(File.join(
- templates_directory,
+ .render(File.read(File.join(templates_directory,
file_name + '.erb')),
params))
end
end
end