lib/nanoc/cli/command_runner.rb in nanoc-3.3.7 vs lib/nanoc/cli/command_runner.rb in nanoc-3.4.0

- old
+ new

@@ -21,16 +21,11 @@ # @return [Nanoc::Site] The site in the current working directory def site # Load site if possible @site ||= nil if File.file?('config.yaml') && @site.nil? - begin - @site = Nanoc::Site.new('.') - rescue Nanoc::Errors::UnknownDataSource => e - $stderr.puts "Unknown data source: #{e}" - exit 1 - end + @site = Nanoc::Site.new('.') end @site end @@ -55,13 +50,11 @@ # message and exits. # # @return [void] def require_site if site.nil? - $stderr.puts 'The current working directory does not seem to be a ' + - 'valid/complete nanoc site directory; aborting.' - exit 1 + raise ::Nanoc::Errors::GenericTrivial, "The current working directory does not seem to be a nanoc site." end end # Sets the data source's VCS to the VCS with the given name. Does nothing # when the site's data source does not support VCSes (i.e. does not @@ -75,11 +68,10 @@ return if vcs_name.nil? || site.nil? # Find VCS vcs_class = Nanoc::Extra::VCS.named(vcs_name.to_sym) if vcs_class.nil? - $stderr.puts "A VCS named #{vcs_name} was not found; aborting." - exit 1 + raise Nanoc::Errors::GenericTrivial, "A VCS named #{vcs_name} was not found" end site.data_sources.each do |data_source| # Skip if not possible next if !data_source.respond_to?(:vcs=)