DYAutomate 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +43 -0
- data/bin/dj +5 -0
- data/lib/DYAutomate/Command/Git/tagAdd.rb +69 -0
- data/lib/DYAutomate/Command/Pod/push.rb +93 -0
- data/lib/DYAutomate/Command/Pod/version.rb +59 -0
- data/lib/DYAutomate/Command/Workspace/update.rb +59 -0
- data/lib/DYAutomate/Command/dgit.rb +48 -0
- data/lib/DYAutomate/Command/pod.rb +158 -0
- data/lib/DYAutomate/Command/workspace.rb +90 -0
- data/lib/DYAutomate/Command.rb +49 -0
- data/lib/DYAutomate/version.rb +3 -0
- data/lib/DYAutomate.rb +11 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 438507c33cf700baf806f30fe9affe634ca0384e
|
4
|
+
data.tar.gz: b85adef4ae7fdf87feffe6c93dd208eb8339fc53
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f4e43f68cb255bc3003615e922314ff25fe3f357074fc69034dd05cb4585f9c7208452d0f62d1775b0f20af590742985178787d84c682ac9fc472b341fd1d696
|
7
|
+
data.tar.gz: 78a16749ad3cc6a01645fdefed2da52fe4fdb2a8b7ca0684693625f7e8ec04ebd9e23052950567a4050551a826b66146bb983e7da0b32ce3f6499da0ffac1e41
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# DYAutomate
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/DYAutomate`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'DYAutomate'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install DYAutomate
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/DYAutomate. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the DYAutomate project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/DYAutomate/blob/master/CODE_OF_CONDUCT.md).
|
data/bin/dj
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
module DYAutomate
|
3
|
+
class Command
|
4
|
+
class Git <Command
|
5
|
+
|
6
|
+
class TagAdd < Git
|
7
|
+
|
8
|
+
# self.abstract_command = true
|
9
|
+
self.command = 'tagAdd'
|
10
|
+
self.summary = '推送私有库到repo'
|
11
|
+
self.arguments = [
|
12
|
+
CLAide::Argument.new('NAME', true),
|
13
|
+
]
|
14
|
+
|
15
|
+
# #要查询的lib名字
|
16
|
+
# attr_accessor :name
|
17
|
+
# #查询结果lib信息
|
18
|
+
# attr_accessor :info
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
# @name = argv.shift_argument
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def validate!
|
26
|
+
super
|
27
|
+
# unless @name
|
28
|
+
# help! 'need the lib `NAME`.'
|
29
|
+
# end
|
30
|
+
|
31
|
+
# unless existAtPools?
|
32
|
+
# help! "the podspec file is not exist at #{Dir.pwd}."
|
33
|
+
# end
|
34
|
+
end
|
35
|
+
|
36
|
+
def run
|
37
|
+
pp('tagAdd run ...',1)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_tag(newTag)
|
42
|
+
|
43
|
+
@git_obj.tags.each{|x|
|
44
|
+
if x.name.eql?(newTag)
|
45
|
+
puts "Errror git --- #{newTag} has exist!"
|
46
|
+
end
|
47
|
+
}
|
48
|
+
|
49
|
+
#git操作
|
50
|
+
begin
|
51
|
+
git.add(:all=>true)
|
52
|
+
#提交更改
|
53
|
+
git.commit("修改版本号 newTag")
|
54
|
+
git.push
|
55
|
+
|
56
|
+
#打tag
|
57
|
+
git.add_tag(newTag, {:m => "tag更新"})
|
58
|
+
#push tag
|
59
|
+
git.push('origin','master',{:tags =>newTag})
|
60
|
+
rescue
|
61
|
+
git.reset_hard()
|
62
|
+
puts "Errror git --- newTag"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
|
2
|
+
module DYAutomate
|
3
|
+
class Command
|
4
|
+
class Pod <Command
|
5
|
+
|
6
|
+
class Push < Pod
|
7
|
+
|
8
|
+
require 'git'
|
9
|
+
# self.abstract_command = true
|
10
|
+
self.command = 'push'
|
11
|
+
self.summary = '推送私有库到repo'
|
12
|
+
self.arguments = [
|
13
|
+
# CLAide::Argument.new('NAME', true),
|
14
|
+
]
|
15
|
+
|
16
|
+
# #要查询的lib名字
|
17
|
+
# attr_accessor :name
|
18
|
+
# #查询结果lib信息
|
19
|
+
# attr_accessor :info
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
# @name = argv.shift_argument
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate!
|
27
|
+
super
|
28
|
+
# unless @name
|
29
|
+
# help! 'need the lib `NAME`.'
|
30
|
+
# end
|
31
|
+
|
32
|
+
# unless existAtPools?
|
33
|
+
# help! "the podspec file is not exist at #{Dir.pwd}."
|
34
|
+
# end
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
pp('push run ...',1)
|
39
|
+
|
40
|
+
Dir.chdir(@path)
|
41
|
+
new_v = get_spec_version
|
42
|
+
|
43
|
+
isTagOk = true
|
44
|
+
retry_time = 2
|
45
|
+
|
46
|
+
#git 处理
|
47
|
+
begin
|
48
|
+
isTagOk = system "git add ."
|
49
|
+
isTagOk = system "git commit -m \"修改版本号 ->#{new_v}\""
|
50
|
+
isTagOk = system "git push"
|
51
|
+
unless isTagOk
|
52
|
+
retry_time.times{
|
53
|
+
pp('retry push ...',1)
|
54
|
+
isTagOk = system "git push"
|
55
|
+
system 'sleep 2'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
if isTagOk
|
60
|
+
isTagOk = system "git tag -a #{new_v} -m '升级tag'"
|
61
|
+
isTagOk = system "git push --tags"
|
62
|
+
unless isTagOk
|
63
|
+
retry_time.times{
|
64
|
+
pp('retry push tags ...',1)
|
65
|
+
isTagOk = system "git push --tags"
|
66
|
+
system 'sleep 2'
|
67
|
+
}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
rescue
|
71
|
+
isTagOk = false
|
72
|
+
pp("Errror git --- #{@name} --- #{new_v}", 2)
|
73
|
+
end
|
74
|
+
|
75
|
+
if isTagOk
|
76
|
+
#push 到repo仓库
|
77
|
+
dy_update_repo
|
78
|
+
isok = system "pod repo push #{@repoName} \
|
79
|
+
--sources='master',#{@repoName} \
|
80
|
+
--use-libraries \
|
81
|
+
--allow-warnings \
|
82
|
+
--verbose"
|
83
|
+
unless isok
|
84
|
+
system "git reset --hard "
|
85
|
+
system "git tag -d #{new_v}"
|
86
|
+
system "git push origin -d #{new_v}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
module DYAutomate
|
3
|
+
class Command
|
4
|
+
class Pod <Command
|
5
|
+
class Version < Pod
|
6
|
+
|
7
|
+
# self.abstract_command = true
|
8
|
+
self.command = 'ver'
|
9
|
+
self.summary = '修改podspec文件版本号'
|
10
|
+
self.arguments = [
|
11
|
+
CLAide::Argument.new('addVersion', false),
|
12
|
+
CLAide::Argument.new('addBigVersion', false)
|
13
|
+
]
|
14
|
+
|
15
|
+
# def self.options
|
16
|
+
# [
|
17
|
+
# ['--add', '增加一个小版本'],
|
18
|
+
# # ['-minus', ' 减少一个小版本'],
|
19
|
+
# ['--addBig', '增加一个大版本'],
|
20
|
+
# # ['-minusBig', ' 减少一个大版本'],
|
21
|
+
# ].concat(super)
|
22
|
+
# end
|
23
|
+
|
24
|
+
def initialize(argv)
|
25
|
+
@add = argv.shift_argument
|
26
|
+
@addBig = argv.shift_argument
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
if @add.to_i > 0
|
32
|
+
pp('增加一个小版本',1)
|
33
|
+
new_v = get_version_new
|
34
|
+
fix_pod_version(new_v)
|
35
|
+
end
|
36
|
+
if @addBig.to_i > 0
|
37
|
+
pp('增加一个大版本',1)
|
38
|
+
new_v = get_version_big_new
|
39
|
+
new_v = '0.14.0'
|
40
|
+
fix_pod_version(new_v)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def fix_pod_version(new_version)
|
45
|
+
if new_version
|
46
|
+
#查找内容
|
47
|
+
targetLine = file_line_match(@spec_path,/s.version *=/)
|
48
|
+
newLine = " s.version = '#{new_version}' \n"
|
49
|
+
file_line_match_replace(@spec_path,/s.version *=/,newLine)
|
50
|
+
pp(get_spec_version,1)
|
51
|
+
else
|
52
|
+
pp('fix_pod_version error,new_version is nil',1)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
module DYAutomate
|
3
|
+
class Command
|
4
|
+
class WorkSpace <Command
|
5
|
+
|
6
|
+
class Update < WorkSpace
|
7
|
+
|
8
|
+
# require 'git'
|
9
|
+
# self.abstract_command = true
|
10
|
+
self.command = 'up'
|
11
|
+
self.summary = '更新repo,并install'
|
12
|
+
self.arguments = [
|
13
|
+
# CLAide::Argument.new('NAME', true),
|
14
|
+
]
|
15
|
+
|
16
|
+
# #要查询的lib名字
|
17
|
+
# attr_accessor :name
|
18
|
+
# #查询结果lib信息
|
19
|
+
# attr_accessor :info
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
# @name = argv.shift_argument
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate!
|
27
|
+
super
|
28
|
+
# unless @name
|
29
|
+
# help! 'need the lib `NAME`.'
|
30
|
+
# end
|
31
|
+
|
32
|
+
# unless existAtPools?
|
33
|
+
# help! "the podspec file is not exist at #{Dir.pwd}."
|
34
|
+
# end
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
pp('pod WorkSpace update run ...',1)
|
39
|
+
Dir.chdir(@path)
|
40
|
+
dy_update_repo
|
41
|
+
do_install
|
42
|
+
end
|
43
|
+
|
44
|
+
def do_install
|
45
|
+
system "rm -rf Podfile.lock"
|
46
|
+
isOk = system "pod install"
|
47
|
+
if isOk
|
48
|
+
pp("pod install 成功",1)
|
49
|
+
else
|
50
|
+
pp("pod install 失败",1)
|
51
|
+
end
|
52
|
+
system "sleep 3"
|
53
|
+
system "open *.xcworkspace"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module DYAutomate
|
2
|
+
class Command
|
3
|
+
class Git < Command
|
4
|
+
|
5
|
+
# require 'Command/pod/push.rb'
|
6
|
+
# require 'Command/pod/edit.rb'
|
7
|
+
require 'git'
|
8
|
+
|
9
|
+
self.abstract_command = true
|
10
|
+
self.command = 'g'
|
11
|
+
self.summary = 'git相关操作'
|
12
|
+
# self.default_subcommand = 'list'
|
13
|
+
self.arguments = [
|
14
|
+
CLAide::Argument.new('NAME', true),
|
15
|
+
]
|
16
|
+
|
17
|
+
#路径
|
18
|
+
attr_accessor :path
|
19
|
+
# #查询结果lib信息
|
20
|
+
attr_accessor :git_obj
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate!
|
27
|
+
super
|
28
|
+
# unless @name
|
29
|
+
# help! 'need the lib `NAME`.'
|
30
|
+
# end
|
31
|
+
|
32
|
+
unless existGit?
|
33
|
+
help! "at #{Dir.pwd},is not git"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
pp('git run ...',1)
|
39
|
+
end
|
40
|
+
|
41
|
+
def existGit?
|
42
|
+
@git_obj = Git.new(Dir.pwd)
|
43
|
+
@git_obj
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
module DYAutomate
|
2
|
+
class Command
|
3
|
+
class Pod < Command
|
4
|
+
|
5
|
+
require 'Command/pod/push.rb'
|
6
|
+
require 'Command/pod/version.rb'
|
7
|
+
|
8
|
+
self.abstract_command = true
|
9
|
+
self.command = 'pod'
|
10
|
+
self.summary = 'pod的相关操作'
|
11
|
+
# self.default_subcommand = 'list'
|
12
|
+
self.arguments = [
|
13
|
+
# CLAide::Argument.new('NAME', true),
|
14
|
+
]
|
15
|
+
|
16
|
+
#lib名字
|
17
|
+
attr_accessor :name
|
18
|
+
#当前路径
|
19
|
+
attr_accessor :path
|
20
|
+
|
21
|
+
# spec文件路径
|
22
|
+
attr_accessor :spec_path
|
23
|
+
# #查询结果lib信息
|
24
|
+
attr_accessor :spec_name
|
25
|
+
|
26
|
+
def initialize(argv)
|
27
|
+
@path = Dir.pwd
|
28
|
+
# @path = '/Users/cdd/Documents/Dy/podsDemo/DYPodDemoA'
|
29
|
+
@repoName = 'dy_repo_private_pods'
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def validate!
|
34
|
+
super
|
35
|
+
unless existPodspec?
|
36
|
+
help! "!!! has no podspec file at #{@path}"
|
37
|
+
else
|
38
|
+
puts "find podspec" + "#{@spec_path}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
pp('pod run ...',1)
|
44
|
+
end
|
45
|
+
|
46
|
+
#podspec文件是否存在
|
47
|
+
def existPodspec?
|
48
|
+
exist = false
|
49
|
+
Dir.entries(@path).each{ |d|
|
50
|
+
if d.to_s =~ /.podspec/
|
51
|
+
exist = true
|
52
|
+
@spec_path = File.join(@path,d.to_s)
|
53
|
+
@spec_name = d.to_s
|
54
|
+
@name = d.to_s.split('.')[0]
|
55
|
+
break
|
56
|
+
end
|
57
|
+
}
|
58
|
+
exist
|
59
|
+
end
|
60
|
+
|
61
|
+
#查找spec中版本号
|
62
|
+
def get_spec_version
|
63
|
+
#查找文本
|
64
|
+
targetLine = file_line_match(@spec_path,/s.version *=/)
|
65
|
+
match = targetLine.match(/'[\d].[\d]*.[\d]*'/)
|
66
|
+
v = ''
|
67
|
+
if match
|
68
|
+
v = match.to_s.gsub(/'/,'')
|
69
|
+
end
|
70
|
+
v
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_version_new
|
74
|
+
new_v = ''
|
75
|
+
cur_v = get_spec_version
|
76
|
+
pp(cur_v,1)
|
77
|
+
if cur_v && cur_v.size > 0
|
78
|
+
new_v = cur_v.split('.').map.with_index{|x,i|
|
79
|
+
if i == 2
|
80
|
+
x.to_i + 1
|
81
|
+
else
|
82
|
+
x
|
83
|
+
end
|
84
|
+
}.join('.')
|
85
|
+
end
|
86
|
+
pp("get_version_new == #{new_v}",1)
|
87
|
+
new_v
|
88
|
+
end
|
89
|
+
|
90
|
+
def get_version_big_new
|
91
|
+
new_v = ''
|
92
|
+
cur_v = get_spec_version
|
93
|
+
pp(cur_v,1)
|
94
|
+
if cur_v && cur_v.size > 0
|
95
|
+
new_v = cur_v.split('.').map.with_index{|x,i|
|
96
|
+
if i == 1
|
97
|
+
x.to_i + 1
|
98
|
+
elsif i == 2
|
99
|
+
0
|
100
|
+
else
|
101
|
+
x
|
102
|
+
end
|
103
|
+
}.join('.')
|
104
|
+
end
|
105
|
+
pp("get_version_big_new == #{new_v}",1)
|
106
|
+
new_v
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
#文本文件查找内容
|
111
|
+
def file_line_match(path,reg)
|
112
|
+
pp('file_line_match ...' + path ,1)
|
113
|
+
targetLine = ''
|
114
|
+
File.open(path,"r+") do |file| #r:utf-8表示以utf-8编码读取文件,要与当前代码文件的编码相同
|
115
|
+
file.each_line {|line|
|
116
|
+
puts line
|
117
|
+
if line =~ reg
|
118
|
+
targetLine = line
|
119
|
+
break
|
120
|
+
end
|
121
|
+
}
|
122
|
+
end
|
123
|
+
pp('file_line_match..end --' + targetLine,1)
|
124
|
+
targetLine
|
125
|
+
end
|
126
|
+
|
127
|
+
#文本文件替换某一行中文本
|
128
|
+
def file_line_match_replace(path,reg,newline)
|
129
|
+
filePath = path
|
130
|
+
#查找要替换的文本
|
131
|
+
targetLine = file_line_match(filePath,reg)
|
132
|
+
|
133
|
+
#替换内容
|
134
|
+
content = File.read(filePath)
|
135
|
+
newContent = content.gsub(targetLine, newline)
|
136
|
+
|
137
|
+
#覆盖内容
|
138
|
+
File.open(filePath,"w+") do |file| #r:utf-8表示以utf-8编码读取文件,要与当前代码文件的编码相同
|
139
|
+
file.write(newContent)
|
140
|
+
file.close
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
#更新repo
|
145
|
+
def dy_update_repo
|
146
|
+
path = File.join(Dir.home,'.cocoapods/repos')
|
147
|
+
excludeFiles = [".","..",".DS_Store",'master']
|
148
|
+
Dir.entries(path).each do |subDir|
|
149
|
+
puts subDir
|
150
|
+
unless excludeFiles.include?(subDir)
|
151
|
+
system "pod repo update #{subDir}"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module DYAutomate
|
2
|
+
class Command
|
3
|
+
class WorkSpace < Command
|
4
|
+
require 'Command/WorkSpace/update.rb'
|
5
|
+
self.abstract_command = true
|
6
|
+
self.command = 'ws'
|
7
|
+
self.summary = '项目工程workspace的相关操作'
|
8
|
+
# self.default_subcommand = 'list'
|
9
|
+
self.arguments = [
|
10
|
+
# CLAide::Argument.new('NAME', true),
|
11
|
+
]
|
12
|
+
|
13
|
+
#lib名字
|
14
|
+
attr_accessor :name
|
15
|
+
#当前路径
|
16
|
+
attr_accessor :path
|
17
|
+
|
18
|
+
# spec文件路径
|
19
|
+
attr_accessor :project_path
|
20
|
+
# #查询结果lib信息
|
21
|
+
attr_accessor :workSpace_path
|
22
|
+
|
23
|
+
def initialize(argv)
|
24
|
+
@path = Dir.pwd
|
25
|
+
# @path = '/Users/cw/Documents/Dy/Apps/doing/doing'
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate!
|
30
|
+
super
|
31
|
+
unless existProject?
|
32
|
+
help! "!!! has no project file at --> #{@path}"
|
33
|
+
else
|
34
|
+
pp("find project at -->#{@project_path}",1)
|
35
|
+
end
|
36
|
+
|
37
|
+
unless existWorkSpace?
|
38
|
+
help! "!!! has no xcworkspace file at --> #{@path}"
|
39
|
+
else
|
40
|
+
pp("find xcworkspace at --> " + "#{@workSpace_path}",1)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def run
|
45
|
+
pp('WorkSpace run ...',1)
|
46
|
+
end
|
47
|
+
|
48
|
+
#project文件是否存在
|
49
|
+
def existProject?
|
50
|
+
exist = false
|
51
|
+
Dir.entries(@path).each{ |d|
|
52
|
+
if d.to_s =~ /.xcodeproj/
|
53
|
+
exist = true
|
54
|
+
@project_path = File.join(@path,d.to_s)
|
55
|
+
# @spec_name = d.to_s
|
56
|
+
@name = d.to_s.split('.')[0]
|
57
|
+
break
|
58
|
+
end
|
59
|
+
}
|
60
|
+
exist
|
61
|
+
end
|
62
|
+
|
63
|
+
#workspace文件是否存在
|
64
|
+
def existWorkSpace?
|
65
|
+
exist = false
|
66
|
+
Dir.entries(@path).each{ |d|
|
67
|
+
if d.to_s =~ /.xcworkspace/
|
68
|
+
exist = true
|
69
|
+
@workSpace_path = File.join(@path,d.to_s)
|
70
|
+
break
|
71
|
+
end
|
72
|
+
}
|
73
|
+
exist
|
74
|
+
end
|
75
|
+
|
76
|
+
#更新repo
|
77
|
+
def dy_update_repo
|
78
|
+
path = File.join(Dir.home,'.cocoapods/repos')
|
79
|
+
excludeFiles = [".","..",".DS_Store",'master']
|
80
|
+
Dir.entries(path).each do |subDir|
|
81
|
+
puts subDir
|
82
|
+
unless excludeFiles.include?(subDir)
|
83
|
+
system "pod repo update #{subDir}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'DYAutomate.rb'
|
2
|
+
require 'version'
|
3
|
+
|
4
|
+
module DYAutomate
|
5
|
+
|
6
|
+
require 'CLAide'
|
7
|
+
|
8
|
+
class Command < CLAide::Command
|
9
|
+
|
10
|
+
require 'Command/pod.rb'
|
11
|
+
require 'Command/workspace.rb'
|
12
|
+
# require 'Command/dgit.rb'
|
13
|
+
|
14
|
+
self.abstract_command = true
|
15
|
+
self.command = 'dj'
|
16
|
+
self.version = VERSION
|
17
|
+
self.description = <<-Detail
|
18
|
+
iOS自动化工具集合
|
19
|
+
Detail
|
20
|
+
# self.plugin_prefixes = %w(claide DYAutomate)
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.options
|
27
|
+
[
|
28
|
+
['--silent', 'Show nothing'],
|
29
|
+
].concat(super)
|
30
|
+
end
|
31
|
+
|
32
|
+
def run
|
33
|
+
pp('automate works!!',1)
|
34
|
+
end
|
35
|
+
|
36
|
+
def pp(msg,level)
|
37
|
+
unless msg
|
38
|
+
return
|
39
|
+
end
|
40
|
+
|
41
|
+
if level == 1
|
42
|
+
puts msg.white if msg
|
43
|
+
elsif level == 2
|
44
|
+
puts msg.red if msg
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
data/lib/DYAutomate.rb
ADDED
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: DYAutomate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 陈冬冬
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: progress
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: colored2
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.1.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: version_sorter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.2.4
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.2.4
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: claide
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.2
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '2.0'
|
93
|
+
type: :runtime
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.0.2
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '2.0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: cocoapods
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.6.1
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 1.6.1
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: git
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :runtime
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
description: 自动化工具
|
132
|
+
email:
|
133
|
+
- chendongdong@dongyin.net.cn
|
134
|
+
executables:
|
135
|
+
- dj
|
136
|
+
extensions: []
|
137
|
+
extra_rdoc_files: []
|
138
|
+
files:
|
139
|
+
- README.md
|
140
|
+
- bin/dj
|
141
|
+
- lib/DYAutomate.rb
|
142
|
+
- lib/DYAutomate/Command.rb
|
143
|
+
- lib/DYAutomate/Command/Git/tagAdd.rb
|
144
|
+
- lib/DYAutomate/Command/Pod/push.rb
|
145
|
+
- lib/DYAutomate/Command/Pod/version.rb
|
146
|
+
- lib/DYAutomate/Command/Workspace/update.rb
|
147
|
+
- lib/DYAutomate/Command/dgit.rb
|
148
|
+
- lib/DYAutomate/Command/pod.rb
|
149
|
+
- lib/DYAutomate/Command/workspace.rb
|
150
|
+
- lib/DYAutomate/version.rb
|
151
|
+
homepage: https://code.aliyun.com/iOSTools/DYAutomate.git
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata: {}
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
- lib/DYAutomate
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubyforge_project:
|
172
|
+
rubygems_version: 2.6.14
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: 自动化工具
|
176
|
+
test_files: []
|