cocoapods-soul-component-plugin 0.0.2 → 0.0.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2973ba2951120c6f1fcc995d160ba9021ba167826dc8c3e3cc9636bb4f2aa993
|
4
|
+
data.tar.gz: 78ec8ef8b8d1905530ac31c7fe498f1ecfe1948979c420d7dfb5b6ac559b96fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e884aec7137fb65168db58fee703f8d8b34edb35945e12d982d1ec405201ea67f7f857ea3d40bd8283684437c039e7b95eda6ab192ae5498c89b8f88420239a
|
7
|
+
data.tar.gz: e2174829dc3590418da0daab2c2f04979da30ca2afb51f17a423cbd47221bfaeedbb13450944678ced82d414a7e02c6a07054c767b3af242d926fbaaeb0c4e61
|
@@ -3,8 +3,19 @@ require 'fileutils'
|
|
3
3
|
require 'json'
|
4
4
|
require 'xcodeproj'
|
5
5
|
require 'cocoapods-downloader'
|
6
|
+
require 'cocoapods/user_interface'
|
7
|
+
require_relative '../gem_version'
|
6
8
|
|
7
9
|
module Pod
|
10
|
+
module Downloader
|
11
|
+
class Git < Base
|
12
|
+
def download_deep
|
13
|
+
clone(false,false )
|
14
|
+
checkout_commit if options[:commit]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
8
19
|
class Command
|
9
20
|
class Devops < Command
|
10
21
|
self.summary = <<-SUMMARY
|
@@ -29,7 +40,7 @@ module CocoapodsSoulComponentPlugin
|
|
29
40
|
class Soul_Component
|
30
41
|
attr_accessor :name, :local, :submodule, :version, :git, :branch, :path, :commit
|
31
42
|
|
32
|
-
def initialize(name, local, submodule, version, git, branch, path)
|
43
|
+
def initialize(name, local, submodule, version, git, branch, path, commit)
|
33
44
|
@name = name
|
34
45
|
@local = local
|
35
46
|
@submodule = submodule
|
@@ -50,11 +61,11 @@ module CocoapodsSoulComponentPlugin
|
|
50
61
|
end
|
51
62
|
|
52
63
|
def self.podfile_path
|
53
|
-
root_path
|
64
|
+
"#{root_path}/Podfile"
|
54
65
|
end
|
55
66
|
|
56
67
|
def self.component_file_path
|
57
|
-
root_path
|
68
|
+
"#{root_path}/devops/component.json"
|
58
69
|
end
|
59
70
|
|
60
71
|
Pod::HooksManager.register('cocoapods-soul-component-plugin', :pre_install) do |_context|
|
@@ -68,15 +79,13 @@ module CocoapodsSoulComponentPlugin
|
|
68
79
|
end
|
69
80
|
|
70
81
|
def self.post_run
|
71
|
-
return if use_components == false
|
72
|
-
|
73
82
|
Pod::UI.puts '添加component.json文件引用'
|
74
83
|
project = Xcodeproj::Project.open(Pod::Config.instance.sandbox.project_path)
|
75
84
|
# 获取主group
|
76
85
|
group = project.main_group
|
77
86
|
group.set_source_tree('SOURCE_ROOT')
|
78
87
|
# 向group中添加 文件引用
|
79
|
-
file_ref = group.new_reference(
|
88
|
+
file_ref = group.new_reference(self.component_file_path)
|
80
89
|
# podfile_local排序
|
81
90
|
podfile_local_group = group.children.last
|
82
91
|
group.children.pop
|
@@ -85,30 +94,42 @@ module CocoapodsSoulComponentPlugin
|
|
85
94
|
end
|
86
95
|
|
87
96
|
def self.pre_run
|
88
|
-
|
89
|
-
|
97
|
+
Pod::UI.puts "当前版本:#{CocoapodsSoulComponentPlugin::VERSION}".green
|
90
98
|
json = File.read(self.component_file_path)
|
91
99
|
obj = JSON.parse(json)
|
92
100
|
dependencies = obj['dependencies']
|
93
101
|
|
94
102
|
dependencies.each do |each|
|
95
|
-
$components.push(Soul_Component.new(each[0], each[1]['local'], each[1]['submodule'], each[1]['version'], each[1]['git'], each[1]['branch'], each[1]['path']))
|
103
|
+
$components.push(Soul_Component.new(each[0], each[1]['local'], each[1]['submodule'], each[1]['version'], each[1]['git'], each[1]['branch'], each[1]['path'],each[1]['commit']))
|
96
104
|
end
|
97
105
|
|
98
106
|
$components.each do |each|
|
99
107
|
if each.path == nil
|
100
108
|
if each.submodule == false
|
101
109
|
if each.local == true
|
102
|
-
local_path = each.name
|
103
|
-
|
110
|
+
local_path = each.name
|
111
|
+
|
112
|
+
if each.commit != nil
|
113
|
+
local_path += '-'
|
114
|
+
local_path += each.commit.to_s
|
115
|
+
elsif each.branch != nil
|
116
|
+
local_path += '-'
|
117
|
+
local_path += each.branch.to_s
|
118
|
+
elsif each.version != nil
|
119
|
+
local_path += '-'
|
120
|
+
local_path += each.version.to_s
|
121
|
+
end
|
122
|
+
target_path = "#{root_path}/LocalPods/#{local_path}1"
|
104
123
|
each.path = target_path
|
105
124
|
|
106
125
|
if File.exist?(target_path) == false
|
107
|
-
options = { git: each.git, commit: each.commit,
|
126
|
+
options = { git: each.git, commit: each.commit, tag: each.version, branch:each.branch }
|
108
127
|
options = Pod::Downloader.preprocess_options(options)
|
109
128
|
downloader = Pod::Downloader.for_target(target_path, options)
|
110
|
-
downloader.
|
111
|
-
|
129
|
+
downloader.download_deep
|
130
|
+
Pod::UI.puts "本地 #{each.name} 不存在,进行 clone 。参数:#{options}".green
|
131
|
+
else
|
132
|
+
Pod::UI.puts "本地 #{each.name} 已存在,不进行变更,如需更新请删除。位置:#{target_path}".yellow
|
112
133
|
end
|
113
134
|
end
|
114
135
|
else
|
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.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|