Class: Gonzui::AbstractAptGet
Instance Attribute Summary
#temporary_directory
Instance Method Summary
collapse
#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
Constructor Details
#initialize(config, package_name) ⇒ AbstractAptGet
Returns a new instance of AbstractAptGet.
60
61
62
63
64
65
66
|
# File 'lib/gonzui/apt.rb', line 60
def initialize(config, package_name)
@config = config
@package_name = package_name
@apt_options = ""
@cleaning_procs = []
set_temporary_directory(config.temporary_directory)
end
|
Instance Method Details
#add_cleaning_proc(proc) ⇒ Object
84
85
86
|
# File 'lib/gonzui/apt.rb', line 84
def add_cleaning_proc(proc)
@cleaning_procs.push(proc)
end
|
#clean ⇒ Object
95
96
97
98
|
# File 'lib/gonzui/apt.rb', line 95
def clean
@cleaning_procs.each {|proc| proc.call }
clean_temporary_directory
end
|
89
90
91
92
93
|
# File 'lib/gonzui/apt.rb', line 89
def
prepare_temporary_directory
run_apt_get
return
end
|
80
81
82
|
# File 'lib/gonzui/apt.rb', line 80
def
NotImplementedError.new("should be implemented in a sub class")
end
|
#run_apt_get ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/gonzui/apt.rb', line 68
def run_apt_get
cd = "cd"
cd << " /d" if (/mswin|mingw|bccwin/ =~ RUBY_PLATFORM)
command_line = sprintf("#{cd} %s && apt-get -qq %s source %s >/dev/null 2>&1",
shell_escape(self.temporary_directory),
@apt_options,
shell_escape(@package_name))
status = system(command_line)
raise AptGetError.new("#{@package_name}: unable to get sources") if
status == false
end
|