File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-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,17 @@ 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
57+
4758 #
4859 # The version identifier for this remote location. This is computed using
4960 # the name of the software, the version of the software, and the checksum.
@@ -182,11 +193,15 @@ def download
182193 # is copied over as a raw file.
183194 #
184195 def deploy
185- if downloaded_file . end_with? ( *ALL_EXTENSIONS )
196+ if downloaded_file . end_with? ( *ALL_EXTENSIONS ) && extract_required?
186197 log . info ( log_key ) { "Extracting `#{ safe_downloaded_file } ' to `#{ safe_project_dir } '" }
187198 extract
188199 else
189- log . info ( log_key ) { "`#{ safe_downloaded_file } ' is not an archive - copying to `#{ safe_project_dir } '" }
200+ if extract_required?
201+ log . info ( log_key ) { "`#{ safe_downloaded_file } ' has extraction disabled - copying to `#{ safe_project_dir } '" }
202+ else
203+ log . info ( log_key ) { "`#{ safe_downloaded_file } ' is not an archive - copying to `#{ safe_project_dir } '" }
204+ end
190205
191206 if File . directory? ( downloaded_file )
192207 # 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