pixab 2.2.0 → 2.2.1

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: 7c2253162bf9e37eaaaa541ca25d978ee6ced4fdeda468101b90fc0758ecc805
4
- data.tar.gz: 42237eb540beb23065e0ccc03f267cdaa03f82f27122b1f8e51c6d7f1ff247e2
3
+ metadata.gz: 40bdedbf96ae1aad98cea6889c0cd32dafc9d9d6634ed181ea5d3aad9fc50c53
4
+ data.tar.gz: f097ad80dcff665eb3f0e6a77f7717fbed41bc7e7503e6819a09e0591e5b43f2
5
5
  SHA512:
6
- metadata.gz: d1a0f1839ea57b8e810a4ef2c019566b1b2b20d7c9923f160edf1a055f04af2d65d97e4c72d7a71c0482a688d2fb31b029a1cba0501b09164f7a98e3db5957d9
7
- data.tar.gz: 76c95d7addbd2ce3425e3b5c975d775e4e87ea645e53e82d40bd7d08266f17abfe7fb3bc2488e74166d971a88381f9bc6eb24ac636f6b3def7323d9750b9b939
6
+ metadata.gz: 74c4e32db81e84edf7d54c6a7bf719290bf458978440435e231113ba1e08eefb6dc659934742f295a1660733887c4adbb24f00f408adc303c22e050a57264d4f
7
+ data.tar.gz: fec66d4eac0ed930fa2052a3d02d77e8a482b1da15edf8f068e6fdbb5c98f81bf25649b0bdf0d707115fa54b15b69639dd192a3ce3ec7313040a622f59ccf705
@@ -16,9 +16,17 @@ module Pixab
16
16
  `git fetch origin`
17
17
 
18
18
  @branch = GitUtils.current_branch
19
+ if @branch.nil?
20
+ puts "无法获取当前分支".red
21
+ end
22
+
19
23
  @target_branch = get_target_branch(@branch)
20
- @remote_branch = GitUtils.remote_branch(@branch)
21
- @remote_target_branch = GitUtils.remote_branch(@target_branch)
24
+ if @target_branch.nil?
25
+ puts "无法获取目标分支,当前分支:#{@branch}".red
26
+ end
27
+
28
+ @remote_branch = "origin/#{@branch}"
29
+ @remote_target_branch = "origin/#{@target_branch}"
22
30
  end
23
31
 
24
32
  def get_target_branch(branch)
@@ -39,13 +47,22 @@ module Pixab
39
47
  end
40
48
 
41
49
  def get_version(feature_name)
50
+ # 用 '_' 分割字符串
42
51
  parts = feature_name.split('_')
43
- parts.map do |part|
44
- is_numeric = part.match?(/^\d+$/) # 检查是否为纯数字
45
- if is_numeric
52
+
53
+ # 遍历分割的部分
54
+ parts.each do |part|
55
+ # 判断是否为纯数字
56
+ if part.match?(/^\d+$/)
57
+ return part
58
+ # 判断是否为类似 7.5.0 的格式
59
+ elsif part.match?(/^\d+(\.\d+)*$/)
46
60
  return part
47
61
  end
48
62
  end
63
+
64
+ # 如果没有满足条件的字符串,返回 nil
65
+ nil
49
66
  end
50
67
 
51
68
  # 判断远程分支是否代码是否同步到远程目标分支
data/lib/pixab/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pixab
4
- VERSION = "2.2.0"
4
+ VERSION = "2.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixab
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 廖再润