release-gem 0.1.4 → 0.1.5

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: 25dd9ae22ee2f6e81080fb7dfad95726cf299aa4c8e437ea49ccf015ba383566
4
- data.tar.gz: f3f0f229c66f3eb7e3c9aa2cbf275a0cbaed4f55da0987c17bddcde48bfb8890
3
+ metadata.gz: 4a3f43d3c0b887a2346a0ee9b126a6f7a2edd0715f77b910762caeec3056bd76
4
+ data.tar.gz: 937d525b33b1695c16ddd1ff3edd77a554ea8be086832cc1052d27e468d4b7a0
5
5
  SHA512:
6
- metadata.gz: e892d6126c332f5266abaf1c3bb992c4cd4f9157eac46da023f4eff89b9a1217e69fed6656c24447fe903d707d2803c86241290b65f0aada86e06985faa8ee33
7
- data.tar.gz: 2142260e3f9bc6af01c6bc6e3812b9258e8ec077dbb44d77f77243989b722ed9306fe8f6d2a467043d5681acf37fb193004b504815cef932552307e82cee3831
6
+ metadata.gz: ca0da466583bf5191772d82a08507acaca1db045a6e93c6dc9573ed5a445f58a31570328f73a0f1840fcc328bfadf92fc40b03696a46086628ebfe1a99d828ea
7
+ data.tar.gz: b2a5f5d9ec4d3bda1fb86bed8b001b85ca7b1e12fefe585dba8297dcda51cd76f7b9acccddd63192c6119bb0237ba671dd0cb7662847c9d7cf9960f0e0b74b91
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- release-gem (0.1.4)
4
+ release-gem (0.1.5)
5
5
  colorize
6
6
  git_cli
7
7
  gvcs
@@ -15,7 +15,7 @@ GEM
15
15
  specs:
16
16
  colorize (0.8.1)
17
17
  diff-lcs (1.5.0)
18
- git_cli (0.11.2)
18
+ git_cli (0.11.3)
19
19
  gvcs
20
20
  ptools (~> 1.4.0)
21
21
  teLogger
@@ -39,7 +39,7 @@ GEM
39
39
  rspec-support (~> 3.12.0)
40
40
  rspec-support (3.12.0)
41
41
  teLogger (0.2.2)
42
- toolrack (0.21.0)
42
+ toolrack (0.22.0)
43
43
  tty-color (0.6.0)
44
44
  tty-command (0.10.1)
45
45
  pastel (~> 0.8)
@@ -1,7 +1,7 @@
1
1
 
2
2
  #require 'rake'
3
3
  require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
4
+ #require "rspec/core/rake_task"
5
5
  require 'yaml'
6
6
  require_relative 'gemdep'
7
7
 
@@ -36,6 +36,13 @@ module Release
36
36
  if block
37
37
 
38
38
  block.call(:action_start, :relase_dependencies)
39
+
40
+ gemdepInst.development_gem.each do |k,v|
41
+ gemdepInst.infect_gem(v, k, &block)
42
+ block.call(:block_until_dev_gem_done, { name: k, path: v })
43
+ end
44
+
45
+
39
46
  keys = gemdepInst.development_gem.keys
40
47
  loop do
41
48
  begin
@@ -12,6 +12,8 @@ module Release
12
12
  opts[:ui] = TTY::Prompt.new
13
13
  @inst = Action::GemAction.new(root, opts)
14
14
  @pmt = opts[:tty] || opts[:ui]
15
+ @msgColor = opts[:msgColor] || :yellow
16
+ @discardColor = opts[:discardColor] || false
15
17
  end
16
18
 
17
19
  def exec(&block)
@@ -22,7 +24,58 @@ module Release
22
24
  @inst.release_dependencies do |ops, *args|
23
25
  case ops
24
26
  when :action_start
