git-message 0.2 → 0.3
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/README.md +27 -8
- data/exe/git-message +35 -79
- data/git-message.gemspec +3 -2
- data/lib/git/message.rb +0 -31
- data/lib/git/message/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1d6b3272857a159c64d8d434b5ac04f0e624a2e
|
4
|
+
data.tar.gz: 3f1c17418e370a3ee3ee3af5423b1a37f49a55db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3347d41a4202769224b55fd84879c161d7d436033ac2afed42aee931a90b4e8b957896f5f3fa8c7b04e0c59db177d6d489fbe57b8182cb68a6412334467726a3
|
7
|
+
data.tar.gz: a664e6699c584057aa09e06646df778031d47b9036145d0842a38ae4b18d840b76271b2c5dfb0b4f02d224cbae40bd00e4e7b90d545b2c6935221de444b63e15
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Git::Message
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
git-message is A plugin of Git for creating a Angular style commit message.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,17 +20,38 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
###Angular style commit message
|
24
|
+
|
25
|
+
type[scope]:subject
|
26
|
+
|
27
|
+
###Type
|
28
|
+
|
29
|
+
1. feat
|
30
|
+
2. fix
|
31
|
+
3. docs
|
32
|
+
4. style
|
33
|
+
5. refactor
|
34
|
+
6. test
|
35
|
+
7. chore
|
36
|
+
8. debug
|
37
|
+
|
38
|
+
###Command
|
26
39
|
|
27
|
-
|
40
|
+
```
|
41
|
+
git message --type 1 --scope hello.rb --message world
|
42
|
+
```
|
43
|
+
|
44
|
+
or just use
|
28
45
|
|
29
|
-
|
46
|
+
```
|
47
|
+
git message
|
48
|
+
```
|
30
49
|
|
31
|
-
|
50
|
+
and then follow the note to enter the type,scope and subject
|
32
51
|
|
33
52
|
## Contributing
|
34
53
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Wingzki/git-message. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
55
|
|
37
56
|
|
38
57
|
## License
|
data/exe/git-message
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'colorize'
|
5
|
+
require 'commander/import'
|
5
6
|
|
6
7
|
require 'git/message/version'
|
7
8
|
require 'git/message'
|
8
9
|
|
9
|
-
def getType (
|
10
|
+
def getType (type)
|
10
11
|
|
11
|
-
case
|
12
|
+
case type
|
12
13
|
when '1'
|
13
14
|
"feat"
|
14
15
|
when '2'
|
@@ -26,107 +27,62 @@ def getType (num)
|
|
26
27
|
when '8'
|
27
28
|
"debug"
|
28
29
|
else
|
29
|
-
|
30
|
+
type
|
30
31
|
end
|
31
32
|
|
32
33
|
end
|
33
34
|
|
34
|
-
|
35
|
+
never_trace!
|
36
|
+
default_command :commit
|
35
37
|
|
36
|
-
|
38
|
+
program :name, 'git-message'
|
39
|
+
program :version, Git::Message::VERSION
|
40
|
+
program :description, 'A plugin of Git for creating a Angular style commit message.'
|
37
41
|
|
38
|
-
|
39
|
-
puts "Commiting with message:#{commitMessage}".green
|
40
|
-
puts ""
|
42
|
+
command :commit do |c|
|
41
43
|
|
42
|
-
|
44
|
+
c.description = "Commit with Angular style commit message"
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
options = {}
|
49
|
-
option_parser = OptionParser.new do |opts|
|
50
|
-
# 这里是这个命令行工具的帮助信息
|
51
|
-
opts.banner = 'here is help messages of git-message.'
|
52
|
-
|
53
|
-
# 下面第一项是 Short option(没有可以直接在引号间留空),第二项是 Long option,第三项是对 Option 的描述
|
54
|
-
opts.on('-v', '--version', 'version of git-message') do
|
55
|
-
puts Git::Message::VERSION
|
56
|
-
exit
|
57
|
-
end
|
58
|
-
|
59
|
-
opts.on('-t TYPE', '--type TYPE', 'Type of commit message') do |value|
|
60
|
-
options[:type] = value
|
61
|
-
end
|
62
|
-
|
63
|
-
opts.on('-s SCOPE', '--scope SCOPE', 'Scope of commit message') do |value|
|
64
|
-
options[:scope] = value
|
65
|
-
end
|
66
|
-
|
67
|
-
opts.on('-m MESSAGE', '--message MESSAGE', 'Subject of commit message') do |value|
|
68
|
-
options[:subject] = value
|
69
|
-
end
|
46
|
+
c.example "git message --type 1 --scope hello.rb --message world", ""
|
70
47
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
# options[:name] = value
|
75
|
-
# end
|
48
|
+
c.option '-t', '--type STRING', String, 'Type of commit message'
|
49
|
+
c.option '-s', '--scope STRING', String, 'Scope of commit message'
|
50
|
+
c.option '-m', '--message STRING', String, 'Subject of commit message'
|
76
51
|
|
77
|
-
|
78
|
-
# opts.on('-a A,B', '--array A,B', Array, 'List of arguments') do |value|
|
79
|
-
# options[:array] = value
|
80
|
-
# end
|
81
|
-
end.parse!
|
52
|
+
c.action do |args, options|
|
82
53
|
|
83
|
-
tempType =
|
84
|
-
tempScope =
|
85
|
-
tempSubject =
|
54
|
+
tempType = getType options.type
|
55
|
+
tempScope = options.scope
|
56
|
+
tempSubject = options.message
|
86
57
|
|
87
|
-
if tempType
|
58
|
+
if !tempType
|
88
59
|
|
89
|
-
|
60
|
+
tempType = choose("Type of your commit?", :feat, :fix, :docs, :style, :refactor, :test, :chore, :debug)
|
90
61
|
|
91
|
-
|
62
|
+
end
|
92
63
|
|
93
|
-
|
94
|
-
options[:type] = getType num
|
64
|
+
if !tempScope
|
95
65
|
|
96
|
-
|
66
|
+
tempScope = ask("Scope of your commit: ")
|
97
67
|
|
98
|
-
|
68
|
+
end
|
99
69
|
|
100
|
-
|
101
|
-
|
102
|
-
if tempScope.length == 0
|
103
|
-
|
104
|
-
Git::Message::showScopeNote
|
105
|
-
|
106
|
-
while (1)
|
107
|
-
|
108
|
-
scope = gets.chomp
|
109
|
-
options[:scope] = scope
|
70
|
+
if !tempSubject
|
110
71
|
|
111
|
-
|
72
|
+
tempSubject = ask("Subject of your commit: ")
|
112
73
|
|
113
|
-
|
74
|
+
end
|
114
75
|
|
115
|
-
|
116
|
-
|
117
|
-
if tempSubject.length == 0
|
118
|
-
|
119
|
-
Git::Message::showMessage
|
76
|
+
commitMessage = "\"#{tempType}[#{tempScope}]:#{tempSubject}\""
|
120
77
|
|
121
|
-
|
78
|
+
puts ""
|
79
|
+
puts "Commiting with message:#{commitMessage}".green
|
80
|
+
puts ""
|
122
81
|
|
123
|
-
|
124
|
-
options[:subject] = subject
|
82
|
+
command = 'git commit -m ' + commitMessage
|
125
83
|
|
126
|
-
|
84
|
+
system command
|
127
85
|
|
128
|
-
|
86
|
+
end
|
129
87
|
|
130
88
|
end
|
131
|
-
|
132
|
-
runCommend options
|
data/git-message.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Wingzki"]
|
10
10
|
spec.email = ["thewingofthesky@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{A plugin
|
13
|
-
spec.description = %q{A plugin
|
12
|
+
spec.summary = %q{A plugin of Git for creating a Angular style commit message}
|
13
|
+
spec.description = %q{A plugin of Git for creating a Angular style commit message}
|
14
14
|
spec.homepage = "https://github.com/Wingzki"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.11"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_dependency "colorize", "~> 0.7.7"
|
25
|
+
spec.add_dependency "commander", "4.4.0"
|
25
26
|
end
|
data/lib/git/message.rb
CHANGED
@@ -3,36 +3,5 @@ require "git/message/version"
|
|
3
3
|
module Git
|
4
4
|
module Message
|
5
5
|
|
6
|
-
def Message.showTypeOption
|
7
|
-
|
8
|
-
puts <<EOF
|
9
|
-
|
10
|
-
1 feat: 新功能(feature)
|
11
|
-
2 fix: 修补bug
|
12
|
-
3 docs: 文档(documentation)
|
13
|
-
4 style: 格式(不影响代码运行的变动)
|
14
|
-
5 refactor:重构(即不是新增功能,也不是修改bug的代码变动)
|
15
|
-
6 test: 增加测试
|
16
|
-
7 chore: 构建过程或辅助工具的变动
|
17
|
-
8 debug: 调试的变更(仅作调试使用)
|
18
|
-
|
19
|
-
EOF
|
20
|
-
|
21
|
-
print 'Enter the type number of your commit:'
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
def Message.showScopeNote
|
26
|
-
|
27
|
-
print 'Enter the scope of your commit:'
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def Message.showMessage
|
32
|
-
|
33
|
-
print 'Enter the subject of your commit:'
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
6
|
end
|
38
7
|
end
|
data/lib/git/message/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wingzki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02
|
11
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,21 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.7.7
|
55
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: commander
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.4.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.4.0
|
69
|
+
description: A plugin of Git for creating a Angular style commit message
|
56
70
|
email:
|
57
71
|
- thewingofthesky@gmail.com
|
58
72
|
executables:
|
@@ -95,5 +109,5 @@ rubyforge_project:
|
|
95
109
|
rubygems_version: 2.4.7
|
96
110
|
signing_key:
|
97
111
|
specification_version: 4
|
98
|
-
summary: A plugin
|
112
|
+
summary: A plugin of Git for creating a Angular style commit message
|
99
113
|
test_files: []
|