mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
-refactored _execute() for much better readability :-)
-added dependency for for ruby-debug-completion -turned on auto-eval for ruby-debug -added the ability to run debugger on the last line of a method: http://dancingpenguinsoflight.com/2009/09/an-improved-ruby-debugger-invocation/
This commit is contained in:
parent
c92e8fee18
commit
67cd00cfbf
4 changed files with 23 additions and 26 deletions
25
Rakefile
25
Rakefile
|
@ -4,20 +4,21 @@ require 'rake'
|
||||||
begin
|
begin
|
||||||
require 'jeweler'
|
require 'jeweler'
|
||||||
Jeweler::Tasks.new do |gem|
|
Jeweler::Tasks.new do |gem|
|
||||||
gem.name = "aasm"
|
gem.name = 'aasm'
|
||||||
gem.summary = %Q{State machine mixin for Ruby objects}
|
gem.summary = %Q{State machine mixin for Ruby objects}
|
||||||
gem.description = %Q{AASM is a continuation of the acts as state machine rails plugin, built for plain Ruby objects.}
|
gem.description = %Q{AASM is a continuation of the acts as state machine rails plugin, built for plain Ruby objects.}
|
||||||
gem.homepage = "http://rubyist.github.com/aasm/"
|
gem.homepage = 'http://rubyist.github.com/aasm/'
|
||||||
gem.authors = ["Scott Barron", "Scott Petersen", "Travis Tilley"]
|
gem.authors = ['Scott Barron', 'Scott Petersen', 'Travis Tilley']
|
||||||
gem.email = "scott@elitists.net, ttilley@gmail.com"
|
gem.email = 'scott@elitists.net, ttilley@gmail.com'
|
||||||
gem.add_development_dependency "rspec"
|
gem.add_development_dependency 'ruby-debug-completion'
|
||||||
gem.add_development_dependency "shoulda"
|
gem.add_development_dependency 'rspec'
|
||||||
|
gem.add_development_dependency 'shoulda'
|
||||||
gem.add_development_dependency 'sdoc'
|
gem.add_development_dependency 'sdoc'
|
||||||
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
||||||
end
|
end
|
||||||
Jeweler::GemcutterTasks.new
|
Jeweler::GemcutterTasks.new
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
puts 'Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler'
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'spec/rake/spectask'
|
require 'spec/rake/spectask'
|
||||||
|
@ -38,7 +39,7 @@ begin
|
||||||
end
|
end
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
task :rcov do
|
task :rcov do
|
||||||
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
abort 'RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ begin
|
||||||
end
|
end
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
task :reek do
|
task :reek do
|
||||||
abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
|
abort 'Reek is not available. In order to run reek, you must: sudo gem install reek'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ begin
|
||||||
end
|
end
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
task :roodi do
|
task :roodi do
|
||||||
abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
|
abort 'Roodi is not available. In order to run roodi, you must: sudo gem install roodi'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ begin
|
||||||
if File.exist?('VERSION')
|
if File.exist?('VERSION')
|
||||||
version = File.read('VERSION')
|
version = File.read('VERSION')
|
||||||
else
|
else
|
||||||
version = ""
|
version = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
rdoc.rdoc_dir = 'rdoc'
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
@ -103,6 +104,6 @@ begin
|
||||||
rdoc.template = 'direct'
|
rdoc.template = 'direct'
|
||||||
end
|
end
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
puts "aasm makes use of the sdoc gem. Install it with: sudo gem install sdoc"
|
puts 'aasm makes use of the sdoc gem. Install it with: sudo gem install sdoc'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -35,18 +35,11 @@ class AASM::SupportingClasses::StateTransition
|
||||||
private
|
private
|
||||||
|
|
||||||
def _execute(obj, on_transition, *args)
|
def _execute(obj, on_transition, *args)
|
||||||
if on_transition.is_a?(Proc)
|
case on_transition
|
||||||
if on_transition.arity != 0
|
when Proc
|
||||||
on_transition.call(obj, *args)
|
on_transition.arity == 0 ? on_transition.call : on_transition.call(obj, *args)
|
||||||
else
|
when Symbol, String
|
||||||
on_transition.call
|
obj.send(:method, on_transition.to_sym).arity == 0 ? obj.send(on_transition) : obj.send(on_transition, *args)
|
||||||
end
|
|
||||||
elsif on_transition.is_a?(Symbol) || on_transition.is_a?(String)
|
|
||||||
if obj.send(:method, on_transition.to_sym).arity != 0
|
|
||||||
obj.send(on_transition, *args)
|
|
||||||
else
|
|
||||||
obj.send(on_transition)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,9 @@ require 'aasm'
|
||||||
require 'spec'
|
require 'spec'
|
||||||
require 'spec/autorun'
|
require 'spec/autorun'
|
||||||
|
|
||||||
|
require 'ruby-debug'; Debugger.settings[:autoeval] = true; debugger; rubys_debugger = 'annoying'
|
||||||
|
require 'ruby-debug/completion'
|
||||||
|
|
||||||
Spec::Runner.configure do |config|
|
Spec::Runner.configure do |config|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,8 +23,8 @@ class Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'ruby-debug'
|
require 'ruby-debug'; Debugger.settings[:autoeval] = true; debugger; rubys_debugger = 'annoying'
|
||||||
Debugger.start
|
require 'ruby-debug/completion'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue