release-gem 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/release/gem/vcs_action.rb +182 -57
- data/lib/release/gem/vcs_cli_action.rb +289 -104
- data/lib/release/gem/version.rb +1 -1
- data/templates/standard_cli_flow.rb +3 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee50e97b208bc323892b6e5ed4af3812fd19cf1955241884d6700c94b03cdb24
|
4
|
+
data.tar.gz: 23b84aa1dea610e1e60bcced74fb15af3ae070e2f74f72b27427e9967e555ced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2538c22c29d80482cdbb781e45b0570f3bd837075aea1fcb5833a242b494cf8e0aeb3383caaaf7e1d675486193b2406fb89dd316a424afc3e64c4bcb15cd84de
|
7
|
+
data.tar.gz: 61dd98175626747dbf74e800aa60842061029bf783695d4e28a0e21124d154fc2ae2e318afd19cebd8a4272695fcc2b6d8ca87ace8f3a9e0c50a61b17c904f0f
|
data/Gemfile.lock
CHANGED
@@ -42,11 +42,10 @@ module Release
|
|
42
42
|
instance_eval(&block) if block
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
|
47
|
-
res = :done
|
45
|
+
def add(&block)
|
46
|
+
|
48
47
|
if block
|
49
|
-
|
48
|
+
|
50
49
|
loop do
|
51
50
|
|
52
51
|
stgDir, stgFiles = @ws.staged_files
|
@@ -63,83 +62,217 @@ module Release
|
|
63
62
|
delFiles.delete_if { |f| stgFiles.include?(f) }
|
64
63
|
delDir.delete_if { |f| stgDir.include?(f) }
|
65
64
|
|
66
|
-
|
67
|
-
res = block.call(:select_files_to_manage, { modified: { files: modFiles, dirs: modDir }, new: { files: newFiles, dirs: newDir }, deleted: { files: delFiles, dirs: delDir }, staged: { files: stgFiles, dirs: stgDir }, vcs: self } )
|
65
|
+
res = block.call(:select_files_to_add, { modified: { files: modFiles, dirs: modDir }, new: { files: newFiles, dirs: newDir }, deleted: { files: delFiles, dirs: delDir }, staged: { files: stgFiles, dirs: stgDir }, vcs: self } )
|
68
66
|
|
69
|
-
|
67
|
+
doneTriggered = false
|
68
|
+
sel = res.clone
|
69
|
+
if sel.include?(:done)
|
70
|
+
sel.delete_if { |e| e == :done }
|
71
|
+
doneTriggered = true
|
72
|
+
end
|
73
|
+
|
74
|
+
if not_empty?(sel)
|
75
|
+
st, rres = @ws.add_to_staging(*sel)
|
76
|
+
if st
|
77
|
+
block.call(:files_added_successfully, { count: sel.length, output: rres })
|
78
|
+
else
|
79
|
+
block.call(:files_failed_to_be_added, { output: rres } )
|
80
|
+
end
|
81
|
+
else
|
82
|
+
block.call(:no_files_given)
|
83
|
+
end
|
84
|
+
|
85
|
+
break if doneTriggered
|
70
86
|
|
71
87
|
end
|
72
88
|
|
73
89
|
end
|
74
90
|
|
75
|
-
res
|
76
|
-
|
77
91
|
end
|
78
92
|
|
79
|
-
|
80
|
-
|
81
|
-
# git ls-files
|
82
|
-
#
|
83
|
-
def commit_new_files(msg = nil, &block)
|
84
|
-
|
85
|
-
res = :value
|
93
|
+
def diff(&block)
|
94
|
+
|
86
95
|
if block
|
87
|
-
|
96
|
+
|
88
97
|
loop do
|
89
98
|
|
90
99
|
stgDir, stgFiles = @ws.staged_files
|
91
|
-
|
100
|
+
modDir, modFiles = @ws.modified_files
|
101
|
+
|
102
|
+
modFiles.delete_if { |f| stgFiles.include?(f) }
|
103
|
+
modDir.delete_if { |f| stgDir.include?(f) }
|
104
|
+
|
105
|
+
res = block.call(:select_files_to_diff, { modified: { files: modFiles, dirs: modDir }, staged: { files: stgFiles, dirs: stgDir }, vcs: self } )
|
92
106
|
|
93
|
-
|
94
|
-
|
95
|
-
|
107
|
+
doneTriggered = false
|
108
|
+
sel = res.clone
|
109
|
+
if sel.include?(:done)
|
110
|
+
sel.delete_if { |e| e == :done }
|
111
|
+
doneTriggered = true
|
96
112
|
end
|
97
113
|
|
98
|
-
|
99
|
-
|
114
|
+
if not_empty?(sel)
|
115
|
+
sel.each do |s|
|
116
|
+
st, rres = @ws.diff_file(s)
|
117
|
+
if st
|
118
|
+
block.call(:diff_file_result, { file: s, output: rres })
|
119
|
+
else
|
120
|
+
block.call(:diff_file_error, { file: s, output: rres } )
|
121
|
+
end
|
122
|
+
end
|
123
|
+
else
|
124
|
+
block.call(:no_files_given)
|
125
|
+
end
|
100
126
|
|
101
|
-
|
127
|
+
break if doneTriggered
|
102
128
|
|
103
|
-
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
def ignore(*files, &block)
|
136
|
+
|
137
|
+
if block
|
138
|
+
|
139
|
+
loop do
|
140
|
+
|
141
|
+
newDir, newFiles = @ws.new_files
|
142
|
+
|
143
|
+
res = block.call(:select_files_to_ignore, { files: newFiles, dirs: newDir } )
|
144
|
+
|
145
|
+
doneTriggered = false
|
146
|
+
sel = res.clone
|
147
|
+
if sel.include?(:done)
|
148
|
+
sel.delete_if { |e| e == :done }
|
149
|
+
doneTriggered = true
|
150
|
+
end
|
151
|
+
|
152
|
+
if not_empty?(sel)
|
153
|
+
st, rres = @ws.ignore(*sel)
|
154
|
+
if st
|
155
|
+
block.call(:files_ignored_successfully, { count: sel.length, output: rres })
|
156
|
+
else
|
157
|
+
block.call(:files_failed_to_be_ignored, { output: rres } )
|
158
|
+
end
|
159
|
+
else
|
160
|
+
block.call(:no_files_given)
|
161
|
+
end
|
162
|
+
|
163
|
+
break if doneTriggered
|
104
164
|
|
105
165
|
end
|
106
166
|
|
107
|
-
|
167
|
+
else
|
168
|
+
|
169
|
+
@ws.ignore(*files) if not_empty?(files)
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
def remove_from_staging(*files, &block)
|
176
|
+
|
177
|
+
if block
|
178
|
+
|
179
|
+
loop do
|
108
180
|
|
109
181
|
stgDir, stgFiles = @ws.staged_files
|
110
|
-
block.call(:staged_elements_of_commit, { files: stgFiles, dirs: stgDir })
|
111
182
|
|
112
|
-
|
113
|
-
raise VcsActionError, "Commit message is empty" if is_empty?(msg)
|
183
|
+
res = block.call(:select_files_to_remove, { files: stgFiles, dirs: stgDir } )
|
114
184
|
|
115
|
-
|
116
|
-
|
117
|
-
if
|
118
|
-
|
185
|
+
doneTriggered = false
|
186
|
+
sel = res.clone
|
187
|
+
if sel.include?(:done)
|
188
|
+
sel.delete_if { |e| e == :done }
|
189
|
+
doneTriggered = true
|
190
|
+
end
|
191
|
+
|
192
|
+
if not_empty?(sel)
|
193
|
+
st, rres = @ws.remove_from_staging(*sel)
|
194
|
+
if st
|
195
|
+
block.call(:files_removed_successfully, { count: sel.length, output: rres })
|
196
|
+
else
|
197
|
+
block.call(:files_removed_to_be_ignored, { output: rres } )
|
198
|
+
end
|
119
199
|
else
|
120
|
-
block.call(:
|
200
|
+
block.call(:no_files_given)
|
121
201
|
end
|
122
|
-
|
202
|
+
|
203
|
+
break if doneTriggered
|
123
204
|
|
124
205
|
end
|
125
206
|
|
207
|
+
else
|
126
208
|
|
127
|
-
|
209
|
+
@ws.removed_from_staging(*files) if not_empty?(files)
|
128
210
|
|
129
|
-
|
130
|
-
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
def delete_file(*files, &block)
|
216
|
+
|
217
|
+
if block
|
218
|
+
|
219
|
+
loop do
|
220
|
+
|
221
|
+
stgDir, stgFiles = @ws.staged_files
|
222
|
+
modDir, modFiles = @ws.modified_files
|
223
|
+
newDir, newFiles = @ws.new_files
|
224
|
+
|
225
|
+
modFiles.delete_if { |f| stgFiles.include?(f) }
|
226
|
+
modDir.delete_if { |f| stgDir.include?(f) }
|
227
|
+
|
228
|
+
newFiles.delete_if { |f| stgFiles.include?(f) }
|
229
|
+
newDir.delete_if { |f| stgDir.include?(f) }
|
230
|
+
|
231
|
+
res = block.call(:select_files_to_delete, { modified: { files: modFiles, dirs: modDir }, new: { files: newFiles, dirs: newDir }, staged: { files: stgFiles, dirs: stgDir } } )
|
232
|
+
|
233
|
+
doneTriggered = false
|
234
|
+
sel = res.clone
|
235
|
+
if sel.include?(:done)
|
236
|
+
sel.delete_if { |e| e == :done }
|
237
|
+
doneTriggered = true
|
238
|
+
end
|
239
|
+
|
240
|
+
if not_empty?(sel)
|
241
|
+
staged = []
|
242
|
+
nonTrack = []
|
243
|
+
sel.each do |s|
|
244
|
+
if s.is_a?(GitCli::Delta::NewFile)
|
245
|
+
confirm = block.call(:confirm_nontrack_delete, s.path)
|
246
|
+
if confirm
|
247
|
+
FileUtils.rm(s.path)
|
248
|
+
block.call(:nontrack_file_deleted, s.path)
|
249
|
+
end
|
250
|
+
elsif s.is_a?(GitCli::Delta::ModifiedFile)
|
251
|
+
# not staged
|
252
|
+
confirm = block.call(:confirm_vcs_delete, s.path)
|
253
|
+
puts "vcs confirm : #{confirm}"
|
254
|
+
if confirm
|
255
|
+
@ws.remove_from_vcs(s.path)
|
256
|
+
block.call(:vcs_file_deleted, s.path)
|
257
|
+
end
|
258
|
+
elsif s.is_a?(GitCli::Delta::StagedFile)
|
259
|
+
confirm = block.call(:confirm_staged_delete, s.path)
|
260
|
+
if confirm
|
261
|
+
@ws.remove_from_staging(s.path)
|
262
|
+
block.call(:staged_file_deleted, s.path)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
else
|
268
|
+
block.call(:no_files_given)
|
269
|
+
end
|
270
|
+
|
271
|
+
break if doneTriggered
|
131
272
|
|
132
|
-
cp "Commit with user message : #{msg}"
|
133
|
-
st, res = @ws.commit(msg)
|
134
|
-
if st
|
135
|
-
block.call(:commit_successful, res) if block
|
136
|
-
else
|
137
|
-
block.call(:commit_failed, res) if block
|
138
273
|
end
|
139
|
-
[st, res]
|
140
274
|
|
141
275
|
end
|
142
|
-
|
143
276
|
end
|
144
277
|
|
145
278
|
def commit(msg = nil, &block)
|
@@ -220,16 +353,16 @@ module Release
|
|
220
353
|
|
221
354
|
if is_empty?(msg)
|
222
355
|
if block
|
223
|
-
msg = block.call(:tag_message)
|
356
|
+
msg = block.call(:tag_message, { tag: tag })
|
224
357
|
end
|
225
358
|
end
|
226
359
|
|
227
360
|
cp "tagged with name : #{tag} and message : #{msg}"
|
228
361
|
st, res = @ws.create_tag(tag, msg)
|
229
362
|
if st
|
230
|
-
block.call(:tagging_success, res) if block
|
363
|
+
block.call(:tagging_success, { tag: tag, output: res }) if block
|
231
364
|
else
|
232
|
-
block.call(:tagging_failed, res) if block
|
365
|
+
block.call(:tagging_failed, { tag: tag, output: res }) if block
|
233
366
|
end
|
234
367
|
|
235
368
|
[st, res]
|
@@ -314,14 +447,6 @@ module Release
|
|
314
447
|
|
315
448
|
end
|
316
449
|
|
317
|
-
def ignore(*files)
|
318
|
-
@ws.ignore(*files)
|
319
|
-
end
|
320
|
-
|
321
|
-
def remove_from_staging(*files)
|
322
|
-
@ws.remove_from_staging(*files)
|
323
|
-
end
|
324
|
-
|
325
450
|
|
326
451
|
private
|
327
452
|
def method_missing(mtd, *args, &block)
|
@@ -20,8 +20,49 @@ module Release
|
|
20
20
|
instance_eval(&block) if block
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def manage_workspace(*args, &block)
|
24
|
+
|
25
|
+
loop do
|
26
|
+
|
27
|
+
ops = @prmt.select(pmsg("\n Please select a VCS workspace operation : ")) do |m|
|
28
|
+
|
29
|
+
m.choice "Add", :add
|
30
|
+
m.choice "Ignore", :ignore
|
31
|
+
m.choice "Diff", :diff
|
32
|
+
m.choice "Remove staged file", :remove_staged
|
33
|
+
m.choice "Delete file", :del
|
34
|
+
m.choice "Commit", :commit
|
35
|
+
m.choice "Done", :done
|
36
|
+
m.choice "Abort", :abort
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
case ops
|
41
|
+
when :abort
|
42
|
+
raise Release::Gem::Abort, "User aborted"
|
43
|
+
when :add
|
44
|
+
add
|
45
|
+
when :diff
|
46
|
+
diff
|
47
|
+
when :ignore
|
48
|
+
ignore
|
49
|
+
when :remove_staged
|
50
|
+
remove_staged
|
51
|
+
when :del
|
52
|
+
delete_file
|
53
|
+
when :commit
|
54
|
+
commit
|
55
|
+
break
|
56
|
+
when :done
|
57
|
+
break
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
def add(*input, &block)
|
65
|
+
@inst.add do |ops, *args|
|
25
66
|
preset = false
|
26
67
|
if block
|
27
68
|
res = block.call(ops, *args)
|
@@ -36,71 +77,120 @@ module Release
|
|
36
77
|
|
37
78
|
if preset
|
38
79
|
case ops
|
39
|
-
when :
|
40
|
-
mfiles = args.first
|
80
|
+
when :select_files_to_add
|
41
81
|
|
42
|
-
|
82
|
+
mfiles = args.first
|
83
|
+
@prmt.puts pmsg("\n Files already added to staging : ")
|
84
|
+
mfiles[:staged].each do |k,v|
|
85
|
+
v.each do |vv|
|
86
|
+
@prmt.puts " * #{vv}"
|
87
|
+
end
|
88
|
+
end
|
43
89
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
90
|
+
@prmt.puts ""
|
91
|
+
res = []
|
92
|
+
[:modified, :new, :deleted].each do |cat|
|
93
|
+
mfiles[cat].each do |k,v|
|
94
|
+
v.each do |vv|
|
95
|
+
res << vv
|
49
96
|
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
sel = @prmt.multi_select pmsg("\n Following are files that could be added to version control : ") do |m|
|
50
101
|
|
102
|
+
res.sort.each do |f|
|
103
|
+
m.choice f, f.path
|
51
104
|
end
|
52
105
|
|
53
106
|
m.choice "Done", :done
|
107
|
+
m.choice "Abort", :abort
|
108
|
+
end
|
54
109
|
|
110
|
+
if sel.include?(:abort)
|
111
|
+
raise Release::Gem::Abort, "User aborted"
|
112
|
+
else
|
113
|
+
sel
|
55
114
|
end
|
56
115
|
|
57
|
-
|
116
|
+
when :files_added_successfully
|
117
|
+
v = args.first
|
118
|
+
@prmt.puts "\n #{v[:count]} file(s) added successfully.\n#{v[:output]}"
|
58
119
|
|
59
|
-
|
120
|
+
when :files_failed_to_be_added
|
121
|
+
v = args.first
|
122
|
+
@prmt.puts "\n File(s) failed to be added. Error was : \n#{v[:output]}"
|
60
123
|
|
61
|
-
|
62
|
-
m.choice "Ignore", :ignore
|
63
|
-
m.choice "Remove from staging", :remove_from_staging if sel.is_a?(GitCli::Delta::StagedFile)
|
64
|
-
m.choice "Delete", :delete if (sel.is_a?(GitCli::Delta::NewFile) or sel.is_a?(GitCli::Delta::NewDir))
|
65
|
-
m.choice "Done", :done
|
66
|
-
end
|
124
|
+
end
|
67
125
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
126
|
+
end
|
127
|
+
|
128
|
+
end # block of add()
|
129
|
+
end
|
130
|
+
|
131
|
+
def diff(*input, &block)
|
132
|
+
@inst.diff do |ops, *args|
|
133
|
+
preset = false
|
134
|
+
if block
|
135
|
+
res = block.call(ops, *args)
|
136
|
+
if res.nil?
|
137
|
+
preset = true
|
138
|
+
else
|
139
|
+
res
|
140
|
+
end
|
141
|
+
else
|
142
|
+
preset = true
|
143
|
+
end
|
144
|
+
|
145
|
+
if preset
|
146
|
+
case ops
|
147
|
+
when :select_files_to_diff
|
148
|
+
|
149
|
+
mfiles = args.first
|
150
|
+
res = []
|
151
|
+
[:modified, :staged].each do |cat|
|
152
|
+
mfiles[cat].each do |k,v|
|
153
|
+
v.each do |vv|
|
154
|
+
res << vv
|
87
155
|
end
|
88
|
-
when :done
|
89
156
|
end
|
157
|
+
end
|
158
|
+
|
159
|
+
sel = @prmt.multi_select pmsg("\n Select files for diff operation : ") do |m|
|
90
160
|
|
161
|
+
res.sort.each do |f|
|
162
|
+
m.choice f, f.path
|
163
|
+
end
|
164
|
+
|
165
|
+
m.choice "Done", :done
|
166
|
+
m.choice "Abort", :abort
|
91
167
|
end
|
92
168
|
|
93
|
-
sel
|
169
|
+
if sel.include?(:abort)
|
170
|
+
raise Release::Gem::Abort, "User aborted"
|
171
|
+
else
|
172
|
+
sel
|
173
|
+
end
|
174
|
+
|
175
|
+
when :diff_file_result
|
176
|
+
v = args.first
|
177
|
+
@prmt.puts "Diff result for file '#{v[:file]}'"
|
178
|
+
puts v[:output].light_blue
|
179
|
+
STDIN.gets
|
180
|
+
|
181
|
+
when :diff_file_error
|
182
|
+
v = args.first
|
183
|
+
@prmt.puts "\n Failed to diff file '#{v[:file]}'. Error was : \n#{v[:output]}"
|
94
184
|
|
95
185
|
end
|
186
|
+
|
96
187
|
end
|
97
188
|
|
98
|
-
end
|
99
|
-
end
|
189
|
+
end # block of add()
|
190
|
+
end
|
100
191
|
|
101
|
-
def
|
102
|
-
|
103
|
-
|
192
|
+
def ignore(*input, &block)
|
193
|
+
@inst.ignore do |ops, *args|
|
104
194
|
preset = false
|
105
195
|
if block
|
106
196
|
res = block.call(ops, *args)
|
@@ -114,87 +204,172 @@ module Release
|
|
114
204
|
end
|
115
205
|
|
116
206
|
if preset
|
117
|
-
|
118
207
|
case ops
|
119
|
-
when :
|
208
|
+
when :select_files_to_ignore
|
209
|
+
|
120
210
|
mfiles = args.first
|
121
|
-
@prmt.
|
122
|
-
|
123
|
-
|
124
|
-
|
211
|
+
sel = @prmt.multi_select pmsg("\n Following are files that could be ignored : ") do |m|
|
212
|
+
|
213
|
+
mfiles[:files].sort.each do |v|
|
214
|
+
m.choice v, v.path
|
125
215
|
end
|
216
|
+
|
217
|
+
|
218
|
+
m.choice "Done", :done
|
219
|
+
m.choice "Abort", :abort
|
126
220
|
end
|
127
221
|
|
128
|
-
|
222
|
+
if sel.include?(:abort)
|
223
|
+
raise Release::Gem::Abort, "User aborted"
|
224
|
+
else
|
225
|
+
sel
|
226
|
+
end
|
129
227
|
|
130
|
-
|
228
|
+
when :files_ignored_successfully
|
229
|
+
v = args.first
|
230
|
+
@prmt.puts "\n #{v[:count]} file(s) ignored successfully.\n#{v[:output]}"
|
131
231
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
232
|
+
when :files_failed_to_be_ignored
|
233
|
+
v = args.first
|
234
|
+
@prmt.puts "\n File(s) failed to be ignored. Error was : \n#{v[:output]}"
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
|
240
|
+
end # block of add()
|
241
|
+
end
|
242
|
+
|
243
|
+
def remove_staged(*input, &block)
|
244
|
+
@inst.remove_from_staging do |ops, *args|
|
245
|
+
preset = false
|
246
|
+
if block
|
247
|
+
res = block.call(ops, *args)
|
248
|
+
if res.nil?
|
249
|
+
preset = true
|
250
|
+
else
|
251
|
+
res
|
252
|
+
end
|
253
|
+
else
|
254
|
+
preset = true
|
255
|
+
end
|
256
|
+
|
257
|
+
if preset
|
258
|
+
case ops
|
259
|
+
when :select_files_to_remove
|
260
|
+
|
261
|
+
mfiles = args.first
|
262
|
+
|
263
|
+
sel = @prmt.multi_select pmsg("\n Following are files that could be removed from staging : ") do |m|
|
264
|
+
|
265
|
+
mfiles[:files].sort.each do |v|
|
266
|
+
m.choice v, v.path
|
136
267
|
end
|
137
268
|
|
138
|
-
|
269
|
+
|
139
270
|
m.choice "Done", :done
|
140
271
|
m.choice "Abort", :abort
|
141
272
|
end
|
142
273
|
|
143
274
|
if sel.include?(:abort)
|
144
275
|
raise Release::Gem::Abort, "User aborted"
|
145
|
-
elsif sel.include?(:skip)
|
146
|
-
:skip
|
147
276
|
else
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
277
|
+
sel
|
278
|
+
end
|
279
|
+
|
280
|
+
when :files_removed_successfully
|
281
|
+
v = args.first
|
282
|
+
@prmt.puts "\n #{v[:count]} file(s) removed successfully.\n#{v[:output]}"
|
283
|
+
|
284
|
+
when :files_removed_to_be_ignored
|
285
|
+
v = args.first
|
286
|
+
@prmt.puts "\n File(s) failed to be removed. Error was : \n#{v[:output]}"
|
287
|
+
|
288
|
+
end
|
289
|
+
|
290
|
+
end
|
291
|
+
|
292
|
+
end # block
|
293
|
+
end
|
294
|
+
|
295
|
+
def delete_file(*args, &block)
|
296
|
+
res = @inst.delete_file do |ops, *args|
|
297
|
+
|
298
|
+
preset = false
|
299
|
+
if block
|
300
|
+
res = block.call(ops, *args)
|
301
|
+
if res.nil?
|
302
|
+
preset = true
|
303
|
+
else
|
304
|
+
res
|
305
|
+
end
|
306
|
+
else
|
307
|
+
preset = true
|
308
|
+
end
|
309
|
+
|
310
|
+
if preset
|
311
|
+
|
312
|
+
case ops
|
313
|
+
when :select_files_to_delete
|
314
|
+
mfiles = args.first
|
315
|
+
|
316
|
+
files = []
|
317
|
+
[:new, :staged, :modified].each do |cat|
|
318
|
+
mfiles[cat].each do |k,v|
|
319
|
+
v.each do |vv|
|
320
|
+
files << vv
|
321
|
+
#m.choice vv, vv
|
157
322
|
end
|
158
323
|
end
|
159
324
|
|
160
|
-
res
|
161
|
-
|
162
325
|
end
|
163
326
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
confirm = @prmt.yes?(pmsg(" Commit message : #{msg}\n Proceed? No to provide a new commit message "))
|
169
|
-
if confirm
|
170
|
-
break
|
327
|
+
|
328
|
+
sel = @prmt.multi_select pmsg("\n Following are files that could be deleted : ") do |m|
|
329
|
+
files.sort do |f|
|
330
|
+
m.choice f, f
|
171
331
|
end
|
332
|
+
m.choice "Done", :done
|
333
|
+
m.choice "Abort", :abort
|
172
334
|
end
|
173
335
|
|
174
|
-
msg
|
175
|
-
|
176
|
-
when :staged_elements_of_commit
|
177
336
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
@prmt.puts " * #{vv}"
|
183
|
-
end
|
337
|
+
if sel.include?(:abort)
|
338
|
+
raise Release::Gem::Abort, "User aborted"
|
339
|
+
else
|
340
|
+
sel
|
184
341
|
end
|
185
342
|
|
186
|
-
when :
|
187
|
-
|
188
|
-
@prmt.
|
343
|
+
when :confirm_nontrack_delete
|
344
|
+
v = args.first
|
345
|
+
@prmt.yes?(pmsg("\n Delete non-tracked file '#{v}'? "))
|
189
346
|
|
190
|
-
when :
|
191
|
-
|
347
|
+
when :nontrack_file_deleted
|
348
|
+
v = args.first
|
349
|
+
@prmt.puts pmsg("\n Non tracked file '#{v}' deleted ")
|
350
|
+
|
351
|
+
when :confirm_vcs_delete
|
352
|
+
v = args.first
|
353
|
+
not @prmt.no?(pmsg("\n Delete version-controlled file '#{v}'?\n After delete the file will no longer keeping track of changes. "))
|
354
|
+
|
355
|
+
when :vcs_file_deleted
|
356
|
+
v = args.first
|
357
|
+
@prmt.puts pmsg("\n Version-controlled file '#{v}' deleted ")
|
358
|
+
|
359
|
+
when :confirm_staged_delete
|
360
|
+
v = args.first
|
361
|
+
@prmt.yes?(pmsg("\n Delete staged file '#{v}'?\n After delete the file shall be removed from staging. The file will still exist physically "))
|
362
|
+
|
363
|
+
when :staged_file_deleted
|
364
|
+
v = args.first
|
365
|
+
@prmt.puts pmsg("\n Staged file '#{v}' deleted ")
|
192
366
|
|
193
367
|
end
|
194
368
|
end
|
195
|
-
end #
|
369
|
+
end # delete_file block
|
370
|
+
|
371
|
+
end # delete_file
|
196
372
|
|
197
|
-
end # commit_new_files
|
198
373
|
|
199
374
|
|
200
375
|
def commit(*args, &block)
|
@@ -226,15 +401,22 @@ module Release
|
|
226
401
|
|
227
402
|
@prmt.puts ""
|
228
403
|
|
229
|
-
|
230
|
-
|
231
|
-
[
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
end
|
404
|
+
files = []
|
405
|
+
[:modified, :new, :deleted].each do |cat|
|
406
|
+
mfiles[cat].each do |k,v|
|
407
|
+
v.each do |vv|
|
408
|
+
files << vv
|
409
|
+
#m.choice vv, vv.path
|
236
410
|
end
|
411
|
+
end
|
412
|
+
|
413
|
+
end
|
237
414
|
|
415
|
+
|
416
|
+
sel = @prmt.multi_select pmsg("\n Following are files that could be added to version control : ") do |m|
|
417
|
+
|
418
|
+
files.sort.each do |f|
|
419
|
+
m.choice f, f.path
|
238
420
|
end
|
239
421
|
|
240
422
|
m.choice "Skip", :skip #if mfiles[:counter] == 0
|
@@ -318,14 +500,17 @@ module Release
|
|
318
500
|
|
319
501
|
case ops
|
320
502
|
when :tag_message
|
321
|
-
|
503
|
+
v = args.first
|
504
|
+
@prmt.ask(pmsg("\n Please provide message for the tag : "), value: "Auto tagging by gem-release gem during releasing version #{v[:tag]}", required: true)
|
322
505
|
|
323
506
|
when :tagging_success
|
324
|
-
|
325
|
-
@prmt.puts
|
507
|
+
v = args.first
|
508
|
+
@prmt.puts pmsg("\n Tagging of source code with tag '#{v[:tag]}' is successful.", :green)
|
509
|
+
@prmt.puts v[:output]
|
326
510
|
|
327
511
|
when :tagging_failed
|
328
|
-
|
512
|
+
v = args.first
|
513
|
+
@prmt.puts pmsg("\n Tagging of source code with tag '#{v[:tag]}' failed. Error was : #{v[:output]}", :red)
|
329
514
|
|
330
515
|
when :no_tagging_required
|
331
516
|
@prmt.puts pmsg("\n No tagging required. Source head is the tagged item ", :green)
|
data/lib/release/gem/version.rb
CHANGED
@@ -10,15 +10,11 @@ Release::Gem.engine(:gem, root: Dir.getwd) do
|
|
10
10
|
# step 1 : run test
|
11
11
|
run_test(:rspec)
|
12
12
|
|
13
|
-
# to allow user to get a view on what's changed
|
14
|
-
# and allow user to ignore or remove file from staging
|
15
|
-
vcs_cli_overview_changes
|
16
|
-
|
17
13
|
# Reason to put it here is because gem build shall
|
18
14
|
# only consider files already inside git system via
|
19
15
|
# git ls-files command. Anything new that is not yet
|
20
16
|
# check in will not be packup by the gem build process
|
21
|
-
|
17
|
+
vcs_cli_manage_workspace
|
22
18
|
|
23
19
|
# step 2 : check dependency
|
24
20
|
gem_cli_release_dependencies
|
@@ -34,17 +30,13 @@ Release::Gem.engine(:gem, root: Dir.getwd) do
|
|
34
30
|
gem_cli_install(version: ver)
|
35
31
|
end
|
36
32
|
|
37
|
-
puts "version : #{ver}"
|
38
|
-
|
39
|
-
@selVer = value(:selected_version)
|
40
|
-
|
41
33
|
vcs_add_to_staging_if_commit_before("Gemfile.lock")
|
42
34
|
vcs_add_to_staging(value(:version_file_path))
|
43
35
|
|
44
|
-
vcs_commit("Commit after gem version #{
|
36
|
+
vcs_commit("Commit after gem version #{ver} built")
|
45
37
|
|
46
38
|
# step 7 : tag the source code
|
47
|
-
vcs_cli_tag( tag:
|
39
|
+
vcs_cli_tag( tag: ver )
|
48
40
|
|
49
41
|
# step 8 : Push the source code
|
50
42
|
vcs_cli_push
|