Sha256: 551f12306401b47fb44b10dd56bfce7feb044e3608b5910ff0113dac1a584d62

Contents?: true

Size: 797 Bytes

Versions: 8

Compression:

Stored size: 797 Bytes

Contents

# frozen_string_literal: true

require_relative 'base'

module Bankai
  module Generators
    HOST_TEMPLATE = <<-RUBY

      if Rails.env.production?
        "https://\#{ENV['APPLICATION_HOST']}"
      else
        "http://\#{ENV['APPLICATION_HOST']}"
      end
    RUBY

    # :nodoc:
    class SitemapGenerator < Base
      def add_sitemap_generator
        gem 'sitemap_generator'
        in_root { run 'bundle install' }
      end

      def init_sitemap
        in_root { run 'bundle exec rake sitemap:install' }
      end

      def generate_sitmap_config
        gsub_file 'config/sitemap.rb',
                  %r{"http://www.example.com"},
                  HOST_TEMPLATE
        in_root do
          run 'bundle exec rubocop -a config/sitemap.rb'
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bankai-0.13.1 lib/bankai/generators/sitemap_generator.rb
bankai-0.13.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.12.1 lib/bankai/generators/sitemap_generator.rb
bankai-0.12.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.11.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.10.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.9.1 lib/bankai/generators/sitemap_generator.rb
bankai-0.9.0 lib/bankai/generators/sitemap_generator.rb