lib/awestruct/deploy/base_deploy.rb in awestruct-0.5.4.rc vs lib/awestruct/deploy/base_deploy.rb in awestruct-0.5.4.rc2

- old
+ new

@@ -1,7 +1,9 @@ require 'awestruct/deployers' require 'awestruct/compatibility' +require 'awestruct/util/exception_helper' + Dir[ File.join( File.dirname(__FILE__), '..', 'scm', '*.rb' ) ].each do |f| begin require f rescue LoadError => e raise e 'Something horribly, horribly wrong has happened' @@ -16,10 +18,11 @@ def initialize(site_config, deploy_config) # Add a single front slash at the end of output dir @site_path = File.join( site_config.output_dir, '/' ).gsub(/^\w:\//, '/') @gzip = deploy_config['gzip'] + @gzip_level = deploy_config['gzip_level'] || Zlib::BEST_COMPRESSION @source_dir = deploy_config['source_dir'] || site_config.dir @ignore_uncommitted = deploy_config['uncommitted'] init_scm(deploy_config['scm'] || 'git') end @@ -59,20 +62,20 @@ ext_sym = ext[1..-1].to_sym case ext_sym when :css, :js, :html require 'zlib' if !is_gzipped item - gzip_file item + gzip_file(item, @gzip_level) end end end end end - def gzip_file(filename) + def gzip_file(filename, level) $LOG.debug "Gzipping File #{filename}" - Zlib::GzipWriter.open("#{filename}.gz") do |gz| + Zlib::GzipWriter.open("#{filename}.gz", level) do |gz| gz.mtime = File.mtime(filename) gz.orig_name = filename gz.write File.binread(filename) end File.rename("#{filename}.gz", "#{filename}") @@ -92,10 +95,10 @@ def init_scm type begin clazz = Object.const_get('Awestruct').const_get('Scm').const_get(type.capitalize) @scm = clazz.new rescue - $LOG.error( "Could not resolve class for scm type: #{type}" ) if $LOG.error? + ExceptionHelper.log_message( "Could not resolve class for scm type: #{type}" ) end end end end end