ggsm 1.2.0 → 1.3.0

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
  SHA1:
3
- metadata.gz: d194bcbcc90cdf2025160a000a16360e3de891a7
4
- data.tar.gz: e84546de9fcaacbf29e0c95ee69591e3d2cd98f8
3
+ metadata.gz: edc278718389521b909307d6e17aa9c885a48dbb
4
+ data.tar.gz: af4aaca2ad7a49360347f304dccf7fe75092760a
5
5
  SHA512:
6
- metadata.gz: 15111fb0282681c54cc30635b6b323c15e729349774c49550d1a1791988c3da63a1c77496f45ecd2b40bfa7bf1126d4c4af3a070be3483ba32d0c8ec50ce9eaf
7
- data.tar.gz: 2a263cbb1f36d1bd8e748b35a44bd8afa5e361e680ab3d2aa7a7298350c148c676b7892c6a2c785fb5d2e2a66eade4583724df43e63f1dfe42729949612f7df5
6
+ metadata.gz: 6131395780e5c21ac27c309ed2aea21891bd7f697c4babfcc74a7e1040e7f8b5a28a54ea6df981d29dbfda38383126221856fbfc61fc64d8b90685575d191b00
7
+ data.tar.gz: 3884e4075320d1dd1607ebc01866a77399bef0399af6c6e877231dd9c8e9d75f2e8418e2663b8b2e2ab2b40b0b27278ab67e840b9b3bbd4ac01d0d9309a8de0e
data/README.md CHANGED
@@ -1,8 +1,5 @@
1
1
  # GGSM
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/hex`. 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
2
+ TODO
6
3
 
7
4
  ## Installation
8
5
 
@@ -18,7 +15,7 @@ And then execute:
18
15
 
19
16
  Or install it yourself as:
20
17
 
21
- $ gem install hex
18
+ $ gem install ggsm
22
19
 
23
20
  ## Usage
24
21
 
@@ -32,7 +29,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
29
 
33
30
  ## Contributing
34
31
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hex. 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.
32
+ Bug reports and pull requests are welcome on GitHub https://github.com/YoKeyword/ggsm. 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
33
 
37
34
 
38
35
  ## License
@@ -1,7 +1,6 @@
1
1
  require 'thor'
2
2
  require_relative 'ggsm/version'
3
3
  require_relative 'ggsm/flow/start'
4
- require_relative 'ggsm/flow/update'
5
4
  require_relative 'ggsm/flow/sync'
6
5
  require_relative 'ggsm/flow/switch'
7
6
  require_relative 'ggsm/flow/delete'
@@ -12,7 +11,6 @@ require_relative 'ggsm/flow/finish'
12
11
  module GGSM
13
12
  class Cli < Thor
14
13
  include Start
15
- include Update
16
14
  include Sync
17
15
  include Switch
18
16
  include Delete
@@ -30,11 +28,6 @@ module GGSM
30
28
  switch_flow(branch)
31
29
  end
32
30
 
33
- desc 'update', '更新当前commit对应的子模块commit'
34
- def update
35
- update_flow
36
- end
37
-
38
31
  desc 'sync', '当前分支同步(拉取)远程代码'
39
32
  def sync
40
33
  sync_flow
@@ -49,7 +42,7 @@ module GGSM
49
42
  delete_flow(branch, remote, all)
50
43
  end
51
44
 
52
- desc 'foreach [<commands>...]', '全模块执行git命令(foreach后跟git命令)'
45
+ desc 'foreach [<commands>...]', '所有模块执行git命令(foreach后跟git命令)'
53
46
  def foreach(*commands)
54
47
  foreach_flow(*commands)
55
48
  end
@@ -59,7 +52,7 @@ module GGSM
59
52
  merge_flow(branch)
60
53
  end
61
54
 
62
- desc 'finish', '完成开发,ggsm merge并解决冲突后执行'
55
+ desc 'finish', 'Merge后并解决冲突后执行'
63
56
  def finish
64
57
  finish_flow
65
58
  end
@@ -9,18 +9,35 @@ module GGSM
9
9
  check_submodule
10
10
  check_un_commit_code
11
11
 
12
+ arry_conflict = []
13
+
12
14
  subs = get_submodule
13
15
  subs.each do |sub|
14
16
  Dir.chdir sub
15
- puts "==> 进入#{sub}:".yellow
16
- system "git merge #{branch}"
17
+ process_merge(arry_conflict, sub, branch)
17
18
  Dir.chdir '..'
18
19
  end
19
20
 
20
- puts '==> 进入主工程:'.yellow
21
- system "git merge #{branch}"
22
-
21
+ process_merge(arry_conflict, '主工程', branch)
23
22
  puts "Modules执行:git merge #{branch}".blue
23
+
24
+ if arry_conflict.size > 0
25
+ tip = "==> #{arry_conflict.size}个模块冲突:"
26
+ arry_conflict.reverse.each do |sub|
27
+ tip = "#{tip} #{sub}"
28
+ end
29
+ puts tip.red
30
+ end
31
+ end
32
+
33
+ def process_merge(arry_conflict, module_name, branch)
34
+ puts "==> 进入#{module_name}:".yellow
35
+ result_merge = `git merge #{branch}`
36
+ puts result_merge
37
+
38
+ if result_merge.include? 'Merge conflict'
39
+ arry_conflict.push(module_name)
40
+ end
24
41
  end
