Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ Here is an example:
name "ruby"
default_version "1.9.2-p290"
source url: "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
md5: "604da71839a6ae02b5b5b5e1b792d5eb"
md5: "604da71839a6ae02b5b5b5e1b792d5eb",
extract: false

dependency "zlib"
dependency "ncurses"
Expand Down
19 changes: 17 additions & 2 deletions lib/omnibus/fetchers/net_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ def fetch_required?
!(File.exist?(downloaded_file) && digest(downloaded_file, digest_type) == checksum)
end

#
# A extract is required if the downloaded_file is an archive and
# source[:extract] is set to true if provided. Default: true
#
# @return [true, false]
#
def extract_required?
return false unless downloaded_file.end_with?(*ALL_EXTENSIONS)
!source.key?(:extract) ? true : source[:extract]
end

#
# The version identifier for this remote location. This is computed using
# the name of the software, the version of the software, and the checksum.
Expand Down Expand Up @@ -182,11 +193,15 @@ def download
# is copied over as a raw file.
#
def deploy
if downloaded_file.end_with?(*ALL_EXTENSIONS)
if downloaded_file.end_with?(*ALL_EXTENSIONS) && extract_required?
log.info(log_key) { "Extracting `#{safe_downloaded_file}' to `#{safe_project_dir}'" }
extract
else
log.info(log_key) { "`#{safe_downloaded_file}' is not an archive - copying to `#{safe_project_dir}'" }
if extract_required?
log.info(log_key) { "`#{safe_downloaded_file}' has extraction disabled - copying to `#{safe_project_dir}'" }
else
log.info(log_key) { "`#{safe_downloaded_file}' is not an archive - copying to `#{safe_project_dir}'" }
end

if File.directory?(downloaded_file)
# If the file itself was a directory, copy the whole thing over. This
Expand Down