release-gem 0.1.1 → 0.1.3

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: d7e0a394923bafd0342c5e97acb21832ed7ea58d72a2030b403d11dead5d9667
4
- data.tar.gz: 504bf8e30c3bc4092664f5bab77bcf5fc5cb3b64efd696ce5c4abc77f7699ad3
3
+ metadata.gz: 0ae1c83005e05a5eeb8c5342aa98ae270205dbeb02c3090f585ba5eb68e26f09
4
+ data.tar.gz: 6a50159b2e2acba162ea32cf9e5294805f4358ae57b3717d14ac2b825f1e66bc
5
5
  SHA512:
6
- metadata.gz: 1547583e15ddc80f3a34aee0e57e7972028980238d005c5535f0b47d835ee187841cc6373e046ec748fadfe334706d80483927c1354b8ea904a6ef417a6bbabd
7
- data.tar.gz: 96dac3327d061f75db576fcf1ffcd743094f5e524f41afb69ea655c43f46bf8b21122326fc35dc91ebb0d2b78f2cf595de3d82677b6070a8e2330688b4977445
6
+ metadata.gz: 96081961c0db069c1affa0f83ba4cc7ff8db5d0ca5f7ecfa50fff124bbc93244da78ba1ec0d386059fef313021896e62c25595335bdd9713bc024258a4bc1a4c
7
+ data.tar.gz: e779b2b0e95fc57744a6164e157ecaf7121dbc61cee878fc735808a859fb8d103a73f5d2bfef3c4eb8630e1a36365ff17a39a5361fb87f272f95a36aab1b5fe6
data/Gemfile CHANGED
@@ -9,6 +9,4 @@ gem "rake", "~> 13.0"
9
9
 
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
- gem "gvcs", git: "gvcs", branch: "master"
13
- gem "git_cli", git: "git_cli", branch: "master"
14
12
 
data/Gemfile.lock CHANGED
@@ -1,26 +1,10 @@
1
- GIT
2
- remote: git_cli
3
- revision: 05d83d28f37f4023920b6bf91d975b818d0f13fe
4
- branch: master
5
- specs:
6
- git_cli (0.11.2)
7
- gvcs
8
- ptools (~> 1.4.0)
9
- teLogger
10
- toolrack
11
-
12
- GIT
13
- remote: gvcs
14
- revision: 698970026596bdff48e475c92387287b5966dd1e
15
- branch: master
16
- specs:
17
- gvcs (0.1.1)
18
-
19
1
  PATH
20
2
  remote: .
21
3
  specs:
22
- release-gem (0.1.1)
4
+ release-gem (0.1.3)
23
5
  colorize
6
+ git_cli
7
+ gvcs
24
8
  teLogger
25
9
  toolrack
26
10
  tty-command
@@ -31,6 +15,12 @@ GEM
31
15
  specs:
32
16
  colorize (0.8.1)
33
17
  diff-lcs (1.5.0)
18
+ git_cli (0.11.2)
19
+ gvcs
20
+ ptools (~> 1.4.0)
21
+ teLogger
22
+ toolrack
23
+ gvcs (0.1.1)
34
24
  pastel (0.8.0)
35
25
  tty-color (~> 0.5)
36
26
  ptools (1.4.3)
@@ -68,8 +58,6 @@ PLATFORMS
68
58
  x86_64-linux
69
59
 
70
60
  DEPENDENCIES
71
- git_cli!
72
- gvcs!
73
61
  rake (~> 13.0)
74
62
  release-gem!
75
63
  rspec (~> 3.0)
@@ -3,6 +3,7 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
5
  require 'yaml'
6
+ require_relative 'gemdep'
6
7
 
7
8
  module Release
8
9
  module Gem
@@ -28,8 +29,39 @@ module Release
28
29
  instance_eval(&block) if block
29
30
  end
30
31
 
31
- def release_dependencies
32
- puts "gem release dependencies"
32
+ def release_dependencies(*args, &block)
33
+ if block
34
+
35
+ block.call(:action_start, :relase_dependencies)
36
+ puts "gem release dependencies"
37
+ puts "Project has development gem? : #{gemdepInst.has_development_gem?}"
38
+ keys = gemdepInst.development_gem.keys
39
+ loop do
40
+ begin
41
+ conf = block.call(:define_gem_prod_config, { gems: keys })
42
+ if conf.is_a?(Hash)
43
+ conf.each do |k,v|
44
+ gemdepInst.configure_gem(k,v)
45
+ end
46
+ break if gemdepInst.all_dev_gems_has_config?
47
+ keys = gemdepInst.not_configured_gem
48
+ else
49
+ block.call(:invalid_gem_prod_config, "Expected return from :define_gem_prod_config is a hash of \"gem name\" => { type: [:runtime | :dev], version: \">= 1.2.0\" }. Note version can be empty")
50
+ end
51
+ rescue GemDepError => ex
52
+ block.call(:invlid_gem_prod_config, ex.message)
53
+ end
54
+ end
55
+
56
+ gemdepInst.transfer_gem
57
+ end
58
+
59
+
60
+ end
61
+
62
+ def dependency_restore
63
+ puts "restoring dependency"
64
+ gemdepInst.restore_dev_gem
33
65
  end
