Sha256: c21bd928e4841782b288ad81fc614f513d8a2416c7df59076b097a75f506ce9d

Contents?: true

Size: 1015 Bytes

Versions: 6

Compression:

Stored size: 1015 Bytes

Contents

# This effectively hides the rake task 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 team[:name] and team[:id] for all sites within Jobshop."
  task teams: :environment do
    Jobshop::Team.joins(:owner)
      .select([ "jobshop_teams.id", "name", "jobshop_users.email AS owner_email" ]).each do |team|
      team_name = team.name.ljust(32)
      puts "#{team_name} | #{team.id} | #{team.owner_email} "
    end
  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

6 entries across 6 versions & 1 rubygems

Version Path
jobshop-0.0.15 lib/tasks/jobshop_tasks.rake
jobshop-0.0.14 lib/tasks/jobshop_tasks.rake
jobshop-0.0.13 lib/tasks/jobshop_tasks.rake
jobshop-0.0.12 lib/tasks/jobshop_tasks.rake
jobshop-0.0.11 lib/tasks/jobshop_tasks.rake
jobshop-0.0.10 lib/tasks/jobshop_tasks.rake