11# Similar to:
22# https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/external_sources/abstract_external_source.rb
3- require 'cocoapods-embed-flutter/flutter/downloader '
3+ require 'cocoapods-embed-flutter/flutter'
44require 'cocoapods'
55
66module Flutter
77 module Pub
8+ # The ExternalSources modules name-spaces all the classes
9+ # for accessing remote Flutter projects.
10+ #
811 module ExternalSources
12+ # The keys accepted by the hash of the source attribute.
13+ #
914 SOURCE_KEYS = {
1015 :git => [ :tag , :branch , :commit , :submodules ] . freeze ,
1116 :svn => [ :folder , :tag , :revision ] . freeze ,
@@ -97,11 +102,9 @@ def ==(other)
97102
98103 public
99104
100- # @!group Subclasses hooks
101-
102105 # Fetches the external source from the remote according to the params.
103106 #
104- # @param [Sandbox] sandbox
107+ # @param [Pod:: Sandbox] sandbox
105108 # the sandbox where the specification should be stored.
106109 #
107110 # @return [void]
@@ -138,6 +141,12 @@ def normalized_pupspec_path(declared_path)
138141 Spec . find_file ( name , declared_path )
139142 end
140143
144+ # Return the normalized path for a pubspec assuming sandbox
145+ # pod folder as location.
146+ #
147+ # @return [String] The uri of the pubspec appending the name of the file
148+ # and expanding it if necessary.
149+ #
141150 def normalized_pupspec_path
142151 Spec . find_file ( name , target )
143152 end
@@ -146,21 +155,24 @@ def normalized_pupspec_path
146155
147156 # @! Subclasses helpers
148157
149- # Pre-downloads a Pod passing the options to the downloader and informing
150- # the sandbox.
158+ # Pre-downloads a flutter project passing the options to the downloader
159+ # and informing the sandbox.
151160 #
152- # @param [Sandbox] sandbox
153- # The sandbox where the Pod should be downloaded.
161+ # @param [Pod:: Sandbox] sandbox
162+ # The sandbox where the flutter project should be downloaded.
154163 #
155- # @note To prevent a double download of the repository the pod is
156- # marked as pre-downloaded indicating to the installer that only
164+ # @note To prevent a double download of the repository the flutter project
165+ # is marked as pre-downloaded indicating to the installer that only
157166 # clean operations are needed.
158167 #
159168 # @todo The downloader configuration is the same of the
160- # #{PodSourceInstaller} and it needs to be kept in sync.
169+ # #{Pod::Installer::PodSourceInstaller}
170+ # and it needs to be kept in sync.
161171 #
162172 # @return [void]
163173 #
174+ # @todo Implement caching for remote sources.
175+ #
164176 def pre_download ( sandbox )
165177 title = "Pre-downloading: `#{ name } ` #{ description } "
166178 Pod ::UI . titled_section ( title , :verbose_prefix => '-> ' ) do
@@ -185,13 +197,19 @@ def pre_download(sandbox)
185197 end
186198 end
187199
200+ # @return [Pod::Downloader::Request] the request to remote
201+ # flutter project source.
202+ #
188203 def download_request
189204 Pod ::Downloader ::Request . new (
190205 :name => name ,
191206 :params => params ,
192207 )
193208 end
194209
210+ # @return [String] the path where this flutter project
211+ # will be downloaded relative paths.
212+ #
195213 def target
196214 return Pod ::Config . instance . sandbox . pod_dir ( name )
197215 end
0 commit comments