Class: Rant::Generators::Package::Zip

Inherits:
Archive::Zip show all
Defined in:
lib/rant/import/package/zip.rb

Instance Attribute Summary

Attributes inherited from Archive::Base

#archive_path, #ch

Instance Method Summary collapse

Methods inherited from Archive::Zip

#define_task, #initialize, #rubyzip

Methods inherited from Archive::Base

#define_manifest_task, #get_archive_path, #get_files, #initialize, #path, #rac, #rac=, rant_gen, #with_manifest

Methods included from MetaUtils

#rant_attr, #rant_flag, #redirect_accessor, #redirect_message, #redirect_reader, #redirect_writer, #string_attr, #valid_attr_name

Constructor Details

This class inherits a constructor from Rant::Generators::Archive::Zip

Instance Method Details

#define_rubyzip_taskObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rant/import/package/zip.rb', line 25

def define_rubyzip_task
    define_task_for_dir do
	fn = @dist_dirname + (@extension ? @extension : "")
	old_pwd = Dir.pwd
	begin
                   Dir.chdir @dist_root
                   rubyzip fn, @dist_dirname, :recurse => true
	ensure
	    Dir.chdir old_pwd
	end
    end
end

#define_zip_taskObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rant/import/package/zip.rb', line 10

def define_zip_task
    define_task_for_dir do
	fn = @dist_dirname + (@extension ? @extension : "")
	old_pwd = Dir.pwd
	Dir.chdir @dist_root
               # zip adds to existing archive
               @rac.cx.sys.rm_f fn if test ?e, fn
	# zip options:
	#   y: store symlinks instead of referenced files
	#   r: recurse into directories
	#   q: quiet operation
	@rac.cx.sys %W(zip -yqr #{fn} #@dist_dirname)
	Dir.chdir old_pwd
    end
end