5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/generators/bushido/mail_routes_generator.rb', line 5
def create_mail_routes_file
Dir.mkdir("#{Rails.root}/lib/bushido") if not Dir.exists? "#{Rails.root}/lib/bushido"
lib "bushido/mail_routes.rb" do
"::Bushido::Mailroute.map do |m|\n\n m.route(\"simple\") do\n m.subject(\"hello\")\n end\n\nend\n EOF\n end\n\n lib(\"bushido/hooks/email_hooks.rb\") do\n <<-EOF\nclass BushidoEmailHooks < Bushido::EventObserver\n\n def mail_simple\n puts \"YAY!\"\n puts params.inspect\n end\n\nend\n EOF\n end\n \n initializer \"bushido_hooks.rb\" do\n <<-EOF\nDir[\"\\\#{Dir.pwd}/lib/bushido/**/*.rb\"].each { |file| require file }\n EOF\n end\n \n initializer(\"bushido_mail_routes.rb\", \"require './lib/bushido/mail_routes.rb'\")\n\nend\n"
|