Sha256: 8fd756ecfdbd35a71a99991c5a9433ddb7e53b6df9cb0dec17ad80591903a313

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

module Souls
  module Sync
    class << self
      def model
        cp_dir = %w[db app/models spec/factories]
        cp_dir.each do |dir|
          cp_and_dl_files(dir: dir)
        end
      end

      private

      def cp_and_dl_files(dir: "db")
        require("#{Souls.get_mother_path}/config/souls")
        worker_paths = Souls.configuration.workers.map { |n| n[:name] }
        worker_paths.each do |path|
          cp_path = "./apps/api/#{dir}"
          old_path = "./apps/#{path}/#{dir}"
          FileUtils.rm_rf(old_path) if Dir.exist?(old_path)
          FileUtils.mkdir(old_path) unless Dir.exist?(old_path)
          system("cp -r #{cp_path}/* #{old_path}", chdir: Souls.get_mother_path)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
souls-0.38.2 lib/souls/cli/sync/model.rb