prima-twig 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/twig-open-pr +14 -4
- data/lib/command.rb +60 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b2a181c44c45d9147fc291461a0a4ff805b50c5
|
|
4
|
+
data.tar.gz: 9fd50461d8b3b719fbb4db6350cabe2eda195baa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ed8270781d2e2b97e68931ee9d4755bf897c11d2a668e48bd2da8e404aec09aee9f7e923e592b07366f596cfa9f5dee18ea6680c42f0804e37b4ac025b59fda
|
|
7
|
+
data.tar.gz: 473970d26bcc38d91764976f50f71c60d25a8984ef7fc28f76db75c87a5013caf9263147783d63df5731d13f38cc21bfcce4380bb6951b86d0759deb9a7101a7
|
data/bin/twig-open-pr
CHANGED
|
@@ -79,7 +79,7 @@ class OpenPR
|
|
|
79
79
|
exit 0
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
pr = create_pull_request
|
|
82
|
+
pr = create_pull_request(choose_base_branch)
|
|
83
83
|
puts "Pull Request ##{ pr.number } creata".green
|
|
84
84
|
cmd = %{ twig pr "#{ pr.number }"}
|
|
85
85
|
exec(cmd)
|
|
@@ -89,6 +89,16 @@ class OpenPR
|
|
|
89
89
|
exit 0
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
+
def choose_base_branch
|
|
93
|
+
choose do |menu|
|
|
94
|
+
menu.prompt = 'Su quale branch vuoi effettuare la PR? '.cyan
|
|
95
|
+
menu.shell = true
|
|
96
|
+
|
|
97
|
+
menu.choice('dev') {'dev'}
|
|
98
|
+
menu.choice('master') {'master'}
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
92
102
|
def is_on_github?
|
|
93
103
|
begin
|
|
94
104
|
@prima.gh.branch @prima.repo_name, @prima.current_branch_name
|
|
@@ -98,16 +108,16 @@ class OpenPR
|
|
|
98
108
|
end
|
|
99
109
|
end
|
|
100
110
|
|
|
101
|
-
def create_pull_request
|
|
111
|
+
def create_pull_request(base_branch)
|
|
102
112
|
current_branch_name = @prima.current_branch_name
|
|
113
|
+
puts "Creazione pull request sul branch #{ base_branch }"
|
|
103
114
|
title = ask('Titolo: ')
|
|
104
115
|
head = @prima.current_branch_name
|
|
105
|
-
base = 'dev'
|
|
106
116
|
body = ask('Body: ')
|
|
107
117
|
unless @prima.twig.get_branch_property(current_branch_name, 'issue').nil?
|
|
108
118
|
body << " close ##{@prima.twig.get_branch_property(current_branch_name, 'issue')}"
|
|
109
119
|
end
|
|
110
|
-
@prima.gh.create_pull_request @prima.repo_name,
|
|
120
|
+
@prima.gh.create_pull_request @prima.repo_name, base_branch, head, title, body
|
|
111
121
|
end
|
|
112
122
|
end
|
|
113
123
|
|
data/lib/command.rb
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
require 'colorize'
|
|
2
|
+
require 'optparse'
|
|
3
|
+
|
|
4
|
+
module Command
|
|
5
|
+
def exec_step command, output = nil
|
|
6
|
+
if output
|
|
7
|
+
puts output
|
|
8
|
+
else
|
|
9
|
+
puts "exec > ".green + "#{command}".yellow
|
|
10
|
+
end
|
|
11
|
+
`#{command}`
|
|
12
|
+
exit($?.exitstatus) unless 0 === $?.exitstatus
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def output msg
|
|
16
|
+
puts "twig binaries > ".black + msg
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def stop_if check, msg
|
|
20
|
+
if check
|
|
21
|
+
output_msg = case msg
|
|
22
|
+
when Symbol
|
|
23
|
+
symbol_message msg
|
|
24
|
+
when Array
|
|
25
|
+
array_message msg
|
|
26
|
+
else
|
|
27
|
+
msg
|
|
28
|
+
end
|
|
29
|
+
puts "there was a problem > ".red + output_msg
|
|
30
|
+
exit(1)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def symbol_message s
|
|
35
|
+
case s
|
|
36
|
+
when :clean
|
|
37
|
+
"hai dei file non committati...non posso continuare'"
|
|
38
|
+
when :detached_head
|
|
39
|
+
"repo in stato 'head detached'"
|
|
40
|
+
when :wrong_args
|
|
41
|
+
"argomento non corretto"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def array_message arr
|
|
46
|
+
case arr[0]
|
|
47
|
+
when :wrong_args
|
|
48
|
+
msg = symbol_message arr[0]
|
|
49
|
+
msg += "\n"
|
|
50
|
+
msg += " valore possibile: "
|
|
51
|
+
values = "[ " + arr[1].join(" | ").yellow + " ]"
|
|
52
|
+
msg += values
|
|
53
|
+
msg
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def stop_unless check, msg
|
|
58
|
+
stop_if (not check), msg
|
|
59
|
+
end
|
|
60
|
+
end
|
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.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matteo Giachino
|
|
@@ -124,6 +124,7 @@ files:
|
|
|
124
124
|
- bin/twig-open-pr
|
|
125
125
|
- bin/twig-pick-issue
|
|
126
126
|
- bin/twig-review
|
|
127
|
+
- lib/command.rb
|
|
127
128
|
- lib/prima_twig.rb
|
|
128
129
|
homepage: http://rubygems.org/gems/prima-twig
|
|
129
130
|
licenses:
|
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
145
146
|
version: '0'
|
|
146
147
|
requirements: []
|
|
147
148
|
rubyforge_project:
|
|
148
|
-
rubygems_version: 2.4.
|
|
149
|
+
rubygems_version: 2.4.6
|
|
149
150
|
signing_key:
|
|
150
151
|
specification_version: 4
|
|
151
152
|
summary: The Prima twig toolbelt
|