Sha256: 08ef17afe40bc4753b8300f264e13e664abbfdf6793a2b318c50f691bd843c74

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators/migration'

module SeoOptimizer
  class MetaTagsGenerator < Rails::Generators::Base
    source_root File.expand_path('templates', __dir__)
    desc 'Generates meta tags'

    def add_meta_tags
      inject_into_file 'app/views/layouts/application.html.erb', after: '<head>' do
        File.open("#{File.expand_path('templates', __dir__)}/meta_tags.erb").read
      end
      template 'meta_tags_helper.erb', File.join('app/helpers', 'meta_tags_helper.rb')
      template 'default_meta.erb', File.join('config/initializers', 'default_meta.rb')
      template 'meta_yml.erb', File.join('config', 'meta.yml')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seo_optimizer-0.1.2 lib/generators/seo_optimizer/meta_tags/meta_tags_generator.rb
seo_optimizer-0.1.1 lib/generators/seo_optimizer/meta_tags/meta_tags_generator.rb