Sha256: a14ff59ef5be849a35ca76e8a607f9d37db8f34cd7ab293563818e7d6fd9b82f

Contents?: true

Size: 905 Bytes

Versions: 3

Compression:

Stored size: 905 Bytes

Contents

class Gossiper::NotificationTypeGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('../templates', __FILE__)

  def create_class_file
    template 'notification_type.rb', File.join(
      Gossiper.configuration.notifications_root_folder.to_s,
      'notifications',
      class_path,
      "#{singular_name}_notification.rb"
    )
  end

  def create_test_file
    test_sufix = defined?(RSpec) ? 'spec' : 'test'

    template 'notification_type_test.rb', File.join(
      Gossiper.configuration.notifications_test_folder.to_s,
      'notifications',
      class_path,
      "#{singular_name}_notification_#{test_sufix}.rb"
    )
  end

  def create_template
    template 'notification_type_template.rb', File.join(
      Gossiper.configuration.notifications_template_folder.to_s,
      'notifications',
      class_path,
      "#{singular_name}_notification.html.erb"
    )
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gossiper-0.3.2 lib/generators/gossiper/notification_type/notification_type_generator.rb
gossiper-0.3.1 lib/generators/gossiper/notification_type/notification_type_generator.rb
gossiper-0.3.0 lib/generators/gossiper/notification_type/notification_type_generator.rb