Sha256: 91beb0c363f55e73c678fba243baa08dbcc432dcde37a4225504f128baf2dee4

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

[![Build Status](https://travis-ci.org/s-osa/oneshot_task_generator.svg?branch=master)](https://travis-ci.org/s-osa/oneshot_task_generator)
[![Gem Version](https://badge.fury.io/rb/oneshot_task_generator.svg)](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/ohesnot_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
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/s-osa/oneshot_task_generator.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oneshot_task_generator-0.1.2 README.md
oneshot_task_generator-0.1.1 README.md