git-message 0.1.6 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8bf8d8759c58be4072c7f8b8808fe6f28dd517b
4
- data.tar.gz: c1dc484993b99b80f84fed029ef4f028dc989eb6
3
+ metadata.gz: 106c6947963bf80a07c5f9777080d3e903c1af07
4
+ data.tar.gz: f244a986b4752a2429d6bf4d28693cedf3f2a247
5
5
  SHA512:
6
- metadata.gz: 6c16b2fe694a65267f378e96677ef114efa4c2fa452a4c4368c7aae4c690bff31457b9761e374bb87d5be7a977588f4da4fdf60a6c302253415e086846c7d5ec
7
- data.tar.gz: dcf3033547e3dd54620b1d8aeaceff1adb0d9431e7b4e54fdb37d4e6e969c00d2ea82aa62e6ef869ddeb16a3a9741a68af10131526dcdeaeeedc2ef4a32f0415
6
+ metadata.gz: 530e23dd711d78377ba718e558e44070494e14631c864e18d9b6a82f8a7fd42f911d8c4e5a10c76c13388c79081b6ba36eb1ee57e65dd5a16603fdf27b5eb600
7
+ data.tar.gz: 8fd2a4bdef29ead8a8f548c47898e8e6c16df8c6ac32d59b69763cd0a21e59db62bb002705144e281f7dcfe8d016f775931e333fe6a06a90414efb0e7dbd8ac1
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .gem
data/exe/git-message CHANGED
@@ -8,29 +8,43 @@ require 'git/message'
8
8
 
9
9
  def getType (num)
10
10
 
11
- case num
12
- when '1'
13
- "feat"
14
- when '2'
15
- "fix"
16
- when '3'
17
- "docs"
18
- when '4'
19
- "style"
20
- when '5'
21
- "refactor"
22
- when '6'
23
- "test"
24
- when '7'
25
- "chore"
26
- when '8'
27
- "debug"
28
- else
29
- ''
30
- end
11
+ case num
12
+ when '1'
13
+ "feat"
14
+ when '2'
15
+ "fix"
16
+ when '3'
17
+ "docs"
18
+ when '4'
19
+ "style"
20
+ when '5'
21
+ "refactor"
22
+ when '6'
23
+ "test"
24
+ when '7'
25
+ "chore"
26
+ when '8'
27
+ "debug"
28
+ else
29
+ ''
30
+ end
31
31
 
32
32
  end
33
33
 
34
+ def runCommend (options)
35
+
36
+ commitMessage = "#{options[:type]}[#{options[:scope]}]:#{options[:subject]}".strip
37
+
38
+ puts ""
39
+ puts "Commiting with message:#{commitMessage}".green
40
+ puts ""
41
+
42
+ command = 'git commit -m ' + commitMessage
43
+
44
+ system command
45
+
46
+ end
47
+
34
48
  options = {}
35
49
  option_parser = OptionParser.new do |opts|
36
50
  # 这里是这个命令行工具的帮助信息
@@ -38,8 +52,20 @@ opts.banner = 'here is help messages of git-message.'
38
52
 
39
53
  # 下面第一项是 Short option(没有可以直接在引号间留空),第二项是 Long option,第三项是对 Option 的描述
40
54
  opts.on('-v', '--version', 'version of git-message') do
41
- puts Git::Message::VERSION
42
- exit
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
43
69
  end
44
70
 
45
71
  # # Option 作为 flag,带argument,用于将argument作为数值解析,比如"name"信息
@@ -54,45 +80,53 @@ end
54
80
  # end
55
81
  end.parse!
56
82
 
57
- Git::Message::showTypeOption
83
+ tempType = String.new("#{options[:type]}")
84
+ tempScope = String.new("#{options[:scope]}")
85
+ tempSubject = String.new("#{options[:subject]}")
86
+
87
+ if tempType.length == 0
88
+
89
+ Git::Message::showTypeOption
58
90
 
59
- while (1)
91
+ while (1)
60
92
 
61
93
  num = gets.chomp
62
94
  options[:type] = getType num
63
95
 
64
96
  break
65
97
 
98
+ end
99
+
66
100
  end
67
101
 
68
- Git::Message::showScopeNote
102
+ if tempScope.length == 0
103
+
104
+ Git::Message::showScopeNote
69
105
 
70
- while (1)
106
+ while (1)
71
107
 
72
108
  scope = gets.chomp
73
109
  options[:scope] = scope
74
110
 
75
111
  break
76
112
 
113
+ end
114
+
77
115
  end
78
116
 
79
- Git::Message::showMessage
117
+ if tempSubject.length == 0
80
118
 
81
- while (1)
119
+ Git::Message::showMessage
120
+
121
+ while (1)
82
122
 
83
123
  subject = gets.chomp
84
124
  options[:subject] = subject
85
125
 
86
126
  break
87
127
 
88
- end
89
-
90
- commitMessage = options[:type] + '[' + options[:scope] + ']' + ':' + options[:subject]
128
+ end
91
129
 
92
- puts ""
93
- puts "Commiting with message:#{commitMessage}".green
94
- puts ""
95
-
96
- command = 'git commit -m ' + commitMessage
130
+ end
97
131
 
98
- system command
132
+ runCommend options
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Message
3
- VERSION = "0.1.6"
3
+ VERSION = "0.2"
4
4
  end
5
5
  end
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.1.6
4
+ version: '0.2'
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-04 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler