Sha256: a5d622457caa59c419d2ea4a576448538c5829f07d271cb9758218e9e837e29d

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

require 'rails/generators/erb/mailer/mailer_generator'
require 'generators/goma/helpers/mailer_helpers'

module Goma
  module Generators
    module Mailer
      class ErbGenerator < ::Erb::Generators::MailerGenerator
        hide!
        include MailerHelpers
        source_root File.expand_path('../templates', __FILE__)

        class_option :resource_name

        def copy_goma_view_files
          base_path = File.join("app/views", class_path, file_name)

          goma_actions.each do |action, _|
            @action = action
            formats.each do |format|
              @path = File.join(base_path, filename_with_extensions(action, format))
              template filename_with_extensions(action, format), @path
            end
          end
        end

      protected
        if Rails.version < "4.1"
          def formats
            [format]
          end

          def filename_with_extensions(name, format=self.format)
            [name, format, handler].compact.join(".")
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
goma-0.0.1.rc3 lib/generators/goma/mailer/erb/erb_generator.rb
goma-0.0.1.rc2 lib/generators/goma/mailer/erb/erb_generator.rb
goma-0.0.1.rc1 lib/generators/goma/mailer/erb/erb_generator.rb
goma-0.0.1.gamma lib/generators/goma/mailer/erb/erb_generator.rb
goma-0.0.1.beta lib/generators/goma/mailer/erb/erb_generator.rb