bin/zcc in zcc-0.0.1 vs bin/zcc in zcc-0.0.2

- old
+ new

@@ -38,35 +38,31 @@ if i == b: return buff end end end end - -#--############ BEGIN CONFIGURATION #################### -## Basic configuration below. To complete full configuration, including picking z39.50 servers please see zcc.yaml -TO_SHOW = 10 -#HOW_TO_SAVE = 'search_term' -HOW_TO_SAVE = 'timestamp' #with 'timestamp' all records are saved to the same date stamped file of the time the program starts. The other valid value is 'search_term' in which case each record is saved according to the search term appending on to files which have the same search term - -TIMESTAMP = Time.now.strftime("%Y%m%d%H%M%S") -SCRIPTING = 'yes' #if you want scripting enabled for each record -CSV = 'yes' #would you like to run the csv creation? -LINTER = 'yes' #If you do not have the Perl MARC::Lint module installed, probably from cpan, change this value to 'no' -FORMAT_TO_SAVE = 'marc' #other value that works is 'xml' which saves in marcxml -###### END OF CONFIGURATION ########### - $testing = ARGV[0] $testing = nil unless $testing == 'v' or $testing == 't' puts "We're testing " if $testing STDIN.gets if $testing +#reading in config from yaml file yamlfile = YAML.load_file( "#{File.expand_path("~")}/.zcc/zcc.yaml" ) zservers = yamlfile['zservers'] labels = yamlfile['labels'] scripting = yamlfile['scripting'] $procs = yamlfile['procs'] +TO_SHOW = yamlfile['to_show'] +HOW_TO_SAVE = yamlfile['save_filename'] +TIMESTAMP = Time.now.strftime("%Y%m%d%H%M%S") +SCRIPTING = yamlfile['scripting_on'] +CSV = yamlfile['csv_on'] +LINTER = yamlfile['linter_on'] +FORMAT_TO_SAVE = yamlfile['save_record_syntax'] + + #class String # def to_proc # eval "Proc.new #{self} " # or "Proc.new #{self}" in my case # end #end @@ -188,11 +184,11 @@ next if continue? == 'again' end final_taken = taken[0] puts final_taken - final_taken.local_script(scripting) if SCRIPTING == 'yes' + final_taken.local_script(scripting) if SCRIPTING puts "--------------FINAL RECORD----------------------------" puts final_taken puts "--------------FINAL RECORD----------------------------\a" puts "Above is how your final record looks. Are you happy with it? (anything or n)" @@ -201,11 +197,11 @@ if to_save_or_not_to_save == 'n' next if continue? == 'again' end - csv = final_taken.marc_to_csv(labels) if CSV == 'yes' + csv = final_taken.marc_to_csv(labels) if CSV print "\n#{csv}\n" if HOW_TO_SAVE == 'search_term' filename = search_term.gsub(' ','_') @@ -218,18 +214,18 @@ if FORMAT_TO_SAVE == 'marc' aFile = File.new("#{filename}\.mrc","a+") aFile.write(final_taken.to_marc) puts "#{final_taken['245']['a']} saved in #{filename}\.mrc" aFile.close - elsif FORMAT_TO_SAVE == 'xml' + elsif FORMAT_TO_SAVE == 'marcxml' puts final_taken.to_xml aFile = File.new("#{filename}\.xml","a+") aFile.write(final_taken.to_xml) puts "#{final_taken['245']['a']} saved in #{filename}\.xml" aFile.close end - if CSV == 'yes' + if CSV csvFile = File.new("csv-#{filename}\.txt","a+") csvFile.write(csv) puts "csv for #{taken[0]['245']['a']} saved in csv-#{filename}\.txt" csvFile.close end