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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f42f504fd6a2564ff180b2887201cda6efef5a093aebe5daaffcf036bd75db9
4
- data.tar.gz: ac0a4628f51ba7e00a8c21b780eb68ed2e2ba21ebcecbe1389790f388a2187bf
3
+ metadata.gz: 68633c73a94efde0973209d10cbbc7f4712107cfb2453043c8229e72944f5d3e
4
+ data.tar.gz: bc812963c3ffcfc9518a5baa3b671731c7e440be148df3de9226ba25a6b7aaca
5
5
  SHA512:
6
- metadata.gz: 494214649db2ef58d7086e605a4f7e8bdd31ee1059bc968a7ad29bc8ae3591c7c58180a8499745faabd00da558ddd7497436a5aca9ab7a82966b9ac782f28a2a
7
- data.tar.gz: b706a58beb2324cf7c4912173e5d36960e2e377fd9f4c0e7413f919838c1dd8d8fdd072f462ade2f8e8f0060a96c9d6defb6796baa5e6f7fa949e322914876d1
6
+ metadata.gz: 6649071183530ab917f1a2e5e28ba1360be5d071c16d14d6a2e8e0ba652c3a80021aa27ce8e64d075571ac9f8c7628a824b95998b9fa6bd3f007db736b660446
7
+ data.tar.gz: 84a859b1fac4174876860886ef9e76e63d653dd8be21cac1407f9391a1cb203187f82e7ae9d55487264613871160d59684cd5b8183827d2f76d8683e93c229d9
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  module Gd
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -19,7 +19,11 @@ module Pod
19
19
  end
20
20
 
21
21
  Pod::UI::puts("replaceing Frameworks")
22
- nameList = podfile.get_use_source_code_selector.call()
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 path
44
+ if new_path
44
45
  if @local
45
- options[:path] = path
46
+ options[:path] = new_path
46
47
  else
47
- options[:podspec] = path
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
- USE_BINARIES = 'use_binaries'
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[USE_BINARIES] = flag
9
+ internal_hash[GD_USE_BINARIES] = flag
10
10
  end
11
11
 
12
12
  def get_use_binaries
13
- internal_hash[USE_BINARIES]
13
+ internal_hash[GD_USE_BINARIES]
14
14
  end
15
15
 
16
16
  def use_source_code_selector!(&block)
@@ -1,5 +1,5 @@
1
1
  module Pod
2
- class SpecBuilder
2
+ class GDSpecBuilder
3
3
  def initialize(spec, source, embedded, dynamic, git_sources)
4
4
  @spec = spec
5
5
  @source = source.nil? ? '{ :path => \'.\' }' : source
@@ -1,7 +1,7 @@
1
1
  require 'zip'
2
2
 
3
3
  module Pod
4
- class Uploader
4
+ class GDUploader
5
5
  def initialize(spec, upload_spec_name, upload_local_path, spec_sources)
6
6
  @spec = spec
7
7
  @work_dir = Dir.pwd
@@ -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.option('upload')
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 == 1
91
- uploader = Uploader.new(@spec, @upload_spec_name, @upload_local_path, @spec_sources)
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 build_in_sandbox(platform)
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
- perform_build(platform, static_sandbox, dynamic_sandbox, static_installer)
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 = SpecBuilder.new(@spec, @source, @embedded, @dynamic, @upload_git_sources)
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
- build_in_sandbox(platform)
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 perform_build(platform, static_sandbox, dynamic_sandbox, static_installer)
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 SpecBuilder do
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 = SpecBuilder.new(@spec, nil, false, nil, nil)
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.1
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-14 00:00:00.000000000 Z
12
+ date: 2020-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cocoapods