class Mastiff::InstallGenerator

class UploaderGenerator < Rails::Generators::NamedBase

Public Instance Methods

copy_initializer() click to toggle source
# File lib/generators/mastiff/install/install_generator.rb, line 24
def copy_initializer
  template "mastiff.rb", "config/initializers/mastiff.rb"
end
copy_uploaders() click to toggle source
# File lib/generators/mastiff/install/install_generator.rb, line 49
def copy_uploaders
  empty_directory "app/uploaders"
  # In future check param for other file upload/storage integration
  if true
    template "carrierwave/mail_attachment_uploader.rb", "app/uploaders/mail_attachment_uploader.rb"
  end
end
copy_workers() click to toggle source
# File lib/generators/mastiff/install/install_generator.rb, line 29
def copy_workers
  # In future check param for other async processing integrations
  if true
    unless File.exist?('config/sidekiq.yml')
      template "sidekiq/sidekiq.yml", "config/sidekiq.yml"
    else
      append_file 'config/sidekiq.yml' do
        ':concurrency: 50'
        ':queues:'
        '  - default'
        '  - email_queue'
      end

    end
    empty_directory "app/workers"
    template "sidekiq/sync_mail_worker.rb",           "app/workers/sync_mail_worker.rb"
    template "sidekiq/sync_attachment_worker.rb",     "app/workers/sync_attachment_worker.rb"
    template "sidekiq/process_attachment_worker.rb",  "app/workers/process_attachment_worker.rb"
  end
end
create_data_directory() click to toggle source
# File lib/generators/mastiff/install/install_generator.rb, line 57
def create_data_directory
   empty_directory "data/attachments/pending"
end