Sha256: 541b957348b20b6cdb78c6d046a7adff639e3a776bd0b55a57bee1e943179528

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# This effectively hides `rake jobshop:install:migrations` from `$ rake -T`.
Rake::Task["jobshop:install:migrations"].instance_variable_set(:@comments, [])

namespace :jobshop do
  task :disable_autoload do
    ActiveSupport::Dependencies.class_eval do
      extend Module.new {
        def load_file(path, const_paths = loadable_constants_for_path(path))
          jobshop_models_path = File.join(Jobshop::Engine.root, "app", "models")
          return if path.starts_with?(jobshop_models_path)
          super
        end
      }
    end
  end

  desc "Outputs organization[:name] and organization[:id] for all sites within Jobshop."
  task organizations: :environment do
    Jobshop::Organization
      .select([ "jobshop_organizations.id", "name" ]).each do |organization|
      organization_name = organization.name.ljust(32)
      puts "#{organization_name} | #{organization.id}"
    end
  end

  desc "Start Incoming Email Worker"
  task postmaster: :environment do
    queue_name = Jobshop.configuration.aws.incoming_email_queue
    postmaster_path = File.join(Jobshop::Engine.root, "lib", "jobshop", "postmaster.rb")

    exec <<~SHELL
      bundle exec \
        shoryuken -R -q #{queue_name} -r #{postmaster_path}
    SHELL
  end
end

%w( db:migrate db:rollback db:migrate:up db:migrate:down ).each do |t|
  Rake::Task[t].prerequisites << "jobshop:disable_autoload"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobshop-0.0.163 lib/tasks/jobshop_tasks.rake