git-message 0.1.0 → 0.1.1
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/git-message-0.1.0.gem +0 -0
- data/git-message.gemspec +1 -1
- data/lib/git/message/message.rb +136 -0
- data/lib/git/message/version.rb +1 -1
- metadata +4 -3
- data/lib/git/message.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af6e57e957e342a37c68a644968d861f41109979
|
4
|
+
data.tar.gz: 40e204eee9a63967e583047044d2e8faeaf42341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7c7276f13f3879fee315cd801f39711acee3b138e5f11216142a8af750b60e8065763022e31b9d71430052b7bfbb5844d5e97047d20b96a48471ba06447f396
|
7
|
+
data.tar.gz: 52dcbc98811d94f34c6764cd4407a026dfa57b66f00ca4adb721d89ab60949c4d4f1899ce95bd581fa529e3413ddc25454720c54d6377cc5c60f1340a749d505
|
Binary file
|
data/git-message.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'git/message/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "git-message"
|
8
8
|
spec.version = Git::Message::VERSION
|
9
|
-
spec.authors = ["
|
9
|
+
spec.authors = ["Wingzki"]
|
10
10
|
spec.email = ["thewingofthesky@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{A plugin for git to creat a commit message}
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require "git/message/version"
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
module Git
|
5
|
+
module Message
|
6
|
+
|
7
|
+
def showTypeOption
|
8
|
+
|
9
|
+
puts <<EOF
|
10
|
+
|
11
|
+
1 feat: 新功能(feature)
|
12
|
+
2 fix: 修补bug
|
13
|
+
3 docs: 文档(documentation)
|
14
|
+
4 style: 格式(不影响代码运行的变动)
|
15
|
+
5 refactor:重构(即不是新增功能,也不是修改bug的代码变动)
|
16
|
+
6 test: 增加测试
|
17
|
+
7 chore: 构建过程或辅助工具的变动
|
18
|
+
8 debug: 调试的变更(仅作调试使用)
|
19
|
+
|
20
|
+
Enter the type number of your commit:
|
21
|
+
EOF
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def showScopeNote
|
26
|
+
|
27
|
+
puts <<EOF
|
28
|
+
|
29
|
+
Enter the scope of your commit:
|
30
|
+
EOF
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def showMessage
|
35
|
+
|
36
|
+
puts <<EOF
|
37
|
+
|
38
|
+
Enter the subject of your commit:
|
39
|
+
EOF
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
def getType (num)
|
44
|
+
|
45
|
+
case num
|
46
|
+
when '1'
|
47
|
+
"feat"
|
48
|
+
when '2'
|
49
|
+
"fix"
|
50
|
+
when '3'
|
51
|
+
"docs"
|
52
|
+
when '4'
|
53
|
+
"style"
|
54
|
+
when '5'
|
55
|
+
"refactor"
|
56
|
+
when '6'
|
57
|
+
"test"
|
58
|
+
when '7'
|
59
|
+
"chore"
|
60
|
+
when '8'
|
61
|
+
"debug"
|
62
|
+
else
|
63
|
+
''
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
options = {}
|
69
|
+
option_parser = OptionParser.new do |opts|
|
70
|
+
# 这里是这个命令行工具的帮助信息
|
71
|
+
opts.banner = 'here is help messages of git-message.'
|
72
|
+
|
73
|
+
# Option 作为switch,不带argument,用于将 switch 设置成 true 或 false
|
74
|
+
options[:switch] = false
|
75
|
+
# 下面第一项是 Short option(没有可以直接在引号间留空),第二项是 Long option,第三项是对 Option 的描述
|
76
|
+
opts.on('-v', '--version') do
|
77
|
+
# 这个部分就是使用这个Option后执行的代码
|
78
|
+
puts 'v0.1'
|
79
|
+
exit
|
80
|
+
end
|
81
|
+
|
82
|
+
# # Option 作为 flag,带argument,用于将argument作为数值解析,比如"name"信息
|
83
|
+
# #下面的“value”就是用户使用时输入的argument
|
84
|
+
# opts.on('-n NAME', '--name Name', 'Pass-in single name') do |value|
|
85
|
+
# options[:name] = value
|
86
|
+
# end
|
87
|
+
|
88
|
+
# # Option 作为 flag,带一组用逗号分割的arguments,用于将arguments作为数组解析
|
89
|
+
# opts.on('-a A,B', '--array A,B', Array, 'List of arguments') do |value|
|
90
|
+
# options[:array] = value
|
91
|
+
# end
|
92
|
+
end.parse!
|
93
|
+
|
94
|
+
showTypeOption
|
95
|
+
|
96
|
+
while (1)
|
97
|
+
|
98
|
+
num = gets.chomp
|
99
|
+
options[:type] = getType num
|
100
|
+
|
101
|
+
break
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
showScopeNote
|
106
|
+
|
107
|
+
while (1)
|
108
|
+
|
109
|
+
scope = gets.chomp
|
110
|
+
options[:scope] = scope
|
111
|
+
|
112
|
+
break
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
showMessage
|
117
|
+
|
118
|
+
while (1)
|
119
|
+
|
120
|
+
subject = gets.chomp
|
121
|
+
options[:subject] = subject
|
122
|
+
|
123
|
+
break
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
commitMessage = options[:type] + '[' + options[:scope] + ']' + ':' + options[:subject]
|
128
|
+
|
129
|
+
puts 'Commiting with message:' + commitMessage
|
130
|
+
|
131
|
+
command = 'git commit -m ' + commitMessage
|
132
|
+
|
133
|
+
system command
|
134
|
+
|
135
|
+
end
|
136
|
+
end
|
data/lib/git/message/version.rb
CHANGED
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Wingzki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
@@ -53,8 +53,9 @@ files:
|
|
53
53
|
- Rakefile
|
54
54
|
- bin/console
|
55
55
|
- bin/setup
|
56
|
+
- git-message-0.1.0.gem
|
56
57
|
- git-message.gemspec
|
57
|
-
- lib/git/message.rb
|
58
|
+
- lib/git/message/message.rb
|
58
59
|
- lib/git/message/version.rb
|
59
60
|
homepage: https://github.com/Wingzki
|
60
61
|
licenses:
|