25
- @pmt.say "\n Release dependencies starting...\n".yellow
27
+ @pmt.say pmsg("\n Release dependencies starting...\n")
28
+
29
+ ## from release_infector
30
+ when :multiple_gemspec
31
+ v = args.first
32
+ @pmt.select(pmsg("\n There are multiple gemspecs found. Please select one to proceed : ")) do |m|
33
+ v.each do |vv|
34
+ m.choice vv, vv
35
+ end
36
+ end
37
+
38
+ when :adding_to_gemspec
39
+ v = args.first
40
+ @pmt.say pmsg("\n Adding release-gem to gemspec '#{v[:gemspec]}'")
41
+
42
+ when :gemspec_updated
43
+ v = args.first
44
+ @pmt.say pmsg("\n Gemspec file of GEM '#{v[:name]}' updated with release-gem gem")
45
+
46
+ when :adding_to_rackfile
47
+ v = args.first
48
+ @pmt.say pmsg("\n Adding require to Rakefile at #{v[:rakefile]}")
49
+
50
+ when :creating_new_rakefile
51
+ v = args.first
52
+ @pmt.say pmsg("\n Creating new Rakefile at #{v[:rakefile]}")
53
+
54
+ when :rakefile_updated
55
+ v = args.first
56
+ @pmt.say pmsg("\n Rakefile '#{v[:rakefile]}' updated!")
57
+
58
+ when :select_terminal
59
+ v = args.first
60
+ @pmt.select(pmsg("\n Please select a terminal for development GEM '#{v[:name]}' release : ")) do |m|
61
+ v[:options].each do |t|
62
+ m.choice t, t
63
+ end
64
+ end
65
+
66
+ when :new_terminal_launching
67
+ v = args.first
68
+ @pmt.say pmsg("\n New terminal lanching for GEM '#{v[:name]}' using terminal '#{v[:terminal]}'")
69
+
70
+ when :new_terminal_launched
71
+ v = args.first
72
+ @pmt.say pmsg("\n New terminal launched for GEM '#{v[:name]}' using terminal '#{v[:terminal]}'")
73
+
74
+ when :block_until_dev_gem_done
75
+ v = args.first
76
+ @pmt.yes? pmsg("\n Development GEM '#{v[:name]}' has separate windows for release. Is it done? ")
77
+
78
+ ### End release_infector
26
79
 
27
80
  when :define_gem_prod_config
28
81
 
@@ -31,7 +84,7 @@ module Release
31
84
 
32
85
  loop do
33
86
 
34
- sel = @pmt.select("\n The following development gems requires configuration. Please select one to configure ".yellow) do |m|
87
+ sel = @pmt.select(pmsg("\n The following development gems requires configuration. Please select one to configure ")) do |m|
35
88
  selections.each do |g|
36
89
  m.choice g, g
37
90
  end
@@ -39,17 +92,17 @@ module Release
39
92
 
40
93
  config[sel] = {} if config[sel].nil?
41
94
 
42
- type = @pmt.select("\n The gem in production will be runtime or development ? ".yellow) do |m|
95
+ type = @pmt.select(pmsg("\n The gem in production will be runtime or development ? ")) do |m|
43
96
  m.choice "Runtime", :runtime
44
97
  m.choice "Development only", :dev
45
98
  end
46
99
 
47
100
  config[sel][:type] = type
48
101
 
49
- ver = @pmt.ask("\n Is there specific version pattern (including the ~>/>/>=/= of gemspec) for the gem in production? (Not mandatory) : ".yellow)
102
+ ver = @pmt.ask(pmsg("\n Is there specific version pattern (including the ~>/>/>=/= of gemspec) for the gem in production? (Not mandatory) : "))
50
103
  config[sel][:version] = ver if not_empty?(ver)
51
104
 
52
- @pmt.puts " ** Done configure for gem #{sel}".yellow
105
+ @pmt.puts pmsg(" ** Done configure for gem #{sel}")
53
106
  selections.delete_if { |v| v == sel }
54
107
  break if selections.length == 0
55
108
 
@@ -58,10 +111,10 @@ module Release
58
111
  config
59
112
 
60
113
  when :development_gem_temporary_promoted
61
- @pmt.puts "\n Development gem(s) temporary promoted to production status".yellow
114
+ @pmt.puts pmsg("\n Development gem(s) temporary promoted to production status")
62
115
 
63
116
  when :no_development_gems_found
64
- @pmt.puts "\n No development gem(s) in used found".yellow
117
+ @pmt.puts pmsg("\n No development gem(s) in used found")
65
118
 
66
119
  end
67
120
  end
@@ -73,7 +126,7 @@ module Release
73
126
  @inst.build do |ops, *args|
74
127
  case ops
75
128
  when :action_start
76
- @pmt.say " Gem building starting...\n".yellow
129
+ @pmt.say pmsg(" Gem building starting...\n")
77
130
  when :select_version
78
131
  preset = false
79
132
  if block
@@ -90,7 +143,7 @@ module Release
90
143
  if preset
