Added backwards compat override to Dir class
This commit is contained in:
parent
713ea521c8
commit
696a71bd8b
@ -30,6 +30,15 @@ class Dir
|
|||||||
output_path
|
output_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
## For backwards compat
|
||||||
|
def chdir(dir = nil &block)
|
||||||
|
if dir.nil?
|
||||||
|
Dir.chdir(self, &block)
|
||||||
|
else
|
||||||
|
Dir.chdir(dir, &block)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class String
|
class String
|
||||||
@ -170,7 +179,7 @@ class Installer
|
|||||||
file_contents = Net::HTTP.get(uri)
|
file_contents = Net::HTTP.get(uri)
|
||||||
output_file = "discord-#{version}.tar.gz"
|
output_file = "discord-#{version}.tar.gz"
|
||||||
puts "download_installer: Output file will #{output_file}"
|
puts "download_installer: Output file will #{output_file}"
|
||||||
Dir.chdir($CONFIG[:install_dir]) do
|
$CONFIG[:install_dir].chdir do
|
||||||
File.open(output_file, 'wb') do |file|
|
File.open(output_file, 'wb') do |file|
|
||||||
file.write(file_contents)
|
file.write(file_contents)
|
||||||
end
|
end
|
||||||
@ -181,7 +190,7 @@ class Installer
|
|||||||
def install
|
def install
|
||||||
installer_file = "discord-#{self.remote_version}.tar.gz"
|
installer_file = "discord-#{self.remote_version}.tar.gz"
|
||||||
puts "do_install: Extracting new installer"
|
puts "do_install: Extracting new installer"
|
||||||
Dir.chdir($CONFIG[:install_dir]) do
|
$CONFIG[:install_dir].chdir do
|
||||||
File.open(installer_file, 'rb') do |file|
|
File.open(installer_file, 'rb') do |file|
|
||||||
Gem::Package.new("").extract_tar_gz(file, $CONFIG[:install_dir])
|
Gem::Package.new("").extract_tar_gz(file, $CONFIG[:install_dir])
|
||||||
end
|
end
|
||||||
@ -249,7 +258,7 @@ def make_backup
|
|||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir(Dir.home) do
|
Dir.chdir(Dir.home) do
|
||||||
puts "make_backup: Beginning backup process (OUTPUT_FILE = #{Dir.getwd}/#{$CONFIG[:backup_filename]})"
|
puts "make_backup: Beginning backup process (OUTPUT_FILE = #{Dir.getwd/$CONFIG[:backup_filename]})"
|
||||||
File.open($CONFIG[:backup_filename], "wb") do |backup_file|
|
File.open($CONFIG[:backup_filename], "wb") do |backup_file|
|
||||||
Zlib::GzipWriter.wrap(backup_file) do |gzip|
|
Zlib::GzipWriter.wrap(backup_file) do |gzip|
|
||||||
Gem::Package::TarWriter.new(gzip) do |tar|
|
Gem::Package::TarWriter.new(gzip) do |tar|
|
||||||
|
Loading…
Reference in New Issue
Block a user