25
42
  end
26
43
  end
@@ -13,6 +13,7 @@ module GGSM
13
13
  puts '==> 进入主工程:'.yellow
14
14
 
15
15
  arry_conflict = []
16
+ current_branch = get_current_branch
16
17
 
17
18
  need_stash = try_stash
18
19
  result = system "git checkout -b #{branch} #{action}"
@@ -24,7 +25,12 @@ module GGSM
24
25
  return
25
26
  end
26
27
 
27
- `git submodule update --init --recursive`
28
+ result = system 'git submodule update --init --recursive'
29
+ unless result
30
+ tip_contact_author
31
+ `git checkout #{current_branch};git branch -D #{branch}`
32
+ return
33
+ end
28
34
 
29
35
  subs = get_submodule
30
36
  subs.each do |sub|
@@ -39,7 +45,7 @@ module GGSM
39
45
  end
40
46
 
41
47
  if arry_conflict.size > 0
42
- tip = '==> 冲突待解决:'
48
+ tip = "==> #{arry_conflict.size}个模块冲突:"
43
49
  arry_conflict.each do |sub|
44
50
  tip = "#{tip} #{sub}"
45
51
  end
@@ -13,6 +13,7 @@ module GGSM
13
13
  puts '==> 进入主工程:'.yellow
14
14
 
15
15
  arry_conflict = []
16
+ arry_commit_not_exist = []
16
17
 
17
18
  need_stash = try_stash
18
19
  result = system "git checkout #{branch}"
@@ -34,7 +35,11 @@ module GGSM
34
35
  result = system "git checkout #{branch}"
35
36
 
36
37
  if result
37
- system "git reset --hard #{sub_commits.fetch(subs.index(sub))}"
38
+ commit = sub_commits.fetch(subs.index(sub));
39
+ commit_exist = system "git reset --hard #{commit}"
40
+ unless commit_exist
41
+ arry_commit_not_exist.push("==> #{sub}模块不存在远程commit:#{commit}")
42
+ end
38
43
  else
39
44
  puts "[#{sub}] 没有#{branch}分支,创建并切换到#{branch}".blue
40
45
  system "git checkout -b #{branch}"
@@ -47,12 +52,19 @@ module GGSM
47
52
  end
48
53
 
49
54
  if arry_conflict.size > 0
50
- tip = '==> 冲突待解决:'
55
+ tip = "==> #{arry_conflict.size}个模块冲突:"
51
56
  arry_conflict.each do |sub|
52
57
  tip = "#{tip} #{sub}"
53
58
  end
54
59
  puts tip.red
55
60
  end
61
+
62
+ if arry_commit_not_exist.size > 0
63
+ arry_commit_not_exist.each do |tip|
64
+ puts tip.red
65
+ end
66
+ tip_contact_author
67
+ end
56
68
  end
57
69
  end
58
70
  end
@@ -13,8 +13,7 @@ module GGSM
13
13
  return
14
14
  end
15
15
 
