gct 0.2.8 → 0.3.0

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: 1fa46eae8380ffa9b10615aa774bcdbfdd4d00283f306c3a315e89612d59ef4b
4
- data.tar.gz: 62ef10f120701564182015ab617f42a00f94e838049b392cfc75995a6a1d2599
3
+ metadata.gz: 234020953df6dd3d1f9a2844c5fdd7b06129f901aac392e6d8a1695add614678
4
+ data.tar.gz: 25d52ea8b3467f69db9865169d033fa042f46136b32dd25681e8ee16555ecc43
5
5
  SHA512:
6
- metadata.gz: 8901885267628b0e5c73ee1c38e6d9053086fc4057673a61546963f05843ef2a739f86c5156c731ceae5ddc16e1704ba398d2d08060cf30ef6900007f0a0ec9b
7
- data.tar.gz: 6c566ca2de8a69dd8b323c7f83fd942d9a5e61642f27fc9ab2cee2f2605e27a722fc6b39baea84ecabb0da86ce28828d028d23fe0c863b2c40ce699f3c4708f7
6
+ metadata.gz: 6f2b677246254294754e4b8b25c15ba44df16e87abb513adeb9515463fc72f6bb523360d14608d7aebb83110511b31cf28357e4a731bc64df7b9f520a40985e3
7
+ data.tar.gz: 12ecd76daed4b90b7ef2d29da084d7658fc33fed7282e486f3519db0962e78cfff6422c684cb7960f9a8eff50e6c57f0044e452ae15691e0a83f3122ccbebff6
@@ -25,7 +25,7 @@ module Gct
25
25
 
26
26
  def addRepo
27
27
  puts "pod命令为:pod repo add iOSCRGTPodSource https://gi-dev.ccrgt.com/ios/iOSCRGTPodSource.git".green
28
- system "pod repo add iOSCRGTPodSource https://gi-dev.ccrgt.com/ios/iOSCRGTPodSource.git || { exit 1; }"
28
+ system "pod repo add iOSCRGTPodSource https://gi-dev.ccrgt.com/ios/iOSCRGTPodSource.git", exception: true
29
29
  end
30
30
  end
31
31
  end
@@ -25,7 +25,7 @@ module Gct
25
25
 
26
26
  def updateRepo
27
27
  puts "pod命令为:pod repo update iOSCRGTPodSource".green
28
- system "pod repo update iOSCRGTPodSource || { exit 1; }"
28
+ system "pod repo update iOSCRGTPodSource", exception: true
29
29
  puts "如果找不到 iOSCRGTPodSource 文件,先执行gct repo add".green
30
30
  end
31
31
  end
@@ -0,0 +1,62 @@
1
+ module Gct
2
+ class Command
3
+ class Tag < Command
4
+
5
+ self.summary = '添加tag'
6
+ self.description = <<-DESC
7
+ 十进制增加tag版本
8
+ DESC
9
+
10
+ self.arguments = [
11
+ CLAide::Argument.new('TAG', false),
12
+ ]
13
+
14
+ def initialize(argv)
15
+ @tag = argv.shift_argument
16
+ super
17
+ end
18
+
19
+ def validate!
20
+ super
21
+ end
22
+
23
+ def run
24
+ get_now_tag
25
+ add_push_new_tag
26
+ end
27
+
28
+ def update_tag_podspec
29
+ # 更新podspec的版本号 @new_tag 创建MR推送到远端
30
+
31
+ end
32
+
33
+ def get_now_tag
34
+ spec_file = Pathname.glob('*.podspec').first
35
+ raise "在 #{Dir.pwd} 目录下找不到podspec文件".red if spec_file.nil?
36
+
37
+ spec = Pod::Specification.from_file(spec_file)
38
+ @now_tag = spec.version
39
+ end
40
+
41
+ def add_push_new_tag
42
+ @new_tag = @tag || autoAddTag(@now_tag.to_s)
43
+ update_tag_podspec
44
+ `git tag #{@new_tag}`
45
+ `git push origin #{@new_tag} || { exit 1; }`
46
+ end
47
+
48
+ def autoAddTag(tag)
49
+ tag_points = tag.to_s.split('.')
50
+ index = tag_points.length - 1
51
+ need_add_point = tag_points[index].to_i + 1
52
+ tag_points[index] = need_add_point == 10 ? 0 : need_add_point
53
+ while need_add_point == 10 && index > 0
54
+ index = index - 1
55
+ need_add_point = tag_points[index].to_i + 1
56
+ tag_points[index] = need_add_point == 10 && index != 0 ? 0 : need_add_point
57
+ end
58
+ tag_points.join('.')
59
+ end
60
+ end
61
+ end
62
+ end
data/lib/gct/command.rb CHANGED
@@ -23,6 +23,7 @@ module Gct
23
23
  require 'gct/command/build'
24
24
  require 'gct/command/spec'
25
25
  require 'gct/command/repo'
26
+ require 'gct/command/tag'
26
27
 
27
28
  self.abstract_command = true
28
29
  self.command = 'gct'
data/lib/gct/version.rb CHANGED
@@ -2,5 +2,5 @@ module Gct
2
2
  # freeze 冻结对象,将对象变成一个常量
3
3
  # unless 右边的代码块成立,才会运行左边的代码块
4
4
  # defined? 是用来判断本地变量是否存在,也可用来判断是否存在方法
5
- VERSION = "0.2.8".freeze unless defined? Gct::VERSION
5
+ VERSION = "0.3.0".freeze unless defined? Gct::VERSION
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jieming
@@ -141,6 +141,7 @@ files:
141
141
  - lib/gct/command/repo/update.rb
142
142
  - lib/gct/command/spec.rb
143
143
  - lib/gct/command/spec/lint.rb
144
+ - lib/gct/command/tag.rb
144
145
  - lib/gct/constant.rb
145
146
  - lib/gct/version.rb
146
147
  homepage: https://gi-dev.ccrgt.com/ios-thirdpart/gct