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: fa620c7c3ab4615ab343b36920c4d100a31cf593b3e2099bb550e288751aa843
4
- data.tar.gz: 9dadc43531e8c1c78891d1e0f1c0de44c9a86bf80c59e74df8b547eb364d6f3c
3
+ metadata.gz: 2973ba2951120c6f1fcc995d160ba9021ba167826dc8c3e3cc9636bb4f2aa993
4
+ data.tar.gz: 78ec8ef8b8d1905530ac31c7fe498f1ecfe1948979c420d7dfb5b6ac559b96fc
5
5
  SHA512:
6
- metadata.gz: 026a210fd891acbd0bdc07ac147639c0685e59cb9efcf6d5a5eec0ea4c031a1bf6934c307a8611e2f5da0d35ee2310255af6f221a9f2778ca0d95f0950f43a5d
7
- data.tar.gz: cbd9b68c220ce4b23157b452abdb4db6ee50bc3491e9d8ff8f8bcab97c28c978a272159b07e429cb8f3572c1e8cc4ee2418286573ba797db56469c4f72e3ad51
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 + '/Podfile'
64
+ "#{root_path}/Podfile"
54
65
  end
55
66
 
56
67
  def self.component_file_path
57
- root_path + '/devops/component.json'
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(Pod::Config.instance.sandbox.root + '../devops/component.json')
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
- time = Time.now.to_i
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 + each.branch.to_s + each.commit.to_s
103
- target_path = root_path + '/LocalPods/' + local_path
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, branch: each.branch }
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.download
111
- downloader.checkout_options #=> { :git => 'example.com', :commit => 'd7f410490dabf7a6bde665ba22da102c3acf1bd9' }
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
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module CocoapodsSoulComponentPlugin
2
- VERSION = "0.0.2"
3
+ VERSION = '0.0.8'
3
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.2
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-09 00:00:00.000000000 Z
11
+ date: 2021-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler