Always chdir.
This commit is contained in:
parent
28fd59672a
commit
528b4b367e
@ -14,8 +14,8 @@ class AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :meta, :name, :version
|
attr_reader :meta, :name, :version, :shutup
|
||||||
attr_reader :shutup
|
private :meta, :name, :version, :shutup
|
||||||
|
|
||||||
def initialize(url, name, version, **meta)
|
def initialize(url, name, version, **meta)
|
||||||
@url = url
|
@url = url
|
||||||
@ -52,8 +52,22 @@ class AbstractDownloadStrategy
|
|||||||
.extract_nestedly(basename: basename_without_params,
|
.extract_nestedly(basename: basename_without_params,
|
||||||
extension_only: true,
|
extension_only: true,
|
||||||
verbose: ARGV.verbose? && !shutup)
|
verbose: ARGV.verbose? && !shutup)
|
||||||
|
chdir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def chdir
|
||||||
|
entries = Dir["*"]
|
||||||
|
case entries.length
|
||||||
|
when 0 then raise "Empty archive"
|
||||||
|
when 1 then begin
|
||||||
|
Dir.chdir entries.first
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
private :chdir
|
||||||
|
|
||||||
# @!attribute [r] cached_location
|
# @!attribute [r] cached_location
|
||||||
# The path to the cached file or directory associated with the resource.
|
# The path to the cached file or directory associated with the resource.
|
||||||
def cached_location; end
|
def cached_location; end
|
||||||
@ -180,18 +194,6 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def chdir
|
|
||||||
entries = Dir["*"]
|
|
||||||
case entries.length
|
|
||||||
when 0 then raise "Empty archive"
|
|
||||||
when 1 then begin
|
|
||||||
Dir.chdir entries.first
|
|
||||||
rescue
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def ext
|
def ext
|
||||||
# We need a Pathname because we've monkeypatched extname to support double
|
# We need a Pathname because we've monkeypatched extname to support double
|
||||||
# extensions (e.g. tar.gz).
|
# extensions (e.g. tar.gz).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user