ding 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/ding/cli.rb +9 -7
- data/lib/ding/models/git.rb +14 -1
- data/lib/ding/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1283f43275acdd4e1e0eb77d2d19c529c8f8299
|
4
|
+
data.tar.gz: b0e9cddae73956fe6df73166af79ebeef10ad10e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c7ae14659c594f06209893bbd27a30695a39d058036645fb6fdc35fdfc4d0a87dabe5baa4675d81013a50c5519fb536f5f226baa50dd3bd3a2fc4059ea46450
|
7
|
+
data.tar.gz: 569c9bfa49d026813df401273cd3e2ac523b7b4794097d56136a21665c8584646c54bcbf341d75602b3a358b59052e1fdcd2275e99bb4c2d01524d35a1adf386
|
data/README.md
CHANGED
@@ -56,10 +56,14 @@ listed, this can be over-ridden by using the `-m` flag.
|
|
56
56
|
ding push
|
57
57
|
|
58
58
|
Options:
|
59
|
-
-b
|
59
|
+
-b, [--branch=BRANCH] # specify an over-ride destination branch
|
60
|
+
-l, [--local], [--no-local] # operate on local branches (merged from remote)
|
60
61
|
-m, [--merged], [--no-merged] # display branches that have been merged
|
61
62
|
-p, [--pattern=PATTERN] # specify a pattern for listing branches
|
62
|
-
# Default:
|
63
|
+
# Default: *XAP*
|
64
|
+
-f, [--force] # use the force on commands that allow it e.g. git push
|
65
|
+
# Default: true
|
66
|
+
-v, [--verbose], [--no-verbose] # show verbose output such as full callstack on errors
|
63
67
|
|
64
68
|
Push feature branch(es) to the testing branch (this is the default action)
|
65
69
|
|
data/lib/ding/cli.rb
CHANGED
@@ -9,12 +9,13 @@ module Ding
|
|
9
9
|
default_task :push
|
10
10
|
|
11
11
|
desc "push", "Push feature branch(es) to the testing branch (this is the default action)"
|
12
|
-
option :branch, type: 'string',
|
13
|
-
option :
|
14
|
-
option :
|
12
|
+
option :branch, type: 'string', aliases: '-b', default: nil, desc: 'specify an over-ride destination branch'
|
13
|
+
option :local, type: 'boolean', aliases: '-l', default: false, desc: 'operate on local branches (merged from remote)'
|
14
|
+
option :merged, type: 'boolean', aliases: '-m', default: false, desc: 'only display branches that have been merged'
|
15
|
+
option :pattern, type: 'string', aliases: '-p', default: '*XAP*', desc: 'specify a pattern for listing branches'
|
15
16
|
def push
|
16
|
-
|
17
|
-
|
17
|
+
testing_branch = options[:branch] || Ding::TESTING_BRANCH.dup
|
18
|
+
|
18
19
|
say "\nDing ding ding: let's merge one or more feature branches to #{testing_branch}:\n\n", :green
|
19
20
|
|
20
21
|
repo = Ding::Git.new(options).tap do |r|
|
@@ -23,13 +24,14 @@ module Ding
|
|
23
24
|
r.reset_local_state
|
24
25
|
end
|
25
26
|
|
27
|
+
develop_branch = r.branch_in_context(Ding::DEVELOP_BRANCH.dup)
|
26
28
|
r.checkout develop_branch
|
27
29
|
|
28
30
|
say "> Deleting #{testing_branch}", :green
|
29
31
|
r.delete_branch(testing_branch)
|
30
32
|
|
31
|
-
say ">
|
32
|
-
r.
|
33
|
+
say "> Fetching branches from the remote", :green
|
34
|
+
r.fetch_branches
|
33
35
|
end
|
34
36
|
|
35
37
|
branches = repo.branches(options[:pattern])
|
data/lib/ding/models/git.rb
CHANGED
@@ -11,7 +11,8 @@ module Ding
|
|
11
11
|
|
12
12
|
def branches(pattern)
|
13
13
|
merged = options[:merged] ? '--merged' : '--no-merged'
|
14
|
-
|
14
|
+
remote = options[:local] ? '' : '--remote'
|
15
|
+
%x(git branch #{remote} --list #{remote_version(pattern)} #{merged}).split
|
15
16
|
end
|
16
17
|
|
17
18
|
def branch_exists?(branch)
|
@@ -61,6 +62,18 @@ module Ding
|
|
61
62
|
raise "Unable to push #{branch} branch!" unless run_cmd push_cmd
|
62
63
|
end
|
63
64
|
|
65
|
+
def branch_in_context(branch)
|
66
|
+
if options[:local]
|
67
|
+
local_version(branch)
|
68
|
+
else
|
69
|
+
remote_version(branch)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def fetch_branches
|
74
|
+
raise "Error synchronising with the remote" unless run_cmd 'git fetch --all'
|
75
|
+
end
|
76
|
+
|
64
77
|
def update
|
65
78
|
raise "Error synchronising with the remote" unless run_cmd "git up"
|
66
79
|
end
|
data/lib/ding/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Warren Bain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|