Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bushido:mail_routes creates email hooks file and an initializer to lo…

…ad it

Signed-off-by: Akash Manohar J <akash@akash.im>
  • Loading branch information...
commit 8ae71783f70359a15e1a7e8ea9ffd108a5c127f2 1 parent 9045c86
@HashNuke HashNuke authored
Showing with 20 additions and 3 deletions.
  1. +20 −3 lib/generators/bushido/mail_routes_generator.rb
View
23 lib/generators/bushido/mail_routes_generator.rb
@@ -6,7 +6,6 @@ def create_mail_routes_file
# Create the lib/bushido directory if it doesnt exist
Dir.mkdir("#{Rails.root}/lib/bushido") if not Dir.exists? "#{Rails.root}/lib/bushido"
- # Create the mail routes file
lib "bushido/mail_routes.rb" do
<<-EOF
::Bushido::Mailroute.map do |m|
@@ -18,11 +17,29 @@ def create_mail_routes_file
end
EOF
end
+
+ lib("bushido/hooks/email_hooks.rb") do
+ <<-EOF
+class BushidoEmailHooks < Bushido::EventObserver
+
+ def mail_simple
+ puts "YAY!"
+ puts params.inspect
+ end
+
+end
+ EOF
+ end
+
+ initializer "bushido_hooks.rb" do
+ <<-EOF
+Dir["\#{Dir.pwd}/lib/bushido/**/*.rb"].each { |file| require file }
+ EOF
+ end
- # Create the initializer required to load the mail routes file
initializer("bushido_mail_routes.rb", "require './lib/bushido/mail_routes.rb'")
- end
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.