release-gem 0.1.7 → 0.1.8

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
  SHA256:
3
- metadata.gz: dea9d324f7b793ed225472a24d957dcd38eabb8f713271d2cb524a6f1e5f1923
4
- data.tar.gz: 6581b5e4fa0d949871b87392e97f139f30785791d93a6fa040260ba52ab312d3
3
+ metadata.gz: ed5f60168ae7d89802f6c0f5a18ff62bb055a66aef8ba9af2c87c6f10ecba99a
4
+ data.tar.gz: dd3c409579297a14c397fb3e874a7da49856544b05a687727e4ae4f74f1be6e7
5
5
  SHA512:
6
- metadata.gz: 970ea9b05c234620c01a03193e2a92a1c485e0019ac381ba87b3e09c0a82b6d6ba2e8abd80d911d6250e995d1fc36435000ce4f9491f3c1628b474ec78489c1f
7
- data.tar.gz: e45f427d07988e498c13cbcf7cc95eacde6523f5e2551ea7e098f9ad6062f60b7039e24800e0c79f8da3b7010c909d5c517273f28d4d69cdc2b4aa639700feda
6
+ metadata.gz: 40e7a44d4694335fed765e3d96caffbbfd1d1b1a130f2ea9b8eec35268394b0d2eb4427c112b9e8fd369b05de9505f9c8d0765616bf4fc197733644b2bcd3db0
7
+ data.tar.gz: cd3679b3878d822c8f4b1768f4ceafaa6fa7274030f928660ccdef78a438dd509f92d6234b93a3cfcdc8d537acce188e5e5b6517bfa69e27e7c94e453f8cb04d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- release-gem (0.1.7)
4
+ release-gem (0.1.8)
5
5
  colorize
6
6
  git_cli
7
7
  gvcs
@@ -63,7 +63,9 @@ module Release
63
63
  end
64
64
  end
65
65
 
66
+ Gem.logger.debug "About to transfer gem"
66
67
  gemdepInst.transfer_gem
68
+ Gem.logger.debug "GEM transfer!"
67
69
 
68
70
  block.call(:development_gem_temporary_promoted)
69
71
  end
@@ -124,6 +126,8 @@ module Release
124
126
  if $?
125
127
  cp "Gem build successfully at #{Gem.format_dt(Time.now)}"
126
128
 
129
+ register(:version_file_path, verfile)
130
+
127
131
  if block
128
132
  block.call(:gem_build_successfully, @selVersion)
129
133
  else
@@ -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?
@@ -66,7 +66,7 @@ module Release
66
66
  # block should call vcs for remove, ignore and diff
67
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
68
 
69
- break if res == :done
69
+ break if not res.is_a?(GitCli::Delta::VCSItem) and res == :done
70
70
 
71
71
  end
72
72
 
@@ -290,6 +290,30 @@ module Release
290
290
  @ws.add_to_staging(*files)
291
291
  end
292
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
+
293
317
  def ignore(*files)
294
318
  @ws.ignore(*files)
295
319
  end
@@ -54,19 +54,21 @@ module Release
54
54
 
55
55
  end
56
56
 
57
- if sel != :done
57
+ if sel.is_a?(GitCli::Delta::VCSItem)
58
58
 
59
- selOps = @prmt.select pmsg("\n What do you want to do with file '#{sel}'?") do |m|
59
+ selOps = @prmt.select pmsg("\n What do you want to do with file '#{sel.path}'?") do |m|
60
60
 
61
- m.choice "Diff", :diff
61
+ m.choice "Diff", :diff if not (sel.is_a?(GitCli::Delta::NewFile) or sel.is_a?(GitCli::Delta::NewDir))
62
62
  m.choice "Ignore", :ignore
63
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))
64
65
  m.choice "Done", :done
65
66
  end
66
67
 
67
68
  case selOps
68
69
  when :diff
69
- puts @inst.diff_file(sel.path)
70
+ st, res = @inst.diff_file(sel.path)
71
+ puts res
70
72
  STDIN.getc
71
73
  when :ignore
72
74
  confirm = @prmt.yes?(pmsg("\n Add file '#{sel.path}' to gitignore file?"))
@@ -78,6 +80,11 @@ module Release
78
80
  if confirm
79
81
  @inst.remove_from_staging(sel.path)
80
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
81
88
  when :done
82
89
  end
83
90
 
@@ -120,7 +127,7 @@ module Release
120
127
 
121
128
  @prmt.puts ""
122
129
 
123
- 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|
124
131
 
125
132
  mfiles[:new].each do |k,v|
126
133
  v.each do |vv|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Release
4
4
  module Gem
5
- VERSION = "0.1.7"
5
+ VERSION = "0.1.8"
6
6
  end
7
7
  end
@@ -11,42 +11,44 @@ Release::Gem.engine(:gem, root: Dir.getwd) do
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
14
15
  vcs_cli_overview_changes
15
16
 
16
- gem_cli_action do
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
- # step 2 : check dependency
19
- release_dependencies
23
+ # step 2 : check dependency
24
+ gem_cli_release_dependencies
20
25
 
21
- vcs_cli_commit_new_files
26
+ # step 3 : build the gem
27
+ st, ver = gem_cli_build
22
28
 
23
- # step 3 : build the gem
24
- st, ver = build
29
+ gem_cli_dependency_restore
25
30
 
26
- dependency_restore
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
27
36
 
28
- if st
29
- # step 4, push the gem to rubygems
30
- push(version: ver)
31
- install(version: ver)
32
- end
37
+ puts "version : #{ver}"
33
38
 
34
- end # gem_cli_action
39
+ @selVer = value(:selected_version)
35
40
 
41
+ vcs_add_to_staging_if_commit_before("Gemfile.lock")
42
+ vcs_add_to_staging(value(:version_file_path))
36
43
 
37
- vcs_cli_action do
38
- @selVer = value(:selected_version)
44
+ vcs_commit("Commit after gem version #{@selVer} built")
39
45
 
40
- # step 6 : commit vcs
41
- commit
46
+ # step 7 : tag the source code
47
+ vcs_cli_tag( tag: @selVer )
42
48
 
43
- # step 7 : tag the source code
44
- tag( tag: @selVer )
49
+ # step 8 : Push the source code
50
+ vcs_cli_push
45
51
 
46
- # step 8 : Push the source code
47
- push
48
-
49
- end # vcs_action block
50
52
  rescue Release::Gem::Abort => ex
51
53
  STDERR.puts "\n -- Aborted by user. Message was : #{ex.message}\n".red
52
54
  rescue TTY::Reader::InputInterrupt => ex
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: release-gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris