Module: Deploy::Compress

Defined in:
lib/deploy.rb

Class Method Summary collapse

Class Method Details

.closure(content, file) ⇒ Object



97
98
99
# File 'lib/deploy.rb', line 97

def self.closure(content, file)
  Closure::Compiler.new.compile(content)
end

.compile(file) ⇒ Object



87
88
89
90
91
# File 'lib/deploy.rb', line 87

def self.compile(file)
  content = File.read(file).encode!('UTF-8', 'UTF-8', :invalid => :replace) 
  content = closure(content, file)
  gzip(content, file)
end

.compress(file) ⇒ Object



82
83
84
85
# File 'lib/deploy.rb', line 82

def self.compress(file)
  content = File.read(file).encode!('UTF-8', 'UTF-8', :invalid => :replace) 
  gzip(content, file)
end

.gzip(content, file) ⇒ Object



93
94
95
# File 'lib/deploy.rb', line 93

def self.gzip(content, file)
  Zlib::GzipWriter.open("#{file}.gz") {|f| f.write(content) }
end