@@ -38,12 +38,12 @@ def self.fetchWithNameAndOptions(name, options)
3838 options = options . last if options . is_a? ( Array )
3939 raise StandardError , "No options specified for flutter module: '#{ name } '." unless options . is_a? ( Hash )
4040
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 ) }
4442 source = DownloaderSource . new ( name , options , Pod ::Config . instance . podfile_path )
4543 source . fetch ( Pod ::Config . instance . sandbox )
4644 path = source . normalized_pupspec_path
45+ elsif options . key? ( :path )
46+ path = options [ :path ]
4747 else
4848 raise StandardError , "Invalid flutter module: '#{ name } '."
4949 end
@@ -116,8 +116,8 @@ def fetch(sandbox)
116116 # @return [String] a string representation of the source suitable for UI.
117117 #
118118 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
121121 url = options . delete ( strategy )
122122 result = "from `#{ url } `"
123123 options . each do |key , value |
@@ -148,7 +148,8 @@ def normalized_pupspec_path(declared_path)
148148 # and expanding it if necessary.
149149 #
150150 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 )
152153 end
153154
154155 private
@@ -203,10 +204,16 @@ def pre_download(sandbox)
203204 def download_request
204205 Pod ::Downloader ::Request . new (
205206 :name => name ,
206- :params => params ,
207+ :params => download_params ,
207208 )
208209 end
209210
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+
210217 # @return [String] the path where this flutter project
211218 # will be downloaded relative paths.
212219 #
0 commit comments