Sha256: 420e2dbb59a724765eb1bf1cdbe07fdaa84529163b6f742e8f4b2746dd078b5e

Contents?: true

Size: 814 Bytes

Versions: 22

Compression:

Stored size: 814 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}"
          system("rm -rf #{old_path}", chdir: Souls.get_mother_path)
          system("mkdir -p #{old_path}", chdir: Souls.get_mother_path)
          system("cp -r #{cp_path}/* #{old_path}", chdir: Souls.get_mother_path)
        rescue StandardError
          # Do nothing
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
souls-0.51.2 lib/souls/cli/sync/model.rb
souls-0.51.1 lib/souls/cli/sync/model.rb
souls-0.51.0 lib/souls/cli/sync/model.rb
souls-0.50.0 lib/souls/cli/sync/model.rb
souls-0.49.0 lib/souls/cli/sync/model.rb
souls-0.48.2 lib/souls/cli/sync/model.rb
souls-0.48.1 lib/souls/cli/sync/model.rb
souls-0.48.0 lib/souls/cli/sync/model.rb
souls-0.47.1 lib/souls/cli/sync/model.rb
souls-0.47.0 lib/souls/cli/sync/model.rb
souls-0.46.1 lib/souls/cli/sync/model.rb
souls-0.46.0 lib/souls/cli/sync/model.rb
souls-0.45.4 lib/souls/cli/sync/model.rb
souls-0.45.3 lib/souls/cli/sync/model.rb
souls-0.45.2 lib/souls/cli/sync/model.rb
souls-0.45.1 lib/souls/cli/sync/model.rb
souls-0.45.0 lib/souls/cli/sync/model.rb
souls-0.44.6 lib/souls/cli/sync/model.rb
souls-0.44.5 lib/souls/cli/sync/model.rb
souls-0.44.4 lib/souls/cli/sync/model.rb