# encoding: utf-8 usage 'create_site [options] path' aliases 'cs' summary 'create a site' description <<-EOS Create a new site at the given path. The site will use the filesystem_unified data source by default, but this can be changed using the --datasource commandline option. EOS required :d, :datasource, 'specify the data source for the new site' run do |opts, args, cmd| Nanoc3::CLI::Commands::CreateSite.call(opts, args, cmd) end module Nanoc3::CLI::Commands class CreateSite < ::Nanoc3::CLI::Command class << self protected # Converts the given array to YAML format def array_to_yaml(array) '[ ' + array.map { |s| "'" + s + "'" }.join(', ') + ' ]' end end DEFAULT_CONFIG = <A Brand New nanoc Site

You’ve just created a new nanoc site. The page you are looking at right now is the home page for your site. To get started, consider replacing this default homepage with your own customized homepage. Some pointers on how to do so:

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!

EOS DEFAULT_STYLESHEET = < A Brand New nanoc Site - <%= @item[:title] %>
<%= yield %>
EOS DEFAULT_RAKEFILE = < "Home" }, '/' ) # Create stylesheet data_source.create_item( DEFAULT_STYLESHEET.make_compatible_with_env, {}, '/stylesheet/', :extension => '.css' ) # Create layout data_source.create_layout( DEFAULT_LAYOUT.make_compatible_with_env, {}, '/default/' ) # Create code FileUtils.mkdir_p('lib') File.open('lib/default.rb', 'w') do |io| io.write "\# All files in the 'lib' directory will be loaded\n" io.write "\# before nanoc starts compiling.\n" end end end end