34
66
 
35
67
  def build(*args, &block)
@@ -288,6 +320,13 @@ module Release
288
320
  end
289
321
  end
290
322
 
323
+ def gemdepInst
324
+ if @gemdepInst.nil?
325
+ @gemdepInst = GemDep.new(@root)
326
+ end
327
+ @gemdepInst
328
+ end
329
+
291
330
 
292
331
  end
293
332
  end
@@ -19,8 +19,47 @@ module Release
19
19
  end
20
20
 
21
21
  def release_dependencies
22
- puts "CLI release dependencies"
23
- @inst.release_dependencies
22
+ @inst.release_dependencies do |ops, *args|
23
+ case ops
24
+ when :action_start
25
+ @pmt.say "\n Release dependencies starting...\n".yellow
26
+
27
+ when :define_gem_prod_config
28
+
29
+ config = {}
30
+ selections = args.first[:gems]
31
+
32
+ loop do
33
+
34
+ sel = @pmt.select("\n The following development gems requires configuration. Please select one to configure") do |m|
35
+ selections.each do |g|
36
+ m.choice g, g
37
+ end
38
+ end
39
+
40
+ config[sel] = {} if config[sel].nil?
41
+
42
+ type = @pmt.select("\n The gem in production will be runtime or development ? ") do |m|
43
+ m.choice "Runtime", :runtime
44
+ m.choice "Development only", :dev
45
+ end
46
+
47
+ config[sel][:type] = type
48
+
49
+ ver = @pmt.ask("\n Is there specific version pattern (including the ~>/>/>=/= of gemspec) for the gem in production? (Not mandatory) : ")
50
+ config[sel][:version] = ver if not_empty?(ver)
51
+
52
+ @pmt.puts " ** Done configure for gem #{sel}"
53
+ selections.delete_if { |v| v == sel }
54
+ break if selections.length == 0
55
+
56
+ end
57
+
58
+ config
59
+
60
+ end
61
+ end
62
+
24
63
  end
25
64
 
26
65
  def build(*pargs, &block)
@@ -108,6 +108,7 @@ module Release
108
108
 
109
109
  when :commit_successful
110
110
  @prmt.puts "\n Changes committed".green
111
+ @prmt.puts args.first
111
112
 
112
113
  when :commit_failed
113
114
  @prmt.puts "\n Changes failed to be committed. Error was : #{args.first}"
@@ -142,6 +143,7 @@ module Release
142
143
 
143
144
  when :tagging_success
144
145
  @prmt.puts "\n Tagging of source code is successful.".green
146
+ @prmt.puts args.first
145
147
 
146
148
  when :tagging_failed
147
149
  @prmt.puts "\n Tagging of source code failed. Error was : #{args.first}".red
@@ -204,6 +206,7 @@ module Release
204
206
 
205
207
  when :push_successful
206
208
  @prmt.puts "\n Push success!".green
209
+ @prmt.puts args.first
207
210
 
208
211
  when :push_failed
209
212
  @prmt.puts "\nPush failed. Error was : #{args.first}".red
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Release
4
4
  module Gem
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
data/tasks/standard.rake CHANGED
@@ -38,6 +38,12 @@ namespace :gem do
38
38
  end
39
39
  end
40
40
 
41
+ #desc "Release test"
42
+ #task :test_release do
43
+ # stdFlow = File.join(File.dirname(__FILE__),"..","templates","standard_flow")
44
+ # require stdFlow
45
+ #end
46
+
41
47
  desc "Copy the standard flow to project local so modification of the flow is possible"
42
48
  task :customize_flow do
43
49
  stdFlow = File.join(File.dirname(__FILE__),"..","templates","standard_cli_flow.rb")
@@ -4,17 +4,16 @@ require 'release/gem'
4
4
 
5
5
  puts "\n Standard GEM CLI release flow version #{Release::Gem::VERSION}\n".yellow
6
6
 
7
- begin
8
-
9
- Release::Gem.engine(:gem, root: Dir.getwd) do
7
+ Release::Gem.engine(:gem, root: Dir.getwd) do
10
8
 
9
+ begin
11
10
  # step 1 : run test
12
11
  run_test(:rspec)
13
12
 
14
13
  gem_cli_action do
15
14
 
16
15
  # step 2 : check dependency
17
- release_dependencies
16
+ release_dependencies
18
17
 
19
18
  # step 3 : build the gem
20
19
  st, ver = build
@@ -39,17 +38,20 @@ begin
39
38
  push
40
39
 
41
40
  end # vcs_action block
41
+ rescue Release::Gem::Abort => ex
42
+ STDERR.puts "\n -- Aborted by user. Message was : #{ex.message}\n".red
43
+ rescue TTY::Reader::InputInterrupt => ex
44
+ rescue Exception => ex
45
+ STDERR.puts "\n -- Error thrown. Message was : #{ex.message}".red
46
+ STDERR.puts "\n#{ex.backtrace.join("\n")}" if ENV["RELGEM_DEBUG"] == true
47
+ ensure
48
+ gem_dependency_restore
49
+ end
42
50
 
43
- end # Release::Gem::Engine block
51
+ end # Release::Gem::Engine block
44
52
 
45
- puts "\n *** GEM standard release flow done!\n".green
53
+ puts "\n *** GEM CLI standard release flow done!\n".green
46
54
 
47
- rescue Release::Gem::Abort => ex
48
- STDERR.puts "\n -- Aborted by user. Message was : #{ex.message}\n".red
49
- rescue TTY::Reader::InputInterrupt => ex
50
- rescue Exception => ex
51
- STDERR.puts "\n -- Error thrown. Message was : #{ex.message}".red
52
- end
53
55
 
54
56
 
55
57
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'gem/release'
3
+ require 'release/gem'
4
4
 
5
5
  require 'tty/prompt'
6
6
 
@@ -8,17 +8,56 @@ pmt = TTY::Prompt.new
8
8
 
9
9
  pmt.puts "\n Standard GEM release flow version #{Release::Gem::VERSION}\n".yellow
10
10
 
11
- begin
12
11
 
13
- Release::Gem.engine(:gem, root: Dir.getwd, ui: STDOUT) do
12
+ Release::Gem.engine(:gem, root: Dir.getwd, ui: STDOUT) do
14
13
 
14
+ begin
15
15
  # step 1 : run test
16
16
  run_test(:rspec)
17
17
 
18
18
  gem_action do
19
19
 
20
20
  # step 2 : check dependency
21
- release_dependencies
21
+ release_dependencies do |ops, *args|
22
+ case ops
23
+ when :action_start
24
+ pmt.say "\n Release dependencies starting...\n".yellow
25
+
26
+ when :define_gem_prod_config
27
+
28
+ config = {}
29
+ selections = args.first[:gems]
30
+
31
+ loop do
32
+
33
+ sel = pmt.select("\n The following development gems requires configuration. Please select one to configure") do |m|
34
+ selections.each do |g|
35
+ m.choice g, g
36
+ end
37
+ end
38
+
39
+ config[sel] = {} if config[sel].nil?
40
+
41
+ type = pmt.select("\n The gem in production will be runtime or development ? ") do |m|
42
+ m.choice "Runtime", :runtime
43
+ m.choice "Development only", :dev
44
+ end
45
+
46
+ config[sel][:type] = type
47
+
48
+ ver = pmt.ask("\n Is there specific version pattern (including the ~>/>/>=/= of gemspec) for the gem in production? (Not mandatory) : ")
49
+ config[sel][:version] = ver if not_empty?(ver)
50
+
51
+ pmt.puts " ** Done configure for gem #{sel}"
52
+ selections.delete_if { |v| v == sel }
53
+ break if selections.length == 0
54
+
55
+ end
56
+
57
+ config
58
+
59
+ end
60
+ end
22
61
 
23
62
  # step 3 : build the gem
24
63
  st, ver = build do |ops, *args|
@@ -199,7 +238,7 @@ begin
199
238
  end
200
239
  end
201
240
 
202
-
241
+
203
242
  push do |ops, *args|
204
243
  case ops
205
244
  when :select_remote
@@ -244,17 +283,19 @@ begin
244
283
 
245
284
  end # vcs_action block
246
285
 
247
- end # Release::Gem::Engine block
248
-
249
- pmt.puts "\n *** GEM standard release flow done!\n".green
250
286
 
251
- rescue Release::Gem::Abort => ex
252
- pmt.puts "\n -- Aborted by user. Message was : #{ex.message}\n".red
253
- rescue TTY::Reader::InputInterrupt => ex
254
- rescue Exception => ex
255
- pmt.puts "\n -- Error thrown. Message was : #{ex.message}".red
287
+ rescue Release::Gem::Abort => ex
288
+ pmt.puts "\n -- Aborted by user. Message was : #{ex.message}\n".red
289
+ rescue TTY::Reader::InputInterrupt => ex
290
+ rescue Exception => ex
291
+ pmt.puts "\n -- Error thrown. Message was : #{ex.message}".red
292
+ pmt.puts ex.backtrace.join("\n")
293
+ ensure
294
+ gem_dependency_restore
295
+ end
256
296
  end
257
297
 
298
+ pmt.puts "\n *** GEM standard release flow done!\n".green
258
299
 
259
300
 
260
301
 
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.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: gvcs
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: git_cli
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description: ''
84
112
  email:
85
113
  - chris@antrapol.com