gb 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +3 -2
- data/lib/commands/review.rb +1 -1
- data/lib/commands/status.rb +8 -1
- data/lib/commands/sync.rb +7 -6
- data/lib/commands/workspace.rb +2 -1
- data/lib/config/work_space_config.rb +7 -7
- data/lib/gb/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cbb144ce7b27e5b2d0baf6bef7ad30b081f2b858e7269575fe8077f7a82836a
|
4
|
+
data.tar.gz: 281cae42940517465d86449a455fd1a461059ec8863227a549515b6c0d3329d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80d86fa85596b45d698be35d7c3e4601ecbc7f994665d257b388f1e9480088866a4b8e9d3fd17f38c6def6b8e965e84c1f5bb30b728ce14fa9db585ae5139d1e
|
7
|
+
data.tar.gz: 5961753dc5033357b96cb524339accb519275347ff53b5c92a68487b6c0ef0e47dfd6906a68ed0401c99d20485a9353e670efa66490175cf559d4925bb5c334b
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Gb
|
2
2
|
GB是针对GitLab开发的一款管理工具,使用ruby开发,简化对多个git版本库的管理,方便代码同步及代码提交review。
|
3
3
|
|
4
|
-
##
|
4
|
+
## 安装
|
5
5
|
|
6
6
|
Add this line to your application's Gemfile:
|
7
7
|
|
@@ -17,12 +17,13 @@ Or install it yourself as:
|
|
17
17
|
|
18
18
|
$ gem install gb
|
19
19
|
|
20
|
-
##
|
20
|
+
## 使用
|
21
21
|
|
22
22
|
### 1、创建gb配置文件Gb.yml
|
23
23
|
```ruby
|
24
24
|
#创建本地文件Gb.yml,根据提示输入Gitlab的private token
|
25
25
|
gb create
|
26
|
+
|
26
27
|
#或通过在线url地址下载Gb.yml
|
27
28
|
gb create --config_url=[url]
|
28
29
|
```
|
data/lib/commands/review.rb
CHANGED
@@ -47,7 +47,7 @@ module Gb
|
|
47
47
|
|
48
48
|
def run_in_workspace
|
49
49
|
|
50
|
-
@working_branch = self.workspace_config.
|
50
|
+
@working_branch = self.workspace_config.work_branch
|
51
51
|
@remote_branch = self.workspace_config.remote_branch
|
52
52
|
|
53
53
|
# api: https://www.rubydoc.info/gems/gitlab/toplevel
|
data/lib/commands/status.rb
CHANGED
@@ -12,6 +12,10 @@ module Gb
|
|
12
12
|
DESC
|
13
13
|
|
14
14
|
def run_in_workspace
|
15
|
+
workspace_config = self.workspace_config
|
16
|
+
info "current work branch '#{workspace_config.work_branch}'"
|
17
|
+
info "track remote branch '#{workspace_config.remote_branch}'."
|
18
|
+
puts
|
15
19
|
|
16
20
|
self.gb_config.projects.each do |project|
|
17
21
|
project_path = File.expand_path(project.name, './')
|
@@ -20,7 +24,10 @@ module Gb
|
|
20
24
|
info "for project '#{project.name}'..."
|
21
25
|
g = Git.open(project_path)
|
22
26
|
|
23
|
-
|
27
|
+
if workspace_config.work_branch != g.current_branch
|
28
|
+
error "current branch(#{g.current_branch}) is not work branch."
|
29
|
+
puts
|
30
|
+
end
|
24
31
|
|
25
32
|
changed = g.status.changed
|
26
33
|
added = g.status.added
|
data/lib/commands/sync.rb
CHANGED
@@ -16,7 +16,7 @@ module Gb
|
|
16
16
|
remote = 'origin'
|
17
17
|
workspace_config = self.workspace_config
|
18
18
|
|
19
|
-
info "current work branch '#{workspace_config.
|
19
|
+
info "current work branch '#{workspace_config.work_branch}', remote branch '#{workspace_config.remote_branch}'."
|
20
20
|
|
21
21
|
self.gb_config.projects.each do |project|
|
22
22
|
project_path = File.expand_path(project.name, './')
|
@@ -24,12 +24,13 @@ module Gb
|
|
24
24
|
if File.exist?(project_path)
|
25
25
|
info "sync project '#{project.name}'..."
|
26
26
|
g = Git.open(project_path)
|
27
|
-
if workspace_config.workspace_branch != g.current_branch
|
28
|
-
|
29
|
-
|
30
|
-
end
|
27
|
+
# if workspace_config.workspace_branch != g.current_branch
|
28
|
+
# error "current branch is not work branch(#{workspace_config.workspace_branch})."
|
29
|
+
# exit(1)
|
30
|
+
# end
|
31
|
+
g.checkout(workspace_config.work_branch)
|
31
32
|
g.fetch(remote, :p => true, :t => true)
|
32
|
-
g.pull("origin", workspace_config.
|
33
|
+
g.pull("origin", workspace_config.work_branch)
|
33
34
|
g.pull("origin", workspace_config.remote_branch)
|
34
35
|
puts
|
35
36
|
|
data/lib/commands/workspace.rb
CHANGED
@@ -16,7 +16,7 @@ module Gb
|
|
16
16
|
remote = 'origin'
|
17
17
|
workspace_config = self.workspace_config
|
18
18
|
|
19
|
-
info "current work branch '#{workspace_config.
|
19
|
+
info "current work branch '#{workspace_config.work_branch}'"
|
20
20
|
info "track remote branch '#{workspace_config.remote_branch}'."
|
21
21
|
puts
|
22
22
|
|
@@ -27,6 +27,7 @@ module Gb
|
|
27
27
|
info "Project '#{project.name}'..."
|
28
28
|
g = Git.open(project_path)
|
29
29
|
info "current branch '#{g.current_branch}'."
|
30
|
+
puts
|
30
31
|
else
|
31
32
|
error "please run 'gb init first."
|
32
33
|
break
|
@@ -2,24 +2,24 @@
|
|
2
2
|
module Gb
|
3
3
|
class WorkSpaceConfig
|
4
4
|
attr_reader :remote_branch
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :work_branch
|
6
6
|
|
7
|
-
def initialize(remote_branch,
|
7
|
+
def initialize(remote_branch, work_branch)
|
8
8
|
@remote_branch = remote_branch
|
9
|
-
@
|
9
|
+
@work_branch = work_branch
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.load_file(yaml_filename)
|
13
13
|
node = YAML.load_file(yaml_filename)
|
14
14
|
remote_branch = node['remote_branch']
|
15
|
-
|
16
|
-
return WorkSpaceConfig.new(remote_branch,
|
15
|
+
work_branch = node['work_branch']
|
16
|
+
return WorkSpaceConfig.new(remote_branch, work_branch)
|
17
17
|
end
|
18
18
|
|
19
19
|
def save(path)
|
20
20
|
File.open(path, 'w') do |file|
|
21
|
-
Psych.dump({'remote_branch' => @remote_branch, '
|
21
|
+
Psych.dump({'remote_branch' => @remote_branch, 'work_branch' => @work_branch}, file)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
data/lib/gb/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Gb
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
2
|
+
VERSION = "0.1.2"
|
3
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- binluo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|