lib/nanoc/cli/command_runner.rb in nanoc-4.8.3 vs lib/nanoc/cli/command_runner.rb in nanoc-4.8.4
- old
+ new
@@ -13,31 +13,10 @@
Nanoc::CLI::ErrorHandler.handle_while(command: self) do
run
end
end
- # Gets the site ({Nanoc::Int::Site} instance) in the current directory and
- # loads its data.
- #
- # @return [Nanoc::Int::Site] The site in the current working directory
- def site
- # Load site if possible
- @site ||= nil
- if is_in_site_dir? && @site.nil?
- @site = Nanoc::Int::SiteLoader.new.new_from_cwd
- end
-
- @site
- end
-
- # For debugging purposes.
- #
- # @api private
- def site=(new_site)
- @site = new_site
- end
-
# @return [Boolean] true if the current working directory is a Nanoc site
# directory, false otherwise
def in_site_dir?
Nanoc::Int::SiteLoader.cwd_is_nanoc_site?
end
@@ -75,14 +54,18 @@
self.class.enter_site_dir
$stderr.print 'Loading siteā¦ '
$stderr.flush
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
+
if preprocess
site.compiler.action_provider.preprocess(site)
end
$stderr.puts 'done'
+
+ site
end
# @return [Boolean] true if debug output is enabled, false if not
#
# @see Nanoc::CLI.debug?