cocoapods-binary-flutter 0.0.1
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/lib/cocoapods-binary-flutter/command/flutter.rb +44 -0
- data/lib/cocoapods-binary-flutter/command.rb +1 -0
- data/lib/cocoapods-binary-flutter/gem_version.rb +3 -0
- data/lib/cocoapods-binary-flutter/hook/podfile.rb +109 -0
- data/lib/cocoapods-binary-flutter/hook.rb +1 -0
- data/lib/cocoapods-binary-flutter.rb +1 -0
- data/lib/cocoapods_plugin.rb +2 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4d8bc5c68fa8dddbf61ef4438770a4d91449a20f6f50150e9ef2abac6edf57be
|
4
|
+
data.tar.gz: 01c2a0926d3c8ebb13140cb2377aecd268d06869ec572de79ba2ba3ced98337a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b94a5fad935e08c71554ea6ee06addc355bb8f1d83202716a9312aa254989b0b623e536eb435929d188d40a7be2c55e21556e8073a7956937ed3a320e94ae3f1
|
7
|
+
data.tar.gz: bbde73b9ecc1e9776ca7b194c83c01565c691825b54443f2b30fb6611b82c0d1c77339af969f95d685a0c77c3010798860f0cb8ff88de3b83b4909b5c48d702d
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
# This is an example of a cocoapods plugin adding a top-level subcommand
|
4
|
+
# to the 'pod' command.
|
5
|
+
#
|
6
|
+
# You can also create subcommands of existing or new commands. Say you
|
7
|
+
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
8
|
+
# (e.g. `pod list deprecated`), there are a few things that would need
|
9
|
+
# to change.
|
10
|
+
#
|
11
|
+
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
12
|
+
# the class to exist in the the Pod::Command::List namespace
|
13
|
+
# - change this class to extend from `List` instead of `Command`. This
|
14
|
+
# tells the plugin system that it is a subcommand of `list`.
|
15
|
+
# - edit `lib/cocoapods_plugins.rb` to require this file
|
16
|
+
#
|
17
|
+
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
18
|
+
# in the `plugins.json` file, once your plugin is released.
|
19
|
+
#
|
20
|
+
class Flutter < Command
|
21
|
+
self.summary = 'Short description of cocoapods-binary-flutter.'
|
22
|
+
|
23
|
+
self.description = <<-DESC
|
24
|
+
Longer description of cocoapods-binary-flutter.
|
25
|
+
DESC
|
26
|
+
|
27
|
+
self.arguments = 'NAME'
|
28
|
+
|
29
|
+
def initialize(argv)
|
30
|
+
@name = argv.shift_argument
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate!
|
35
|
+
super
|
36
|
+
help! 'A Pod name is required.' unless @name
|
37
|
+
end
|
38
|
+
|
39
|
+
def run
|
40
|
+
UI.puts "Add your implementation for the cocoapods-binary-flutter plugin in #{__FILE__}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-binary-flutter/gem_version'
|
@@ -0,0 +1,109 @@
|
|
1
|
+
## author:Jacky => shanhaoqiang@lizhi.fm
|
2
|
+
## desc:install binary pods in Podfile
|
3
|
+
#!/usr/bin/env ruby
|
4
|
+
|
5
|
+
require 'digest'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'uri'
|
8
|
+
require 'net/http'
|
9
|
+
require 'net/https'
|
10
|
+
|
11
|
+
module Pod
|
12
|
+
class Podfile
|
13
|
+
module DSL
|
14
|
+
|
15
|
+
#下载
|
16
|
+
def install_remote_flutter_binary(url = nil)
|
17
|
+
#md5
|
18
|
+
md5 = Digest::MD5.new # =>#<Digest::MD5>
|
19
|
+
md5 << url
|
20
|
+
md5value = md5.hexdigest # => "78e73102..."
|
21
|
+
flutter_f_home = Dir.home+'/Library/Caches/CocoaPods/Flutter/'
|
22
|
+
flutter_binary_home = flutter_f_home+md5value
|
23
|
+
flutter_binary_path = flutter_binary_home+'/binary'
|
24
|
+
|
25
|
+
#清除超过30天的缓存
|
26
|
+
Dir.foreach(flutter_f_home) do |item|
|
27
|
+
next if item == '.' or item == '..' or item == '.DS_Store'
|
28
|
+
# do work on real items
|
29
|
+
dirpath = flutter_f_home+item
|
30
|
+
if File.directory?(dirpath)
|
31
|
+
a = File.mtime(dirpath)
|
32
|
+
t = Time.new
|
33
|
+
if (t-a).round/60/60/24 > 30
|
34
|
+
FileUtils.remove_dir(dirpath)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
#判断缓存
|
41
|
+
if File::directory?(flutter_binary_path) == false
|
42
|
+
#创建目录
|
43
|
+
FileUtils.mkdir_p(flutter_binary_home)
|
44
|
+
#下载
|
45
|
+
puts "开始下载 "+url
|
46
|
+
uri = URI(url)
|
47
|
+
download_file = open(flutter_binary_home+"/binary.zip", "wb")
|
48
|
+
Net::HTTP.start(uri.host, uri.port,
|
49
|
+
:use_ssl => uri.scheme == 'https',
|
50
|
+
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
|
51
|
+
|
52
|
+
request = Net::HTTP::Get.new uri.request_uri
|
53
|
+
request.basic_auth 'zhiya_official', '202525631b169f4446103671d4ff0661'
|
54
|
+
begin
|
55
|
+
http.request(request) do |resp|
|
56
|
+
resp.read_body { |segment| download_file.write(segment) }
|
57
|
+
end
|
58
|
+
ensure
|
59
|
+
download_file.close
|
60
|
+
end
|
61
|
+
end
|
62
|
+
#解压
|
63
|
+
puts "开始解压"+flutter_binary_home
|
64
|
+
system("unzip", "-n", flutter_binary_home+'/binary.zip', "-d", flutter_binary_home)
|
65
|
+
end
|
66
|
+
|
67
|
+
#集成
|
68
|
+
install_all_flutter_pods(flutter_binary_path)
|
69
|
+
end
|
70
|
+
|
71
|
+
#安装
|
72
|
+
def install_all_flutter_pods(flutter_binary_path)
|
73
|
+
install_flutter_engine_pod(flutter_binary_path)
|
74
|
+
install_flutter_plugin_pods(flutter_binary_path)
|
75
|
+
install_flutter_application_pod(flutter_binary_path)
|
76
|
+
end
|
77
|
+
|
78
|
+
# 安装flutter引擎
|
79
|
+
def install_flutter_engine_pod(flutter_binary_path)
|
80
|
+
pod 'Flutter', :podspec => File.join(flutter_binary_path, 'flutter', 'Flutter.podspec'), :inhibit_warnings => true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Install Flutter plugin pods.
|
84
|
+
def install_flutter_plugin_pods(flutter_binary_path)
|
85
|
+
# Keep pod path relative so it can be checked into Podfile.lock.
|
86
|
+
# Process will be run from project directory.
|
87
|
+
|
88
|
+
#FlutterPluginRegistrant
|
89
|
+
pod 'FlutterPluginRegistrant', :path => File.join(flutter_binary_path, 'flutter', 'FlutterPluginRegistrant'), :inhibit_warnings => true
|
90
|
+
|
91
|
+
#插件目录
|
92
|
+
ios_plugins_directory_pathname = File.join(flutter_binary_path, 'plugins')
|
93
|
+
|
94
|
+
#plugins遍历
|
95
|
+
Dir.foreach(ios_plugins_directory_pathname) do |item|
|
96
|
+
next if item == '.' or item == '..'
|
97
|
+
# do work on real items
|
98
|
+
pod item, :path => File.join(ios_plugins_directory_pathname, item, 'ios'), :inhibit_warnings => true
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Install Flutter application pod.
|
103
|
+
def install_flutter_application_pod(flutter_binary_path)
|
104
|
+
pod 'App', :path => File.join(flutter_binary_path, 'flutter'), :inhibit_warnings => true
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-binary-flutter/hook/podfile'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-binary-flutter/gem_version'
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-binary-flutter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 单浩强
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A short description of cocoapods-binary-flutter.
|
42
|
+
email:
|
43
|
+
- shanhaoqiang@lizhi.fm
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/cocoapods-binary-flutter.rb
|
49
|
+
- lib/cocoapods-binary-flutter/command.rb
|
50
|
+
- lib/cocoapods-binary-flutter/command/flutter.rb
|
51
|
+
- lib/cocoapods-binary-flutter/gem_version.rb
|
52
|
+
- lib/cocoapods-binary-flutter/hook.rb
|
53
|
+
- lib/cocoapods-binary-flutter/hook/podfile.rb
|
54
|
+
- lib/cocoapods_plugin.rb
|
55
|
+
homepage: https://github.com/EXAMPLE/cocoapods-binary-flutter
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubygems_version: 3.0.3
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: A longer description of cocoapods-binary-flutter.
|
78
|
+
test_files: []
|