1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activejob/lib/rails/generators/job/job_generator.rb
2015-04-29 18:44:37 -07:00

23 lines
625 B
Ruby

require 'rails/generators/named_base'
module Rails # :nodoc:
module Generators # :nodoc:
class JobGenerator < Rails::Generators::NamedBase # :nodoc:
desc 'This generator creates an active job file at app/jobs'
class_option :queue, type: :string, default: 'default', desc: 'The queue name for the generated job'
check_class_collision suffix: 'Job'
hook_for :test_framework
def self.default_generator_root
File.dirname(__FILE__)
end
def create_job_file
template 'job.rb', File.join('app/jobs', class_path, "#{file_name}_job.rb")
end
end
end
end