prima-twig 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/twig-hotfix +97 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39893567ec05dd93e8792337c10983031d770899
|
4
|
+
data.tar.gz: 659ad8ba77f0a8be66b6ec4db0121b1d71b6b526
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01f1bd379d93d0c8d0123d256d09a3da39510fdaa7953bc459960641702a480706aaca05de276d5a44566509bb1ac573bb0db33dc11716a4267af53da51af5eb
|
7
|
+
data.tar.gz: b523a35adec9db583f1da36946e33c69f1c998e11cbcd109375fa03d99c6f722398e27a035b370598b8ea804d20e9b78fd60b5812922421a7c9f972a16bc1d9e
|
data/bin/twig-hotfix
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require_relative '../lib/prima_twig.rb'
|
5
|
+
|
6
|
+
class Hotfix
|
7
|
+
include Command
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@prima = Prima.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute! args
|
14
|
+
possible_args = ["start", "stop"]
|
15
|
+
stop_if args.empty?, [:wrong_args, possible_args]
|
16
|
+
stop_if args.length > 1, [:wrong_args, possible_args]
|
17
|
+
|
18
|
+
stop_if @prima.head_detached?, :detached_head
|
19
|
+
stop_unless @prima.is_clean?, :clean
|
20
|
+
|
21
|
+
case args[0]
|
22
|
+
when "start"
|
23
|
+
start_hotfix!
|
24
|
+
when "stop"
|
25
|
+
merge_hotfix!
|
26
|
+
else
|
27
|
+
stop_if true, [:wrong_args, possible_args]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def start_hotfix!
|
32
|
+
branch_name = @prima.clean_branch_name(ask('Nome del branch: '.blue))
|
33
|
+
branch_name = "hotfix/" + branch_name
|
34
|
+
output "Il nome del branch sarà " + branch_name.yellow
|
35
|
+
|
36
|
+
exec_step "git checkout master"
|
37
|
+
exec_step "git checkout -b " + branch_name
|
38
|
+
end
|
39
|
+
|
40
|
+
def merge_hotfix!
|
41
|
+
current_branch_name = @prima.twig.current_branch_name
|
42
|
+
stop_unless (current_branch_name =~ /^hotfix\//), "Non sei su un branch di hotfix, non posso mergiare nulla"
|
43
|
+
exec_step "git fetch"
|
44
|
+
exec_step "git checkout master"
|
45
|
+
exec_step "git rebase origin/master"
|
46
|
+
exec_step "git merge #{current_branch_name}"
|
47
|
+
exec_step "git checkout dev"
|
48
|
+
exec_step "git rebase origin/dev"
|
49
|
+
exec_step "git merge #{current_branch_name}"
|
50
|
+
delete_local = @prima.yesno "elimino il branch #{current_branch_name}".blue
|
51
|
+
if delete_local
|
52
|
+
exec_step "git branch -d #{current_branch_name}"
|
53
|
+
end
|
54
|
+
push = @prima.yesno 'vuoi effettuare il push di dev e master'.blue
|
55
|
+
if push
|
56
|
+
exec_step "git checkout master"
|
57
|
+
exec_step "git push origin master"
|
58
|
+
exec_step "git checkout dev"
|
59
|
+
exec_step "git push origin dev"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def help_content
|
65
|
+
<<-HELP
|
66
|
+
|
67
|
+
twig-hotfix
|
68
|
+
===========
|
69
|
+
|
70
|
+
Manage hotfix creation and merging
|
71
|
+
|
72
|
+
Synopsis
|
73
|
+
--------
|
74
|
+
|
75
|
+
twig hotfix start
|
76
|
+
twig hotfix close
|
77
|
+
|
78
|
+
Description
|
79
|
+
-----------
|
80
|
+
|
81
|
+
start creates an hotfix from master branch
|
82
|
+
close closes the actual hotfix by merging to dev and master
|
83
|
+
|
84
|
+
Subcommand for Twig: <http://rondevera.github.io/twig/>
|
85
|
+
Author: Matteo Giachino <https://github.com/matteosister>
|
86
|
+
|
87
|
+
HELP
|
88
|
+
end
|
89
|
+
|
90
|
+
args = ARGV.dup
|
91
|
+
|
92
|
+
if args.include?('--help')
|
93
|
+
puts help_content
|
94
|
+
exit
|
95
|
+
end
|
96
|
+
|
97
|
+
Hotfix.new.execute!(args)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prima-twig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Giachino
|
@@ -114,6 +114,7 @@ description: Our tools to manage git, github and trello
|
|
114
114
|
email: matteo.giachino@prima.it
|
115
115
|
executables:
|
116
116
|
- twig-circle
|
117
|
+
- twig-hotfix
|
117
118
|
- twig-open-pr
|
118
119
|
- twig-pick-issue
|
119
120
|
- twig-review
|
@@ -121,6 +122,7 @@ extensions: []
|
|
121
122
|
extra_rdoc_files: []
|
122
123
|
files:
|
123
124
|
- bin/twig-circle
|
125
|
+
- bin/twig-hotfix
|
124
126
|
- bin/twig-open-pr
|
125
127
|
- bin/twig-pick-issue
|
126
128
|
- bin/twig-review
|