Sha256: e308c657da8fde44557efa0a6ea5ac9b5f47d9d1a138572648f02732cf1c6647

Contents?: true

Size: 583 Bytes

Versions: 5

Compression:

Stored size: 583 Bytes

Contents

require 'generators/oneshot/oneshot_generator/configurator'

class OneshotGenerator < Rails::Generators::NamedBase
  extend Configurator

  source_root File.expand_path('../templates', __FILE__)

  attr_reader :current, :timestamp, :task_name, :configuration

  def setup
    @current   = Time.current
    @timestamp = @current.strftime('%Y%m%d')
    @task_name = "#{name.underscore}_#{timestamp}"
    @configuration = self.class.configuration
  end

  def create_file_with_template
    template 'oneshot.rake.erb', "lib/tasks/oneshot/#{timestamp}_#{name.underscore}.rake"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oneshot_task_generator-0.1.4 lib/generators/oneshot/oneshot_generator.rb
oneshot_task_generator-0.1.3 lib/generators/oneshot/oneshot_generator.rb
oneshot_task_generator-0.1.2 lib/generators/oneshot/oneshot_generator.rb
oneshot_task_generator-0.1.1 lib/generators/oneshot/oneshot_generator.rb
oneshot_task_generator-0.1.0 lib/generators/oneshot/oneshot_generator.rb