Skip to content

Commit

Permalink
rename and build
Browse files Browse the repository at this point in the history
  • Loading branch information
tteng committed May 9, 2013
1 parent 3471892 commit 1004286
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 72 deletions.
8 changes: 4 additions & 4 deletions README.rdoc
@@ -1,5 +1,5 @@
= event_machine
With event machine, you can keep an eye on any action on your rails controller, say in your sns website, when user posts a blog, you need to notice all of his friends, but it's really urgly to do like this:
= enhanced_hooks
With enhanced hooks, you can keep an eye on any action on your rails controller, say in your sns website, when user posts a blog, you need to notice all of his friends, but it's really urgly to do like this:

BlogController:
def create
Expand All @@ -15,11 +15,11 @@ Usage:

in your Gemfile:

gem "event_machine", :version => ">=0.4.1"
gem "enhanced_hooks", :version => ">=0.4.1"

and the generate command :

~your_project_path> rails g event_machine create_favorite Favorites create
~your_project_path> rails g enhanced_hooks create_favorite Favorites create

here 'create_event' stands for the event name, and 'Favorites' 'create' for which contorller#action to observe

Expand Down
30 changes: 0 additions & 30 deletions event_machine.gemspec

This file was deleted.

15 changes: 15 additions & 0 deletions lib/enhanced_hooks.rb
@@ -0,0 +1,15 @@
require "enhanced_hooks/version"
require "active_support/dependencies"

module EnhancedHooks

mattr_accessor :app_root

def self.setup
yield self
end

end

require "enhanced_hooks/engine"
require "enhanced_hooks/hooks"
21 changes: 21 additions & 0 deletions lib/enhanced_hooks/engine.rb
@@ -0,0 +1,21 @@
module EnhancedHooks
class Engine < Rails::Engine

initializer "enhanced_hooks.load_app_instance_data" do |app|
EnhancedHooks.setup do |config|
config.app_root = app.root
end
end

#initialize "enhanced_hooks.load_static_assets" do |app|
# app.middleware.use ::ActionDispatc::Static, "#{root}/public"
#end

initializer "enhanced_hooks.application" do
ActiveSupport.on_load :action_controller do
include EnhancedHooks::Hooks
end
end

end
end
2 changes: 1 addition & 1 deletion lib/event_machine/hooks.rb → lib/enhanced_hooks/hooks.rb
@@ -1,7 +1,7 @@
require "pp"
require 'benchmark'

module EventMachine
module EnhancedHooks

module Hooks

Expand Down
@@ -1,3 +1,3 @@
module EventMachine
module EnhancedHooks
VERSION = "0.4.1"
end
13 changes: 0 additions & 13 deletions lib/event_machine.rb

This file was deleted.

21 changes: 0 additions & 21 deletions lib/event_machine/engine.rb

This file was deleted.

@@ -1,13 +1,13 @@
require 'rails/generators'
class EventMachineGenerator < Rails::Generators::Base
class EnhancedHooksGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)

argument :this_event_name, :type => :string
argument :controller_name, :type => :string
argument :action_name, :type => :string

def generate_event
template "event.rb", "#{EventMachine::Hooks::EVENTS_DIR}/#{parsed_event_name}_event.rb"
template "event.rb", "#{EnhancedHooks::Hooks::EVENTS_DIR}/#{parsed_event_name}_event.rb"
template "functional_test.rb", "test/functional/events/#{parsed_event_name}_test.rb"
end

Expand Down

0 comments on commit 1004286

Please sign in to comment.