Sha256: 716bc1b4b185518780e07152ae5601d64c97e4729f673f6f68550b79b95732fc

Contents?: true

Size: 1.77 KB

Versions: 13

Compression:

Stored size: 1.77 KB

Contents

# require this file to load the tasks
require 'rake'

# Require sitemap_generator at runtime.  If we don't do this the ActionView helpers are included
# before the Rails environment can be loaded by other Rake tasks, which causes problems
# for those tasks when rendering using ActionView.
namespace :sitemap do
  # Require sitemap_generator only.  When installed as a plugin the require will fail, so in
  # that case, load the environment first.
  task :require do
    begin
      require 'sitemap_generator'
    rescue LoadError => e
      if defined?(Rails::VERSION)
        Rake::Task['sitemap:require_environment'].invoke
      else
        raise e
      end
    end
  end

  # Require sitemap_generator after loading the Rails environment.  We still need the require
  # in case we are installed as a gem and are setup to not automatically be required.
  task :require_environment do
    if defined?(Rails::VERSION)
      Rake::Task['environment'].invoke
    end
    require 'sitemap_generator'
  end

  desc "Install a default config/sitemap.rb file"
  task :install => ['sitemap:require'] do
    SitemapGenerator::Utilities.install_sitemap_rb(verbose)
  end

  desc "Delete all Sitemap files in public/ directory"
  task :clean => ['sitemap:require'] do
    SitemapGenerator::Utilities.clean_files
  end

  desc "Generate sitemaps and ping search engines."
  task :refresh => ['sitemap:create'] do
    SitemapGenerator::Sitemap.ping_search_engines
  end

  desc "Generate sitemaps but don't ping search engines."
  task 'refresh:no_ping' => ['sitemap:create']

  desc "Generate sitemaps but don't ping search engines.  Alias for refresh:no_ping."
  task :create => ['sitemap:require_environment'] do
    SitemapGenerator::Interpreter.run(:config_file => ENV["CONFIG_FILE"], :verbose => verbose)
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/sitemap_generator-6.3.0/lib/sitemap_generator/tasks.rb
sitemap_generator-6.3.0 lib/sitemap_generator/tasks.rb
sitemap_generator-6.2.1 lib/sitemap_generator/tasks.rb
sitemap_generator-6.2.0 lib/sitemap_generator/tasks.rb
sitemap_generator-6.1.2 lib/sitemap_generator/tasks.rb
sitemap_generator-6.1.1 lib/sitemap_generator/tasks.rb
sitemap_generator-6.1.0 lib/sitemap_generator/tasks.rb
sitemap_generator-6.0.2 lib/sitemap_generator/tasks.rb
sitemap_generator-6.0.1 lib/sitemap_generator/tasks.rb
sitemap_generator-6.0.0 lib/sitemap_generator/tasks.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sitemap_generator-5.3.1/lib/sitemap_generator/tasks.rb
sitemap_generator-5.3.1 lib/sitemap_generator/tasks.rb
sitemap_generator-5.3.0 lib/sitemap_generator/tasks.rb