Class: TerminalBuild
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- TerminalBuild
- Includes:
- Redis::Objects
- Defined in:
- app/models/terminal_build.rb
Instance Method Summary collapse
Instance Method Details
#build_hashes ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/models/terminal_build.rb', line 57 def build_hashes files = Dir.glob("#{path}/**/**", File::FNM_DOTMATCH).select{|x| File.file? x}.map!{|x| x.gsub path+'/', ''} hashes = {} files.each do |file| hashes[file] = [ Digest::MD5.file("#{path}/#{file}").hexdigest, File.size?("#{path}/#{file}") ] end hashes end |
#path ⇒ Object
41 42 43 |
# File 'app/models/terminal_build.rb', line 41 def path Rails.root.join("public/builds/#{id}").to_s end |
#read_version ⇒ Object
49 50 51 52 53 54 55 |
# File 'app/models/terminal_build.rb', line 49 def read_version return unless source.present? Zip::ZipFile.open(source.path) do |zip_file| return zip_file.read('VERSION').strip rescue nil end end |
#url ⇒ Object
45 46 47 |
# File 'app/models/terminal_build.rb', line 45 def url "/builds/#{id}" end |