ding 0.7.4 → 0.8.0

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
2
  SHA1:
3
- metadata.gz: 2e05f95e97b10a2fe9ca8391de9e980d289fbb62
4
- data.tar.gz: 38600b7149dcb9aa2707af2323a69ad9ccaa8c96
3
+ metadata.gz: d8a39c932af78aaa0bb31eb6241ea47df2540a0d
4
+ data.tar.gz: f779635e7018639696730787ae88ca5d3eb23518
5
5
  SHA512:
6
- metadata.gz: 22dfc9dd2c8c3d45e682b933b7f1dd266fe9c6d4a462907ce8064d13d1e6b3a05a2a8e2575c9041b613b0ae0cf442f2919f7cdd50f2a09433e2b264f8dec62ed
7
- data.tar.gz: 4796ecb56b0ad9da839e254abd588478162336c69992202da0308c778d273348d85fefe694c410a29e57815a96801568db45c41397ae211adacd43859643e2c3
6
+ metadata.gz: 874a0c0ac45b7f02a6b9c08dfeb7e4dd64e9bbab3d5e70b87be43ba0e84f54ce94f3c9b24a5040bd70636efa3c1b7e04835aa9151e82d9459eaf2531c81b92d5
7
+ data.tar.gz: d4d7f4a3c2276fc4f0f3960320acb11cd96c3c920883159d76acc9ffac11ac44fb054136e6f4c361a0f9ef73188d78e6b82bc0e307ad64060de3d8e42eea7a5e
data/lib/ding/cli.rb CHANGED
@@ -16,8 +16,12 @@ module Ding
16
16
  say "\nDing ding ding: let's merge one or more feature branches to #{testing_branch}:\n\n", :green
17
17
 
18
18
  repo = Ding::Git.new(options).tap do |r|
19
- say "> Synchronising with the remote", :green
20
19
  r.checkout develop_branch
20
+
21
+ say "> Deleting #{testing_branch}", :green
22
+ r.delete_branch(testing_branch)
23
+
24
+ say "> Synchronising with the remote", :green
21
25
  r.update
22
26
  end
23
27
 
@@ -27,21 +31,15 @@ module Ding
27
31
  exit 1
28
32
  end
29
33
 
30
- feature_branches = ask_which_item(branches, 'Which feature branch should I use?', :multiple)
34
+ feature_branches = ask_which_item(branches, "\nWhich feature branch should I use?", :multiple)
31
35
 
32
36
  repo.tap do |r|
33
- say "\n> Deleting #{testing_branch}", :green
37
+ say "\n> Deleting any synched #{testing_branch}", :green
34
38
  r.delete_branch(testing_branch)
35
39
 
36
- say "> Checking out #{develop_branch}", :green
37
- r.checkout(develop_branch)
38
-
39
40
  say "> Creating #{testing_branch}", :green
40
41
  r.create_branch(testing_branch)
41
42
 
42
- say "> Checking out #{testing_branch}", :green
43
- r.checkout(testing_branch)
44
-
45
43
  say "> Merging in selected feature #{feature_branches.count == 1 ? 'branch' : 'branches'}...", :green
46
44
  merge_errors = false
47
45
  feature_branches.each do |branch|
@@ -66,6 +64,7 @@ module Ding
66
64
  show_error e
67
65
  else
68
66
  say "\n --> I'm finished: ding ding ding!\n\n", :green
67
+ exit 0
69
68
  end
70
69
 
71
70
  desc "version", "Display current version of 'ding'"
@@ -88,6 +87,7 @@ module Ding
88
87
  if yes?("Do you want me to replace the existing key?", :yellow)
89
88
  say "> Removing existing key #{key_name}", :cyan
90
89
  s.delete_ssh_key key_name
90
+
91
91
  say "> Creating the replacement ssh key pair", :cyan
92
92
  s.create_ssh_key key_name, ENV['USER']
93
93
  else
@@ -99,6 +99,7 @@ module Ding
99
99
  end
100
100
  say "> Adding the private key to the ssh config", :green
101
101
  s.update_config options[:host], key_name
