cocoapods-soul-component-plugin 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fe112b7a0c2576a90976d2ad3893dff3ebf8043b1426f61273282ae1d0344b8
4
- data.tar.gz: 78f2bc8841a4005661a077c460dc4714a548a37cc00f1e57f438dc46cf227a61
3
+ metadata.gz: 80e8752bcf3e29fe0c8375f18b08be5f0d03ff7c5eb9e4ee673baf53704ff1b0
4
+ data.tar.gz: 2e052340dc280c917ad61a14af622c2cedbc25b5802fc97290052a07dc6bcf99
5
5
  SHA512:
6
- metadata.gz: fc7abff4f40879636d4e611dd7a61992cdd7a3acbb51d14d29659934eff48c1b8ecb073efe29fc5c567ab8724941b7e2b66b131ab5b7900a9b4a6658df575f73
7
- data.tar.gz: b25d96af0cb3455fbb40c6f0ad3f2c4f934f0ea23bc60d9449748b492b3211ab64c36960405bbc38f31b577b6c20bc138bba392ba75177bd95c3db1d61549ef2
6
+ metadata.gz: 54077c1784559216a6403be52c660516e40c4620348dfbdaecfa3265efc7430f12d0a821b5b5606efa8519c63ceb663798695cdf7a992594f128a061459edcdf
7
+ data.tar.gz: d00ace53cfd644d4a260cbfe6029d3948da91d06cc3b7f06d8c0367f51f66a5f4b94dda99e9e79a7c0d57dc18ba28470158b59a8fdbaadc18f8922e262841a1f
@@ -94,6 +94,10 @@ module CocoapodsSoulComponentPlugin
94
94
  "#{root_path}/devops/component.json"
95
95
  end
96
96
 
97
+ def self.component_user_file_path
98
+ "#{root_path}/devops/component_user.json"
99
+ end
100
+
97
101
  Pod::HooksManager.register('cocoapods-soul-component-plugin', :pre_install) do |_context|
98
102
  Pod::UI.puts '插件 pre_install'
99
103
  end
@@ -119,14 +123,32 @@ module CocoapodsSoulComponentPlugin
119
123
  project.save
120
124
  end
121
125
 
122
- def self.pre_run
126
+ def self.generateComponents
127
+ components = []
123
128
  json = File.read(component_file_path)
124
129
  obj = JSON.parse(json)
125
- dependencies = obj['dependencies']
126
130
 
131
+ dependencies_user = nil
132
+ if File.exist?(component_user_file_path)
133
+ json_user = File.read(component_user_file_path)
134
+ obj_user = JSON.parse(json_user)
135
+ dependencies_user = obj_user['dependencies']
136
+ end
137
+
138
+ dependencies = obj['dependencies']
127
139
  dependencies.each do |each|
128
140
  component = Soul_Component.new(each[0], each[1]['local'], each[1]['submodule'], each[1]['version'], each[1]['git'],
129
141
  each[1]['branch'], each[1]['path'], each[1]['commit'])
142
+ if dependencies_user && dependencies_user[component.name]
143
+ component.local = dependencies_user[component.name]['local']
144
+ component.submodule = dependencies_user[component.name]['submodule'] if dependencies_user[component.name]['submodule']
145
+ component.version = dependencies_user[component.name]['version']
146
+ component.git = dependencies_user[component.name]['git'] if dependencies_user[component.name]['git']
147
+ component.branch = dependencies_user[component.name]['branch']
148
+ component.path = dependencies_user[component.name]['path']
149
+ component.commit = dependencies_user[component.name]['commit']
150
+ Pod::UI.puts "使用用户配置覆盖。参数:#{component.to_hash}".green
151
+ end
130
152
  if @@use_source
131
153
  component.local = true
132
154
  if Pod::Downloader::Git.check_if_has_auth_clone(component.git) == false
@@ -134,7 +156,27 @@ module CocoapodsSoulComponentPlugin
134
156
  Pod::UI.puts "本地依赖 #{component.name} 切换失败,使用 binary 。参数:#{component.to_hash}".red
135
157
  end
136
158
  end
137
- @@components.push(component)
159
+ components.push(component)
160
+ end
161
+ components
162
+ end
163
+
164
+ def self.checkValidComponents
165
+ isValid = true
166
+ @@components.each do |each|
167
+ if each.name.nil? || each.git.nil? || each.local.nil? || each.submodule.nil!
168
+ Pod::UI.puts "缺少必要参数,name/git/local/submodule为必要参数:#{each.to_hash}".red
169
+ isValid = false
170
+ end
171
+ end
172
+ isValid
173
+ end
174
+
175
+ def self.pre_run
176
+ @@components = generateComponents
177
+ if checkValidComponents == false
178
+ Pod::UI.puts '参数异常,退出'.red
179
+ exit(1)
138
180
  end
139
181
 
140
182
  @@components.each do |each|
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module CocoapodsSoulComponentPlugin
3
- VERSION = '0.0.11'
3
+ VERSION = '0.0.12'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-soul-component-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - fang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-09 00:00:00.000000000 Z
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler