git-redmine-commit 0.7.0 → 0.8.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.8.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{git-redmine-commit}
8
- s.version = "0.7.0"
8
+ s.version = "0.8.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Robin Lu"]
12
- s.date = %q{2011-05-26}
12
+ s.date = %q{2012-12-01}
13
13
  s.default_executable = %q{git-redmine-commit}
14
14
  s.description = %q{With this tool, you can do a git commit with a redmine issue id. The message of the commit is filled with the title of the issue automatically.}
15
15
  s.email = %q{iamawalrus@gmail.com}
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
35
35
  s.homepage = %q{http://github.com/robin/git-redmine-commit}
36
36
  s.licenses = ["MIT"]
37
37
  s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.3.7}
38
+ s.rubygems_version = %q{1.4.2}
39
39
  s.summary = %q{git commit with redmine issue id}
40
40
  s.test_files = [
41
41
  "test/helper.rb",
@@ -43,7 +43,6 @@ Gem::Specification.new do |s|
43
43
  ]
44
44
 
45
45
  if s.respond_to? :specification_version then
46
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
46
  s.specification_version = 3
48
47
 
49
48
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -10,10 +10,13 @@ require 'ostruct'
10
10
 
11
11
  require 'rubygems'
12
12
  require 'xmlsimple'
13
+ require 'erb'
13
14
 
14
15
  class GitRedmineCommit
15
16
  defaults = {}
16
17
  REDMINECOMMIT_RC = File.join("#{ENV['HOME']}",".redmine_commit_rc")
18
+ REDMINECOMMIT_TEMPLATE = File.join("#{ENV['HOME']}",".redmine_commit_template")
19
+
17
20
  GRC_CONFIG = if File.exist?(REDMINECOMMIT_RC)
18
21
  defaults.merge(YAML.load_file(REDMINECOMMIT_RC))
19
22
  else
@@ -73,6 +76,15 @@ class GitRedmineCommit
73
76
  end
74
77
  end
75
78
 
79
+ def message_template
80
+ template_src = if File.file?(REDMINECOMMIT_TEMPLATE)
81
+ open(REDMINECOMMIT_TEMPLATE) {|f| f.read}
82
+ else
83
+ "#<%= issue_id %>:<%= issue_subject %>\n"
84
+ end
85
+ ERB.new template_src
86
+ end
87
+
76
88
  def run
77
89
  git_repo = @options[:repo]
78
90
  unless @options[:key] && @options[:url]
@@ -84,11 +96,18 @@ class GitRedmineCommit
84
96
 
85
97
  url = File.join(@options[:url], "issues", "#{@options[:issue_id]}.xml?key=#{@options[:key]}")
86
98
  issue = XmlSimple.xml_in(open(url).read)
87
- title = "fix issue ##{issue['id']} : #{issue['subject']}"
99
+ issue_id = issue['id']
100
+ issue_subject = issue['subject']
101
+ title = message_template.result(binding)
88
102
  temp = Tempfile.new('redmine_commit')
89
103
  temp << title
90
104
  temp.close
91
- puts `git commit #{@options[:git_options]} -F #{temp.path}`
105
+
106
+ commit_template = `git config --get commit.template`
107
+ `git config commit.template #{temp.path}`
108
+ system "git commit #{@options[:git_options]}"
109
+ system "git config --unset commit.template"
110
+ `git config commit.template #{commit_template}` if commit_template && commit_template.size > 0
92
111
  end
93
112
 
94
113
  def get_config(git_repo)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-redmine-commit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
5
- prerelease: false
4
+ hash: 63
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 7
8
+ - 8
9
9
  - 0
10
- version: 0.7.0
10
+ version: 0.8.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Robin Lu
@@ -15,11 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-26 00:00:00 +08:00
18
+ date: 2012-12-01 00:00:00 +08:00
19
19
  default_executable: git-redmine-commit
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- requirement: &id001 !ruby/object:Gem::Requirement
22
+ name: bundler
23
+ prerelease: false
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
25
  none: false
24
26
  requirements:
25
27
  - - ~>
@@ -30,12 +32,12 @@ dependencies:
30
32
  - 0
31
33
  - 0
32
34
  version: 1.0.0
35
+ requirement: *id001
33
36
  type: :development
34
- name: bundler
35
- prerelease: false
36
- version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- requirement: &id002 !ruby/object:Gem::Requirement
38
+ name: jeweler
39
+ prerelease: false
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
41
  none: false
40
42
  requirements:
41
43
  - - ~>
@@ -46,12 +48,12 @@ dependencies:
46
48
  - 5
47
49
  - 2
48
50
  version: 1.5.2
51
+ requirement: *id002
49
52
  type: :development
50
- name: jeweler
51
- prerelease: false
52
- version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- requirement: &id003 !ruby/object:Gem::Requirement
54
+ name: xml-simple
55
+ prerelease: false
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
55
57
  none: false
56
58
  requirements:
57
59
  - - ">="
@@ -62,10 +64,8 @@ dependencies:
62
64
  - 0
63
65
  - 12
64
66
  version: 1.0.12
67
+ requirement: *id003
65
68
  type: :runtime
66
- name: xml-simple
67
- prerelease: false
68
- version_requirements: *id003
69
69
  description: With this tool, you can do a git commit with a redmine issue id. The message of the commit is filled with the title of the issue automatically.
70
70
  email: iamawalrus@gmail.com
71
71
  executables:
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  requirements: []
119
119
 
120
120
  rubyforge_project:
121
- rubygems_version: 1.3.7
121
+ rubygems_version: 1.4.2
122
122
  signing_key:
123
123
  specification_version: 3
124
124
  summary: git commit with redmine issue id