Class: ASRake::Package

Inherits:
BaseExecutable show all
Includes:
Rake::DSL
Defined in:
lib/asrake/package.rb

Instance Attribute Summary collapse

Attributes inherited from BaseExecutable

#output, #output_dir, #output_file

Instance Method Summary collapse

Methods inherited from BaseExecutable

#merge_in, #output_is_dir?, #pathmap, #to_str

Constructor Details

#initialize(file = nil) ⇒ Package

Returns a new instance of Package.



12
13
14
# File 'lib/asrake/package.rb', line 12

def initialize(file=nil)
	super(file)
end

Instance Attribute Details

#filesObject

Returns the value of attribute files.



10
11
12
# File 'lib/asrake/package.rb', line 10

def files
  @files
end

Instance Method Details

#executeObject



30
31
32
33
34
35
36
37
# File 'lib/asrake/package.rb', line 30

def execute
	rm_r output rescue nil
	Zip::ZipFile.open(output, Zip::ZipFile::CREATE) do |zipfile|
		files.each do |to, from|
			zipfile.add(Path::forward(to), Path::forward(from))
		end
	end
end

#to_sObject



26
27
28
# File 'lib/asrake/package.rb', line 26

def to_s
	@output
end