File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,8 @@ Here is an example:
151151name " ruby"
152152default_version " 1.9.2-p290"
153153source url: " http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{ version } .tar.gz" ,
154- md5: " 604da71839a6ae02b5b5b5e1b792d5eb"
154+ md5: " 604da71839a6ae02b5b5b5e1b792d5eb" ,
155+ extract: false
155156
156157dependency " zlib"
157158dependency " ncurses"
Original file line number Diff line number Diff line change @@ -44,6 +44,16 @@ def fetch_required?
4444 !( File . exist? ( downloaded_file ) && digest ( downloaded_file , digest_type ) == checksum )
4545 end
4646
47+ #
48+ # A extract is required if the downloaded_file is an archive and
49+ # source[:extract] is set to true if provided. Default: true
50+ #
51+ # @return [true, false]
52+ #
53+ def extract_required?
54+ return false unless downloaded_file . end_with? ( *ALL_EXTENSIONS )
55+ !source . key? ( :extract ) ? true : source [ :extract ]
56+ end
4757 #
4858 # The version identifier for this remote location. This is computed using
4959 # the name of the software, the version of the software, and the checksum.
@@ -182,11 +192,15 @@ def download
182192 # is copied over as a raw file.
183193 #
184194 def deploy
185- if downloaded_file . end_with? ( *ALL_EXTENSIONS )
195+ if downloaded_file . end_with? ( *ALL_EXTENSIONS ) && extract_required?
186196 log . info ( log_key ) { "Extracting `#{ safe_downloaded_file } ' to `#{ safe_project_dir } '" }
187197 extract
188198 else
189- log . info ( log_key ) { "`#{ safe_downloaded_file } ' is not an archive - copying to `#{ safe_project_dir } '" }
199+ if extract_required?
200+ log . info ( log_key ) { "`#{ safe_downloaded_file } ' has extraction disabled - copying to `#{ safe_project_dir } '" }
201+ else
202+ log . info ( log_key ) { "`#{ safe_downloaded_file } ' is not an archive - copying to `#{ safe_project_dir } '" }
203+ end
190204
191205 if File . directory? ( downloaded_file )
192206 # If the file itself was a directory, copy the whole thing over. This
You can’t perform that action at this time.
0 commit comments