release-gem 0.1.6 → 0.1.8
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/gem_action.rb +8 -2
- data/lib/release/gem/gem_cli_action.rb +1 -0
- data/lib/release/gem/gem_engine.rb +4 -4
- data/lib/release/gem/gemdep.rb +5 -1
- data/lib/release/gem/release_infector.rb +9 -4
- data/lib/release/gem/vcs_action.rb +58 -0
- data/lib/release/gem/vcs_cli_action.rb +79 -1
- data/lib/release/gem/version.rb +1 -1
- data/templates/standard_cli_flow.rb +27 -22
- 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: ed5f60168ae7d89802f6c0f5a18ff62bb055a66aef8ba9af2c87c6f10ecba99a
|
4
|
+
data.tar.gz: dd3c409579297a14c397fb3e874a7da49856544b05a687727e4ae4f74f1be6e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40e7a44d4694335fed765e3d96caffbbfd1d1b1a130f2ea9b8eec35268394b0d2eb4427c112b9e8fd369b05de9505f9c8d0765616bf4fc197733644b2bcd3db0
|
7
|
+
data.tar.gz: cd3679b3878d822c8f4b1768f4ceafaa6fa7274030f928660ccdef78a438dd509f92d6234b93a3cfcdc8d537acce188e5e5b6517bfa69e27e7c94e453f8cb04d
|
data/Gemfile.lock
CHANGED
@@ -38,8 +38,10 @@ module Release
|
|
38
38
|
block.call(:action_start, :relase_dependencies)
|
39
39
|
|
40
40
|
gemdepInst.development_gem.each do |k,v|
|
41
|
-
gemdepInst.infect_gem(v, k, &block)
|
42
|
-
|
41
|
+
res = gemdepInst.infect_gem(v, k, &block)
|
42
|
+
if res != :skip
|
43
|
+
block.call(:block_until_dev_gem_done, { name: k, path: v })
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
|
@@ -61,7 +63,9 @@ module Release
|
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
66
|
+
Gem.logger.debug "About to transfer gem"
|
64
67
|
gemdepInst.transfer_gem
|
68
|
+
Gem.logger.debug "GEM transfer!"
|
65
69
|
|
66
70
|
block.call(:development_gem_temporary_promoted)
|
67
71
|
end
|
@@ -122,6 +126,8 @@ module Release
|
|
122
126
|
if $?
|
123
127
|
cp "Gem build successfully at #{Gem.format_dt(Time.now)}"
|
124
128
|
|
129
|
+
register(:version_file_path, verfile)
|
130
|
+
|
125
131
|
if block
|
126
132
|
block.call(:gem_build_successfully, @selVersion)
|
127
133
|
else
|
@@ -53,14 +53,14 @@ module Release
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def method_missing(mtd, *args, &block)
|
56
|
-
if mtd.to_s.start_with?("
|
56
|
+
if mtd.to_s.start_with?("gem_cli_")
|
57
57
|
Gem.logger.debug "Passing method '#{mtd}' to gem_cli action"
|
58
|
-
pmtd = mtd.to_s[
|
58
|
+
pmtd = mtd.to_s[8..-1].to_sym
|
59
59
|
gem_cli_action_inst.send(pmtd, *args, &block)
|
60
60
|
|
61
|
-
elsif mtd.to_s.start_with?("
|
61
|
+
elsif mtd.to_s.start_with?("vcs_cli_")
|
62
62
|
Gem.logger.debug "Passing method '#{mtd}' to vcs_cli action"
|
63
|
-
pmtd = mtd.to_s[
|
63
|
+
pmtd = mtd.to_s[8..-1].to_sym
|
64
64
|
vcs_cli_action_inst.send(pmtd, *args, &block)
|
65
65
|
|
66
66
|
elsif mtd.to_s.start_with?("gem_")
|
data/lib/release/gem/gemdep.rb
CHANGED
@@ -65,7 +65,7 @@ module Release
|
|
65
65
|
remove_dev_gem_from_gemfile
|
66
66
|
add_gem_to_gemspec(@gemConfig)
|
67
67
|
|
68
|
-
end
|
68
|
+
end # transfer_gem
|
69
69
|
|
70
70
|
def all_dev_gems_has_config?
|
71
71
|
not_configured_gem.length == 0
|
@@ -76,6 +76,7 @@ module Release
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def restore_dev_gem
|
79
|
+
Gem.logger.debug "restore_dev_gem : #{@fileHistory.inspect}"
|
79
80
|
@fileHistory.each do |k,v|
|
80
81
|
FileUtils.mv(k,"#{k}.prod")
|
81
82
|
FileUtils.cp(v,k)
|
@@ -89,6 +90,9 @@ module Release
|
|
89
90
|
ri.trigger_release_gem(&block)
|
90
91
|
end
|
91
92
|
|
93
|
+
####
|
94
|
+
# Private section
|
95
|
+
####
|
92
96
|
private
|
93
97
|
def remove_dev_gem_from_gemfile
|
94
98
|
if has_development_gem?
|
@@ -38,16 +38,19 @@ module Release
|
|
38
38
|
poss = tu_possible_terminal
|
39
39
|
raise ReleaseInfectorError, "No possible terminal found" if is_empty?(poss)
|
40
40
|
|
41
|
+
terminal = ""
|
41
42
|
Bundler.with_clean_env do
|
42
43
|
|
43
44
|
cmd = "cd #{@root} && rake gem:release"
|
44
|
-
terminal = ""
|
45
45
|
if block
|
46
46
|
terminal = block.call(:select_terminal, name: @name, options: poss)
|
47
|
-
terminal
|
47
|
+
if terminal != :skip
|
48
|
+
terminal = poss.first if is_empty?(terminal)
|
49
|
+
|
50
|
+
block.call(:new_terminal_launching, name: @name, terminal: terminal)
|
51
|
+
tu_new_terminal(terminal, cmd)
|
52
|
+
end
|
48
53
|
|
49
|
-
block.call(:new_terminal_launching, name: @name, terminal: terminal)
|
50
|
-
tu_new_terminal(terminal, cmd)
|
51
54
|
else
|
52
55
|
terminal = poss.first
|
53
56
|
block.call(:new_terminal_launching, name: @name, terminal: terminal)
|
@@ -58,6 +61,8 @@ module Release
|
|
58
61
|
|
59
62
|
end
|
60
63
|
|
64
|
+
terminal
|
65
|
+
|
61
66
|
end
|
62
67
|
|
63
68
|
def is_release_gem_installed?
|
@@ -42,6 +42,40 @@ module Release
|
|
42
42
|
instance_eval(&block) if block
|
43
43
|
end
|
44
44
|
|
45
|
+
def overview_changes(&block)
|
46
|
+
|
47
|
+
res = :done
|
48
|
+
if block
|
49
|
+
|
50
|
+
loop do
|
51
|
+
|
52
|
+
stgDir, stgFiles = @ws.staged_files
|
53
|
+
modDir, modFiles = @ws.modified_files
|
54
|
+
newDir, newFiles = @ws.new_files
|
55
|
+
delDir, delFiles = @ws.deleted_files
|
56
|
+
|
57
|
+
modFiles.delete_if { |f| stgFiles.include?(f) }
|
58
|
+
modDir.delete_if { |f| stgDir.include?(f) }
|
59
|
+
|
60
|
+
newFiles.delete_if { |f| stgFiles.include?(f) }
|
61
|
+
newDir.delete_if { |f| stgDir.include?(f) }
|
62
|
+
|
63
|
+
delFiles.delete_if { |f| stgFiles.include?(f) }
|
64
|
+
delDir.delete_if { |f| stgDir.include?(f) }
|
65
|
+
|
66
|
+
# block should call vcs for remove, ignore and diff
|
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 } )
|
68
|
+
|
69
|
+
break if not res.is_a?(GitCli::Delta::VCSItem) and res == :done
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
res
|
76
|
+
|
77
|
+
end
|
78
|
+
|
45
79
|
#
|
46
80
|
# Special operation since the gem build will only include files from
|
47
81
|
# git ls-files
|
@@ -256,6 +290,30 @@ module Release
|
|
256
290
|
@ws.add_to_staging(*files)
|
257
291
|
end
|
258
292
|
|
293
|
+
def add_to_staging_if_commit_before(*files)
|
294
|
+
|
295
|
+
stgDir, stgFiles = @ws.staged_files
|
296
|
+
modDir, modFiles = @ws.modified_files
|
297
|
+
#newDir, newFiles = @ws.new_files
|
298
|
+
delDir, delFiles = @ws.deleted_files
|
299
|
+
|
300
|
+
mFiles = modFiles.map { |e| e.path }
|
301
|
+
sFiles = stgFiles.map { |e| e.path }
|
302
|
+
dFiles = delFiles.map { |e| e.path }
|
303
|
+
|
304
|
+
res = []
|
305
|
+
files.each do |f|
|
306
|
+
if (mFiles.include?(f) or dFiles.include?(f)) and not sFiles.include?(f)
|
307
|
+
res << f
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
if not_empty?(res)
|
312
|
+
@ws.add_to_staging(*res)
|
313
|
+
end
|
314
|
+
|
315
|
+
end
|
316
|
+
|
259
317
|
def ignore(*files)
|
260
318
|
@ws.ignore(*files)
|
261
319
|
end
|
@@ -20,6 +20,84 @@ module Release
|
|
20
20
|
instance_eval(&block) if block
|
21
21
|
end
|
22
22
|
|
23
|
+
def overview_changes(*args, &block)
|
24
|
+
@inst.overview_changes do |ops, *args|
|
25
|
+
preset = false
|
26
|
+
if block
|
27
|
+
res = block.call(ops, *args)
|
28
|
+
if res.nil?
|
29
|
+
preset = true
|
30
|
+
else
|
31
|
+
res
|
32
|
+
end
|
33
|
+
else
|
34
|
+
preset = true
|
35
|
+
end
|
36
|
+
|
37
|
+
if preset
|
38
|
+
case ops
|
39
|
+
when :select_files_to_manage
|
40
|
+
mfiles = args.first
|
41
|
+
|
42
|
+
sel = @prmt.select pmsg("\n Following are files that could be managed : ") do |m|
|
43
|
+
|
44
|
+
[:staged, :modified, :new, :deleted].each do |cat|
|
45
|
+
mfiles[cat].each do |k,v|
|
46
|
+
v.each do |vv|
|
47
|
+
m.choice vv, vv
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
m.choice "Done", :done
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
if sel.is_a?(GitCli::Delta::VCSItem)
|
58
|
+
|
59
|
+
selOps = @prmt.select pmsg("\n What do you want to do with file '#{sel.path}'?") do |m|
|
60
|
+
|
61
|
+
m.choice "Diff", :diff if not (sel.is_a?(GitCli::Delta::NewFile) or sel.is_a?(GitCli::Delta::NewDir))
|
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
|
67
|
+
|
68
|
+
case selOps
|
69
|
+
when :diff
|
70
|
+
st, res = @inst.diff_file(sel.path)
|
71
|
+
puts res
|
72
|
+
STDIN.getc
|
73
|
+
when :ignore
|
74
|
+
confirm = @prmt.yes?(pmsg("\n Add file '#{sel.path}' to gitignore file?"))
|
75
|
+
if confirm
|
76
|
+
@inst.ignore(sel.path)
|
77
|
+
end
|
78
|
+
when :remove_from_staging
|
79
|
+
confirm = @prmt.yes?(pmsg("\n Remove file '#{sel.path}' from staging?"))
|
80
|
+
if confirm
|
81
|
+
@inst.remove_from_staging(sel.path)
|
82
|
+
end
|
83
|
+
when :delete
|
84
|
+
skip = @prmt.no?(pmsg("\n Delete the file '#{sel.path}' from file system? NOTE THIS CANNOT BE UNDONE! "))
|
85
|
+
if not skip
|
86
|
+
FileUtils.rm(sel.path)
|
87
|
+
end
|
88
|
+
when :done
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
sel
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
end # overview_changes
|
100
|
+
|
23
101
|
def commit_new_files(*args, &block)
|
24
102
|
res = @inst.commit_new_files do |ops, *args|
|
25
103
|
|
@@ -49,7 +127,7 @@ module Release
|
|
49
127
|
|
50
128
|
@prmt.puts ""
|
51
129
|
|
52
|
-
sel = @prmt.multi_select pmsg("\n Following are new files that could be added to version control : ") do |m|
|
130
|
+
sel = @prmt.multi_select pmsg("\n Following are new files that could be added to version control.\n Don't worry if you found not all changed files are here. There will be another commit session after the build : ") do |m|
|
53
131
|
|
54
132
|
mfiles[:new].each do |k,v|
|
55
133
|
v.each do |vv|
|
data/lib/release/gem/version.rb
CHANGED
@@ -10,40 +10,45 @@ Release::Gem.engine(:gem, root: Dir.getwd) do
|
|
10
10
|
# step 1 : run test
|
11
11
|
run_test(:rspec)
|
12
12
|
|
13
|
-
|
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
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
# Reason to put it here is because gem build shall
|
18
|
+
# only consider files already inside git system via
|
19
|
+
# git ls-files command. Anything new that is not yet
|
20
|
+
# check in will not be packup by the gem build process
|
21
|
+
vcs_cli_commit
|
17
22
|
|
18
|
-
|
23
|
+
# step 2 : check dependency
|
24
|
+
gem_cli_release_dependencies
|
19
25
|
|
20
|
-
|
21
|
-
|
26
|
+
# step 3 : build the gem
|
27
|
+
st, ver = gem_cli_build
|
22
28
|
|
23
|
-
|
29
|
+
gem_cli_dependency_restore
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
31
|
+
if st
|
32
|
+
# step 4, push the gem to rubygems
|
33
|
+
gem_cli_push(version: ver)
|
34
|
+
gem_cli_install(version: ver)
|
35
|
+
end
|
30
36
|
|
31
|
-
|
37
|
+
puts "version : #{ver}"
|
32
38
|
|
39
|
+
@selVer = value(:selected_version)
|
33
40
|
|
34
|
-
|
35
|
-
|
41
|
+
vcs_add_to_staging_if_commit_before("Gemfile.lock")
|
42
|
+
vcs_add_to_staging(value(:version_file_path))
|
36
43
|
|
37
|
-
|
38
|
-
commit
|
44
|
+
vcs_commit("Commit after gem version #{@selVer} built")
|
39
45
|
|
40
|
-
|
41
|
-
|
46
|
+
# step 7 : tag the source code
|
47
|
+
vcs_cli_tag( tag: @selVer )
|
42
48
|
|
43
|
-
|
44
|
-
|
49
|
+
# step 8 : Push the source code
|
50
|
+
vcs_cli_push
|
45
51
|
|
46
|
-
end # vcs_action block
|
47
52
|
rescue Release::Gem::Abort => ex
|
48
53
|
STDERR.puts "\n -- Aborted by user. Message was : #{ex.message}\n".red
|
49
54
|
rescue TTY::Reader::InputInterrupt => ex
|