Sha256: f41f9b4c16972bf6b467473cd57af8116e008b1cf1455af238dba9cfba3fabc0

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

namespace :occams do
  namespace :cms_seeds do
    desc "Import CMS Seed data into database (from: folder name, to: site identifier, classes: class name[s])"

    task :import, %i[from to classes] => [:environment] do |_t, args|
      from  = args[:from]
      to    = args[:to] || from
      classes = args[:classes].nil? ? nil : args[:classes].split

      puts "Importing CMS Seed data from Folder [#{from}] to Site [#{to}] ..."

      # changing so that logger is going straight to screen
      logger = Occams.logger
      Occams.logger = Logger.new(STDOUT)

      Occams::Seeds::Importer.new(from, to).import!(classes)

      Occams.logger = logger
    end

    desc "Export database data into CMS Seed files (from: site identifier, to: folder name, classes: class name[s])"
    task :export, %i[from to classes] => [:environment] do |_t, args|
      from  = args[:from]
      to    = args[:to] || from
      classes = args[:classes].nil? ? nil : args[:classes].split

      puts "Exporting CMS data from Site [#{from}] to Folder [#{to}] ..."

      # changing so that logger is going straight to screen
      logger = Occams.logger
      Occams.logger = Logger.new(STDOUT)

      Occams::Seeds::Exporter.new(from, to).export!(classes)

      Occams.logger = logger
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
occams-1.0.0 lib/tasks/cms_seeds.rake