Sha256: b63b3ccba06788e176d3f2765d0f71a39f451b1766bd4935e9f96a853535d054

Contents?: true

Size: 827 Bytes

Versions: 15

Compression:

Stored size: 827 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'

module NotificationRenderer

    class TypeGenerator < Rails::Generators::Base

        source_root File.join File.dirname(__FILE__), '../templates/type'
        desc 'Create a new notification type'
        class_option :type, desc: 'Specify the notification type', type: :string, default: NotificationRenderer.configuration.default_type, aliases: '-t'
        class_option :renderers, desc: 'Specify the renderer templates', type: :string, default: NotificationRenderer.configuration.default_renderer, aliases: '-r'

        def create_templates
            options[:renderers].split(' ')&.each do |template|
                template '_template.html', "app/views/notifications/#{options[:type]}/_#{template}.html.erb"
            end
        end

    end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
notification-renderer-1.2.5 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.2.4 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.2.3 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.2.2 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.2.1 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.2.0 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.1.2 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.1.1 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.1.0 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.0.0 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.0.0.beta11 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.0.0.beta10 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.0.0.beta9 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.0.0.beta8 lib/generators/notification_renderer/type_generator.rb
notification-renderer-1.0.0.beta7 lib/generators/notification_renderer/type_generator.rb