@@ -38,12 +38,12 @@ def self.fetchWithNameAndOptions(name, options)
38
38
options = options . last if options . is_a? ( Array )
39
39
raise StandardError , "No options specified for flutter module: '#{ name } '." unless options . is_a? ( Hash )
40
40
41
- if options . key? ( :path )
42
- path = options [ :path ]
43
- elsif SOURCE_KEYS . keys . any? { |key | options . key? ( key ) }
41
+ if SOURCE_KEYS . keys . any? { |key | options . key? ( key ) }
44
42
source = DownloaderSource . new ( name , options , Pod ::Config . instance . podfile_path )
45
43
source . fetch ( Pod ::Config . instance . sandbox )
46
44
path = source . normalized_pupspec_path
45
+ elsif options . key? ( :path )
46
+ path = options [ :path ]
47
47
else
48
48
raise StandardError , "Invalid flutter module: '#{ name } '."
49
49
end
@@ -116,8 +116,8 @@ def fetch(sandbox)
116
116
# @return [String] a string representation of the source suitable for UI.
117
117
#
118
118
def description
119
- strategy = Pod ::Downloader . strategy_from_options ( params )
120
- options = params . dup
119
+ strategy = Pod ::Downloader . strategy_from_options ( download_params )
120
+ options = download_params . dup
121
121
url = options . delete ( strategy )
122
122
result = "from `#{ url } `"
123
123
options . each do |key , value |
@@ -148,7 +148,8 @@ def normalized_pupspec_path(declared_path)
148
148
# and expanding it if necessary.
149
149
#
150
150
def normalized_pupspec_path
151
- Spec . find_file ( name , target )
151
+ search_path = params [ :path ] . nil? ? target : File . expand_path ( params [ :path ] , target )
152
+ Spec . find_file ( name , search_path )
152
153
end
153
154
154
155
private
@@ -203,10 +204,16 @@ def pre_download(sandbox)
203
204
def download_request
204
205
Pod ::Downloader ::Request . new (
205
206
:name => name ,
206
- :params => params ,
207
+ :params => download_params ,
207
208
)
208
209
end
209
210
211
+ # @return [Hash] the options for remote source download.
212
+ #
213
+ def download_params
214
+ params . select { |key , value | !key . equal? ( :path ) }
215
+ end
216
+
210
217
# @return [String] the path where this flutter project
211
218
# will be downloaded relative paths.
212
219
#
0 commit comments