ding 1.1.0 → 1.2.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: df0176335d68e86af6ccf4969523bb0ac5da0bd8
4
- data.tar.gz: 23dc3b2259afcb665653fdf36b376731d7837612
3
+ metadata.gz: c1283f43275acdd4e1e0eb77d2d19c529c8f8299
4
+ data.tar.gz: b0e9cddae73956fe6df73166af79ebeef10ad10e
5
5
  SHA512:
6
- metadata.gz: 019b33111a0df3822be106570f9c8242633b017b0b7836ccb3c29aaadd5bec1d43bc1fe878caa0369cd706c46673d7572f0a8fa94f78e70cd9e21e7c00735738
7
- data.tar.gz: c10de9c6c22f53863a2b7f2785dfde6165d748b356667a569af0c04209458ce3f84bad20275b0e04210df4ccf6328075649dfdd348a13f33c6d0c14a200f1417
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 [--branch=BRANCH] # specify an over-ride destination branch
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: origin/XAP*
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', aliases: '-b', default: nil, desc: 'specify an over-ride destination branch'
13
- option :merged, type: 'boolean', aliases: '-m', default: false, desc: 'display branches that have been merged'
14
- option :pattern, type: 'string', aliases: '-p', default: 'origin/XAP*', desc: 'specify a pattern for listing branches'
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
- develop_branch, testing_branch = Ding::DEVELOP_BRANCH.dup, Ding::TESTING_BRANCH.dup
17
- testing_branch = options[:branch] if options[:branch]
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 "> Synchronising with the remote", :green
32
- r.update
33
+ say "> Fetching branches from the remote", :green
34
+ r.fetch_branches
33
35
  end
34
36
 
35
37
  branches = repo.branches(options[:pattern])
@@ -11,7 +11,8 @@ module Ding
11
11
 
12
12
  def branches(pattern)
13
13
  merged = options[:merged] ? '--merged' : '--no-merged'
14
- %x(git branch --remote --list #{remote_version(pattern)} #{merged}).split
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
@@ -1,3 +1,3 @@
1
1
  module Ding
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
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.1.0
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-10 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler