lib/creator.rb in nanoc-1.1 vs lib/creator.rb in nanoc-1.1.1
- old
+ new
@@ -106,12 +106,12 @@
template_meta = nil
template_content_filename = nil
template = a_params[:template] || 'default'
begin
template_meta = File.read("templates/#{template}/meta.yaml")
- template_content_filenames = Dir.glob("templates/#{template}/#{template}.*")
- template_content_filenames += Dir.glob("templates/#{template}/index.*")
+ template_content_filenames = Dir["templates/#{template}/#{template}.*"]
+ template_content_filenames += Dir["templates/#{template}/index.*"]
template_content_filename = template_content_filenames[0]
template_index = File.read(template_content_filename)
rescue
$stderr.puts 'ERROR: no such template' unless $quiet == true
exit
@@ -120,11 +120,11 @@
template_index = template_index.eruby
# Create index and yaml file
FileManager.create_dir 'content' do
FileManager.create_dir a_pagename do
- FileManager.create_file "#{a_pagename}#{File.extname(template_content_filename)}" do
+ FileManager.create_file "#{a_pagename.sub(/.*\/([^\/]+)/, '\1')}#{File.extname(template_content_filename)}" do
template_index
end
FileManager.create_file 'meta.yaml' do
template_meta
end
@@ -149,7 +149,6 @@
end
end
end
end
-
end