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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7906c461cd27972045e125ef182976ef576a779d38779df2977d1db98c512ae2
4
- data.tar.gz: f62642d10be7fb980816de0d755efc133d9c45d24567127e9df9d5a35c15cdd8
3
+ metadata.gz: 6cbb144ce7b27e5b2d0baf6bef7ad30b081f2b858e7269575fe8077f7a82836a
4
+ data.tar.gz: 281cae42940517465d86449a455fd1a461059ec8863227a549515b6c0d3329d9
5
5
  SHA512:
6
- metadata.gz: 94461a92b513498eaf6c2ba20c219645ada7528066057ca4ad57c55e3c65d400fb5be6c491384a3adf18466b2437e2c73eaeda3e32986c2c50a8c339dabc4333
7
- data.tar.gz: c0aabb519e76d5de400bf366b8a9170bc5cf4e0fc8d3a9837965e79fb62a7ad0d28d3b03e40aa3cc6d8e4c753ded1e15a13309b1cb6fb8779309c1be32c626c5
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
- ## Installation
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
- ## Usage
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
  ```
@@ -47,7 +47,7 @@ module Gb
47
47
 
48
48
  def run_in_workspace
49
49
 
50
- @working_branch = self.workspace_config.workspace_branch
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
@@ -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
- info "current branch '#{g.current_branch}'"
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.workspace_branch}', remote branch '#{workspace_config.remote_branch}'."
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
- error "current branch is not work branch(#{workspace_config.workspace_branch})."
29
- exit(1)
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.workspace_branch)
33
+ g.pull("origin", workspace_config.work_branch)
33
34
  g.pull("origin", workspace_config.remote_branch)
34
35
  puts
35
36
 
@@ -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.workspace_branch}'"
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 :workspace_branch
5
+ attr_reader :work_branch
6
6
 
7
- def initialize(remote_branch, workspace_branch)
7
+ def initialize(remote_branch, work_branch)
8
8
  @remote_branch = remote_branch
9
- @workspace_branch = workspace_branch
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
- workspace_branch = node['workspace_branch']
16
- return WorkSpaceConfig.new(remote_branch, workspace_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, 'workspace_branch' => @workspace_branch}, file)
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.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.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-08-30 00:00:00.000000000 Z
11
+ date: 2019-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab