Sha256: cea7648bb36d9c256be866360fb662382005d4e5af7a70c6b833ea183ecfd552

Contents?: true

Size: 844 Bytes

Versions: 10

Compression:

Stored size: 844 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'
        Bundler.with_clean_env { run 'bundle install' }
      end

      def init_sitemap
        Bundler.with_clean_env { run 'bundle exec rake sitemap:install' }
      end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bankai-0.8.1 lib/bankai/generators/sitemap_generator.rb
bankai-0.8.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.7.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.6.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.5.1 lib/bankai/generators/sitemap_generator.rb
bankai-0.5.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.4.1 lib/bankai/generators/sitemap_generator.rb
bankai-0.4.0 lib/bankai/generators/sitemap_generator.rb
bankai-0.3.1 lib/bankai/generators/sitemap_generator.rb
bankai-0.3.0 lib/bankai/generators/sitemap_generator.rb