yjcocoa 17.8.26 → 18.07.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -6
- data/lib/yjcocoa/command.rb +5 -6
- data/lib/yjcocoa/gem_version.rb +2 -2
- data/lib/yjcocoa/git/git.rb +1 -1
- data/lib/yjcocoa/git/git_cache.rb +1 -4
- data/lib/yjcocoa/git/git_tag.rb +22 -14
- data/lib/yjcocoa/git/git_tag_add.rb +38 -0
- data/lib/yjcocoa/git/git_tag_delete.rb +38 -0
- data/lib/yjcocoa/log/log.rb +87 -0
- data/lib/yjcocoa/pod/pod.rb +31 -0
- data/lib/yjcocoa/pod/pod_dependency.rb +171 -0
- data/lib/yjcocoa/pod/pod_lib.rb +47 -0
- data/lib/yjcocoa/pod/pod_release.rb +90 -0
- data/lib/yjcocoa/pod/product_class.rb +28 -0
- data/lib/yjcocoa/test.rb +1 -0
- data/lib/yjcocoa.rb +5 -3
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 468dc9c57201b9d39c26c51c9e7b7aa683d1c2e4
|
4
|
+
data.tar.gz: a5ca566d3435ac11207a5c95add930a69399e8d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eda8132e956e71098abc1dd49198652034c06a611d09cd93f942f5b49e70a0e9cce60c7cbaffc62ca6ca26f3daafcdd98d464da33ce3c1091e45bbc5a6c0d08
|
7
|
+
data.tar.gz: a7a9d834f2d6bbc331a93c3e76474f537e30591317609db0ae8ffecf2824043a5e557e4e395e9f4f88b84b4117dc4783ba9cb4031057d44dbf717fec708e850a
|
data/README.md
CHANGED
@@ -11,9 +11,24 @@ YJ系列Gem开源库
|
|
11
11
|
|
12
12
|
[https://rubygems.org/gems/yjcocoa](https://rubygems.org/gems/yjcocoa)
|
13
13
|
|
14
|
-
|
14
|
+
```
|
15
|
+
Usage:
|
15
16
|
|
16
|
-
|
17
|
+
$ yjcocoa COMMAND
|
18
|
+
|
19
|
+
YJCocoa, the Cocoa library package manager.
|
20
|
+
|
21
|
+
Commands:
|
22
|
+
|
23
|
+
+ git Git commands
|
24
|
+
+ log log 日志解析
|
25
|
+
+ pod Pod commands
|
26
|
+
|
27
|
+
Options:
|
28
|
+
|
29
|
+
--version Show the version of the tool
|
30
|
+
--help Show help banner of specified command
|
31
|
+
```
|
17
32
|
|
18
33
|
----------
|
19
34
|
|
@@ -27,12 +42,8 @@ QQ:937447974
|
|
27
42
|
|
28
43
|
YJ技术支持群:557445088
|
29
44
|
|
30
|
-
职位:滴滴 iOS 高级工程师
|
31
|
-
|
32
45
|
如果你觉得这个框架很赞,请点击右上角的Star按钮;如果你对我的框架感兴趣,并想持续获得本人最新的框架源文件,欢迎点击右上角的Fork按钮。
|
33
46
|
|
34
|
-
如果你也想来和我们一起在滴滴从事iOS研发工作,欢迎投递简历到937447974@qq.com。
|
35
|
-
|
36
47
|
## Copyright
|
37
48
|
|
38
49
|
CSDN:http://blog.csdn.net/y550918116j
|
data/lib/yjcocoa/command.rb
CHANGED
@@ -9,13 +9,10 @@
|
|
9
9
|
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
10
|
#
|
11
11
|
|
12
|
-
require 'claide'
|
13
|
-
require 'colored2'
|
14
|
-
require 'fileutils'
|
15
|
-
require 'yjcocoa/gem_version'
|
16
|
-
|
17
12
|
module YJCocoa
|
18
13
|
|
14
|
+
require 'yjcocoa/gem_version'
|
15
|
+
|
19
16
|
# Usage
|
20
17
|
class Command < CLAide::Command
|
21
18
|
|
@@ -59,7 +56,7 @@ module YJCocoa
|
|
59
56
|
result = STDIN.gets.chomp.downcase
|
60
57
|
if result.empty?
|
61
58
|
result = answersDowncase.first
|
62
|
-
|
59
|
+
puts "select default: #{result}".yellow
|
63
60
|
else
|
64
61
|
result = "yes" if result == "y"
|
65
62
|
result = "no" if result == "n"
|
@@ -74,6 +71,8 @@ module YJCocoa
|
|
74
71
|
|
75
72
|
# Commands
|
76
73
|
require 'yjcocoa/git/git'
|
74
|
+
require 'yjcocoa/log/log'
|
75
|
+
require 'yjcocoa/pod/pod'
|
77
76
|
|
78
77
|
end
|
79
78
|
|
data/lib/yjcocoa/gem_version.rb
CHANGED
data/lib/yjcocoa/git/git.rb
CHANGED
data/lib/yjcocoa/git/git_tag.rb
CHANGED
@@ -13,25 +13,26 @@ module YJCocoa
|
|
13
13
|
|
14
14
|
class GitTag < Git
|
15
15
|
|
16
|
+
self.abstract_command = false
|
16
17
|
self.command = 'tag'
|
17
18
|
self.summary = 'git tag'
|
18
19
|
self.description = <<-DESC
|
19
20
|
操作 tag 并同步到服务器
|
20
|
-
|
21
|
-
1. 增加tag 1.0:yjcocoa git tag --add=1.0
|
22
|
-
|
23
|
-
2. 删除多个tag 1.0 和 2.0:yjcocoa git tag --delete=1.0,2.0
|
24
21
|
DESC
|
25
22
|
|
26
23
|
def self.options
|
27
|
-
|
28
|
-
|
24
|
+
if self == YJCocoa::GitTag
|
25
|
+
[['--add', '增加 tag, 多 tag 用 "," 分隔'],
|
26
|
+
['--delete', '删除 tag, 多 tag 用 "," 分隔']] + super
|
27
|
+
else
|
28
|
+
super
|
29
|
+
end
|
29
30
|
end
|
30
|
-
|
31
|
+
|
31
32
|
# property
|
32
33
|
attr_accessor :addTag
|
33
34
|
attr_accessor :deleteTags
|
34
|
-
|
35
|
+
|
35
36
|
# 初始化
|
36
37
|
def initialize(argv)
|
37
38
|
super
|
@@ -39,13 +40,16 @@ module YJCocoa
|
|
39
40
|
self.deleteTags = argv.option('delete')
|
40
41
|
self.deleteTags = self.deleteTags.split(",").reject {|i| i.empty? } if self.deleteTags
|
41
42
|
end
|
42
|
-
|
43
|
+
|
43
44
|
# businrss
|
44
45
|
def validate!
|
46
|
+
super
|
45
47
|
exit 0 unless self.gitExist?
|
46
|
-
|
48
|
+
if self.class == YJCocoa::GitTag
|
49
|
+
self.banner! unless self.addTag || self.deleteTags
|
50
|
+
end
|
47
51
|
end
|
48
|
-
|
52
|
+
|
49
53
|
def run
|
50
54
|
if self.addTag
|
51
55
|
self.gitTagAdd
|
@@ -53,19 +57,23 @@ module YJCocoa
|
|
53
57
|
end
|
54
58
|
self.gitTagDelete if self.deleteTags && !self.deleteTags.empty?
|
55
59
|
end
|
56
|
-
|
60
|
+
|
57
61
|
def gitTagAdd
|
58
62
|
puts "YJCocoa git add tag #{self.addTag}".green
|
59
63
|
system("git push origin #{self.addTag}") if system("git tag #{self.addTag}")
|
60
64
|
end
|
61
|
-
|
65
|
+
|
62
66
|
def gitTagDelete
|
63
67
|
puts "YJCocoa git delete tags #{self.deleteTags}".green
|
64
68
|
self.deleteTags.each { |tag|
|
65
69
|
system("git push origin :refs/tags/#{tag}") if system("git tag -d #{tag}")
|
66
70
|
}
|
67
71
|
end
|
68
|
-
|
72
|
+
|
69
73
|
end
|
70
74
|
|
75
|
+
# Commands
|
76
|
+
require 'yjcocoa/git/git_tag_add'
|
77
|
+
require 'yjcocoa/git/git_tag_delete'
|
78
|
+
|
71
79
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# git_tag_add.rb
|
3
|
+
# YJCocoa
|
4
|
+
#
|
5
|
+
# https://github.com/937447974
|
6
|
+
# YJ技术支持群:557445088
|
7
|
+
#
|
8
|
+
# Created by 阳君 on 2018/07/16.
|
9
|
+
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
|
+
#
|
11
|
+
|
12
|
+
module YJCocoa
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
class GitTagAdd < GitTag
|
16
|
+
|
17
|
+
self.abstract_command = false
|
18
|
+
self.command = 'add'
|
19
|
+
self.summary = '添加默认 tag(git库名-%Y%m%d%H%M)'
|
20
|
+
self.description = '添加默认 tag(git库名-%Y%m%d%H%M)'
|
21
|
+
|
22
|
+
def run
|
23
|
+
if File.exist?(".git")
|
24
|
+
tag = File.basename(Dir.pwd)
|
25
|
+
tag << '-'
|
26
|
+
tag << Time.now.strftime("%Y%m%d%H%M")
|
27
|
+
puts "YJCocoa build tag #{tag}".green
|
28
|
+
system("yjcocoa git tag --add=#{tag}")
|
29
|
+
else
|
30
|
+
Dir.chdir("..") {
|
31
|
+
self.run
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# git_tag_delete.rb
|
3
|
+
# YJCocoa
|
4
|
+
#
|
5
|
+
# https://github.com/937447974
|
6
|
+
# YJ技术支持群:557445088
|
7
|
+
#
|
8
|
+
# Created by 阳君 on 2018/07/16.
|
9
|
+
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
|
+
#
|
11
|
+
|
12
|
+
module YJCocoa
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
class GitTagDelete < GitTag
|
16
|
+
|
17
|
+
self.abstract_command = false
|
18
|
+
self.command = 'delete'
|
19
|
+
self.summary = '删除最新的 tag'
|
20
|
+
self.description = '删除最新的 tag'
|
21
|
+
|
22
|
+
def run
|
23
|
+
tag = `git tag`.split("\n").last
|
24
|
+
if tag
|
25
|
+
answer = self.askWithAnswers("是否删除 tag #{tag}", ["Yes", "No"])
|
26
|
+
if answer == "yes"
|
27
|
+
system("YJCocoa git tag --delete=#{tag}")
|
28
|
+
end
|
29
|
+
else
|
30
|
+
puts "暂无 Tag".green
|
31
|
+
self.banner!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#
|
2
|
+
# pod.rb
|
3
|
+
# YJCocoa
|
4
|
+
#
|
5
|
+
# https://github.com/937447974
|
6
|
+
# YJ技术支持群:557445088
|
7
|
+
#
|
8
|
+
# Created by 阳君 on 2018/07/17.
|
9
|
+
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
|
+
#
|
11
|
+
|
12
|
+
module YJCocoa
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
class Log < Command
|
16
|
+
|
17
|
+
self.command = 'log'
|
18
|
+
self.summary = 'log 日志解析'
|
19
|
+
self.description = <<-DESC
|
20
|
+
.log 日志解析,并保留需要的记录\n
|
21
|
+
1. 以文件夹的方式解析,并将解析后的日志存放在文件夹内。\n
|
22
|
+
2. 解析时使用字符串匹配,匹配成功的记录会保留 YJCocoa.log 中。
|
23
|
+
DESC
|
24
|
+
|
25
|
+
def self.options
|
26
|
+
[['--dir', '文件夹地址'], ['--match', '匹配的字符串']] + super
|
27
|
+
end
|
28
|
+
|
29
|
+
LOG_FILE = "YJCocoa.log"
|
30
|
+
|
31
|
+
attr_accessor :dir # 文件夹地址
|
32
|
+
attr_accessor :match # 匹配的字符串
|
33
|
+
|
34
|
+
# 初始化
|
35
|
+
def initialize(argv)
|
36
|
+
super
|
37
|
+
self.dir = argv.option('dir')
|
38
|
+
self.match = argv.option('match')
|
39
|
+
self.match = self.match.split(",").reject {|i| i.empty? } if self.match
|
40
|
+
end
|
41
|
+
|
42
|
+
# businrss
|
43
|
+
def validate!
|
44
|
+
super
|
45
|
+
unless self.dir && Dir.exist?(self.dir)
|
46
|
+
puts "dir:#{self.dir} 文件夹不存在".red
|
47
|
+
self.banner!
|
48
|
+
end
|
49
|
+
unless self.match && self.match.length > 0
|
50
|
+
puts "match 为空".red
|
51
|
+
self.banner!
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def run
|
56
|
+
Dir.chdir(self.dir) {
|
57
|
+
log = ""
|
58
|
+
File.delete(LOG_FILE) if File.exist?(LOG_FILE)
|
59
|
+
for path in Dir["**/*.log"].sort do
|
60
|
+
puts "解析日志 #{path}".green
|
61
|
+
File.open(path, "r") { |file|
|
62
|
+
while line = file.gets
|
63
|
+
if self.check(line)
|
64
|
+
log << line
|
65
|
+
end
|
66
|
+
end
|
67
|
+
}
|
68
|
+
end
|
69
|
+
puts "\n解析完毕,打开日志:#{dir}/#{LOG_FILE}".green
|
70
|
+
File.write(LOG_FILE, log)
|
71
|
+
`open #{LOG_FILE}`
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
def check (line)
|
76
|
+
self.match.each { |m|
|
77
|
+
if line.include?(m)
|
78
|
+
return true
|
79
|
+
end
|
80
|
+
}
|
81
|
+
return false
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# pod.rb
|
3
|
+
# YJCocoa
|
4
|
+
#
|
5
|
+
# https://github.com/937447974
|
6
|
+
# YJ技术支持群:557445088
|
7
|
+
#
|
8
|
+
# Created by 阳君 on 2018/07/16.
|
9
|
+
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
|
+
#
|
11
|
+
|
12
|
+
module YJCocoa
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
class Pod < Command
|
16
|
+
|
17
|
+
self.abstract_command = true
|
18
|
+
self.command = 'pod'
|
19
|
+
self.summary = 'Pod commands'
|
20
|
+
self.description = 'These are common pod commands used in YJCocoa.'
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
# Commands
|
25
|
+
require 'yjcocoa/pod/pod_dependency'
|
26
|
+
require 'yjcocoa/pod/pod_lib'
|
27
|
+
require 'yjcocoa/pod/pod_release'
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
@@ -0,0 +1,171 @@
|
|
1
|
+
#
|
2
|
+
# pod_dependency.rb
|
3
|
+
# YJCocoa
|
4
|
+
#
|
5
|
+
# https://github.com/937447974
|
6
|
+
# YJ技术支持群:557445088
|
7
|
+
#
|
8
|
+
# Created by 阳君 on 2018/07/17.
|
9
|
+
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
|
+
#
|
11
|
+
|
12
|
+
module YJCocoa
|
13
|
+
|
14
|
+
require 'yjcocoa/pod/product_class'
|
15
|
+
|
16
|
+
# Usage
|
17
|
+
class PodDependency < Pod
|
18
|
+
|
19
|
+
self.command = 'dependency'
|
20
|
+
self.summary = '代码依赖分析'
|
21
|
+
self.description = <<-DESC
|
22
|
+
代码依赖分析\n
|
23
|
+
1. 分析库之间的依赖关系;\n
|
24
|
+
2. 搜索不符合规范的 import 导入,库正确导入方式为 '#import <Foundation/Foundation.h>',错误的方式是'#import "Foundation.h"'.
|
25
|
+
DESC
|
26
|
+
|
27
|
+
def self.options
|
28
|
+
[['--dir', '库路径,多个库用’,‘号分割'],
|
29
|
+
['--output', '日志存放路径,默认当前路径']] + super
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_accessor :dir_array # 目录
|
33
|
+
attr_accessor :output # 输出地址
|
34
|
+
attr_accessor :ignore_frameworks # 忽略的外部库
|
35
|
+
|
36
|
+
def initialize(argv)
|
37
|
+
super
|
38
|
+
self.dir_array = argv.option('dir')
|
39
|
+
self.output = argv.option('output')
|
40
|
+
if self.dir_array
|
41
|
+
self.dir_array = self.dir_array.split(",").reject {|i|
|
42
|
+
i.empty? || !Dir.exist?(i)
|
43
|
+
}
|
44
|
+
end
|
45
|
+
self.output = Dir.pwd unless self.output
|
46
|
+
self.output << "/YJCocoa.log"
|
47
|
+
self.ignore_frameworks = ["AppKit", "Foundation", "UIKit", "WatchKit"]
|
48
|
+
end
|
49
|
+
|
50
|
+
def validate!
|
51
|
+
super
|
52
|
+
unless self.dir_array && !self.dir_array.empty?
|
53
|
+
puts "库路径为空或不存在".red
|
54
|
+
self.banner!
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def run
|
59
|
+
log = "YJCocoa 代码依赖分析\n"
|
60
|
+
files = self.search_files
|
61
|
+
log << "文件数:#{files.size}\n"
|
62
|
+
products = self.parsing_files(files)
|
63
|
+
log << "class数:#{products.size}\n"
|
64
|
+
log << self.parsing_class(products)
|
65
|
+
puts "\n分析完毕,打开日志:#{self.output}".green
|
66
|
+
File.write(self.output, log)
|
67
|
+
`open #{self.output}`
|
68
|
+
end
|
69
|
+
|
70
|
+
def search_files
|
71
|
+
puts "\n搜索文件...".green
|
72
|
+
files = []
|
73
|
+
for dir in self.dir_array do
|
74
|
+
Dir.chdir(dir) {
|
75
|
+
puts dir
|
76
|
+
for path in Dir["**/*.{h,m,mm}"] do
|
77
|
+
files << "#{dir}/#{path}"
|
78
|
+
end
|
79
|
+
}
|
80
|
+
end
|
81
|
+
files.uniq!
|
82
|
+
files.sort!
|
83
|
+
end
|
84
|
+
|
85
|
+
def parsing_files(files)
|
86
|
+
puts "\n分析文件...".green
|
87
|
+
hash = {}
|
88
|
+
for file in files
|
89
|
+
puts file
|
90
|
+
fileName = File.basename(file).split(".").first
|
91
|
+
product_class = hash[fileName]
|
92
|
+
unless product_class
|
93
|
+
product_class = ProductClass.new(fileName)
|
94
|
+
hash[fileName] = product_class
|
95
|
+
end
|
96
|
+
case File.extname(file)
|
97
|
+
when ".h"
|
98
|
+
product_class.h_path = file
|
99
|
+
when ".m"
|
100
|
+
product_class.m_path = file
|
101
|
+
when ".mm"
|
102
|
+
product_class.mm_path = file
|
103
|
+
end
|
104
|
+
end
|
105
|
+
return hash
|
106
|
+
end
|
107
|
+
|
108
|
+
def parsing_class(products)
|
109
|
+
puts "\n分析文件内容...".green
|
110
|
+
log = ""
|
111
|
+
all_frameworks = []
|
112
|
+
for project in products.values
|
113
|
+
puts project.name
|
114
|
+
templog = ""
|
115
|
+
hlog = self.parsing_content(project.h_path, all_frameworks, products) if project.h_path
|
116
|
+
templog << hlog if hlog
|
117
|
+
mlog = self.parsing_content(project.m_path, all_frameworks, products) if project.m_path
|
118
|
+
templog << mlog if mlog
|
119
|
+
mmlog = self.parsing_content(project.mm_path, all_frameworks, products) if project.mm_path
|
120
|
+
templog << mmlog if mmlog
|
121
|
+
log << "\n#{project.name}\n#{templog}" unless templog.empty?
|
122
|
+
end
|
123
|
+
all_frameworks.uniq!
|
124
|
+
all_frameworks.sort!
|
125
|
+
return "外部依赖汇总:#{all_frameworks.size} #{all_frameworks.to_s}\n\n" + log
|
126
|
+
end
|
127
|
+
|
128
|
+
def parsing_content(file, all_frameworks, products)
|
129
|
+
frameworks = []
|
130
|
+
warning = []
|
131
|
+
error = []
|
132
|
+
File.open(file, "r") { |file|
|
133
|
+
while line = file.gets
|
134
|
+
if line.include?("#import")
|
135
|
+
if line.include?("<")
|
136
|
+
import = line[/<.*>/][/<.*\//]
|
137
|
+
if import
|
138
|
+
import[0] = ""
|
139
|
+
import[-1] = ""
|
140
|
+
frameworks << import unless self.ignore_frameworks.include?(import)
|
141
|
+
else
|
142
|
+
error << line.chomp
|
143
|
+
end
|
144
|
+
elsif line.include?(".h\"")
|
145
|
+
import = line[/".*.h"/]
|
146
|
+
import[0] = ""
|
147
|
+
import[-1] = ""
|
148
|
+
warning << import unless products[import[0..import.size-3]]
|
149
|
+
end
|
150
|
+
elsif line.include?("@protocol") || line.include?("@interface") || line.include?("@implementation")
|
151
|
+
break
|
152
|
+
end
|
153
|
+
end
|
154
|
+
}
|
155
|
+
all_frameworks.concat(frameworks)
|
156
|
+
frameworks.uniq!
|
157
|
+
frameworks.sort!
|
158
|
+
if !frameworks.empty? || !warning.empty? || !error.empty?
|
159
|
+
log = "#{file}\n"
|
160
|
+
log << "外部依赖:#{frameworks.to_s}\n" unless frameworks.empty?
|
161
|
+
log << "错误依赖:#{error.to_s}\n" unless error.empty?
|
162
|
+
log << "不合理依赖:#{warning.to_s}\n" unless warning.empty?
|
163
|
+
return log
|
164
|
+
end
|
165
|
+
return nil
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# product_lib.rb
|
3
|
+
# YJCocoa
|
4
|
+
#
|
5
|
+
# https://github.com/937447974
|
6
|
+
# YJ技术支持群:557445088
|
7
|
+
#
|
8
|
+
# Created by 阳君 on 2018/07/17.
|
9
|
+
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
|
+
#
|
11
|
+
|
12
|
+
module YJCocoa
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
class PodLib < Pod
|
16
|
+
|
17
|
+
self.command = 'lib'
|
18
|
+
self.summary = 'Develop pods'
|
19
|
+
self.description = 'Develop pods'
|
20
|
+
|
21
|
+
def self.options
|
22
|
+
[['--create', 'Creates a new Pod'],] + super
|
23
|
+
end
|
24
|
+
|
25
|
+
attr_accessor :create # create pod
|
26
|
+
|
27
|
+
def initialize(argv)
|
28
|
+
super
|
29
|
+
self.create = argv.option('create')
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate!
|
33
|
+
super
|
34
|
+
unless self.create && !self.create.empty?
|
35
|
+
puts "库名为空".red
|
36
|
+
self.banner!
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
puts "YJCocoa create pod lib #{self.create}".green
|
42
|
+
system("pod lib create --template-url=git@github.com:937447974/pod-template.git #{self.create}")
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
#
|
2
|
+
# pod_release.rb
|
3
|
+
# YJCocoa
|
4
|
+
#
|
5
|
+
# https://github.com/937447974
|
6
|
+
# YJ技术支持群:557445088
|
7
|
+
#
|
8
|
+
# Created by 阳君 on 2018/07/16.
|
9
|
+
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
|
+
#
|
11
|
+
|
12
|
+
module YJCocoa
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
class PodRelease < Pod
|
16
|
+
|
17
|
+
self.abstract_command = false
|
18
|
+
self.command = 'release'
|
19
|
+
self.summary = '收集 pod 库的 版本号'
|
20
|
+
self.description = <<-DESC
|
21
|
+
收集 pod 库的 版本号
|
22
|
+
|
23
|
+
注意事项: podfile 和 sender 不可为空
|
24
|
+
DESC
|
25
|
+
|
26
|
+
def self.options
|
27
|
+
[['--podfile', '包含 pods 库的 podfile 文件路径'],
|
28
|
+
['--pods', 'pods 库,多 pod 用 "," 分隔']] + super
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_accessor :podfile # 文件路径
|
32
|
+
attr_accessor :pods # pods 库
|
33
|
+
|
34
|
+
# 初始化
|
35
|
+
def initialize(argv)
|
36
|
+
super
|
37
|
+
self.podfile = argv.option('podfile')
|
38
|
+
self.pods = argv.option('pods')
|
39
|
+
self.pods = self.pods.split(",").reject {|i| i.empty? } if self.pods
|
40
|
+
end
|
41
|
+
|
42
|
+
def validate!
|
43
|
+
super
|
44
|
+
puts "podfile 为空".red unless self.podfile
|
45
|
+
puts "pods 为空".red unless self.pods
|
46
|
+
self.banner! unless self.podfile && self.pods
|
47
|
+
unless File.exist?(self.podfile)
|
48
|
+
puts "podfile 文件路径 #{self.podfile} 不存在".red
|
49
|
+
self.banner!
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# businrss
|
54
|
+
def run
|
55
|
+
self.gitPull
|
56
|
+
content = []
|
57
|
+
File.open(self.podfile, "r") { |file|
|
58
|
+
while line = file.gets #标准输入流
|
59
|
+
result = check(self.pods, line)
|
60
|
+
content << "#{result}" if result
|
61
|
+
end
|
62
|
+
}
|
63
|
+
puts "YJCocoa Pod Release".green
|
64
|
+
puts content.sort * "\n"
|
65
|
+
end
|
66
|
+
|
67
|
+
def gitPull
|
68
|
+
puts "#{self.podfile} git pull".green
|
69
|
+
Dir.chdir(File.dirname(self.podfile)) {| path |
|
70
|
+
system("yjcocoa git pull")
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
private def check (pods, line)
|
75
|
+
pods.each { |pod|
|
76
|
+
if line.include?(pod)
|
77
|
+
pods.delete(pod)
|
78
|
+
line.split(',').each { |item|
|
79
|
+
if item.include?("tag") || item.include?("branch")
|
80
|
+
return "#{pod}, #{item.chomp}"
|
81
|
+
end
|
82
|
+
}
|
83
|
+
end
|
84
|
+
}
|
85
|
+
return nil
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# product_class.rb
|
3
|
+
# YJCocoa
|
4
|
+
#
|
5
|
+
# https://github.com/937447974
|
6
|
+
# YJ技术支持群:557445088
|
7
|
+
#
|
8
|
+
# Created by 阳君 on 2018/07/17.
|
9
|
+
# Copyright © 2017年 YJCocoa. All rights reserved.
|
10
|
+
#
|
11
|
+
|
12
|
+
module YJCocoa
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
class ProductClass
|
16
|
+
|
17
|
+
attr_accessor :name
|
18
|
+
attr_accessor :h_path
|
19
|
+
attr_accessor :m_path
|
20
|
+
attr_accessor :mm_path
|
21
|
+
|
22
|
+
def initialize(name)
|
23
|
+
self.name = name
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/lib/yjcocoa/test.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Dir.chdir("..") { system("yjcocoa git pull") }
|
data/lib/yjcocoa.rb
CHANGED
@@ -11,11 +11,13 @@
|
|
11
11
|
|
12
12
|
require 'rubygems'
|
13
13
|
require 'claide'
|
14
|
-
require '
|
15
|
-
require '
|
14
|
+
require 'colored2'
|
15
|
+
require 'date'
|
16
|
+
require 'fileutils'
|
17
|
+
require 'json'
|
16
18
|
|
17
19
|
module YJCocoa
|
18
20
|
|
19
|
-
|
21
|
+
require 'yjcocoa/command'
|
20
22
|
|
21
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yjcocoa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 18.07.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 阳君
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|
@@ -69,6 +69,15 @@ files:
|
|
69
69
|
- lib/yjcocoa/git/git_cache.rb
|
70
70
|
- lib/yjcocoa/git/git_pull.rb
|
71
71
|
- lib/yjcocoa/git/git_tag.rb
|
72
|
+
- lib/yjcocoa/git/git_tag_add.rb
|
73
|
+
- lib/yjcocoa/git/git_tag_delete.rb
|
74
|
+
- lib/yjcocoa/log/log.rb
|
75
|
+
- lib/yjcocoa/pod/pod.rb
|
76
|
+
- lib/yjcocoa/pod/pod_dependency.rb
|
77
|
+
- lib/yjcocoa/pod/pod_lib.rb
|
78
|
+
- lib/yjcocoa/pod/pod_release.rb
|
79
|
+
- lib/yjcocoa/pod/product_class.rb
|
80
|
+
- lib/yjcocoa/test.rb
|
72
81
|
homepage: https://github.com/937447974/YJCocoaGem
|
73
82
|
licenses:
|
74
83
|
- MIT
|
@@ -89,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
98
|
version: '0'
|
90
99
|
requirements: []
|
91
100
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.6.
|
101
|
+
rubygems_version: 2.6.14
|
93
102
|
signing_key:
|
94
103
|
specification_version: 3
|
95
104
|
summary: YJCocoa, the Cocoa library package manager.
|