Class: Gonzui::DebAptGet
Instance Attribute Summary
#temporary_directory
Class Method Summary
collapse
Instance Method Summary
collapse
#add_cleaning_proc, #clean, #extract, #initialize, #run_apt_get
#clean_temporary_directory, #prepare_temporary_directory, #set_temporary_directory
Methods included from Util
assert, assert_equal, assert_equal_all, assert_non_nil, assert_not_reached, benchmark, command_exist?, commify, eprintf, format_bytes, program_name, protect_from_signals, require_command, set_verbosity, shell_escape, unix?, vprintf, windows?, wprintf
Class Method Details
.apt_type ⇒ Object
102
103
104
|
# File 'lib/gonzui/apt.rb', line 102
def self.apt_type
:deb
end
|
Instance Method Details
#contains_single_tarball?(directory) ⇒ Boolean
133
134
135
136
137
138
|
# File 'lib/gonzui/apt.rb', line 133
def contains_single_tarball?(directory)
entries = Dir.entries_without_dots(directory)
entries.delete("debian")
entries.delete("CVS") entries.length == 1 and Extractor.supported_file?(entries.first)
end
|
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/gonzui/apt.rb', line 140
def
remove_deb_files
source_directory = find_deb_source_directory
if contains_single_tarball?(source_directory)
archive_file_name = find_archive(source_directory)
= Extractor.new(@config, archive_file_name)
add_cleaning_proc(lambda{ .clean_temporary_directory })
return .
else
return source_directory
end
end
|
#find_archive(directory) ⇒ Object
#find_deb_source_directory ⇒ Object
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/gonzui/apt.rb', line 114
def find_deb_source_directory
entries = Dir.entries_without_dots(self.temporary_directory)
directory = entries.map {|entry|
File.join(self.temporary_directory, entry)
}.find {|path|
File.directory?(path)
}
raise AptGetError.new("#{@package_name}: source directory not found") if
directory.nil?
return directory
end
|
#remove_deb_files ⇒ Object
126
127
128
129
130
131
|
# File 'lib/gonzui/apt.rb', line 126
def remove_deb_files
Dir.entries(self.temporary_directory).each {|entry|
file_name = File.join(self.temporary_directory, entry)
File.unlink(file_name) if File.file?(file_name)
}
end
|