Sha256: 4933bfd0da01df3d6a23af47df4daa5391f346467ed203dbef16ac650f0e23ad

Contents?: true

Size: 850 Bytes

Versions: 5

Compression:

Stored size: 850 Bytes

Contents

require "#{Rails.root}/spec/fixtures/geoblacklight_schema"

class FixturesIndexer
  def self.run
    FixturesIndexer.new.run
  end
  def initialize
    @solr = Blacklight.solr
  end
  def run
    index
    commit
  end
  def fixtures
    @fixtures ||= JSON::parse(File.read("#{Rails.root}/spec/fixtures/geoblacklight_schema/transformed.json"))
    # @fixtures ||= file_list.map do |file|
    #   fixture_template = ERB.new(File.read(file))
    #   rendered_template = fixture_template.result(binding)
    #   YAML::load rendered_template
    # end
  end
  def file_list
    # data = JSON::parse(File.read("#{Rails.root}/spec/fixtures/geoblacklight_schema/transformed.json"))
    # @file_list ||= Dir["#{Rails.root}/spec/fixtures/solr_documents/*.yml"]
  end

  private
  def index
    @solr.add fixtures
  end
  def commit
    @solr.commit
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geoblacklight-0.0.6 lib/geoblacklight/fixtures_indexer.rb
geoblacklight-0.0.5 lib/geoblacklight/fixtures_indexer.rb
geoblacklight-0.0.4 lib/geoblacklight/fixtures_indexer.rb
geoblacklight-0.0.3 lib/geoblacklight/fixtures_indexer.rb
geoblacklight-0.0.2 lib/geoblacklight/fixtures_indexer.rb