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
|
||||
require 'jeweler'
|
||||
Jeweler::Tasks.new do |gem|
|
||||
gem.name = "aasm"
|
||||
gem.name = 'aasm'
|
||||
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.homepage = "http://rubyist.github.com/aasm/"
|
||||
gem.authors = ["Scott Barron", "Scott Petersen", "Travis Tilley"]
|
||||
gem.email = "scott@elitists.net, ttilley@gmail.com"
|
||||
gem.add_development_dependency "rspec"
|
||||
gem.add_development_dependency "shoulda"
|
||||
gem.homepage = 'http://rubyist.github.com/aasm/'
|
||||
gem.authors = ['Scott Barron', 'Scott Petersen', 'Travis Tilley']
|
||||
gem.email = 'scott@elitists.net, ttilley@gmail.com'
|
||||
gem.add_development_dependency 'ruby-debug-completion'
|
||||
gem.add_development_dependency 'rspec'
|
||||
gem.add_development_dependency 'shoulda'
|
||||
gem.add_development_dependency 'sdoc'
|
||||
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
||||
end
|
||||
Jeweler::GemcutterTasks.new
|
||||
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
|
||||
|
||||
require 'spec/rake/spectask'
|
||||
|
@ -38,7 +39,7 @@ begin
|
|||
end
|
||||
rescue LoadError
|
||||
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
|
||||
|
||||
|
@ -66,7 +67,7 @@ begin
|
|||
end
|
||||
rescue LoadError
|
||||
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
|
||||
|
||||
|
@ -78,7 +79,7 @@ begin
|
|||
end
|
||||
rescue LoadError
|
||||
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
|
||||
|
||||
|
@ -91,7 +92,7 @@ begin
|
|||
if File.exist?('VERSION')
|
||||
version = File.read('VERSION')
|
||||
else
|
||||
version = ""
|
||||
version = ''
|
||||
end
|
||||
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
|
@ -103,6 +104,6 @@ begin
|
|||
rdoc.template = 'direct'
|
||||
end
|
||||
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
|
||||
|
||||
|
|
|
@ -35,18 +35,11 @@ class AASM::SupportingClasses::StateTransition
|
|||
private
|
||||
|
||||
def _execute(obj, on_transition, *args)
|
||||
if on_transition.is_a?(Proc)
|
||||
if on_transition.arity != 0
|
||||
on_transition.call(obj, *args)
|
||||
else
|
||||
on_transition.call
|
||||
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
|
||||
case on_transition
|
||||
when Proc
|
||||
on_transition.arity == 0 ? on_transition.call : on_transition.call(obj, *args)
|
||||
when Symbol, String
|
||||
obj.send(:method, on_transition.to_sym).arity == 0 ? obj.send(on_transition) : obj.send(on_transition, *args)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@ require 'aasm'
|
|||
require 'spec'
|
||||
require 'spec/autorun'
|
||||
|
||||
require 'ruby-debug'; Debugger.settings[:autoeval] = true; debugger; rubys_debugger = 'annoying'
|
||||
require 'ruby-debug/completion'
|
||||
|
||||
Spec::Runner.configure do |config|
|
||||
|
||||
end
|
||||
|
|
|
@ -23,8 +23,8 @@ class Test::Unit::TestCase
|
|||
end
|
||||
|
||||
begin
|
||||
require 'ruby-debug'
|
||||
Debugger.start
|
||||
require 'ruby-debug'; Debugger.settings[:autoeval] = true; debugger; rubys_debugger = 'annoying'
|
||||
require 'ruby-debug/completion'
|
||||
rescue LoadError
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue