1
1
# Similar to:
2
2
# 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'
4
4
require 'cocoapods'
5
5
6
6
module Flutter
7
7
module Pub
8
+ # The ExternalSources modules name-spaces all the classes
9
+ # for accessing remote Flutter projects.
10
+ #
8
11
module ExternalSources
12
+ # The keys accepted by the hash of the source attribute.
13
+ #
9
14
SOURCE_KEYS = {
10
15
:git => [ :tag , :branch , :commit , :submodules ] . freeze ,
11
16
:svn => [ :folder , :tag , :revision ] . freeze ,
@@ -97,11 +102,9 @@ def ==(other)
97
102
98
103
public
99
104
100
- # @!group Subclasses hooks
101
-
102
105
# Fetches the external source from the remote according to the params.
103
106
#
104
- # @param [Sandbox] sandbox
107
+ # @param [Pod:: Sandbox] sandbox
105
108
# the sandbox where the specification should be stored.
106
109
#
107
110
# @return [void]
@@ -138,6 +141,12 @@ def normalized_pupspec_path(declared_path)
138
141
Spec . find_file ( name , declared_path )
139
142
end
140
143
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
+ #
141
150
def normalized_pupspec_path
142
151
Spec . find_file ( name , target )
143
152
end
@@ -146,21 +155,24 @@ def normalized_pupspec_path
146
155
147
156
# @! Subclasses helpers
148
157
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.
151
160
#
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.
154
163
#
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
157
166
# clean operations are needed.
158
167
#
159
168
# @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.
161
171
#
162
172
# @return [void]
163
173
#
174
+ # @todo Implement caching for remote sources.
175
+ #
164
176
def pre_download ( sandbox )
165
177
title = "Pre-downloading: `#{ name } ` #{ description } "
166
178
Pod ::UI . titled_section ( title , :verbose_prefix => '-> ' ) do
@@ -185,13 +197,19 @@ def pre_download(sandbox)
185
197
end
186
198
end
187
199
200
+ # @return [Pod::Downloader::Request] the request to remote
201
+ # flutter project source.
202
+ #
188
203
def download_request
189
204
Pod ::Downloader ::Request . new (
190
205
:name => name ,
191
206
:params => params ,
192
207
)
193
208
end
194
209
210
+ # @return [String] the path where this flutter project
211
+ # will be downloaded relative paths.
212
+ #
195
213
def target
196
214
return Pod ::Config . instance . sandbox . pod_dir ( name )
197
215
end
0 commit comments