lib/nanoc/cli/commands/create-site.rb in nanoc-4.9.3 vs lib/nanoc/cli/commands/create-site.rb in nanoc-4.9.4

- old
+ new

@@ -3,10 +3,11 @@ usage 'create-site [options] path' aliases :create_site, :cs summary 'create a site' description 'Create a new site at the given path. The site will use the `filesystem` data source.' flag nil, :force, 'force creation of new site' +param :path module Nanoc::CLI::Commands class CreateSite < ::Nanoc::CLI::CommandRunner class << self protected @@ -27,11 +28,11 @@ auto_prune: true data_sources: - type: filesystem encoding: utf-8 -EOS + EOS DEFAULT_RULES = <<~EOS unless defined? DEFAULT_RULES #!/usr/bin/env ruby compile '/index.html' do @@ -57,11 +58,11 @@ compile '/**/*' do write item.identifier.to_s end layout '/**/*', :erb -EOS + EOS DEFAULT_ITEM = <<~EOS unless defined? DEFAULT_ITEM --- title: Home --- @@ -74,11 +75,11 @@ <li><p><strong>Change this page’s content</strong> by editing the “index.html” file in the “content” directory. This is the actual page content, and therefore doesn’t include the header, sidebar or style information (those are part of the layout).</p></li> <li><p><strong>Change the layout</strong>, which is the “default.html” file in the “layouts” directory, and create something unique (and hopefully less bland).</p></li> </ul> <p>If you need any help with customizing your Nanoc web site, be sure to check out the documentation (see sidebar), and be sure to subscribe to the discussion group (also see sidebar). Enjoy!</p> -EOS + EOS DEFAULT_STYLESHEET = <<~EOS unless defined? DEFAULT_STYLESHEET * { margin: 0; padding: 0; @@ -178,11 +179,11 @@ #sidebar li { font-size: 14px; line-height: 20px; } -EOS + EOS DEFAULT_LAYOUT = <<~EOS unless defined? DEFAULT_LAYOUT <!DOCTYPE HTML> <html lang="en"> <head> @@ -210,17 +211,13 @@ <li><a href="http://nanoc.ws/contributing/">Contributing</a></li> </ul> </div> </body> </html> -EOS + EOS def run - # Extract arguments - if arguments.length != 1 - raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}" - end - path = arguments[0] + path = arguments[:path] # Check whether site exists if File.exist?(path) && (!File.directory?(path) || !(Dir.entries(path) - %w[. ..]).empty?) && !options[:force] raise( Nanoc::Int::Errors::GenericTrivial,