lib/zine/cli.rb in zine-0.14.0 vs lib/zine/cli.rb in zine-0.15.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'thor' require 'rainbow' require 'time' require 'yaml' require 'zine' @@ -14,10 +16,14 @@ no_commands do def init_site @the_site ||= Zine::Site.new end + + def options + @the_site.options + end end desc 'build', 'Build the site' def build # set_trace_func proc { |event, file, line, id, _binding, classname| @@ -45,19 +51,18 @@ end desc 'nuke', 'Delete the build folder' def nuke init_site - FileUtils.remove_dir @the_site.options['directories']['build'], + FileUtils.remove_dir options['directories']['build'], force: true puts Rainbow('Site nuked. It\'s the only way to be sure.').green end desc 'post TITLE', 'Create the file for a new blog post, titled TITLE' def post(name) init_site - options = @the_site.options option_dir = options['directories'] Zine::CLI.source_root option_dir['templates'] @date = DateTime.now @name = name file = "#{@date.strftime('%Y-%m-%d')}-#{Zine::Page.slug(name)}.md" @@ -75,10 +80,10 @@ end desc 'style', 'Build the site\'s stylesheet' def style init_site - style = Zine::Style.new(@the_site.options['directories']) + style = Zine::Style.new(options['directories']) style.process(File) puts Rainbow('Stylesheet rendered').green end desc 'version', 'Show the version number'