Orbit/app/jobs/generate_system_summary.rb

46 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

2013-04-24 11:21:11 +00:00
class GenerateSystemSummary
@queue = :high
def self.perform()
@site = Site.first
get_disk_free
get_git_log_list
get_package_info
@site.save
end
def self.get_package_info
@info = {}
get_nginx_version
get_MongoDB_version
get_Linux_version
@site.system_package_info = @info
end
def self.get_git_log_list
git_commit_list_path = OrbitSystemPreference::GitCommitListPath
%x[rm #{git_commit_list_path}]
%x[cd #{Rails.root};#{OrbitSystemPreference::GitLogCommend} >>#{git_commit_list_path} ]
end
def self.get_disk_free
@site.disk_space= %x[#{OrbitSystemPreference::DiskFree}]
end
def self.get_nginx_version
@info[:nginx] = %x[#{OrbitSystemPreference::SystemPackage::NginxVersion} ]
end
def self.get_MongoDB_version
@info[:mongodb] = %x[#{OrbitSystemPreference::SystemPackage::MongodbVersion} ]
end
def self.get_Linux_version
@info[:linux] = %x[#{OrbitSystemPreference::SystemPackage::SystemVersion} ]
end
def self.check_system_has_enough_space( limit =OrbitSystemPreference::DefaultDiskSpaceLimit )
binding.pry
end
end