Sha256: adee18d25eeb0707effdb9c05db2c534159b3040bd29ff3ef9eeccf41f425f14

Contents?: true

Size: 1.26 KB

Versions: 46

Compression:

Stored size: 1.26 KB

Contents

require 'csv'
require 'open-uri'
require 'time'

namespace 'import' do
  namespace 'test' do
    namespace 'csv' do
    
      # Import from a small CSV file (single)
      desc "Importing a single CSV file (less than 5000 rows)"
      task 'single_file' => :environment do
        verbose = true
        verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
        path = Kuppayam::Engine.root.join('db', 'test_data', "single_file", "master.csv")
        Region.destroy_all
        Region.import_data_file(path, true, verbose)
        puts "Importing Completed".green if verbose
      end

      # Import from a bunch of split CSV files of same format (typically large CSV gets split into rows of 5000 or 10000)
      desc "Importing a bunch of split CSV file"
      task 'split_files' => :environment do
        verbose = true
        verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
        path = Kuppayam::Engine.root.join('db', 'test_data', "split_files")
        Region.destroy_all
        Region.import_data_recursively(path, true, verbose)
        puts "Importing Completed".green if verbose
      end

    end
    
    namespace 'xlsx' do
    end
    
    namespace 'sql' do
    end
  end
end
    

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
kuppayam-0.2.12.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.11.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.10.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.9.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.8.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.7.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.6.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.5.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.4.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.3.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.2.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.1.pre.materialize lib/tasks/test_import.rake
kuppayam-0.2.0.pre.materialize lib/tasks/test_import.rake
kuppayam-0.1.39 lib/tasks/test_import.rake
kuppayam-0.1.38 lib/tasks/test_import.rake
kuppayam-0.1.37 lib/tasks/test_import.rake
kuppayam-0.1.36 lib/tasks/test_import.rake
kuppayam-0.1.35 lib/tasks/test_import.rake
kuppayam-0.1.34 lib/tasks/test_import.rake
kuppayam-0.1.33 lib/tasks/test_import.rake