Sha256: 235aa804efed846e6e4112cf7416812c85b2eea785cecfce498f2de4c3ca3ba6

Contents?: true

Size: 1.01 KB

Versions: 18

Compression:

Stored size: 1.01 KB

Contents

require 'rails/generators/named_base'
require 'rails/generators/model_helpers'
require 'rails/generators/active_record/migration'

module Shinq
  module Generators
    class WorkerGenerator < ::Rails::Generators::NamedBase
      include ::Rails::Generators::ModelHelpers
      include ::Rails::Generators::Migration
      include ::ActiveRecord::Generators::Migration

      argument :attributes, :type => :array, :default => [], :banner => "field[:type][:index] field[:type][:index]"

      check_class_collision

      class_option :migration,  :type => :boolean
      class_option :parent,     :type => :string, :desc => "The parent class for the generated model"

      source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))

      def create_migration_file
        migration_template 'create_table_migration.erb', "db/migrate/create_#{table_name}.rb"
      end

      def create_worker_file
        template 'worker.erb', File.join('app/workers', class_path, "#{file_name}.rb")
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
shinq-1.3.0 lib/generators/shinq/worker/worker_generator.rb
shinq-1.2.0 lib/generators/shinq/worker/worker_generator.rb
shinq-1.1.0 lib/generators/shinq/worker/worker_generator.rb
shinq-1.0.2 lib/generators/shinq/worker/worker_generator.rb
shinq-1.0.1 lib/generators/shinq/worker/worker_generator.rb
shinq-1.0.0 lib/generators/shinq/worker/worker_generator.rb
shinq-1.0.0.rc1 lib/generators/shinq/worker/worker_generator.rb
shinq-0.8.1 lib/generators/shinq/worker/worker_generator.rb
shinq-0.8.0 lib/generators/shinq/worker/worker_generator.rb
shinq-0.7.1 lib/generators/shinq/worker/worker_generator.rb
shinq-0.7.0 lib/generators/shinq/worker/worker_generator.rb
shinq-0.6.0 lib/generators/shinq/worker/worker_generator.rb
shinq-0.5.1 lib/generators/shinq/worker/worker_generator.rb
shinq-0.5.0 lib/generators/shinq/worker/worker_generator.rb
shinq-0.4.0 lib/generators/shinq/worker/worker_generator.rb
shinq-0.3.0 lib/generators/shinq/worker/worker_generator.rb
shinq-0.2.0 lib/generators/shinq/worker/worker_generator.rb
shinq-0.1.0 lib/generators/shinq/worker/worker_generator.rb