Skip to content

Commit

Permalink
Add dependency on custom_callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
obrie committed Sep 25, 2007
1 parent b410525 commit 26b00de
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*SVN*

* Add dependency on custom_callbacks

*0.0.1* (September 22nd, 2007)

* Move test fixtures out of the test application root directory
Expand Down
9 changes: 5 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
== has_states

has_states adds support for managing states, events, and transitions within a
+has_states+ adds support for managing states, events, and transitions within a
model.

== Resources
Expand Down Expand Up @@ -68,9 +68,10 @@ events for your models. It is cross-platform, written in Java.
== Dependencies

This plugin depends on the presence of the following plugins:
* class_associations - http://wiki.pluginaweek.org/Class_associations
* dry_transaction_rollbacks - http://wiki.pluginaweek.org/Dry_transaction_callbacks
* eval_call - http://wiki.pluginaweek.org/Eval_call
* class_associations[http://wiki.pluginaweek.org/Class_associations]
* custom_callbacks[http://wiki.pluginaweek.org/Custom_callbacks]
* dry_transaction_rollbacks[http://wiki.pluginaweek.org/Dry_transaction_callbacks]
* eval_call[http://wiki.pluginaweek.org/Eval_call]

This plugin is also plugin+. That means that it contains a slice of an
application, such as models and migrations. To test or use a plugin+, you
Expand Down
3 changes: 3 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ spec = Gem::Specification.new do |s|
s.autorequire = 'has_states'
s.has_rdoc = true
s.test_files = Dir['test/unit/**/*_test.rb']
s.add_dependency 'class_associations'
s.add_dependency 'custom_callbacks'
s.add_dependency 'eval_call'

s.author = 'Aaron Pfeifer, Neil Abraham'
s.email = 'info@pluginaweek.org'
Expand Down
1 change: 1 addition & 0 deletions lib/has_states.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'class_associations'
require 'custom_callbacks'
require 'dry_transaction_rollbacks' unless defined?(ActiveRecord::Rollback) # Supported on edge
require 'eval_call'

Expand Down
8 changes: 1 addition & 7 deletions lib/has_states/active_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,7 @@ def #{name}_count(*args)
def add_callbacks
[:before_enter, :after_enter, :before_exit, :after_exit].each do |type|
callback = "#{type}_#{name}"
@owner_class.class_eval <<-end_eval
def self.#{callback}(*callbacks, &block)
callbacks << block if block_given?
write_inheritable_array(:#{callback}, callbacks)
end
end_eval

@owner_class.callback(callback)
@owner_class.send(callback, @options[type]) if @options[type]
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/app_root/config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$:.unshift("#{RAILS_ROOT}/../../../../../rails/plugin_dependencies/lib")
begin
require 'plugin_dependencies'
rescue Exception => ex
rescue Exception => e
end

Rails::Initializer.run do |config|
Expand Down
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Load local repository plugin paths
$:.unshift("#{File.dirname(__FILE__)}/../../../associations/class_associations/lib")
$:.unshift("#{File.dirname(__FILE__)}/../../../miscellaneous/custom_callbacks/lib")
$:.unshift("#{File.dirname(__FILE__)}/../../../miscellaneous/dry_transaction_rollbacks/lib")
$:.unshift("#{File.dirname(__FILE__)}/../../../../ruby/object/eval_call/lib")

Expand Down

0 comments on commit 26b00de

Please sign in to comment.