Sha256: e2fde59781788473be8fef182a2e8a187a7527f7f39156fdec210e54a194f78b
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
[](https://travis-ci.org/s-osa/oneshot_task_generator) [](https://badge.fury.io/rb/oneshot_task_generator) # OneshotTaskGenerator Simple rake task generator for oneshot tasks. ```sh $ bin/rails generate oneshot FooBar create lib/tasks/oneshot/20180205_foo_bar.rake ``` Then, skeleton file for oneshot rake task will be generated. ```ruby # Skeleton for this file was generated by `bin/rails generate oneshot FooBar` # For copy and paste: `bin/rake oneshot:foo_bar_20180205` namespace :oneshot do desc '' task foo_bar_20180205: :environment do end end ``` ## Installation Add this line to your application's Gemfile: ```ruby gem 'oneshot_task_generator' ``` And then execute: ``` $ bundle ``` ## Customization ### Task Body ```ruby # config/initializers/oneshot_task_generator.rb OneshotGenerator.configure do |config| config.body = <<-BODY ActiveRecord::Base.transaction do # Write transactional code here end BODY end ``` ```ruby # Skeleton for this file was generated by `bin/rails generate oneshot FooBar` # For copy and paste: `bin/rake oneshot:foo_bar_20180208` namespace :oneshot do desc '' task foo_bar_20180208: :environment do ActiveRecord::Base.transaction do # Write transactional code here end end end ``` ### Arguments ```ruby # config/initializers/oneshot_task_generator.rb OneshotGenerator.configure do |config| config.arguments = ['task', 'args'] end ``` ```ruby # Skeleton for this file was generated by `bin/rails generate oneshot FooBar` # For copy and paste: `bin/rake oneshot:foo_bar_20180208` namespace :oneshot do desc '' task foo_bar_20180208: :environment do |task, args| end end ``` ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/s-osa/oneshot_task_generator.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oneshot_task_generator-0.1.4 | README.md |