Module: Deploy::Compress

Defined in:
lib/deploy.rb

Class Method Summary collapse

Class Method Details

.closure(content, file) ⇒ Object



95
96
97
# File 'lib/deploy.rb', line 95

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

.compile(file) ⇒ Object



85
86
87
88
89
# File 'lib/deploy.rb', line 85

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



80
81
82
83
# File 'lib/deploy.rb', line 80

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

.gzip(content, file) ⇒ Object



91
92
93
# File 'lib/deploy.rb', line 91

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