Module: Allsum
- Defined in:
- lib/allsum/client/config.rb,
lib/allsum/client/logger.rb,
lib/allsum/client/version.rb,
lib/allsum/client/complicator.rb,
lib/allsum/client/models/filename.rb
Defined Under Namespace
Modules: Client
Class Method Summary collapse
Class Method Details
.setup ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/allsum/client/check.rb', line 14 def Allsum.setup yaml_path = File.absolute_path(File.dirname($0)) + '/../allsum_config.yml' puts "Reading config file: #{yaml_path}" if @debug || @verbose raw_config = File.read(yaml_path) config = YAML.load(raw_config) @debug = true @verbose = true puts @rootDirectory = config["client"]["included"] if @debug puts @excludedDirectoryNames = config["client"]["excluded"] if @debug puts @includedFileTypes = config["client"]["filetypes"] if @debug puts host = config["server"]["host"] if @debug puts port = config["server"]["port"] if @debug puts user = config["server"]["username"] if @debug puts pass = config["server"]["password"] if @debug puts table = config["server"]["table"] if @debug Allsum::Client::Logger.new(host, port, user, pass, table, @debug, @verbose) Allsum::Client::Models::Filename.new() @rootDirectory.find.each do |gooddir| Find.find(gooddir) do |path| if FileTest.directory?(path) #determine if this is a directory we don't like... @excludedDirectoryNames.each do |baddir| if baddir.include?(File.basename(path.downcase)) Find.prune #don't look in this directory puts "excluded directory #{path}" if @debug end end else #we have a file puts "we have a file #{path}" if @debug filetype = Allsum::Client::Complicator.file_type(path) @includedFileTypes.each do |includeFile| puts "Incl type: " + includeFile if @debug || @verbose puts "File type: " + filetype if @debug || @verbose if includeFile.include?(filetype) puts path if @debug || @verbose Allsum::Client::Complicator.filename(path) Allsum::Client::Complicator.file_size(path) Allsum::Client::Complicator.calculate_checksums(path) Allsum::Client::Complicator.version_info(path) Allsum::Client::Complicator.log_to_db(path) end end end end end end |