91
144
 
92
145
  opts = args.first
93
- res = @pmt.select("\n Please select new gem version : \n".yellow) do |m|
146
+ res = @pmt.select(pmsg("\n Please select new gem version : \n")) do |m|
94
147
  opts[:proposed_next].reverse.each do |v|
95
148
  m.choice v,v
96
149
  end
@@ -103,8 +156,8 @@ module Release
103
156
 
104
157
  if res == :custom
105
158
  loop do
106
- res = @pmt.ask("\n Please provide custom version number for the release : ".yellow,required: true)
107
- confirmed = @pmt.yes?("\n Use version '#{res}'? No to try again")
159
+ res = @pmt.ask(pmsg("\n Please provide custom version number for the release : "),required: true)
160
+ confirmed = @pmt.yes?(pmsg("\n Use version '#{res}'? No to try again"))
108
161
  break if confirmed
109
162
  end
110
163
  end
@@ -128,7 +181,7 @@ module Release
128
181
 
129
182
  if preset
130
183
 
131
- res = @pmt.select("\n There are multiple version file found. Please select which one to update : ".yellow) do |m|
184
+ res = @pmt.select(pmsg("\n There are multiple version file found. Please select which one to update : ")) do |m|
132
185
  opts = args.first
133
186
  opts.each do |f|
134
187
  m.choice f,f
@@ -144,7 +197,7 @@ module Release
144
197
  @selVersion = args.first
145
198
 
146
199
  when :gem_build_successfully
147
- @pmt.puts "\n Gem version '#{args.first}' built successfully".green
200
+ @pmt.puts pmsg("\n Gem version '#{args.first}' built successfully", :green)
148
201
  @inst.register(:selected_version, args.first)
149
202
  [true, args.first]
150
203
  end
@@ -158,7 +211,7 @@ module Release
158
211
  case ops
159
212
  when :multiple_rubygems_account
160
213
  creds = args.first
161
- res = @pmt.select("\n Multiple rubygems account detected. Please select one : ".yellow) do |m|
214
+ res = @pmt.select(pmsg("\n Multiple rubygems account detected. Please select one : ")) do |m|
162
215
  creds.each do |k,v|
163
216
  m.choice k,k
164
217
  end
@@ -173,9 +226,9 @@ module Release
173
226
  st = pargs.first
174
227
  res = pargs[1]
175
228
  if st
176
- @pmt.puts "\n Gem push successful.".green
229
+ @pmt.puts pmsg("\n Gem push successful.", :green)
177
230
  else
178
- @pmt.puts "\n Gem push failed. Error was :\n #{res}".red
231
+ @pmt.puts pmsg("\n Gem push failed. Error was :\n #{res}", :red)
179
232
  end
180
233
  end
181
234
  end
@@ -184,7 +237,7 @@ module Release
184
237
 
185
238
  def install(*args, &block)
186
239
 
187
- sysInst = @pmt.yes?("\n Install release into system? ".yellow)
240
+ sysInst = @pmt.yes?(pmsg("\n Install release into system? "))
188
241
  if sysInst
189
242
  @inst.install(*args)
190
243
  end
@@ -195,6 +248,22 @@ module Release
195
248
  @inst.send(mtd,*args, &block)
196
249
  end
197
250
 
251
+ def pmsg(msg, color = nil)
252
+ if not msg.nil?
253
+ if @discardColor == true
254
+ msg
255
+ else
256
+ if not_empty?(color)
257
+ msg.send(color)
258
+ elsif not_empty?(@msgColor)
259
+ msg.send(@msgColor)
260
+ else
261
+ msg
262
+ end
263
+ end
264
+ end
265
+ end
266
+
198
267
  end
199
268
  end
200
269
  end
@@ -11,6 +11,7 @@ module Release
11
11
 
12
12
  def initialize(root, opts = { })
13
13
  @root = root
14
+ @discardColor = opts[:discardColor] || false
14
15
  @devGems = {}
15
16
  @gemConfig = {}
16
17
  @fileHistory = {}
@@ -82,6 +83,12 @@ module Release
82
83
  @fileHistory.clear
83
84
  end
84
85
 
86
+ def infect_gem(gem_root,name, &block)
87
+ ri = ReleaseInfector.new(gem_root, name)
88
+ ri.infect(&block)
89
+ ri.trigger_release_gem(&block)
90
+ end
91
+
85
92
  private
