Sha256: 03fd86c508205b0e0b9185acda58c3bc803d6c10f3c629f364e6063b6280ff63

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.1 lib/tasks/cms_seeds.rake