Method: Update#initialize
- Defined in:
- lib/ncbi_taxonomy_update.rb
#initialize ⇒ Update
Returns a new instance of Update.
9 10 11 12 13 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 |
# File 'lib/ncbi_taxonomy_update.rb', line 9 def initialize @home_dir = Dir.home @work_dir = @home_dir + "/.ncbi_taxonomy" md5_file = @work_dir + "/taxdump.tar.gz.md5" md5_old_file = @work_dir + "/taxdump.tar.gz.md5.old" @taxdb = @work_dir + "/taxonomy.db.prep" @taxdb_release = @work_dir + "/taxonomy.db" @status = nil # check workinng directory, if not exist, make it. if File.exist?(@work_dir) if !File.directory?(@work_dir) @status = "This software uses $HOME/.ncbi_taxonomy directory. However, in your home directory there is same name of file. We recommend you change that file name to another name." return else Dir.chdir @work_dir if File.exist?(md5_file) `rm -f #{md5_old_file}` File.rename(md5_file, md5_old_file) self.download_md5 `diff #{md5_file} #{md5_old_file}` if $?.exitstatus == 0 @status = false return else @status = true return end else self.download_md5 end end else Dir.mkdir @work_dir Dir.chdir @work_dir self.download_md5 end @status = true return end |