Class: Libis::RosettaChecker::FilesToIngestCleanupOptions
- Inherits:
-
Object
- Object
- Libis::RosettaChecker::FilesToIngestCleanupOptions
- Defined in:
- lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#dbpass ⇒ Object
Returns the value of attribute dbpass.
-
#dburl ⇒ Object
Returns the value of attribute dburl.
-
#dbuser ⇒ Object
Returns the value of attribute dbuser.
-
#delete ⇒ Object
Returns the value of attribute delete.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#quiet ⇒ Object
Returns the value of attribute quiet.
-
#recursive ⇒ Object
Returns the value of attribute recursive.
-
#report ⇒ Object
Returns the value of attribute report.
-
#report_file ⇒ Object
Returns the value of attribute report_file.
Instance Method Summary collapse
- #define(parser) ⇒ Object
- #define_dbparams(parser) ⇒ Object
- #define_delete(parser) ⇒ Object
- #define_logfile(parser) ⇒ Object
- #define_quiet(parser) ⇒ Object
- #define_recursive(parser) ⇒ Object
- #define_report(parser) ⇒ Object
- #define_report_file(parser) ⇒ Object
-
#initialize(command) ⇒ FilesToIngestCleanupOptions
constructor
A new instance of FilesToIngestCleanupOptions.
Constructor Details
#initialize(command) ⇒ FilesToIngestCleanupOptions
Returns a new instance of FilesToIngestCleanupOptions.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 6 def initialize(command) self.command = command self.delete = false self.quiet = false self.log_file = nil self.recursive = false self.report = true default_report_file = "#{command.split(' ').last}-#{DateTime.now.strftime('%Y%m%d-%H%M%S')}.csv" self.report_file = default_report_file self.dburl = '//libis-db-rosetta:1551/ROSETTAP.kuleuven.be' self.dbuser = 'V2KU_REP00' self.dbpass = 'V2KU_REP00' end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def command @command end |
#dbpass ⇒ Object
Returns the value of attribute dbpass.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def dbpass @dbpass end |
#dburl ⇒ Object
Returns the value of attribute dburl.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def dburl @dburl end |
#dbuser ⇒ Object
Returns the value of attribute dbuser.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def dbuser @dbuser end |
#delete ⇒ Object
Returns the value of attribute delete.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def delete @delete end |
#log_file ⇒ Object
Returns the value of attribute log_file.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def log_file @log_file end |
#quiet ⇒ Object
Returns the value of attribute quiet.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def quiet @quiet end |
#recursive ⇒ Object
Returns the value of attribute recursive.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def recursive @recursive end |
#report ⇒ Object
Returns the value of attribute report.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def report @report end |
#report_file ⇒ Object
Returns the value of attribute report_file.
4 5 6 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 4 def report_file @report_file end |
Instance Method Details
#define(parser) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 21 def define(parser) parser. = "Usage: #{command} [options] [[r_options] [directory|[@]file] ...]" parser.separator '' parser.separator 'This tool will scan directories for files that are/are not ingested in Rosetta.' parser.separator '' parser.separator 'If a file name preceded with a \'@\' is given as an argument, the file is expected to be a' parser.separator 'text file with directory names - one directory per line.' parser.separator '' parser.separator 'The tool will compare the file sizes, MD5 checksums and file names with the information in the' parser.separator 'Rosetta database to determine if a possible match is found.' parser.separator 'with [r_options] (can be repeated in between directory/file inputs):' define_quiet parser define_logfile parser define_recursive parser parser.separator '' parser.separator 'with [options]:' define_report parser define_report_file parser # define_delete parser define_dbparams parser end |
#define_dbparams(parser) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 92 def define_dbparams(parser) parser.on '--db-url [URL]', "Database connection URL [#{self.dburl}]" do |url| self.dburl = url end parser.on '--db-user [USER]', "Database user name [#{self.dbuser}]" do |user| self.dbuser = user end parser.on '--db-pass [PASSWORD]', "Database password [#{self.dbpass}" do |pass| self.dbpass = pass end end |
#define_delete(parser) ⇒ Object
84 85 86 87 88 89 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 84 def define_delete(parser) parser.on '-D', '--[no-]delete', "Perform file deletes when file is ingested [#{self.delete}]" do |flag| self.delete = flag end end |
#define_logfile(parser) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 53 def define_logfile(parser) parser.on '-l', '--logfile [FILE]', "Send logging output to file - appends to existing file [#{self.log_file}]", '(re)set to empty string for no logging to file' do |file| self.log_file = file end end |
#define_quiet(parser) ⇒ Object
46 47 48 49 50 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 46 def define_quiet(parser) parser.on '-q', '--[no-]quiet', "Be quiet - no logging output on screen [#{self.quiet}]" do |flag| self.quiet = flag end end |
#define_recursive(parser) ⇒ Object
62 63 64 65 66 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 62 def define_recursive(parser) parser.on '-R', '--[no-]recursive', "Parse through subdirectories [#{self.recursive}]" do |flag| self.recursive = flag end end |
#define_report(parser) ⇒ Object
69 70 71 72 73 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 69 def define_report(parser) parser.on '--[no-]report', "Create a report file - overwrites existing file [#{self.report}]" do |flag| self.report = flag end end |
#define_report_file(parser) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/libis/rosetta_checker/options/files_to_ingest_cleanup.rb', line 76 def define_report_file(parser) parser.on '-o', '--output-file [FILE]', "File name for the report, if enabled [#{self.report_file}]" do |file| self.report_file = file end end |