16
- current_branch = `git branch | grep "*"`.split("* ")[1].split("\n")[0]
17
- switch_flow(current_branch)
16
+ switch_flow(get_current_branch)
18
17
  end
19
18
  end
20
- end
19
+ end
@@ -9,16 +9,25 @@ module GGSM
9
9
  end
10
10
 
11
11
  def get_submodule
12
- sub_status = `git submodule`
13
12
  pattern = /(?<=\s)[0-9a-zA-Z]*(?=\s)/
13
+
14
+ sub_status = `git submodule`
14
15
  sub_status = sub_status.split(/\n/)
16
+ match = pattern.match(sub_status[0])
17
+
18
+ if match==nil
19
+ puts '==> 初始化子模块'.yellow
20
+ `git submodule update --init --recursive`
21
+ sub_status = `git submodule`
22
+ sub_status = sub_status.split(/\n/)
23
+ end
15
24
 
16
25
  result = []
17
26
  sub_status.each do |sub|
18
27
  match = pattern.match(sub.strip)
19
28
  result.push(match[0])
20
29
  end
21
- return result
30
+ result
22
31
  end
23
32
 
24
33
  def get_submodule_commit
@@ -30,7 +39,7 @@ module GGSM
30
39
  match = pattern.match(sub.strip)
31
40
  result.push(match[0][0...7])
32
41
  end
33
- return result
42
+ result
34
43
  end
35
44
 
36
45
  def check_un_commit_code
@@ -53,7 +62,13 @@ module GGSM
53
62
  end
54
63
 
55
64
  def get_current_branch
56
- return `git branch | grep "*"`.split('* ')[1].split("\n")[0]
65
+ `git branch | grep "*"`.split('* ')[1].split("\n")[0]
66
+ end
67
+
68
+ def tip_contact_author
69
+ latest_commit = `git log test -1 --oneline | grep ''`.split(' ')[0]
70
+ author = `git show #{latest_commit}|grep "Author:"`.chomp
71
+ puts "请联系#{author} 推送远程缺失的commit".red
57
72
  end
58
73
  end
59
74
  end
@@ -1,3 +1,3 @@
1
1
  module GGSM
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ggsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YoKey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-08 00:00:00.000000000 Z
11
+ date: 2017-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.14'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.14'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: colorize
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: A gem for Git Submodule
@@ -74,16 +74,15 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
78
- - .rspec
79
- - .travis.yml
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
80
  - CODE_OF_CONDUCT.md
81
81
  - Gemfile
82
82
  - LICENSE.txt
83
83
  - README.md
84
84
  - Rakefile
85
85
  - bin/ggsm
86
- - ggsm-1.0.0.gem
87
86
  - ggsm.gemspec
88
87
  - lib/ggsm.rb
89
88
  - lib/ggsm/flow/delete.rb
@@ -93,7 +92,6 @@ files:
93
92
  - lib/ggsm/flow/start.rb
94
93
  - lib/ggsm/flow/switch.rb
95
94
  - lib/ggsm/flow/sync.rb
96
- - lib/ggsm/flow/update.rb
97
95
  - lib/ggsm/util/stash.rb
98
96
  - lib/ggsm/util/submodule.rb
99
97
  - lib/ggsm/version.rb
@@ -107,17 +105,17 @@ require_paths:
107
105
  - lib
108
106
  required_ruby_version: !ruby/object:Gem::Requirement
109
107
  requirements:
110
- - - '>='
108
+ - - ">="
111
109
  - !ruby/object:Gem::Version
112
110
  version: '0'
113
111
  required_rubygems_version: !ruby/object:Gem::Requirement
114
112
  requirements:
115
- - - '>='
113
+ - - ">="
116
114
  - !ruby/object:Gem::Version
117
115
  version: '0'
118
116
  requirements: []
119
117
  rubyforge_project:
120
- rubygems_version: 2.6.12
118
+ rubygems_version: 2.6.11
121
119
  signing_key:
122
120
  specification_version: 4
123
121
  summary: ggsm
Binary file
@@ -1,10 +0,0 @@
1
- module GGSM
2
- module Update
3
- def update_flow
4
- check_submodule
5
-
6
- system 'git submodule update --init --recursive'
7
- puts '==> 更新子模块完成!'.yellow
8
- end
9
- end
10
- end