chid 0.1.4 → 0.1.5
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/CHANGELOG.md +5 -0
- data/lib/chid/commands/gitflow/commit.rb +41 -11
- data/lib/chid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 594d77b67587ed2a523c044bf7920d28d563e243
|
4
|
+
data.tar.gz: b1e05442eeee7ef9969e0905d8c49db6eabfb7ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c2e20c9a2d81a8ec6846665682010f7bbc89fea199034370e2947882905638d740acd4906ec334472b1f42967a7eeeb6e6bf3e87744d6563a241d7edbeb2ac3
|
7
|
+
data.tar.gz: 91a5214c483d2ea03b538564af5b055fa7725251461f78db90cbfde78a055973a74e32d0b7a5335f283c801f3d71c7cd83a2ceb86a6c08f0b0365d9d87ea2dc4
|
data/CHANGELOG.md
CHANGED
@@ -29,20 +29,47 @@ Usage:
|
|
29
29
|
- specific file have now this line
|
30
30
|
- this is the description line two
|
31
31
|
|
32
|
+
Signed-off-by: "YourName" "yourEmail@mail.com"
|
33
|
+
|
34
|
+
Options:
|
35
|
+
|
36
|
+
-A Will concat the title with 'Add'
|
37
|
+
-R Will concat the title with 'Remove'
|
38
|
+
-U Will concat the title with 'Update'
|
39
|
+
-Ref Will concat the title with 'Refactor'
|
40
|
+
-F Will concat the title with 'Fix'
|
41
|
+
|
32
42
|
DESC
|
33
43
|
|
34
|
-
self.arguments = []
|
44
|
+
self.arguments = ['-A', '-R', '-U', '-Ref', '-F']
|
35
45
|
|
36
46
|
def run
|
37
47
|
commit = build_commit
|
38
48
|
system("git commit -sm \"#{commit}\"")
|
39
|
-
system("git push origin #{branch}")
|
49
|
+
system("git push origin #{branch}") if do_push?
|
50
|
+
end
|
51
|
+
|
52
|
+
def first_option
|
53
|
+
@first_option ||= self.class.arguments.select { |a| options[a] }.compact.join(' ')
|
54
|
+
end
|
55
|
+
|
56
|
+
def first_option_kind
|
57
|
+
options_titles = {
|
58
|
+
'-A' => 'Add',
|
59
|
+
'-U' => 'Update',
|
60
|
+
'-R' => 'Remove',
|
61
|
+
'-U' => 'Update',
|
62
|
+
'-Ref' => 'Refactor',
|
63
|
+
'-F' => 'Fix'
|
64
|
+
}
|
65
|
+
|
66
|
+
options_titles[first_option]
|
40
67
|
end
|
41
68
|
|
42
69
|
def build_commit
|
43
70
|
@commit_lines = "\n"
|
44
|
-
commit_kind = add_commit_kind
|
45
|
-
commit_title = add_commit_title
|
71
|
+
commit_kind = first_option_kind || add_commit_kind
|
72
|
+
commit_title = add_commit_title(commit_kind)
|
46
73
|
add_commit_description
|
47
74
|
commit = "#{branch_name} #{commit_kind} #{commit_title} \n #{@commit_lines}"
|
48
75
|
end
|
@@ -55,21 +82,24 @@ Usage:
|
|
55
82
|
@branch_name ||= branch[/\w{1,}\/#?\d{1,}/] || branch
|
56
83
|
end
|
57
84
|
|
85
|
+
def prompt
|
86
|
+
@prompt ||= TTY::Prompt.new
|
87
|
+
end
|
88
|
+
|
58
89
|
def add_commit_kind
|
59
|
-
@prompt = TTY::Prompt.new
|
60
90
|
choices = ['Add', 'Remove','Update', 'Refactor','Fix']
|
61
|
-
result =
|
91
|
+
result = prompt.select('Select commit type: ', choices)
|
62
92
|
end
|
63
93
|
|
64
|
-
def add_commit_title
|
94
|
+
def add_commit_title(kind_title)
|
65
95
|
puts 'Tell me the commit title'
|
66
|
-
print
|
96
|
+
print "> #{kind_title} "
|
67
97
|
commit_title = STDIN.gets.strip
|
68
98
|
end
|
69
99
|
|
70
100
|
def add_commit_description
|
71
101
|
puts 'Tell me the commit description, one action per line'
|
72
|
-
print "> "
|
102
|
+
print "> #{} "
|
73
103
|
commit_description ="- #{STDIN.gets.strip} \n"
|
74
104
|
@commit_lines << commit_description
|
75
105
|
add_commit_description unless did_commit_finished?
|
@@ -77,13 +107,13 @@ Usage:
|
|
77
107
|
|
78
108
|
def do_push?
|
79
109
|
answers = ['Yes','No']
|
80
|
-
result_should_push =
|
110
|
+
result_should_push = prompt.select('Push changes?', answers)
|
81
111
|
result_should_push == 'Yes'
|
82
112
|
end
|
83
113
|
|
84
114
|
def did_commit_finished?
|
85
115
|
answers = ['Yes','No']
|
86
|
-
result_description_finished =
|
116
|
+
result_description_finished = prompt.select('more?', answers)
|
87
117
|
result_description_finished == 'No'
|
88
118
|
end
|
89
119
|
end
|
data/lib/chid/version.rb
CHANGED