Class: LogicalConstruct::TarballTask
- Inherits:
-
Mattock::Rake::FileCommandTask
- Object
- Mattock::Rake::FileCommandTask
- LogicalConstruct::TarballTask
show all
- Defined in:
- lib/logical-construct/archive-tasks.rb
Instance Method Summary
collapse
Instance Method Details
#action_flag(string) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/logical-construct/archive-tasks.rb', line 56
def action_flag(string)
case string
when "c", /create/
"--create"
when "x", /extract/
"--extract"
when "d", /compare/
"--compare"
else
string
end
end
|
#add_options(tar) ⇒ Object
69
70
71
|
# File 'lib/logical-construct/archive-tasks.rb', line 69
def add_options(tar)
tar.options << "--files-from=" + listfile
end
|
#default_configuration ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/logical-construct/archive-tasks.rb', line 14
def default_configuration
super
self.compression_flag ||=
case compression
when :auto
"--auto-compress"
when :gzip
"--gzip"
when :bzip, :bzip2
"--bzip2"
when :xz
"--xz"
when :lzip
"--lzip"
when :lzma
"--lzma"
when :lzop
"--lzop"
when :compress
"--compress"
else
""
end
self.basename = name
end
|
#resolve_configuration ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/logical-construct/archive-tasks.rb', line 41
def resolve_configuration
extension.sub(/[.]$/,'')
unpacked_parent.absolute_path ||= absolute_path
archive_parent.absolute_path ||= absolute_path
unless basename.nil?
unpacked_dir.relative_path ||= basename
archive.relative_path ||= [basename, extension].join(".")
end
resolve_paths
super
end
|
#tar_command(action, verbose = true, &block) ⇒ Object
73
74
75
76
77
78
|
# File 'lib/logical-construct/archive-tasks.rb', line 73
def tar_command(action, verbose = true, &block)
tar_command_without_directory(action, verbose) do |tar|
tar.options << "--directory="+unpacked_dir.absolute_path
yield tar if block_given?
end
end
|
#tar_command_without_directory(action, verbose = true) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/logical-construct/archive-tasks.rb', line 80
def tar_command_without_directory(action, verbose = true)
command = cmd("tar") do |tar|
tar.options << action
tar.options << "--verbose" if verbose
tar.options << compression_flag
tar.options << "--file="+archive.absolute_path
tar.options << "--exclude-vcs" if exclude_vcs
yield(tar) if block_given?
end
return command
end
|