86
93
  def remove_dev_gem_from_gemfile
87
94
  if has_development_gem?
@@ -12,6 +12,8 @@ module Release
12
12
  opts[:ui] = TTY::Prompt.new
13
13
  @inst = Action::VcsAction.new(root,opts)
14
14
  @prmt = TTY::Prompt.new
15
+ @color = opts[:msgColor] || :yellow
16
+ @discardColor = opts[:discardColor] || false
15
17
  end
16
18
 
17
19
  def exec(&block)
@@ -38,7 +40,7 @@ module Release
38
40
  case ops
39
41
  when :select_files_to_commit
40
42
  mfiles = args.first
41
- @prmt.puts "\n Files already added to staging : ".yellow
43
+ @prmt.puts pmsg("\n Files already added to staging : ")
42
44
  mfiles[:staged].each do |k,v|
43
45
  v.each do |vv|
44
46
  @prmt.puts " * #{vv}"
@@ -47,7 +49,7 @@ module Release
47
49
 
48
50
  @prmt.puts ""
49
51
 
50
- sel = @prmt.multi_select "\n Following are files that could be added to version control : ".yellow do |m|
52
+ sel = @prmt.multi_select pmsg("\n Following are files that could be added to version control : ") do |m|
51
53
 
52
54
  [:modified, :new, :deleted].each do |cat|
53
55
  mfiles[cat].each do |k,v|
@@ -74,9 +76,9 @@ module Release
74
76
  if not_empty?(s)
75
77
  st, cres = add_to_staging(*s) if not_empty?(s)
76
78
  if st
77
- @prmt.puts "\n Files added successfully".green
79
+ @prmt.puts pmsg("\n Files added successfully", :green)
78
80
  else
79
- @prmt.puts "\n Files failed to be added. Message was : #{cres}".red
81
+ @prmt.puts pmsg("\n Files failed to be added. Message was : #{cres}", :red)
80
82
  end
81
83
  end
82
84
 
@@ -87,8 +89,8 @@ module Release
87
89
  when :commit_message
88
90
  msg = ""
89
91
  loop do
90
- msg = @prmt.ask("\n Commit message : ".yellow, required: true)
91
- confirm = @prmt.yes?(" Commit message : #{msg}\n Proceed? No to provide a new commit message ".yellow)
92
+ msg = @prmt.ask(pmsg("\n Commit message : "), required: true)
93
+ confirm = @prmt.yes?(pmsg(" Commit message : #{msg}\n Proceed? No to provide a new commit message "))
92
94
  if confirm
93
95
  break
94
96
  end
@@ -99,7 +101,7 @@ module Release
99
101
  when :staged_elements_of_commit
100
102
 
101
103
  elements = args.first
102
- @prmt.puts "\n Following files/directories shall be committed in this session : ".yellow
104
+ @prmt.puts pmsg("\n Following files/directories shall be committed in this session : ")
103
105
  elements.each do |k,v|
104
106
  v.each do |vv|
105
107
  @prmt.puts " * #{vv}"
@@ -107,11 +109,11 @@ module Release
107
109
  end
108
110
 
109
111
  when :commit_successful
110
- @prmt.puts "\n Changes committed".green
112
+ @prmt.puts pmsg("\n Changes committed",:green)
111
113
  @prmt.puts args.first
112
114
 
113
115
  when :commit_failed
114
- @prmt.puts "\n Changes failed to be committed. Error was : #{args.first}"
116
+ @prmt.puts pmsg("\n Changes failed to be committed. Error was : #{args.first}")
115
117
 
116
118
  end
117
119
  end
@@ -139,17 +141,17 @@ module Release
139
141
 
140
142
  case ops
141
143
  when :tag_message
142
- @prmt.ask("\n Please provide message for the tag : ".yellow, value: "Auto tagging by gem-release gem during releasing version #{@selVer}", required: true)
144
+ @prmt.ask(pmsg("\n Please provide message for the tag : "), value: "Auto tagging by gem-release gem during releasing version #{@selVer}", required: true)
143
145
 
144
146
  when :tagging_success
145
- @prmt.puts "\n Tagging of source code is successful.".green
147
+ @prmt.puts pmsg("\n Tagging of source code is successful.", :green)
146
148
  @prmt.puts args.first
147
149
 
148
150
  when :tagging_failed
