Sha256: 324deb85eb4e089a970b34c0226bf641f5b056eb0a2f07162594703cef22d045

Contents?: true

Size: 897 Bytes

Versions: 1

Compression:

Stored size: 897 Bytes

Contents

# frozen_string_literal: true

def check_environment!
  if !Rails.env.development?
    raise "Database commands are only supported in development environment"
  end
end

desc 'Run db:migrate:reset task and populate sample content for development environment'
task 'dev:reset' => ['db:load_config'] do |_, args|
  check_environment!

  Rake::Task['db:migrate:reset'].invoke
  Rake::Task['dev:config'].invoke
  Rake::Task['dev:populate'].invoke
end

desc 'Initialize development environment'
task 'dev:config' => ['db:load_config'] do |_, args|
  DiscourseDev::Config.new.update!
end

desc 'Populate sample content for development environment'
task 'dev:populate' => ['db:load_config'] do |_, args|
  Rake::Task['groups:populate'].invoke
  Rake::Task['users:populate'].invoke
  Rake::Task['categories:populate'].invoke
  Rake::Task['tags:populate'].invoke
  Rake::Task['topics:populate'].invoke
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse_dev-0.0.4 lib/discourse_dev/tasks/dev.rake