Sha256: 870b9c60ad4e198ca561ebefd35725f6cea210e69912525d36f3ae4a5b1c36a5

Contents?: true

Size: 991 Bytes

Versions: 4

Compression:

Stored size: 991 Bytes

Contents

require 'multi_logger'

namespace :iqvoc do

  namespace :import do

    desc 'Imports some ntriples data from a given url (URL=...). Use the parameter NAMESPACE=... to define the default namespace used in your data.'
    task :url => :environment do
      require 'iqvoc/skos_importer'

      raise "You have to specify an url for the data file to be imported. Example: rake iqvoc:import:url URL=... NAMESPACE=" unless ENV['URL']
      raise "You have to specify a default namespace for the data to be imported. Example: rake iqvoc:import:url URL=... NAMESPACE=" unless ENV['NAMESPACE']

      stdout_logger = Logger.new(STDOUT)
      stdout_logger.level = Logger::INFO

      publish = if ENV['PUBLISH'].nil? || ENV['PUBLISH'] == "true"
        true
      else
        false
      end

      importer = Iqvoc::SkosImporter.new(open(URI.parse(ENV['URL']).to_s), URI.parse(ENV['NAMESPACE']).to_s, MultiLogger.new(stdout_logger, Rails.logger), publish)
      importer.run
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iqvoc-4.3.3 lib/tasks/importer.rake
iqvoc-4.3.2 lib/tasks/importer.rake
iqvoc-4.3.1 lib/tasks/importer.rake
iqvoc-4.3.0 lib/tasks/importer.rake