149
- @prmt.puts "\n Tagging of source code failed. Error was : #{args.first}".red
151
+ @prmt.puts pmsg("\n Tagging of source code failed. Error was : #{args.first}", :red)
150
152
 
151
153
  when :no_tagging_required
152
- @prmt.puts "\n No tagging required. Source head is the tagged item ".green
154
+ @prmt.puts pmsg("\n No tagging required. Source head is the tagged item ", :green)
153
155
 
154
156
  end
155
157
  end # preset ?
@@ -178,7 +180,7 @@ module Release
178
180
  case ops
179
181
  when :select_remote
180
182
  val = args.first
181
- sel = @prmt.select("\n Please select one of the remote config below : ") do |m|
183
+ sel = @prmt.select(pmsg("\n Please select one of the remote config below : ")) do |m|
182
184
  val.each do |k,v|
183
185
  m.choice k, k
184
186
  end
@@ -190,14 +192,14 @@ module Release
190
192
  sel
191
193
 
192
194
  when :no_remote_repos_defined
193
- add = @prmt.yes?("\n No remote configuration defined. Add one now?")
195
+ add = @prmt.yes?(pmsg("\n No remote configuration defined. Add one now?"))
194
196
  if add
195
- name = @prmt.ask("\n Name of the repository : ", value: "origin", required: true)
196
- url = @prmt.ask("\n URL of the repository : ", required: true)
197
+ name = @prmt.ask(pmsg("\n Name of the repository : "), value: "origin", required: true)
198
+ url = @prmt.ask(pmsg(" URL of the repository : "), required: true)
197
199
 
198
200
  st, res = add_remote(name, url)
199
201
  if st
200
- @prmt.puts "\n Remote configuration added successfully".green
202
+ @prmt.puts pmsg("\n Remote configuration added successfully",:green)
201
203
  name
202
204
  else
203
205
  raise Release::Gem::Abort, "Failed to add remote configuration. Error was : #{res}"
@@ -205,15 +207,15 @@ module Release
205
207
  end
206
208
 
207
209
  when :push_successful
208
- @prmt.puts "\n Push success!".green
210
+ @prmt.puts pmsg("\n Push success!",:green)
209
211
  @prmt.puts args.first
210
212
 
211
213
  when :push_failed
212
- @prmt.puts "\nPush failed. Error was : #{args.first}".red
214
+ @prmt.puts pmsg("\nPush failed. Error was : #{args.first}",:red)
213
215
 
214
216
  when :no_changes_to_push
215
217
  val = args.first
216
- @prmt.puts "\n Local is in sync with remote (#{val[:remote]}/#{val[:branch]}). Push is not required. "
218
+ @prmt.puts pmsg("\n Local is in sync with remote (#{val[:remote]}/#{val[:branch]}). Push is not required. ")
217
219
  end
218
220
  end
219
221
 
@@ -225,6 +227,22 @@ module Release
225
227
  @inst.send(mtd, *args, &block)
226
228
  end
227
229
 
230
+ def pmsg(msg, color = nil)
231
+ if not msg.nil?
232
+ if @discardColor == true
233
+ msg
234
+ else
235
+ if not_empty?(color)
236
+ msg.send(color)
237
+ elsif not_empty?(@msgColor)
238
+ msg.send(@msgColor)
239
+ else
240
+ msg
241
+ end
242
+ end
243
+ end
244
+ end
245
+
228
246
  end
229
247
  end
230
248
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Release
4
4
  module Gem
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.5"
6
6
  end
7
7
  end
data/lib/release/gem.rb CHANGED
@@ -10,6 +10,7 @@ require 'tty/command'
10
10
 
11
11
  require_relative "gem/version"
12
12
  require_relative 'gem/gem_engine'
13
+ require_relative 'gem/release_infector'
13
14
 
14
15
 
15
16
  module Release
@@ -47,7 +47,7 @@ Release::Gem.engine(:gem, root: Dir.getwd) do
47
47
  rescue TTY::Reader::InputInterrupt => ex
48
48
  rescue Exception => ex
49
49
  STDERR.puts "\n -- Error thrown. Message was : #{ex.message}".red
50
- STDERR.puts "\n#{ex.backtrace.join("\n")}" if ENV["RELGEM_DEBUG"] == true
50
+ STDERR.puts "\n#{ex.backtrace.join("\n")}" if ENV["RELGEM_DEBUG"] == "true"
51
51
  ensure
52
52
  gem_dependency_restore
53
53
  end
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.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris