cocoapods-gd 0.0.1 → 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 +4 -4
- data/lib/cocoapods-gd.rb +1 -1
- data/lib/cocoapods-gd/install_frameworks.rb +5 -1
- data/lib/cocoapods-gd/pod_utils.rb +43 -3
- data/lib/cocoapods-gd/podfile_env.rb +3 -3
- data/lib/cocoapods-gd/spec_builder.rb +1 -1
- data/lib/cocoapods-gd/uploader.rb +1 -1
- data/lib/pod/command/gd.rb +19 -14
- data/spec/unit/specification/spec_builder_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68633c73a94efde0973209d10cbbc7f4712107cfb2453043c8229e72944f5d3e
|
4
|
+
data.tar.gz: bc812963c3ffcfc9518a5baa3b671731c7e440be148df3de9226ba25a6b7aaca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6649071183530ab917f1a2e5e28ba1360be5d071c16d14d6a2e8e0ba652c3a80021aa27ce8e64d075571ac9f8c7628a824b95998b9fa6bd3f007db736b660446
|
7
|
+
data.tar.gz: 84a859b1fac4174876860886ef9e76e63d653dd8be21cac1407f9391a1cb203187f82e7ae9d55487264613871160d59684cd5b8183827d2f76d8683e93c229d9
|
data/lib/cocoapods-gd.rb
CHANGED
@@ -19,7 +19,11 @@ module Pod
|
|
19
19
|
end
|
20
20
|
|
21
21
|
Pod::UI::puts("replaceing Frameworks")
|
22
|
-
|
22
|
+
if podfile.get_use_source_code_selector.nil?
|
23
|
+
nameList = []
|
24
|
+
else
|
25
|
+
nameList = podfile.get_use_source_code_selector.call()
|
26
|
+
end
|
23
27
|
if nameList.nil?
|
24
28
|
nameList = []
|
25
29
|
end
|
@@ -39,12 +39,13 @@ module Pod
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def podfile_from_spec(path, spec_name, platform_name, deployment_target, subspecs, sources)
|
42
|
+
new_path = create_new_podspec(path)
|
42
43
|
options = {}
|
43
|
-
if
|
44
|
+
if new_path
|
44
45
|
if @local
|
45
|
-
options[:path] =
|
46
|
+
options[:path] = new_path
|
46
47
|
else
|
47
|
-
options[:podspec] =
|
48
|
+
options[:podspec] = new_path
|
48
49
|
end
|
49
50
|
end
|
50
51
|
options[:subspecs] = subspecs if subspecs
|
@@ -64,6 +65,45 @@ module Pod
|
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
68
|
+
def create_new_podspec(path)
|
69
|
+
include_json = "#{path}".end_with?(".json")
|
70
|
+
if include_json
|
71
|
+
local_podspec = "#{Dir.pwd}/replaced.podspec.json"
|
72
|
+
else
|
73
|
+
local_podspec = "#{Dir.pwd}/replaced.podspec"
|
74
|
+
end
|
75
|
+
|
76
|
+
FileUtils.cp("#{path}", local_podspec)
|
77
|
+
has_swift_version = false
|
78
|
+
lines = IO.readlines(local_podspec).map do |line|
|
79
|
+
if line.include?("swift_version")
|
80
|
+
has_swift_version = true
|
81
|
+
end
|
82
|
+
if include_json
|
83
|
+
if line.include?("homepage")
|
84
|
+
line = "#{line} \n \"swift_version\": \"5.0\","
|
85
|
+
end
|
86
|
+
else
|
87
|
+
spec = ""
|
88
|
+
if line.include?("s.homepage")
|
89
|
+
spec = "s"
|
90
|
+
line = "#{line} \n #{spec}.swift_version = '5.0'"
|
91
|
+
end
|
92
|
+
if line.include?("spec.homepage")
|
93
|
+
spec = "spec"
|
94
|
+
line = "#{line} \n #{spec}.swift_version = '5.0'"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
line
|
98
|
+
end
|
99
|
+
if !has_swift_version
|
100
|
+
File.open(local_podspec, 'w') do |file|
|
101
|
+
file.puts lines
|
102
|
+
end
|
103
|
+
end
|
104
|
+
local_podspec
|
105
|
+
end
|
106
|
+
|
67
107
|
def binary_only?(spec)
|
68
108
|
deps = spec.dependencies.map { |dep| spec_with_name(dep.name) }
|
69
109
|
[spec, *deps].each do |specification|
|
@@ -2,15 +2,15 @@ require 'cocoapods'
|
|
2
2
|
|
3
3
|
module Pod
|
4
4
|
class Podfile
|
5
|
-
|
5
|
+
GD_USE_BINARIES = 'use_binaries'
|
6
6
|
USE_SOURCE_CODE_SELECTOR = 'use_source_code'
|
7
7
|
|
8
8
|
def use_binaries!(flag = true)
|
9
|
-
internal_hash[
|
9
|
+
internal_hash[GD_USE_BINARIES] = flag
|
10
10
|
end
|
11
11
|
|
12
12
|
def get_use_binaries
|
13
|
-
internal_hash[
|
13
|
+
internal_hash[GD_USE_BINARIES]
|
14
14
|
end
|
15
15
|
|
16
16
|
def use_source_code_selector!(&block)
|
data/lib/pod/command/gd.rb
CHANGED
@@ -11,7 +11,7 @@ module Pod
|
|
11
11
|
def self.options
|
12
12
|
[
|
13
13
|
['--spec-sources=private,https://github.com/CocoaPods/Specs.git', '指定source源'],
|
14
|
-
['--upload', '
|
14
|
+
['--upload', '是否上传,默认不上传'],
|
15
15
|
['--upload-spec-name', '上传仓库必要参数,二进制源对应的spec版本仓库名称'],
|
16
16
|
['--upload-git-sources', '上传仓库必要参数,二进制源对应的git源码仓库名称'],
|
17
17
|
['--upload-local-path', '上传仓库必要参数,git源码仓库映射的本地路径'],
|
@@ -36,7 +36,7 @@ module Pod
|
|
36
36
|
@spec_sources.push('https://gitlab.gaodun.com/iOSLibs/Specs.git')
|
37
37
|
|
38
38
|
# 是否上传
|
39
|
-
@upload = argv.
|
39
|
+
@upload = argv.flag?('upload')
|
40
40
|
|
41
41
|
# 上传二进制源仓库名称
|
42
42
|
@upload_spec_name = argv.option('upload-spec-name')
|
@@ -47,12 +47,8 @@ module Pod
|
|
47
47
|
# 二进制源本地仓库地址
|
48
48
|
@upload_local_path = argv.option('upload-local-path')
|
49
49
|
|
50
|
-
if @upload.nil?
|
51
|
-
@upload = 1
|
52
|
-
end
|
53
|
-
|
54
50
|
if @upload_spec_name.nil?
|
55
|
-
@upload_spec_name = "frameworks-specs"
|
51
|
+
@upload_spec_name = "lizuba-frameworks-specs"
|
56
52
|
end
|
57
53
|
if @upload_git_sources.nil?
|
58
54
|
@upload_git_sources = "https://gitlab.gaodun.com/iOSLibs/Frameworks/raw/master"
|
@@ -80,21 +76,30 @@ module Pod
|
|
80
76
|
target_dir, work_dir = create_working_directory
|
81
77
|
return if target_dir.nil?
|
82
78
|
build_gd
|
79
|
+
|
83
80
|
build_path="#{Dir.pwd}/build"
|
84
81
|
if File.exist?("#{build_path}")
|
85
82
|
FileUtils.rm_rf('build/')
|
86
83
|
end
|
84
|
+
podspec_path="#{Dir.pwd}/replaced.podspec"
|
85
|
+
if File.exist?("#{podspec_path}")
|
86
|
+
FileUtils.rm_rf("#{podspec_path}")
|
87
|
+
end
|
88
|
+
json_path="#{Dir.pwd}/replaced.podspec.json"
|
89
|
+
if File.exist?("#{json_path}")
|
90
|
+
FileUtils.rm_rf("#{json_path}")
|
91
|
+
end
|
87
92
|
`mv "#{work_dir}" "#{target_dir}"`
|
88
93
|
Dir.chdir(@source_dir)
|
89
94
|
|
90
|
-
if @upload ==
|
91
|
-
uploader =
|
95
|
+
if @upload == true
|
96
|
+
uploader = GDUploader.new(@spec, @upload_spec_name, @upload_local_path, @spec_sources)
|
92
97
|
end
|
93
98
|
end
|
94
99
|
|
95
100
|
private
|
96
101
|
|
97
|
-
def
|
102
|
+
def gd_build_in_sandbox(platform)
|
98
103
|
config.installation_root = Pathname.new(Dir.pwd)
|
99
104
|
config.sandbox_root = 'Pods'
|
100
105
|
|
@@ -107,7 +112,7 @@ module Pod
|
|
107
112
|
end
|
108
113
|
|
109
114
|
begin
|
110
|
-
|
115
|
+
gd_perform_build(platform, static_sandbox, dynamic_sandbox, static_installer)
|
111
116
|
ensure # in case the build fails; see Builder#xcodebuild.
|
112
117
|
Pathname.new(config.sandbox_root).rmtree
|
113
118
|
FileUtils.rm_f('Podfile.lock')
|
@@ -115,12 +120,12 @@ module Pod
|
|
115
120
|
end
|
116
121
|
|
117
122
|
def build_gd
|
118
|
-
builder =
|
123
|
+
builder = GDSpecBuilder.new(@spec, @source, @embedded, @dynamic, @upload_git_sources)
|
119
124
|
newspec = builder.spec_metadata
|
120
125
|
|
121
126
|
@spec.available_platforms.each do |platform|
|
122
127
|
if platform.name == :ios
|
123
|
-
|
128
|
+
gd_build_in_sandbox(platform)
|
124
129
|
newspec += builder.spec_platform(platform)
|
125
130
|
end
|
126
131
|
end
|
@@ -153,7 +158,7 @@ module Pod
|
|
153
158
|
[target_dir, work_dir]
|
154
159
|
end
|
155
160
|
|
156
|
-
def
|
161
|
+
def gd_perform_build(platform, static_sandbox, dynamic_sandbox, static_installer)
|
157
162
|
static_sandbox_root = config.sandbox_root.to_s
|
158
163
|
if @dynamic
|
159
164
|
static_sandbox_root = "#{static_sandbox_root}/#{static_sandbox.root.to_s.split('/').last}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path('../../../spec_helper', __FILE__)
|
2
2
|
|
3
3
|
module Pod
|
4
|
-
describe
|
4
|
+
describe GDSpecBuilder do
|
5
5
|
def compare_attributes(first_spec, second_spec, attribute_name)
|
6
6
|
first_spec.attributes_hash[attribute_name].should ==
|
7
7
|
second_spec.attributes_hash[attribute_name]
|
@@ -24,7 +24,7 @@ module Pod
|
|
24
24
|
describe 'Preserve attributes from source specification' do
|
25
25
|
before do
|
26
26
|
@spec = Specification.from_file('spec/fixtures/Builder.podspec')
|
27
|
-
@builder =
|
27
|
+
@builder = GDSpecBuilder.new(@spec, nil, false, nil, nil)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "preserves platform.frameworks" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-gd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Fuller
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-12-
|
12
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cocoapods
|