Sha256: 781b7ff03f6f47bf7e4f86cdf5d2414cd6450223c313bcd980757f4c3c2896e0

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

require 'rails/generators'

module Hancock::Seo
  class SitemapGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
    argument :host_arg, type: :string

    desc 'Hancock::Seo Sitemap config generator'
    def sitemap
      template 'sitemap.erb', "config/sitemap.rb"
    end

    def host
      _host = host_arg.blank? ? "http://host.domain" : host_arg
      if defined?(Addressable)
        Addressable::URI.heuristic_parse(_host).to_s
      else
        if _host =~ /^https?\:\/\//
          _host
        else
          _host = "http://#{_host}"
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hancock_cms_seo-1.0.2 lib/generators/hancock/seo/sitemap/sitemap_generator.rb