cocoapods-flutter-dt 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +13 -0
- data/cocoapods-flutter.gemspec +28 -0
- data/lib/cocoapods-flutter.rb +1 -0
- data/lib/cocoapods-flutter/command.rb +1 -0
- data/lib/cocoapods-flutter/command/flutter.rb +23 -0
- data/lib/cocoapods-flutter/command/flutter/archive.rb +50 -0
- data/lib/cocoapods-flutter/gem_version.rb +3 -0
- data/lib/cocoapods-flutter/native.rb +8 -0
- data/lib/cocoapods-flutter/native/archive/archive.rb +334 -0
- data/lib/cocoapods-flutter/native/archive/command_runner.rb +17 -0
- data/lib/cocoapods-flutter/native/archive/remote.rb +45 -0
- data/lib/cocoapods-flutter/native/archive/zip_tool.rb +56 -0
- data/lib/cocoapods-flutter/native/pod_source_preparer.rb +35 -0
- data/lib/cocoapods-flutter/native/podfile.rb +263 -0
- data/lib/cocoapods-flutter/native/specification/consumer.rb +8 -0
- data/lib/cocoapods-flutter/native/specification/dsl.rb +18 -0
- data/lib/cocoapods-flutter/native/specification/dsl/attribute.rb +12 -0
- data/lib/cocoapods-flutter/native/specification/set.rb +21 -0
- data/lib/cocoapods-flutter/native/specification/set/presenter.rb +13 -0
- data/lib/cocoapods_plugin.rb +2 -0
- data/spec/command/flutter_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5bed8dc160bb69508717eddc4e3f8a7666dec9765a1f23342dfb6c59424a9a4a
|
4
|
+
data.tar.gz: fb4a26c1694ddbd9cf88ac24b9482aa7208c80b32764added0a40ce348a656c4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6c07e00b95ae952d155c59f5d8437fb1c59bbfa6f2269c0768efbe2bf2a7f2d3679c5368532c1f242aaabc71aeada7afcbed739996de6d5edbc58ab779074d1b
|
7
|
+
data.tar.gz: 385c6793709ddfaacdfb954536b83fe6da2e2117b4fa7098edb39722ce60e108e689ed31b5ff8fa774284d2fd8aeefe79572ddbb474e6052387700dea5805cc9
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in cocoapods-flutter.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'cocoapods'
|
8
|
+
|
9
|
+
gem 'mocha'
|
10
|
+
gem 'bacon'
|
11
|
+
gem 'mocha-on-bacon'
|
12
|
+
gem 'prettybacon'
|
13
|
+
gem 'rubyzip'
|
14
|
+
gem 'molinillo'
|
15
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2020 Dreamtracer <jinqiucheng1006@live.cn>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# cocoapods-flutter
|
2
|
+
|
3
|
+
cocoapods plugin for integration Flutter easily.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
**Precondition**
|
8
|
+
Before you use `cocoapods-flutter`, make sure binary server and archive CI tool is ready. I provide you an archive tool and a binary server. Click link below and redirect to another repository.
|
9
|
+
|
10
|
+
[BinaryServer](https://github.com/NicolasKim/binary_server.git)
|
11
|
+
[FlutterArchiveTool](https://github.com/NicolasKim/flutter_archive.git)
|
12
|
+
|
13
|
+
**Gem install**
|
14
|
+
|
15
|
+
```
|
16
|
+
$ gem install cocoapods-flutter
|
17
|
+
```
|
18
|
+
Or download source code build gem on your own
|
19
|
+
```
|
20
|
+
$ gem install cocoapods-flutter.gem
|
21
|
+
```
|
22
|
+
|
23
|
+
**Config environment**
|
24
|
+
```
|
25
|
+
$ export FLUTTER_BINARY_SERVER_BASEURL=https://www.example.com
|
26
|
+
```
|
27
|
+
Here is simple [binary server](https://github.com/NicolasKim/binary_server.git)
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
In Podfile
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
### Case 1
|
35
|
+
```ruby
|
36
|
+
flutter_pod 'package_name', '0.0.1', :mode=>'debug/release', :sdk_version=>'1.12.13'
|
37
|
+
```
|
38
|
+
|
39
|
+
**package_name**
|
40
|
+
Name of package
|
41
|
+
**:sdk_version**
|
42
|
+
Flutter sdk version,default is 1.12.13
|
43
|
+
**:mode**
|
44
|
+
Download binary package of version of debug/release from binary server. On mode debug, of course you can attach, and on mode release, yeah it is just release.
|
45
|
+
|
46
|
+
### Case 2
|
47
|
+
```ruby
|
48
|
+
flutter_pod 'PACKAGE_NAME', :path=>'local/module/path'
|
49
|
+
```
|
50
|
+
**:path**
|
51
|
+
Local path of module
|
52
|
+
|
53
|
+
and `pod install`
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods-flutter/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-flutter-dt'
|
8
|
+
spec.version = CocoapodsFlutter::VERSION
|
9
|
+
spec.authors = ['Dreamtracer']
|
10
|
+
spec.email = ['jinqiucheng1006@live.cn']
|
11
|
+
spec.description = %q{A short description of cocoapods-flutter.}
|
12
|
+
spec.summary = %q{A longer description of cocoapods-flutter.}
|
13
|
+
spec.homepage = 'https://github.com/EXAMPLE/cocoapods-flutter'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'parallel'
|
22
|
+
spec.add_dependency 'cocoapods', '~> 1.4'
|
23
|
+
spec.add_dependency 'rubyzip', '>= 1.0.0'
|
24
|
+
spec.add_dependency 'rest-client'
|
25
|
+
spec.add_dependency 'molinillo', '~> 0.6.6'
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-flutter/gem_version'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-flutter/command/flutter'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'cocoapods-flutter/command/flutter/archive'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Flutter < Command
|
6
|
+
self.summary = ''
|
7
|
+
|
8
|
+
self.description = <<-DESC
|
9
|
+
flutter command line tools
|
10
|
+
DESC
|
11
|
+
|
12
|
+
def initialize(argv)
|
13
|
+
@help = argv.flag?('help')
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def validate!
|
18
|
+
super
|
19
|
+
banner! if @help
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'cocoapods-flutter/native/archive/archive'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Flutter < Command
|
6
|
+
class Archive < Flutter
|
7
|
+
self.summary = 'archive flutter'
|
8
|
+
self.description = <<-DESC
|
9
|
+
发布二进制组件 / 源码组件
|
10
|
+
DESC
|
11
|
+
|
12
|
+
self.arguments = [
|
13
|
+
CLAide::Argument.new(['MODULE', 'VERSION', 'PODREPO'], false)
|
14
|
+
]
|
15
|
+
|
16
|
+
def self.options
|
17
|
+
[
|
18
|
+
['--repo', 'podspec repo'],
|
19
|
+
['--sources', 'podspec sources'],
|
20
|
+
['--upgrade', 'pub upgrade'],
|
21
|
+
['--wrapper', 'Default is flutter'],
|
22
|
+
['--flutterversion', 'FlutterSDK version'],
|
23
|
+
['--buildrun', 'run build-runner']
|
24
|
+
].concat(Pod::Command::Repo::Push.options).concat(super).uniq
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize(argv)
|
28
|
+
@module_name = argv.shift_argument
|
29
|
+
@version = argv.shift_argument
|
30
|
+
@pod_repo = argv.option('repo', 'master')
|
31
|
+
@sources = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
|
32
|
+
@flutter_wrapper = argv.option('wrapper', 'flutter')
|
33
|
+
@pub_upgrade = argv.flag?('upgrade', true)
|
34
|
+
@flutter_version = argv.option('flutterversion', '1.12.13')
|
35
|
+
@build_run = argv.flag?('buildrun', true)
|
36
|
+
@working_dir = Dir.pwd
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
archiver = Archiver.new(@module_name, @version, @sources, @flutter_wrapper, @pub_upgrade, @flutter_version, @build_run, @working_dir,@pod_repo)
|
42
|
+
archiver.archive
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods-flutter/native/specification/dsl'
|
3
|
+
require 'cocoapods-flutter/native/specification/set'
|
4
|
+
require 'cocoapods-flutter/native/specification/consumer'
|
5
|
+
require 'cocoapods-flutter/native/podfile'
|
6
|
+
require 'cocoapods-flutter/native/pod_source_preparer'
|
7
|
+
require 'cocoapods-flutter/native/archive/archive'
|
8
|
+
require 'cocoapods-flutter/native/archive/command_runner'
|
@@ -0,0 +1,334 @@
|
|
1
|
+
require 'cocoapods-flutter/native/archive/command_runner'
|
2
|
+
require 'cocoapods'
|
3
|
+
require 'zip'
|
4
|
+
require 'cocoapods-flutter/native/archive/zip_tool'
|
5
|
+
require 'cocoapods-flutter/native/archive/remote'
|
6
|
+
require 'molinillo'
|
7
|
+
|
8
|
+
class Archiver
|
9
|
+
|
10
|
+
class Plugins
|
11
|
+
attr_reader :spec
|
12
|
+
attr_reader :path
|
13
|
+
attr_reader :name
|
14
|
+
def initialize(name, path, spec)
|
15
|
+
@name = name
|
16
|
+
@path = path
|
17
|
+
@spec = spec
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Dependency < Hash
|
22
|
+
attr_reader :name
|
23
|
+
attr_reader :version
|
24
|
+
def initialize(name, version)
|
25
|
+
@name = name
|
26
|
+
@version = version
|
27
|
+
end
|
28
|
+
def to_hash()
|
29
|
+
{:name => name, :version => version}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
public
|
34
|
+
|
35
|
+
def initialize(module_name, version, sources, flutter_wrapper, pub_upgrade, flutter_version, build_run, working_dir, repo)
|
36
|
+
@module_name = module_name
|
37
|
+
@version = version
|
38
|
+
@sources = sources
|
39
|
+
@flutter_wrapper = flutter_wrapper
|
40
|
+
@pub_upgrade = pub_upgrade
|
41
|
+
@flutter_version = flutter_version
|
42
|
+
@build_run = build_run
|
43
|
+
@working_dir = working_dir
|
44
|
+
@product_dir = "#{@working_dir}/.product/"
|
45
|
+
@pod_repo = repo
|
46
|
+
end
|
47
|
+
|
48
|
+
def archive
|
49
|
+
|
50
|
+
@pub_upgrade ? pub_upgrade : pub_get
|
51
|
+
setup_pod_sources
|
52
|
+
if @build_run
|
53
|
+
excute_build_run
|
54
|
+
end
|
55
|
+
build_framework
|
56
|
+
@plugins = fetch_plugins
|
57
|
+
debug
|
58
|
+
release
|
59
|
+
Pod::UserInterface.message "All is ready to use!, now you can use 'flutter_pod '#{@module_name}', '#{@version}', :mode=>'debug/release' to use the pod"
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def release
|
65
|
+
app_file, sdk_file = zip_files @plugins, 'Release'
|
66
|
+
upload_files app_file, sdk_file, 'Release'
|
67
|
+
make_pod 'Release'
|
68
|
+
end
|
69
|
+
|
70
|
+
def debug
|
71
|
+
app_file, sdk_file = zip_files @plugins, 'Debug'
|
72
|
+
upload_files app_file, sdk_file, 'Debug'
|
73
|
+
make_pod 'Debug'
|
74
|
+
end
|
75
|
+
|
76
|
+
def pub_upgrade
|
77
|
+
if CommandRunner.run(@flutter_wrapper, 'pub', 'upgrade') == false
|
78
|
+
raise "Pub upgrade fail"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def pub_get
|
83
|
+
if CommandRunner.run(@flutter_wrapper, 'pub', 'get') == false
|
84
|
+
raise "Pub get fail"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def setup_pod_sources
|
89
|
+
Pod::UserInterface.info 'Setup pod sources...'
|
90
|
+
origin_pod_file_root_dir = @working_dir + '/.ios'
|
91
|
+
origin_pod_file_dir = origin_pod_file_root_dir+ '/Podfile'
|
92
|
+
temp_pod_file_dir_1 = @working_dir + '/tmp1.txt'
|
93
|
+
temp_pod_file_dir_2 = @working_dir + '/tmp2.txt'
|
94
|
+
if File.exist? temp_pod_file_dir_1
|
95
|
+
FileUtils.remove_file temp_pod_file_dir_1
|
96
|
+
end
|
97
|
+
if File.exist? temp_pod_file_dir_2
|
98
|
+
FileUtils.remove_file temp_pod_file_dir_2
|
99
|
+
end
|
100
|
+
|
101
|
+
# origin_pod_file = File.open origin_pod_file_dir
|
102
|
+
temp_pod_file_1 = File.open temp_pod_file_dir_1, "w+"
|
103
|
+
temp_pod_file_2 = File.open temp_pod_file_dir_2, "w+"
|
104
|
+
|
105
|
+
@sources.each do |s|
|
106
|
+
temp_pod_file_2.puts "source '#{s}'"
|
107
|
+
end
|
108
|
+
|
109
|
+
lines = IO.readlines(origin_pod_file_dir)
|
110
|
+
|
111
|
+
lines.each do |line|
|
112
|
+
if line =~ /platform\s+:ios\s*,\s*'\s*[0-9]*.[0-9]*\s*'/
|
113
|
+
temp_pod_file_1.puts "platform :ios, '9.0'"
|
114
|
+
elsif line =~ /source\s+/
|
115
|
+
Pod::UserInterface.message 'Ignore ' + line
|
116
|
+
else
|
117
|
+
temp_pod_file_1.puts line
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
temp_pod_file_1.close
|
122
|
+
|
123
|
+
lines = IO.readlines(temp_pod_file_1)
|
124
|
+
lines.each do |line|
|
125
|
+
temp_pod_file_2.puts line
|
126
|
+
end
|
127
|
+
temp_pod_file_2.close
|
128
|
+
|
129
|
+
File.open origin_pod_file_dir, "w+" do |file|
|
130
|
+
file.write IO.readlines(temp_pod_file_2).join('')
|
131
|
+
file.close
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
def excute_build_run
|
137
|
+
if CommandRunner.run(@flutter_wrapper, 'packages','pub','run','build_runner','build','--delete-conflicting-outputs') == false
|
138
|
+
raise "run build_runner fail"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def build_framework
|
143
|
+
if CommandRunner.run(@flutter_wrapper, 'build','ios-framework',"--output=#{@product_dir}") == false
|
144
|
+
# FileUtils.remove_dir product_dir, true
|
145
|
+
raise "run build_runner fail"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def fetch_plugins
|
150
|
+
results = []
|
151
|
+
flutter_plugins_list = @working_dir + '/.flutter-plugins'
|
152
|
+
lines = IO.readlines(flutter_plugins_list)
|
153
|
+
lines.each do |line|
|
154
|
+
unless line =~ /^#/
|
155
|
+
key_val = line.split '='
|
156
|
+
key = key_val[0]
|
157
|
+
value = key_val[1]
|
158
|
+
value = value.gsub /\n/, ''
|
159
|
+
path = "#{value}ios/#{key}.podspec"
|
160
|
+
results.append Plugins.new(key, path, Pod::Specification.from_file(path))
|
161
|
+
end
|
162
|
+
end
|
163
|
+
results
|
164
|
+
end
|
165
|
+
|
166
|
+
def zip_files(plugins, mode)
|
167
|
+
product_dir = @product_dir + "#{mode}"
|
168
|
+
zip_file_dir = product_dir + "/zip"
|
169
|
+
if Dir.exist? zip_file_dir
|
170
|
+
FileUtils.remove_dir zip_file_dir, true
|
171
|
+
end
|
172
|
+
FileUtils.mkdir_p zip_file_dir
|
173
|
+
zip_file = zip_file_dir + "/#{@module_name}.zip"
|
174
|
+
Zip::File.open(zip_file, Zip::File::CREATE) do |zipfile|
|
175
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3('git', 'rev-parse', 'HEAD')
|
176
|
+
commit = stdout.gets.gsub /\n/, ''
|
177
|
+
info_hash = {
|
178
|
+
:name => @module_name,
|
179
|
+
:commit => commit,
|
180
|
+
:version => @version,
|
181
|
+
:sdk_version => @flutter_version
|
182
|
+
}
|
183
|
+
json = JSON.pretty_generate info_hash
|
184
|
+
zipfile.get_output_stream("info.json") { |f| f.write json }
|
185
|
+
zipfile.add 'pubspec.lock', "#{@working_dir}/pubspec.lock"
|
186
|
+
zipfile.get_output_stream("download_sdk.rb") { |f| f.write sdk_download }
|
187
|
+
zipfile.add_dir "App.framework", "#{product_dir}/App.framework"
|
188
|
+
zipfile.add_dir "FlutterPluginRegistrant.framework","#{product_dir}/FlutterPluginRegistrant.framework"
|
189
|
+
plugins.each do |plugin|
|
190
|
+
file = File.join(product_dir, "#{plugin.spec.name}.framework")
|
191
|
+
if Dir.exist? file
|
192
|
+
zipfile.add_dir("#{plugin.spec.name}.framework", file)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
sdk_file = zip_file_dir + "/Flutter.zip"
|
198
|
+
Zip::File.open sdk_file, Zip::File::CREATE do |zipfile|
|
199
|
+
file = File.join(product_dir, "Flutter.framework")
|
200
|
+
zipfile.add_dir "Flutter.framework", file
|
201
|
+
end
|
202
|
+
[zip_file, sdk_file]
|
203
|
+
end
|
204
|
+
|
205
|
+
def sdk_download
|
206
|
+
|
207
|
+
ruby_code = <<-CODE
|
208
|
+
#!/usr/bin/env ruby
|
209
|
+
|
210
|
+
require 'digest'
|
211
|
+
require 'open-uri'
|
212
|
+
|
213
|
+
sdk_url = ARGV[0]
|
214
|
+
|
215
|
+
def md5(url)
|
216
|
+
Digest::MD5.hexdigest url
|
217
|
+
end
|
218
|
+
def download(url, dest)
|
219
|
+
open(url) do |u|
|
220
|
+
File.open(dest, "w+") do |file|
|
221
|
+
file.write u.read
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
home_dir = Dir.home
|
226
|
+
cache_dir = home_dir + "/.cocoapods/.cache"
|
227
|
+
if Dir.exist?(cache_dir) == false
|
228
|
+
Dir.mkdir cache_dir
|
229
|
+
end
|
230
|
+
#SDK下载
|
231
|
+
sdk_dir = cache_dir + "/\#{md5 sdk_url}"
|
232
|
+
sdk_file = sdk_dir + "/Flutter.zip"
|
233
|
+
if Dir.exist?(sdk_dir) == false
|
234
|
+
Dir.mkdir sdk_dir
|
235
|
+
download sdk_url, sdk_file
|
236
|
+
end
|
237
|
+
if File.exist? "Flutter.framework"
|
238
|
+
`rm -rf Flutter.framework`
|
239
|
+
end
|
240
|
+
`unzip \#{sdk_file} -d \#{Dir.pwd}`
|
241
|
+
CODE
|
242
|
+
|
243
|
+
ruby_code
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
def upload_files(app_file, flutter_sdk, mode)
|
248
|
+
Pod::UserInterface.info 'Start upload resources'
|
249
|
+
remote = Remote.new()
|
250
|
+
Pod::UserInterface.info "Checking #{@module_name}_#{@version}_#{mode.downcase}..."
|
251
|
+
result = remote.exist? @module_name, @version, mode.downcase
|
252
|
+
if result
|
253
|
+
Pod::UserInterface.info "Found #{@module_name}_#{@version}_#{mode.downcase} and deleting..."
|
254
|
+
remote.delete @module_name, @version, mode.downcase
|
255
|
+
end
|
256
|
+
Pod::UserInterface.info "Uploading #{@module_name}_#{@version}_#{mode.downcase}..."
|
257
|
+
remote.upload @module_name, @version, mode.downcase, app_file
|
258
|
+
|
259
|
+
|
260
|
+
Pod::UserInterface.info "Checking Flutter_#{@flutter_version}_#{mode.downcase}..."
|
261
|
+
result = remote.exist? 'Flutter', @flutter_version, mode.downcase
|
262
|
+
unless result
|
263
|
+
Pod::UserInterface.info "No Flutter_#{@flutter_version}_#{mode.downcase} found, start uploading..."
|
264
|
+
remote.upload 'Flutter', @flutter_version, mode.downcase, flutter_sdk
|
265
|
+
end
|
266
|
+
if result
|
267
|
+
Pod::UserInterface.info "Flutter_#{@flutter_version}_#{mode.downcase} was found, skip upload"
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|
271
|
+
|
272
|
+
def ignore_dependency?(name)
|
273
|
+
if name == 'Flutter'
|
274
|
+
return true
|
275
|
+
end
|
276
|
+
|
277
|
+
for plugin in @plugins
|
278
|
+
if plugin.name == name
|
279
|
+
return true
|
280
|
+
end
|
281
|
+
end
|
282
|
+
return false
|
283
|
+
end
|
284
|
+
|
285
|
+
def make_pod(mode)
|
286
|
+
|
287
|
+
dependency_graph = Molinillo::DependencyGraph.new
|
288
|
+
@plugins.each do |plugin|
|
289
|
+
plugin.spec.all_dependencies.each do |dep|
|
290
|
+
unless ignore_dependency? dep.name
|
291
|
+
dependency_graph.add_vertex(dep.name, dep, true)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
remote = Remote.new()
|
297
|
+
sdk_download_url = remote.download_url "Flutter", @flutter_version, mode.downcase
|
298
|
+
app_download_url = remote.download_url @module_name, @version, mode.downcase
|
299
|
+
spec = Pod::Spec.new do |s|
|
300
|
+
s.name = "#{@module_name}_#{mode.downcase}"
|
301
|
+
s.version = @version
|
302
|
+
s.summary = @module_name
|
303
|
+
s.description = @module_name
|
304
|
+
s.homepage = 'http://dreamtracer.top'
|
305
|
+
s.license = { :type => 'BSD' }
|
306
|
+
s.author = { 'Dreamtracer' => 'http://dreamtracer.top' }
|
307
|
+
s.source = { :http => app_download_url }
|
308
|
+
s.ios.deployment_target = '9.0'
|
309
|
+
s.prepare_command = "ruby download_sdk.rb #{sdk_download_url}"
|
310
|
+
vendored_frameworks = ["App.framework", "Flutter.framework", "FlutterPluginRegistrant.framework"]
|
311
|
+
@plugins.each do |plugin|
|
312
|
+
vendored_frameworks.append "#{plugin.name}.framework"
|
313
|
+
end
|
314
|
+
s.vendored_frameworks = vendored_frameworks
|
315
|
+
|
316
|
+
dependency_graph.each do |vertex|
|
317
|
+
s.dependency vertex.payload.name, vertex.payload.requirement.to_s
|
318
|
+
end
|
319
|
+
s.resources = ['info.json', 'pubspec.lock']
|
320
|
+
end
|
321
|
+
temp_dir = Dir.tmpdir
|
322
|
+
spec_file = temp_dir + "/#{@module_name}_#{mode.downcase}.podspec.json"
|
323
|
+
File.open spec_file, "w+" do |file|
|
324
|
+
file.write spec.to_pretty_json
|
325
|
+
end
|
326
|
+
|
327
|
+
Dir.chdir temp_dir do |dir|
|
328
|
+
Pod::Command::Repo::Push.run([@pod_repo, '--allow-warnings', "--sources=#{@sources.join(',')}"])
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
|
333
|
+
end
|
334
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
class CommandRunner
|
4
|
+
|
5
|
+
def CommandRunner.run(*args)
|
6
|
+
command = args.join ' '
|
7
|
+
Pod::UserInterface.info "Running #{command}..."
|
8
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3(*args)
|
9
|
+
exit_status = wait_thr.value
|
10
|
+
if exit_status.success?
|
11
|
+
puts stdout.gets
|
12
|
+
else
|
13
|
+
puts stderr.gets
|
14
|
+
end
|
15
|
+
return exit_status.success?
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
class Remote
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
if ENV['FLUTTER_BINARY_SERVER_BASEURL'].nil?
|
7
|
+
raise StandardError, "Need 'FLUTTER_BINARY_SERVER_BASEURL' in env"
|
8
|
+
end
|
9
|
+
@base_url = ENV['FLUTTER_BINARY_SERVER_BASEURL']
|
10
|
+
end
|
11
|
+
|
12
|
+
def exist?(name, version, tag)
|
13
|
+
uri = URI.join @base_url, "/frameworks/exit/#{name}/#{version}/#{tag}"
|
14
|
+
resp = RestClient.get(uri.to_s)
|
15
|
+
json = JSON.parse(resp.body)
|
16
|
+
json["data"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete(name, version, tag)
|
20
|
+
uri = URI.join @base_url, "/frameworks/#{name}/#{version}/#{tag}"
|
21
|
+
resp = RestClient.delete uri.to_s
|
22
|
+
json = JSON.parse(resp.body)
|
23
|
+
json["status"]['code'] == 0
|
24
|
+
end
|
25
|
+
|
26
|
+
def upload(name, version, tag, file)
|
27
|
+
uri = URI.join @base_url, "/frameworks"
|
28
|
+
resp = RestClient.post(uri.to_s, {
|
29
|
+
file: File.new(file, 'rb'),
|
30
|
+
name: name,
|
31
|
+
version: version,
|
32
|
+
tag: tag
|
33
|
+
})
|
34
|
+
json = JSON.parse(resp.body)
|
35
|
+
@base_url + json["data"]['download_url']
|
36
|
+
end
|
37
|
+
|
38
|
+
def download_url(name, version, tag)
|
39
|
+
uri = URI.join @base_url, "/frameworks/#{name}/#{version}/#{tag}"
|
40
|
+
resp = RestClient.get uri.to_s
|
41
|
+
json = JSON.parse(resp.body)
|
42
|
+
@base_url + json["data"]['download_url']
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'zip'
|
2
|
+
|
3
|
+
class Zip::File
|
4
|
+
def add_dir(entry, dir)
|
5
|
+
if File.directory? dir
|
6
|
+
entries = Dir.entries(dir) - %w[. ..]
|
7
|
+
entries.each do |subentry|
|
8
|
+
add_dir "#{entry}/#{subentry}", "#{dir}/#{subentry}"
|
9
|
+
end
|
10
|
+
else
|
11
|
+
add entry, dir
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class ZipFileGenerator
|
17
|
+
# Initialize with the directory to zip and the location of the output archive.
|
18
|
+
def initialize(input_dir, entry, zipfile)
|
19
|
+
|
20
|
+
@input_dir = input_dir
|
21
|
+
@zipfile = zipfile
|
22
|
+
@entry = entry
|
23
|
+
end
|
24
|
+
|
25
|
+
# Zip the input directory.
|
26
|
+
def write
|
27
|
+
entries = Dir.entries(@input_dir) - %w[. ..]
|
28
|
+
write_entries entries, @entry, @zipfile
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
# A helper method to make the recursion work.
|
34
|
+
def write_entries(entries, path, zipfile)
|
35
|
+
entries.each do |e|
|
36
|
+
zipfile_path = path == '' ? e : File.join(path, e)
|
37
|
+
disk_file_path = File.join(@input_dir, zipfile_path)
|
38
|
+
|
39
|
+
if File.directory? disk_file_path
|
40
|
+
recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)
|
41
|
+
else
|
42
|
+
put_into_archive(disk_file_path, zipfile, zipfile_path)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)
|
48
|
+
zipfile.mkdir zipfile_path
|
49
|
+
subdir = Dir.entries(disk_file_path) - %w[. ..]
|
50
|
+
write_entries subdir, zipfile_path, zipfile
|
51
|
+
end
|
52
|
+
|
53
|
+
def put_into_archive(disk_file_path, zipfile, zipfile_path)
|
54
|
+
zipfile.add(zipfile_path, disk_file_path)
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
# module Pod
|
4
|
+
# class Installer
|
5
|
+
#
|
6
|
+
# class PodSourcePreparer
|
7
|
+
# alias_method :old_prepare!, :prepare!
|
8
|
+
# def prepare!
|
9
|
+
# if @spec.flutter == nil || @spec.flutter == false
|
10
|
+
# old_prepare!
|
11
|
+
# else
|
12
|
+
# flutter_run_prepare_command
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# def flutter_run_prepare_command
|
17
|
+
# return unless @spec.prepare_command
|
18
|
+
# UI.section(' > Running flutter prepare command', '', 1) do
|
19
|
+
# Dir.chdir(path) do
|
20
|
+
# begin
|
21
|
+
# ENV.delete('CDPATH')
|
22
|
+
# ENV['COCOAPODS_VERSION'] = Pod::VERSION
|
23
|
+
# prepare_command = spec.prepare_command.strip_heredoc.chomp
|
24
|
+
# full_command = "\nset -e\n" + prepare_command
|
25
|
+
# bash!('-c', full_command)
|
26
|
+
# ensure
|
27
|
+
# ENV.delete('COCOAPODS_VERSION')
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
# end
|
@@ -0,0 +1,263 @@
|
|
1
|
+
require 'digest'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Podfile
|
7
|
+
module DSL
|
8
|
+
# require
|
9
|
+
# :path=>'/User/path/path' pubspec.yaml dir
|
10
|
+
# '0.1.0' version from binary server
|
11
|
+
# :mode=>'debug/release'
|
12
|
+
# name flutter project name
|
13
|
+
def flutter_pod(name = nil, *requirements)
|
14
|
+
unless name
|
15
|
+
raise StandardError, 'A dependency requires a name.'
|
16
|
+
end
|
17
|
+
|
18
|
+
flutter_project_name = name
|
19
|
+
flutter_project_mode = parse_key(:mode, requirements)
|
20
|
+
flutter_project_path = parse_key(:path, requirements)
|
21
|
+
flutter_project_version = parse_version requirements
|
22
|
+
if flutter_project_mode.nil?
|
23
|
+
flutter_project_mode = "release"
|
24
|
+
end
|
25
|
+
|
26
|
+
unless flutter_project_path.nil?
|
27
|
+
UI.info "Using local flutter project.."
|
28
|
+
load File.join(flutter_project_path, '.ios', 'Flutter', 'podhelper.rb')
|
29
|
+
install_all_flutter_pods flutter_project_path
|
30
|
+
return
|
31
|
+
end
|
32
|
+
|
33
|
+
pod "#{flutter_project_name}_#{flutter_project_mode}", flutter_project_version
|
34
|
+
|
35
|
+
end
|
36
|
+
# def flutter_pod(name = nil, *requirements)
|
37
|
+
# if ENV['FLUTTER_BINARY_SERVER_BASEURL'].nil?
|
38
|
+
# raise StandardError, "Need 'FLUTTER_BINARY_SERVER_BASEURL' in env"
|
39
|
+
# end
|
40
|
+
# unless name
|
41
|
+
# raise StandardError, 'A dependency requires a name.'
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# flutter_project_name = name
|
45
|
+
# flutter_binary_server_base_url = ENV['FLUTTER_BINARY_SERVER_BASEURL']
|
46
|
+
# flutter_project_mode = parse_key(:mode, requirements)
|
47
|
+
# flutter_sdk_version = parse_key(:sdk_version, requirements)
|
48
|
+
# flutter_project_path = parse_key(:path, requirements)
|
49
|
+
# flutter_project_version = parse_version requirements
|
50
|
+
# if flutter_project_mode.nil?
|
51
|
+
# flutter_project_mode = "release"
|
52
|
+
# end
|
53
|
+
# if flutter_sdk_version.nil?
|
54
|
+
# flutter_sdk_version = '1.12.13'
|
55
|
+
# end
|
56
|
+
# flutter_sdk_name = 'Flutter'
|
57
|
+
#
|
58
|
+
# unless flutter_project_path.nil?
|
59
|
+
# UI.info "Using local flutter project.."
|
60
|
+
# load File.join(flutter_project_path, '.ios', 'Flutter', 'podhelper.rb')
|
61
|
+
# install_all_flutter_pods flutter_project_path
|
62
|
+
# return
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
#
|
66
|
+
# sdk_dir = flutter_sdk_dir(flutter_sdk_version, flutter_project_mode, false)
|
67
|
+
# app_dir = package_dir(flutter_project_name,flutter_project_version,flutter_project_mode,false )
|
68
|
+
# plugin_dir = plugin_dir(flutter_project_name,flutter_project_version,false )
|
69
|
+
#
|
70
|
+
# unless Dir.exist? sdk_dir
|
71
|
+
# sdk_download_url = make_download_url flutter_binary_server_base_url, flutter_sdk_name, flutter_sdk_version, flutter_project_mode
|
72
|
+
# UI.info "Downloading Flutter engine..."
|
73
|
+
# sdk_zip_file = "#{flutter_sdk_dir(flutter_sdk_version, flutter_project_mode, true)}/Flutter.zip"
|
74
|
+
# download sdk_download_url, sdk_zip_file
|
75
|
+
# `unzip -o #{sdk_zip_file} -d #{flutter_sdk_dir(flutter_sdk_version, flutter_project_mode, false)}`
|
76
|
+
# `rm -rf #{sdk_zip_file}`
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
#
|
80
|
+
# unless Dir.exist? app_dir
|
81
|
+
# app_download_url = make_download_url flutter_binary_server_base_url, flutter_project_name, flutter_project_version, flutter_project_mode
|
82
|
+
# UI.info "Downloading App..."
|
83
|
+
# app_zip_file = "#{package_dir(flutter_project_name,flutter_project_version,flutter_project_mode,true )}/App.zip"
|
84
|
+
# download app_download_url, app_zip_file
|
85
|
+
# `unzip -o #{app_zip_file} -d #{package_dir(flutter_project_name,flutter_project_version,flutter_project_mode,false)}`
|
86
|
+
# `rm -rf #{app_zip_file}`
|
87
|
+
# end
|
88
|
+
# `cp -f -r -- #{sdk_dir}/Flutter.framework #{app_dir}`
|
89
|
+
#
|
90
|
+
# unless Dir.exist? plugin_dir
|
91
|
+
# plugins_download_url = make_download_url flutter_binary_server_base_url, "#{flutter_project_name}_plugins", flutter_project_version, "release"
|
92
|
+
# UI.info "Downloading Plugins..."
|
93
|
+
# plugin_zip_file = "#{package_dir(flutter_project_name,flutter_project_version,flutter_project_mode,true )}/FlutterPlugin.zip"
|
94
|
+
# download plugins_download_url, plugin_zip_file
|
95
|
+
# `unzip -o #{plugin_zip_file} -d #{plugin_dir(flutter_project_name,flutter_project_version,false)}`
|
96
|
+
# `rm -rf #{plugin_zip_file}`
|
97
|
+
# end
|
98
|
+
#
|
99
|
+
# json = makeFlutterSpec(
|
100
|
+
# 'Flutter',
|
101
|
+
# flutter_project_name,
|
102
|
+
# flutter_project_version,
|
103
|
+
# "#{flutter_project_name}-#{flutter_project_version}",
|
104
|
+
# "http://dreamtracer.top",
|
105
|
+
# {:dreamtracer => "http://dreamtracer.top"},
|
106
|
+
# {:ios => '9.0'},
|
107
|
+
# {:path => '.' },
|
108
|
+
# ["Flutter.framework", "App.framework"]
|
109
|
+
# )
|
110
|
+
#
|
111
|
+
# File.open(app_dir + '/Flutter.podspec.json', "w+") do |f|
|
112
|
+
# f.write json.to_s
|
113
|
+
# f.close
|
114
|
+
# end
|
115
|
+
# pod 'Flutter', :path =>app_dir + '/Flutter.podspec.json'
|
116
|
+
#
|
117
|
+
#
|
118
|
+
# Dir.foreach(plugin_dir) do |file|
|
119
|
+
# if file !="." and file !=".."
|
120
|
+
# pod file, :path =>plugin_dir + '/' + file
|
121
|
+
# end
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# end
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
private
|
130
|
+
|
131
|
+
def makeFlutterSpec(pod_name, package_name, version, desc, homepage, author, platforms, source, vendored_frameworks)
|
132
|
+
my_hash = {:name => pod_name}
|
133
|
+
my_hash[:version] = version
|
134
|
+
my_hash[:summary] = package_name
|
135
|
+
my_hash[:description] = desc
|
136
|
+
my_hash[:homepage] = homepage
|
137
|
+
my_hash[:authors] = author #{:author=>'example@email.com'}
|
138
|
+
my_hash[:platforms] = platforms #{:ios => '10.0'}
|
139
|
+
my_hash[:source] = source #{ :path => '.' }
|
140
|
+
my_hash[:vendored_frameworks] = vendored_frameworks #[Flutter.framework, App.framework]
|
141
|
+
json = JSON.pretty_generate my_hash
|
142
|
+
json
|
143
|
+
end
|
144
|
+
|
145
|
+
def parse_key(key, requirements)
|
146
|
+
result = nil
|
147
|
+
requirements.each do |obj|
|
148
|
+
if obj.is_a?(Hash) && obj.has_key?(key)
|
149
|
+
result = obj[key]
|
150
|
+
end
|
151
|
+
end
|
152
|
+
result
|
153
|
+
end
|
154
|
+
|
155
|
+
def parse_version(requirements)
|
156
|
+
if requirements.first.is_a?(Hash)
|
157
|
+
nil
|
158
|
+
else
|
159
|
+
requirements.first
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def download_sdk(sdkURL, dest)
|
164
|
+
sdk_dir = cache_dir + "/#{md5 sdkURL}"
|
165
|
+
sdk_file = sdk_dir + "/Flutter.zip"
|
166
|
+
unless Dir.exist?(sdk_dir)
|
167
|
+
Dir.mkdir sdk_dir
|
168
|
+
download sdkURL, sdk_file
|
169
|
+
end
|
170
|
+
{:dir=> sdk_dir, :file => sdk_file}
|
171
|
+
end
|
172
|
+
|
173
|
+
def download_app(appURL)
|
174
|
+
app_dir = cache_dir + "/#{md5 appURL}"
|
175
|
+
app_file = app_dir + "/App.zip"
|
176
|
+
unless Dir.exist?(app_dir)
|
177
|
+
Dir.mkdir app_dir
|
178
|
+
download appURL, app_file
|
179
|
+
end
|
180
|
+
{:dir=> app_dir, :file => app_file}
|
181
|
+
end
|
182
|
+
|
183
|
+
def download_plugin(pluginURL)
|
184
|
+
plugin_dir = cache_dir + "/#{md5 pluginURL}"
|
185
|
+
plugin_file = plugin_dir + "/FlutterPlugins.zip"
|
186
|
+
unless Dir.exist?(plugin_dir)
|
187
|
+
Dir.mkdir plugin_dir
|
188
|
+
download pluginURL, plugin_file
|
189
|
+
end
|
190
|
+
{:dir=> plugin_dir, :file => plugin_file}
|
191
|
+
end
|
192
|
+
|
193
|
+
def cache_dir
|
194
|
+
home_dir = Dir.home
|
195
|
+
cache_dir = home_dir + "/.cocoapods/.flutter_cache"
|
196
|
+
unless Dir.exist?(cache_dir)
|
197
|
+
Dir.mkdir cache_dir
|
198
|
+
end
|
199
|
+
cache_dir
|
200
|
+
end
|
201
|
+
|
202
|
+
def flutter_sdk_root_dir
|
203
|
+
sdk_dir = cache_dir + "/FlutterSDK"
|
204
|
+
unless Dir.exist?(sdk_dir)
|
205
|
+
Dir.mkdir sdk_dir
|
206
|
+
end
|
207
|
+
sdk_dir
|
208
|
+
end
|
209
|
+
|
210
|
+
def flutter_sdk_dir(version, tag, auto_create)
|
211
|
+
sdk_dir = "#{flutter_sdk_root_dir}/#{version}/#{tag}"
|
212
|
+
if auto_create
|
213
|
+
unless Dir.exist?(sdk_dir)
|
214
|
+
FileUtils.mkdir_p sdk_dir
|
215
|
+
end
|
216
|
+
end
|
217
|
+
sdk_dir
|
218
|
+
end
|
219
|
+
|
220
|
+
def package_dir(name, version, tag, auto_create)
|
221
|
+
pkg_dir = "#{cache_dir}/#{name}/#{version}/#{tag}"
|
222
|
+
if auto_create
|
223
|
+
unless Dir.exist?(pkg_dir)
|
224
|
+
FileUtils.mkdir_p pkg_dir
|
225
|
+
end
|
226
|
+
end
|
227
|
+
pkg_dir
|
228
|
+
end
|
229
|
+
|
230
|
+
def plugin_dir(name, version, auto_create)
|
231
|
+
plugin_dir = "#{cache_dir}/#{name}/#{version}/plugins"
|
232
|
+
if auto_create
|
233
|
+
unless Dir.exist?(plugin_dir)
|
234
|
+
FileUtils.mkdir_p plugin_dir
|
235
|
+
end
|
236
|
+
end
|
237
|
+
plugin_dir
|
238
|
+
end
|
239
|
+
|
240
|
+
def make_download_url(base_url, name, version, tag)
|
241
|
+
"#{base_url}/frameworks/#{name}/#{version}/#{tag}/zip"
|
242
|
+
end
|
243
|
+
|
244
|
+
|
245
|
+
def md5(url)
|
246
|
+
Digest::MD5.hexdigest url
|
247
|
+
end
|
248
|
+
|
249
|
+
def download(url, dest)
|
250
|
+
begin
|
251
|
+
open(url) do |u|
|
252
|
+
File.open(dest, "w+") do |file|
|
253
|
+
file.write u.read.force_encoding("UTF-8")
|
254
|
+
file.close
|
255
|
+
end
|
256
|
+
end
|
257
|
+
rescue Exception => e
|
258
|
+
UI.info e.to_s
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cocoapods-core/specification/dsl/attribute_support'
|
2
|
+
require 'cocoapods-core/specification/dsl/attribute'
|
3
|
+
require 'cocoapods-core/specification/dsl/platform_proxy'
|
4
|
+
require 'cocoapods-flutter/native/specification/dsl/attribute'
|
5
|
+
|
6
|
+
# module Pod
|
7
|
+
# class Specification
|
8
|
+
# module DSL
|
9
|
+
# extend Pod::Specification::DSL::AttributeSupport
|
10
|
+
#
|
11
|
+
# require 'cocoapods-core/specification/dsl/deprecations'
|
12
|
+
#
|
13
|
+
# root_attribute :flutter,
|
14
|
+
# :required => false
|
15
|
+
#
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
# end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'cocoapods-flutter/native/specification/set/presenter'
|
2
|
+
|
3
|
+
# module Pod
|
4
|
+
# class Specification
|
5
|
+
# class Set
|
6
|
+
# attr_reader :flutter
|
7
|
+
# end
|
8
|
+
# end
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# module Pod
|
12
|
+
# class Specification
|
13
|
+
# module DSL
|
14
|
+
# module RootAttributesAccessors
|
15
|
+
# def flutter
|
16
|
+
# attributes_hash['flutter']
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
# end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$:.unshift((ROOT + 'lib').to_s)
|
4
|
+
$:.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'bacon'
|
8
|
+
require 'mocha-on-bacon'
|
9
|
+
require 'pretty_bacon'
|
10
|
+
require 'pathname'
|
11
|
+
require 'cocoapods'
|
12
|
+
|
13
|
+
Mocha::Configuration.prevent(:stubbing_non_existent_method)
|
14
|
+
|
15
|
+
require 'cocoapods_plugin'
|
16
|
+
|
17
|
+
#-----------------------------------------------------------------------------#
|
18
|
+
|
19
|
+
module Pod
|
20
|
+
|
21
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
22
|
+
#
|
23
|
+
UI.disable_wrap = true
|
24
|
+
|
25
|
+
# Redirects the messages to an internal store.
|
26
|
+
#
|
27
|
+
module UI
|
28
|
+
@output = ''
|
29
|
+
@warnings = ''
|
30
|
+
|
31
|
+
class << self
|
32
|
+
attr_accessor :output
|
33
|
+
attr_accessor :warnings
|
34
|
+
|
35
|
+
def puts(message = '')
|
36
|
+
@output << "#{message}\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
def warn(message = '', actions = [])
|
40
|
+
@warnings << "#{message}\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
def print(message)
|
44
|
+
@output << message
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
#-----------------------------------------------------------------------------#
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-flutter-dt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "\bDreamtracer"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: parallel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cocoapods
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubyzip
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: molinillo
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.6.6
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.6.6
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: A short description of cocoapods-flutter.
|
112
|
+
email:
|
113
|
+
- jinqiucheng1006@live.cn
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE.txt
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- cocoapods-flutter.gemspec
|
124
|
+
- lib/cocoapods-flutter.rb
|
125
|
+
- lib/cocoapods-flutter/command.rb
|
126
|
+
- lib/cocoapods-flutter/command/flutter.rb
|
127
|
+
- lib/cocoapods-flutter/command/flutter/archive.rb
|
128
|
+
- lib/cocoapods-flutter/gem_version.rb
|
129
|
+
- lib/cocoapods-flutter/native.rb
|
130
|
+
- lib/cocoapods-flutter/native/archive/archive.rb
|
131
|
+
- lib/cocoapods-flutter/native/archive/command_runner.rb
|
132
|
+
- lib/cocoapods-flutter/native/archive/remote.rb
|
133
|
+
- lib/cocoapods-flutter/native/archive/zip_tool.rb
|
134
|
+
- lib/cocoapods-flutter/native/pod_source_preparer.rb
|
135
|
+
- lib/cocoapods-flutter/native/podfile.rb
|
136
|
+
- lib/cocoapods-flutter/native/specification/consumer.rb
|
137
|
+
- lib/cocoapods-flutter/native/specification/dsl.rb
|
138
|
+
- lib/cocoapods-flutter/native/specification/dsl/attribute.rb
|
139
|
+
- lib/cocoapods-flutter/native/specification/set.rb
|
140
|
+
- lib/cocoapods-flutter/native/specification/set/presenter.rb
|
141
|
+
- lib/cocoapods_plugin.rb
|
142
|
+
- spec/command/flutter_spec.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
homepage: https://github.com/EXAMPLE/cocoapods-flutter
|
145
|
+
licenses:
|
146
|
+
- MIT
|
147
|
+
metadata: {}
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubygems_version: 3.0.6
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: A longer description of cocoapods-flutter.
|
167
|
+
test_files:
|
168
|
+
- spec/command/flutter_spec.rb
|
169
|
+
- spec/spec_helper.rb
|