yjcocoa 19.01.05 → 19.04.09

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
- SHA1:
3
- metadata.gz: d266e13f581e8b1e706cfae22758563cde9ccf80
4
- data.tar.gz: a3ceb39237847ad6873865e63beb5c3aa6dfb20c
2
+ SHA256:
3
+ metadata.gz: 1214382f56754d3cc57c560c122e45d461feb41ef2a1a42b40f4d724ae14b805
4
+ data.tar.gz: 0f4652aebf2a257a1f063f2f6923254e9490faf3267d6d4909bce7ad4479e10a
5
5
  SHA512:
6
- metadata.gz: f2c1e1b68c4098051235349c7e49b9c6b64705210b5e9ed1fe53e9640bc66496e415383c3939896e1e5b717b57e9c181279f9517564e3cd44cf4d0538962c89c
7
- data.tar.gz: c1b7f1068d3f60e22ea160a99fed19b22f795f12c07d4559047f9a964890b5b33bc2ed2e578cdc05fe5f118cd6fe5f2c6ebb6bd9b6cd3136c3d0d1ce122f766c
6
+ metadata.gz: 2033608fa63cd78531f1ff67342578cbb63ed73442cf98177444327ef0223aedce85bd95820fd2d1e860e249539bd0b7b1ebc446a38ddc20bdc4455645744426
7
+ data.tar.gz: 156029e75711f18b70ffba48577cca89602782e46d310dccd9126bc0ad7b91e180cacd696f9075bec0b81b137c72ea25db505abbab03c37487c0418f745e5a2b
@@ -36,6 +36,7 @@ module YJCocoa
36
36
  # Commands
37
37
  require 'yjcocoa/git/git_branch'
38
38
  require 'yjcocoa/git/git_cache'
39
+ require 'yjcocoa/git/git_checkout'
39
40
  require 'yjcocoa/git/git_pull'
40
41
  require 'yjcocoa/git/git_tag'
41
42
 
@@ -0,0 +1,71 @@
1
+ #
2
+ # git_checkout.rb
3
+ # YJCocoa
4
+ #
5
+ # https://github.com/937447974
6
+ # YJ技术支持群:557445088
7
+ #
8
+ # Created by 阳君 on 2019/03/18.
9
+ # Copyright © 2017年 YJCocoa. All rights reserved.
10
+ #
11
+
12
+ module YJCocoa
13
+
14
+ class GitCheckout < Git
15
+
16
+ self.command = 'checkout'
17
+ self.summary = 'git checkout'
18
+ self.description = 'git checkout 当前文件夹下所有 gits'
19
+
20
+ def self.options
21
+ [['--branch', '切换 branch'],]
22
+ end
23
+
24
+ # property
25
+ attr_accessor :branch
26
+ attr_accessor :gits
27
+
28
+ # 初始化
29
+ def initialize(argv)
30
+ super
31
+ self.branch = argv.option('branch')
32
+ end
33
+
34
+ # businrss
35
+ def validate!
36
+ self.banner! unless self.branch
37
+ end
38
+
39
+ def run
40
+ self.buildGitPaths
41
+ if self.gits.empty?
42
+ if self.gitExist?
43
+ self.gitCheckout
44
+ end
45
+ else
46
+ self.gits.each { |path|
47
+ self.gitCheckout(path)
48
+ }
49
+ end
50
+ end
51
+
52
+ def buildGitPaths
53
+ self.gits = Dir["**/.git"]
54
+ self.gits.map! { |path|
55
+ File.dirname(path)
56
+ }
57
+ end
58
+
59
+ def gitCheckout(path=".")
60
+ Dir.chdir(path) {
61
+ puts "YJCocoa git checkout #{path}/.git".green
62
+ localChanges = !(`git stash` =~ /No local changes to save/)
63
+ system("git checkout -b #{self.branch}") unless system("git checkout #{self.branch}")
64
+ `git stash pop` if localChanges
65
+ puts
66
+ }
67
+ end
68
+
69
+ end
70
+
71
+ 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: 19.01.05
4
+ version: 19.04.09
5
5
  platform: ruby
6
6
  authors:
7
7
  - 阳君
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-05 00:00:00.000000000 Z
11
+ date: 2019-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -67,6 +67,7 @@ files:
67
67
  - lib/yjcocoa/git/git.rb
68
68
  - lib/yjcocoa/git/git_branch.rb
69
69
  - lib/yjcocoa/git/git_cache.rb
70
+ - lib/yjcocoa/git/git_checkout.rb
70
71
  - lib/yjcocoa/git/git_pull.rb
71
72
  - lib/yjcocoa/git/git_tag.rb
72
73
  - lib/yjcocoa/git/git_tag_add.rb
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  version: '0'
103
104
  requirements: []
104
105
  rubyforge_project:
105
- rubygems_version: 2.6.14.3
106
+ rubygems_version: 2.7.8
106
107
  signing_key:
107
108
  specification_version: 3
108
109
  summary: YJCocoa, the Cocoa library package manager.