-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
73 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require "gli" | ||
require "cob_index" | ||
|
||
class App | ||
extend GLI::App | ||
|
||
program_desc "Wrapper cli app for indexing tul_cob app" | ||
|
||
version CobIndex::VERSION | ||
|
||
subcommand_option_handling :normal | ||
arguments :strict | ||
|
||
desc "Ingest files into solr endpoint using tul_cob traject config" | ||
arg_name "Describe arguments to ingest here" | ||
command :ingest do |c| | ||
c.desc "Ingest files into SOLR_URL using tul_cob traject config" | ||
c.action do |global_options, options, args| | ||
|
||
CobIndex::CLI.ingest | ||
end | ||
end | ||
|
||
pre do |global, command, options, args| | ||
# Pre logic here | ||
# Return true to proceed; false to abort and not call the | ||
# chosen command | ||
# Use skips_pre before a command to skip this block | ||
# on that command only | ||
true | ||
end | ||
|
||
post do |global, command, options, args| | ||
# Post logic here | ||
# Use skips_post before a command to skip this | ||
# block on that command only | ||
end | ||
|
||
on_error do |exception| | ||
# Error logic here | ||
# return false to skip default error handling | ||
true | ||
end | ||
end | ||
|
||
exit App.run(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require "cob_index/version" | ||
require "traject" | ||
|
||
module CobIndex | ||
# Your code goes here... | ||
module CLI | ||
def self.ingest | ||
indexer = Traject::Indexer::MarcIndexer.new("solr_writer.commit_on_close": true) | ||
indexer.load_config_file("#{File.dirname(__FILE__)}/cob_index/indexer_config.rb") | ||
indexer.process(StringIO.new(open(ARGV[0]).read)) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters