Class: Gossiper::NotificationTypeGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/gossiper/notification_type/notification_type_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_class_fileObject



4
5
6
7
8
9
10
11
# File 'lib/generators/gossiper/notification_type/notification_type_generator.rb', line 4

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

#create_templateObject



24
25
26
27
28
29
30
31
# File 'lib/generators/gossiper/notification_type/notification_type_generator.rb', line 24

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

#create_test_fileObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/gossiper/notification_type/notification_type_generator.rb', line 13

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

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