Class: CremeFraiche
- Inherits:
-
Object
- Object
- CremeFraiche
- Includes:
- BasicLogging, Singleton, Translating
- Defined in:
- lib/cremefraiche.rb
Overview
The main application-class.
Constant Summary collapse
- @@cur_system =
RUBY_PLATFORM
- @@Info_Key =
'InfoKey: '
- @@Info_Value =
'InfoValue: '
Constants included from BasicLogging
BasicLogging::DEBUG, BasicLogging::ERROR, BasicLogging::FATAL, BasicLogging::INFO, BasicLogging::Levels, BasicLogging::UNKNOWN, BasicLogging::WARN
Instance Attribute Summary collapse
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Attributes included from BasicLogging
Instance Method Summary collapse
-
#process(*args) ⇒ Object
instantiate an object of type CremeFraiche and define the versioning-information.
- #stop ⇒ Object
Methods included from BasicLogging
is_muted?, #log, mute, #set_level, #set_target
Methods included from Translating
Instance Attribute Details
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
179 180 181 |
# File 'lib/cremefraiche.rb', line 179 def msg @msg end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
179 180 181 |
# File 'lib/cremefraiche.rb', line 179 def output @output end |
Instance Method Details
#process(*args) ⇒ Object
instantiate an object of type CremeFraiche and define the versioning-information. Then does the rest… You need to provide the mail-files to a call of this method.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/cremefraiche.rb', line 48 def process(*args) @file_path = __FILE__ @bthr = nil @msg = nil debug(self.object_id.to_s << ': are there arguments ? args.flatten.empty? ' << args.flatten.empty?.to_s) tfile = nil if(args && !args.flatten.empty? ) if args.length == 1 && args[0] == '-' args.compact! args.shift # debug('file piped-in: ' << $<.read) # a file may be piped in from the command-line... if(!$<.eof?) # ... provide a temporary file in that case, tfile = "%s/mail_message" %(Dir.pwd) File.open(tfile, 'w+') {|of| of << $<.read} debug('Temporary eml-file is written.') # ... then do as if it had been part of the argument-list. args << tfile # And I don't care. Really. Thanks. end end debug('processing ' << args.size.to_s << ' files') # check_programs_installed @bthr = BusyIndicator.new(true, 10) args.each do |a| num_files = 0 debug 'creating mailfile' mailfile = EmlFile.new(a) debug ' mailfile created' if(!mailfile.msg || mailfile.msg.empty?) num_files = mailfile.files.size if mailfile.files mailfile.mails do |m| output = CFPrawn.new(m, File.dirname(a) ) (output) end else @msg = mailfile.msg end print "\t" info(trl("Processed %d eml-files") %num_files ) end File.delete(tfile) if tfile && File.exist?(tfile) @bthr.stop("done") end end |
#stop ⇒ Object
97 98 99 100 101 102 |
# File 'lib/cremefraiche.rb', line 97 def stop() if @bthr @bthr.stop("stopped") @bthr = nil end end |