Class: Middleman::Cli::Sitemap

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/middleman-sitemap/commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/middleman-sitemap/commands.rb', line 17

def self.exit_on_failure?
  true
end

.source_rootObject



13
14
15
# File 'lib/middleman-sitemap/commands.rb', line 13

def self.source_root
  ENV['MM_ROOT']
end

Instance Method Details

#buildObject



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/middleman-sitemap/commands.rb', line 29

def build
  shared_instance = ::Middleman::Application.server.inst

  if shared_instance.respond_to? :sitemap
    # Override options based on what was passed on the command line
    shared_instance.options.gzip = options[:gzip] if options[:gzip]
    shared_instance.options.hostname = options[:hostname] if options[:hostname]

    shared_instance.generate_sitemap
  else
    raise Thor::Error.new "You need to activate the sitemap extension in config.rb"
  end
end