102
+
102
103
  say "> Copying the public key to the clipboard", :green
103
104
  copy_file_to_clipboard s.ssh_public_key_file(key_name)
104
105
  end
@@ -107,6 +108,7 @@ module Ding
107
108
  show_error e
108
109
  else
109
110
  say "\n --> I'm finished: ding ding ding!\n\n", :green
111
+ exit 0
110
112
  end
111
113
 
112
114
  desc "key-show", "Copy a public ssh key signature to the system clipboard (use -v to also display the signature)"
@@ -114,7 +116,7 @@ module Ding
114
116
  say "\nDing ding ding: let's copy a public key to the clipboard:\n\n", :green
115
117
 
116
118
  Ding::Ssh.new(options).tap do |s|
117
- key_name = ask_which_item(s.list_ssh_keys, 'Which key do you want to copy?')
119
+ key_name = ask_which_item(s.list_ssh_keys, "\nWhich key do you want to copy?")
118
120
  say "\n> Copying the public key to the clipboard", :green
119
121
  copy_file_to_clipboard s.ssh_public_key_file(key_name)
120
122
  end
@@ -123,6 +125,7 @@ module Ding
123
125
  show_error e
124
126
  else
125
127
  say "\n --> You can now Command-v to paste that key: ding ding ding!\n\n", :green
128
+ exit 0
126
129
  end
127
130
 
128
131
  private
@@ -138,7 +141,7 @@ module Ding
138
141
  def ask_which_item(items, prompt, mode=:single)
139
142
  return Array(items.first) if items.size == 1
140
143
  str_format = "\n %#{items.count.to_s.size}s: %s"
141
- prompt = prompt << "\n > Enter multiple selections separated by ',' or 'A' for all" if mode == :multiple
144
+ prompt = prompt << "\n > Enter a single selection, multiple selections separated by ',', 'A' for all, 'Q' or nothing to quit" if mode == :multiple
142
145
  question = set_color prompt, :yellow
143
146
  answers = {}
144
147
 
@@ -150,21 +153,21 @@ module Ding
150
153
 
151
154
  say question
152
155
  reply = ask(" >", :yellow).to_s
153
- begin
154
- replies = reply.split(',')
155
- if answers[reply]
156
- answers.values_at(reply)
157
- elsif mode == :multiple && reply == 'A'
158
- answers.values
159
- elsif mode == :multiple && !replies.empty?
160
- selected_items = answers.values_at(*replies)
161
- raise "Invalid selection" if selected_items.include?(nil)
162
- selected_items
156
+ replies = reply.split(',')
157
+ if reply.empty? || reply.upcase == 'Q'
158
+ say "\n --> OK, nothing for me to do here but ding ding ding!\n\n", :green
159
+ exit 0
160
+ elsif answers[reply]
161
+ answers.values_at(reply)
162
+ elsif mode == :multiple && reply.upcase == 'A'
163
+ answers.values
164
+ elsif mode == :multiple && !replies.empty?
165
+ selected_items = answers.values_at(*replies)
166
+ if selected_items.include?(nil)
167
+ say "\n --> That's not a valid selection, I'm out of here!\n\n", :red
168
+ exit 1
163
169
  end
164
- rescue
165
- raise if options[:verbose]
166
- say "\n --> That's not a valid selection, I'm out of here!\n\n", :red
167
- exit 1
170
+ selected_items
168
171
  end
169
172
  end
170
173
 
@@ -19,8 +19,9 @@ module Ding
19
19
  raise "Unable to checkout #{branch}" unless run_cmd "git checkout #{branch}"
20
20
  end
21
21
 
22
- def create_branch(branch)
22
+ def create_branch(branch, checkout=true)
23
23
  raise "Unable to create #{branch}" unless run_cmd "git branch --no-track #{branch}"
24
+ checkout(branch) if checkout
24
25
  end
25
26
 
26
27
  def current_branch
data/lib/ding/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ding
2
- VERSION = "0.7.4"
2
+ VERSION = "0.8.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: 0.7.4
4
+ version: 0.8.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-07-06 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler