Autorun is a simple scripting helper module. It allows you write a simple executable script per class easily.
Autorun is a module which invokes 'run' method automatically.
- Implement an executable class and include Autorun.
#!/usr/bin/env ruby
require 'autorun'
class DailyBatch
include Autorun
def run
# ...
end
end
- Then execute it.
$ ruby daily_batch.rb
- When you need to use other method name instead of 'run', use simply alias_method.
class WorkerJob
include Autorun
def perform
# ...
end
alias_method :run, :perform
end
- Autorun does not provide other features such as option parser, please use appropriate gem like 'thor' or 'slop'.
- Fork it ( http://github.com/twodollarz/autorun/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request