git-commit-notifier 0.1.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/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +22 -0
- data/README.textile +54 -0
- data/Rakefile +55 -0
- data/VERSION +1 -0
- data/bin/git-commit-notifier +14 -0
- data/config/git-notifier-configl.yml.sample +15 -0
- data/git-commit-notifier.gemspec +79 -0
- data/lib/commit_hook.rb +53 -0
- data/lib/diff_to_html.rb +321 -0
- data/lib/emailer.rb +102 -0
- data/lib/git.rb +35 -0
- data/lib/result_processor.rb +122 -0
- data/template/email.html.erb +9 -0
- data/template/styles.css +10 -0
- data/test/fixtures/git_log +34 -0
- data/test/fixtures/git_show_51b986619d88f7ba98be7d271188785cbbb541a0 +83 -0
- data/test/fixtures/git_show_a4629e707d80a5769f7a71ca6ed9471015e14dc9 +49 -0
- data/test/fixtures/git_show_dce6ade4cdc2833b53bd600ef10f9bce83c7102d +83 -0
- data/test/fixtures/git_show_e28ad77bba0574241e6eb64dfd0c1291b221effe +76 -0
- data/test/test_helper.rb +21 -0
- data/test/unit/test_commit_hook.rb +22 -0
- data/test/unit/test_diff_to_html.rb +97 -0
- data/test/unit/test_result_processor.rb +95 -0
- metadata +125 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
Commit dce6ade4cdc2833b53bd600ef10f9bce83c7102d
|
2
|
+
Author: Andrew Kaspick <andrew@redlinesoftware.com>
|
3
|
+
Date: Tue Sep 30 14:15:36 2008 -0500
|
4
|
+
|
5
|
+
Ensure select_tag#name attribute uses [] when :multiple is true. [#1146 state:resolved]
|
6
|
+
|
7
|
+
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
|
8
|
+
|
9
|
+
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
|
10
|
+
index 208bf91..7492348 100644
|
11
|
+
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
|
12
|
+
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
|
13
|
+
@@ -62,7 +62,7 @@ module ActionView
|
14
|
+
# # <option>3</option><option>4</option></select>
|
15
|
+
#
|
16
|
+
# select_tag "colors", "<option>Red</option><option>Green</option><option>Blue</option>", :multiple => true
|
17
|
+
- # # => <select id="colors" multiple="multiple" name="colors"><option>Red</option>
|
18
|
+
+ # # => <select id="colors" multiple="multiple" name="colors[]"><option>Red</option>
|
19
|
+
# # <option>Green</option><option>Blue</option></select>
|
20
|
+
#
|
21
|
+
# select_tag "locations", "<option>Home</option><option selected="selected">Work</option><option>Out</option>"
|
22
|
+
@@ -70,14 +70,15 @@ module ActionView
|
23
|
+
# # <option>Out</option></select>
|
24
|
+
#
|
25
|
+
# select_tag "access", "<option>Read</option><option>Write</option>", :multiple => true, :class => 'form_input'
|
26
|
+
- # # => <select class="form_input" id="access" multiple="multiple" name="access"><option>Read</option>
|
27
|
+
+ # # => <select class="form_input" id="access" multiple="multiple" name="access[]"><option>Read</option>
|
28
|
+
# # <option>Write</option></select>
|
29
|
+
#
|
30
|
+
# select_tag "destination", "<option>NYC</option><option>Paris</option><option>Rome</option>", :disabled => true
|
31
|
+
# # => <select disabled="disabled" id="destination" name="destination"><option>NYC</option>
|
32
|
+
# # <option>Paris</option><option>Rome</option></select>
|
33
|
+
def select_tag(name, option_tags = nil, options = {})
|
34
|
+
- content_tag :select, option_tags, { "name" => name, "id" => name }.update(options.stringify_keys)
|
35
|
+
+ html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name
|
36
|
+
+ content_tag :select, option_tags, { "name" => html_name, "id" => name }.update(options.stringify_keys)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Creates a standard text field; use these text fields to input smaller chunks of text like a username
|
40
|
+
diff --git a/railties/doc/guides/source/images/icons/callouts/11.png b/railties/doc/guides/source/images/icons/callouts/11.png
|
41
|
+
new file mode 100644
|
42
|
+
index 0000000..ce47dac
|
43
|
+
Binary files /dev/null and b/railties/doc/guides/source/images/icons/callouts/11.png differ
|
44
|
+
diff --git a/railties/doc/guides/source/icons/up.png b/railties/doc/guides/source/icons/up.png
|
45
|
+
deleted file mode 100644
|
46
|
+
index 2db1ce6..0000000
|
47
|
+
Binary files a/railties/doc/guides/source/icons/up.png and /dev/null differ
|
48
|
+
diff --git a/railties/doc/guides/source/icons/README b/railties/doc/guides/source/icons/README
|
49
|
+
deleted file mode 100644
|
50
|
+
index f12b2a7..0000000
|
51
|
+
--- a/railties/doc/guides/source/icons/README
|
52
|
+
+++ /dev/null
|
53
|
+
@@ -1,5 +0,0 @@
|
54
|
+
-Replaced the plain DocBook XSL admonition icons with Jimmac's DocBook
|
55
|
+
-icons (http://jimmac.musichall.cz/ikony.php3). I dropped transparency
|
56
|
+
-from the Jimmac icons to get round MS IE and FOP PNG incompatibilies.
|
57
|
+
-
|
58
|
+
-Stuart Rackham
|
59
|
+
diff --git a/railties/doc/guides/source/images/icons/README b/railties/doc/guides/source/images/icons/README
|
60
|
+
new file mode 100644
|
61
|
+
index 0000000..f12b2a7
|
62
|
+
--- /dev/null
|
63
|
+
+++ b/railties/doc/guides/source/images/icons/README
|
64
|
+
@@ -0,0 +1,5 @@
|
65
|
+
+Replaced the plain DocBook XSL admonition icons with Jimmac's DocBook
|
66
|
+
+icons (http://jimmac.musichall.cz/ikony.php3). I dropped transparency
|
67
|
+
+from the Jimmac icons to get round MS IE and FOP PNG incompatibilies.
|
68
|
+
+
|
69
|
+
+Stuart Rackham
|
70
|
+
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb
|
71
|
+
index ad8baef..1849a61 100644
|
72
|
+
--- a/actionpack/test/template/form_tag_helper_test.rb
|
73
|
+
+++ b/actionpack/test/template/form_tag_helper_test.rb
|
74
|
+
@@ -211,7 +211,8 @@ class FormTagHelperTest < ActionView::TestCase
|
75
|
+
def test_boolean_optios
|
76
|
+
assert_dom_equal %(<input checked="checked" disabled="disabled" id="admin" name="admin" readonly="readonly" type="checkbox" value="1" />), check_box_tag("admin", 1, true, 'disabled' => true, :readonly => "yes")
|
77
|
+
assert_dom_equal %(<input checked="checked" id="admin" name="admin" type="checkbox" value="1" />), check_box_tag("admin", 1, true, :disabled => false, :readonly => nil)
|
78
|
+
- assert_dom_equal %(<select id="people" multiple="multiple" name="people"><option>david</option></select>), select_tag("people", "<option>david</option>", :multiple => true)
|
79
|
+
+ assert_dom_equal %(<select id="people" multiple="multiple" name="people[]"><option>david</option></select>), select_tag("people", "<option>david</option>", :multiple => true)
|
80
|
+
+ assert_dom_equal %(<select id="people[]" multiple="multiple" name="people[]"><option>david</option></select>), select_tag("people[]", "<option>david</option>", :multiple => true)
|
81
|
+
assert_dom_equal %(<select id="people" name="people"><option>david</option></select>), select_tag("people", "<option>david</option>", :multiple => nil)
|
82
|
+
end
|
83
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
commit e28ad77bba0574241e6eb64dfd0c1291b221effe
|
2
|
+
Author: Tom Stuart <tom@experthuman.com>
|
3
|
+
Date: Wed Oct 8 09:31:00 2008 +0100
|
4
|
+
|
5
|
+
Allow use of :path_prefix and :name_prefix outside of namespaced routes. [#1188 state:resolved]
|
6
|
+
|
7
|
+
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
|
8
|
+
|
9
|
+
diff --git a/actionpack/lib/action_controller/routing/builder.rb b/actionpack/lib/action_controller/routing/builder.rb
|
10
|
+
index 5704d9d..7b888fa 100644
|
11
|
+
--- a/actionpack/lib/action_controller/routing/builder.rb
|
12
|
+
+++ b/actionpack/lib/action_controller/routing/builder.rb
|
13
|
+
@@ -60,12 +60,10 @@ module ActionController
|
14
|
+
# segments are passed alongside in order to distinguish between default values
|
15
|
+
# and requirements.
|
16
|
+
def divide_route_options(segments, options)
|
17
|
+
- options = options.dup
|
18
|
+
+ options = options.except(:path_prefix, :name_prefix)
|
19
|
+
|
20
|
+
if options[:namespace]
|
21
|
+
options[:controller] = "#{options.delete(:namespace).sub(/\/$/, '')}/#{options[:controller]}"
|
22
|
+
- options.delete(:path_prefix)
|
23
|
+
- options.delete(:name_prefix)
|
24
|
+
end
|
25
|
+
|
26
|
+
requirements = (options.delete(:requirements) || {}).dup
|
27
|
+
@@ -68,7 +73,9 @@ class Client < ActiveRecord::Base
|
28
|
+
end
|
29
|
+
|
30
|
+
def removable?
|
31
|
+
- self.projects.find(:first, :select => 'id').nil? && self.invoices.find(:first, :select => 'id').nil?
|
32
|
+
+ self.projects.find(:first, :select => 'id').nil? &&
|
33
|
+
+ self.invoices.find(:first, :select => 'id').nil? &&
|
34
|
+
+ self.recurring_invoices.find(:first, :select => 'id').nil?
|
35
|
+
end
|
36
|
+
|
37
|
+
# some comment
|
38
|
+
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
|
39
|
+
index 1eb26a7..9699a04 100644
|
40
|
+
--- a/actionpack/test/controller/routing_test.rb
|
41
|
+
+++ b/actionpack/test/controller/routing_test.rb
|
42
|
+
@@ -924,6 +924,20 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
+ def test_named_route_with_name_prefix
|
47
|
+
+ rs.add_named_route :page, 'page', :controller => 'content', :action => 'show_page', :name_prefix => 'my_'
|
48
|
+
+ x = setup_for_named_route
|
49
|
+
+ assert_equal("http://named.route.test/page",
|
50
|
+
+ x.send(:my_page_url))
|
51
|
+
+ end
|
52
|
+
+
|
53
|
+
+ def test_named_route_with_path_prefix
|
54
|
+
+ rs.add_named_route :page, 'page', :controller => 'content', :action => 'show_page', :path_prefix => 'my'
|
55
|
+
+ x = setup_for_named_route
|
56
|
+
+ assert_equal("http://named.route.test/my/page",
|
57
|
+
+ x.send(:page_url))
|
58
|
+
+ end
|
59
|
+
+
|
60
|
+
def test_named_route_with_nested_controller
|
61
|
+
rs.add_named_route :users, 'admin/user', :controller => 'admin/user', :action => 'index'
|
62
|
+
x = setup_for_named_route
|
63
|
+
@@ -2147,6 +2161,13 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
|
64
|
+
assert_equal [:x], set.extra_keys(args)
|
65
|
+
end
|
66
|
+
|
67
|
+
+ def test_generate_with_path_prefix
|
68
|
+
+ set.draw { |map| map.connect ':controller/:action/:id', :path_prefix => 'my' }
|
69
|
+
+
|
70
|
+
+ args = { :controller => "foo", :action => "bar", :id => "7", :x => "y" }
|
71
|
+
+ assert_equal "/my/foo/bar/7?x=y", set.generate(args)
|
72
|
+
+ end
|
73
|
+
+
|
74
|
+
def test_named_routes_are_never_relative_to_modules
|
75
|
+
set.draw do |map|
|
76
|
+
map.connect "/connection/manage/:action", :controller => 'connection/manage'
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
unless defined? REVISIONS
|
4
|
+
REVISIONS = ['e28ad77bba0574241e6eb64dfd0c1291b221effe', # 2 files updated
|
5
|
+
'a4629e707d80a5769f7a71ca6ed9471015e14dc9', # 1 file updated
|
6
|
+
'dce6ade4cdc2833b53bd600ef10f9bce83c7102d', # 6 files updated
|
7
|
+
'51b986619d88f7ba98be7d271188785cbbb541a0'] # 3 files updated
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class Test::Unit::TestCase
|
12
|
+
|
13
|
+
def read_file(name)
|
14
|
+
out = ''
|
15
|
+
File.open(name).each { |line|
|
16
|
+
out += line
|
17
|
+
}
|
18
|
+
out
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'mocha'
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/../../lib/commit_hook'
|
6
|
+
require File.dirname(__FILE__) + '/../../lib/git'
|
7
|
+
|
8
|
+
class CommitHookTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def test_hook
|
11
|
+
path = File.dirname(__FILE__) + '/../fixtures/'
|
12
|
+
Git.expects(:log).with(REVISIONS.first, REVISIONS.last).returns(read_file(path + 'git_log'))
|
13
|
+
Git.expects(:mailing_list_address).returns('recipient@test.com')
|
14
|
+
REVISIONS.each do |rev|
|
15
|
+
Git.expects(:show).with(rev).returns(read_file(path + "git_show_#{rev}"))
|
16
|
+
end
|
17
|
+
emailer = mock('Emailer')
|
18
|
+
Emailer.expects(:new).times(4).returns(emailer) # 4 commit, one email for each of them
|
19
|
+
emailer.expects(:send).times(4)
|
20
|
+
CommitHook.run 'config/email.yml.sample', REVISIONS.first, REVISIONS.last, 'refs/heads/master'
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'mocha'
|
3
|
+
require 'cgi'
|
4
|
+
require 'hpricot'
|
5
|
+
|
6
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
7
|
+
|
8
|
+
require File.dirname(__FILE__) + '/../../lib/diff_to_html'
|
9
|
+
require File.dirname(__FILE__) + '/../../lib/git'
|
10
|
+
|
11
|
+
class DiffToHtmlTest < Test::Unit::TestCase
|
12
|
+
|
13
|
+
def test_multiple_commits
|
14
|
+
path = File.dirname(__FILE__) + '/../fixtures/'
|
15
|
+
Git.expects(:log).with(REVISIONS.first, REVISIONS.last).returns(read_file(path + 'git_log'))
|
16
|
+
REVISIONS.each do |rev|
|
17
|
+
Git.expects(:show).with(rev).returns(read_file(path + 'git_show_' + rev))
|
18
|
+
end
|
19
|
+
|
20
|
+
diff = DiffToHtml.new
|
21
|
+
diff.diff_between_revisions REVISIONS.first, REVISIONS.last, 'testproject', 'master'
|
22
|
+
assert_equal 4, diff.result.size # one result for each of the commits
|
23
|
+
|
24
|
+
diff.result.each do |html|
|
25
|
+
assert !html.include?('@@') # diff correctly processed
|
26
|
+
end
|
27
|
+
|
28
|
+
# first commit
|
29
|
+
hp = Hpricot diff.result.first[:html_content]
|
30
|
+
assert_equal 2, (hp/"table").size # 8 files updated - one table for each of the files
|
31
|
+
(hp/"table/tr/").each do |td|
|
32
|
+
if td.inner_html == "require 'iconv'"
|
33
|
+
# first added line in changeset a4629e707d80a5769f7a71ca6ed9471015e14dc9
|
34
|
+
assert_equal '', td.parent.search('td')[0].inner_text # left
|
35
|
+
assert_equal '2', td.parent.search('td')[1].inner_text # right
|
36
|
+
assert_equal "require 'iconv'", td.parent.search('td')[2].inner_html # change
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# second commit
|
41
|
+
hp = Hpricot diff.result[1][:html_content]
|
42
|
+
assert_equal 1, (hp/"table").size # 1 file updated
|
43
|
+
|
44
|
+
# third commit - dce6ade4cdc2833b53bd600ef10f9bce83c7102d
|
45
|
+
hp = Hpricot diff.result[2][:html_content]
|
46
|
+
assert_equal 6, (hp/"table").size # 6 files updated
|
47
|
+
assert_equal 'Added binary file railties/doc/guides/source/images/icons/callouts/11.png', (hp/"h2")[1].inner_text
|
48
|
+
assert_equal 'Deleted binary file railties/doc/guides/source/icons/up.png', (hp/"h2")[2].inner_text
|
49
|
+
assert_equal 'Deleted file railties/doc/guides/source/icons/README', (hp/"h2")[3].inner_text
|
50
|
+
assert_equal 'Added file railties/doc/guides/source/images/icons/README', (hp/"h2")[4].inner_text
|
51
|
+
|
52
|
+
# fourth commit - 51b986619d88f7ba98be7d271188785cbbb541a0
|
53
|
+
hp = Hpricot diff.result[3][:html_content]
|
54
|
+
assert_equal 3, (hp/"table").size # 3 files updated
|
55
|
+
(hp/"table/tr/").each do |td|
|
56
|
+
if td.inner_html =~ /create_btn/
|
57
|
+
cols = td.parent.search('td')
|
58
|
+
['405', '408', ''].include? cols[0].inner_text # line 405 changed
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_single_commit
|
64
|
+
path = File.dirname(__FILE__) + '/../fixtures/'
|
65
|
+
Git.expects(:log).never
|
66
|
+
Git.expects(:show).with(REVISIONS.first).returns(read_file(path + 'git_show_' + REVISIONS.first))
|
67
|
+
|
68
|
+
diff = DiffToHtml.new
|
69
|
+
diff.diff_between_revisions REVISIONS.first, REVISIONS.first, 'testproject', 'master'
|
70
|
+
assert_equal 1, diff.result.size # single result for a single commit
|
71
|
+
assert_equal 'Allow use of :path_prefix and :name_prefix outside of namespaced routes. [#1188 state:resolved]', diff.result.first[:commit_info][:message]
|
72
|
+
assert_equal 'Tom Stuart', diff.result.first[:commit_info][:author]
|
73
|
+
assert_equal 'tom@experthuman.com', diff.result.first[:commit_info][:email]
|
74
|
+
|
75
|
+
hp = Hpricot(diff.result.first[:html_content])
|
76
|
+
assert !diff.result.first[:html_content].include?('@@')
|
77
|
+
assert_equal 2, (hp/"table").size # 2 files updated
|
78
|
+
(hp/"table/tr/").each do |td|
|
79
|
+
if td.inner_html == "require 'iconv'"
|
80
|
+
# first added line in changeset a4629e707d80a5769f7a71ca6ed9471015e14dc9
|
81
|
+
assert_equal '', td.parent.search('td')[0].inner_text # left
|
82
|
+
assert_equal '2', td.parent.search('td')[1].inner_text # right
|
83
|
+
assert_equal "require 'iconv'", td.parent.search('td')[2].inner_html # change
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_tokenize
|
89
|
+
s = "keys = I18n.send :normalize_translation_keys, locale, key, scope"
|
90
|
+
diff = DiffToHtml.new
|
91
|
+
tokens = diff.tokenize_string(s)
|
92
|
+
|
93
|
+
assert_equal ['keys', ' ', '=', ' ', 'I18n', '.', 'send',' ',':','normalize','_','translation','_','keys',',',' ','locale',',',' ',
|
94
|
+
'key',',',' ','scope'], tokens
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'jcode'
|
3
|
+
require File.dirname(__FILE__) + '/../../lib/result_processor'
|
4
|
+
require File.dirname(__FILE__) + '/../../lib/diff_to_html'
|
5
|
+
|
6
|
+
class ResultProcessorTest < Test::Unit::TestCase
|
7
|
+
# button_to_remote 'create_btn'
|
8
|
+
# submit_to_remote 'create_btn'
|
9
|
+
|
10
|
+
def setup
|
11
|
+
create_test_input
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_processor
|
15
|
+
proc = ResultProcessor.new(@diff)
|
16
|
+
removal, addition = proc.results
|
17
|
+
assert_equal 1, removal.size
|
18
|
+
|
19
|
+
assert removal[0].include?(' <span class="rr">b</span>')
|
20
|
+
assert removal[0].include?('<span class="rr">ton</span>')
|
21
|
+
|
22
|
+
assert_equal 1, removal[0].split('<span>').size # one occurrence (beginning of string)
|
23
|
+
assert_equal 1, addition.size
|
24
|
+
assert addition[0].include?(' <span class="aa">s</span>')
|
25
|
+
assert addition[0].include?('<span class="aa">bmi</span>')
|
26
|
+
assert_equal 1, addition[0].split('<span>').size
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_processor_with_almost_no_common_part
|
30
|
+
@diff = [
|
31
|
+
{ :action => :match, :token => ' '},
|
32
|
+
{ :action => :match, :token => ' '},
|
33
|
+
{ :action => :discard_a, :token => 'button'},
|
34
|
+
{:action => :discard_b, :token => 'submit'},
|
35
|
+
{ :action => :match, :token => 'x'}]
|
36
|
+
|
37
|
+
proc = ResultProcessor.new(@diff)
|
38
|
+
removal, addition = proc.results
|
39
|
+
|
40
|
+
assert_equal 1, removal.size
|
41
|
+
assert_equal ' buttonx', removal[0] # no highlight
|
42
|
+
assert_equal 1, addition.size
|
43
|
+
assert_equal ' submitx', addition[0] # no highlight
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_close_span_tag_when_having_difference_at_the_end
|
47
|
+
diff = []
|
48
|
+
s1 = " submit_to_remote 'create_btn', 'Create', :url => { :action => 'cre"
|
49
|
+
s2 = " submit_to_remote 'create_btn', 'Create', :url => { :action => 'sub"
|
50
|
+
|
51
|
+
s1[0..s1.size-6].each_char do |c|
|
52
|
+
diff << { :action => :match, :token => c}
|
53
|
+
end
|
54
|
+
diff << { :action => :discard_a, :token => 'c'}
|
55
|
+
diff << { :action => :discard_a, :token => 'r'}
|
56
|
+
diff << { :action => :discard_a, :token => 'e'}
|
57
|
+
diff << { :action => :discard_b, :token => 's'}
|
58
|
+
diff << { :action => :discard_b, :token => 'u'}
|
59
|
+
diff << { :action => :discard_b, :token => 'b'}
|
60
|
+
|
61
|
+
proc = ResultProcessor.new(diff)
|
62
|
+
removal, addition = proc.results
|
63
|
+
assert_equal 1, removal.size
|
64
|
+
assert removal[0].include?('action =><span class="rr">cre</span>')
|
65
|
+
|
66
|
+
assert_equal 1, addition.size
|
67
|
+
assert addition[0].include?('action =><span class="aa">sub</span>')
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_test_input
|
71
|
+
@diff = []
|
72
|
+
s1 = " button_to_remote 'create_btn', 'Create', :url => { :action => 'create' }"
|
73
|
+
s2 = " submit_to_remote 'create_btn', 'Create', :url => { :action => 'create' }"
|
74
|
+
|
75
|
+
@diff = [
|
76
|
+
[:match, ' '],
|
77
|
+
[:match, ' '],
|
78
|
+
[:discard_a,'b'],
|
79
|
+
[:discard_b,'s'],
|
80
|
+
[:match, 'u'],
|
81
|
+
[:discard_b,'b'],
|
82
|
+
[:discard_b,'m'],
|
83
|
+
[:discard_b,'i'],
|
84
|
+
[:match, 't'],
|
85
|
+
[:discard_a,'t'],
|
86
|
+
[:discard_a,'o'],
|
87
|
+
[:discard_a,'n']]
|
88
|
+
@diff = @diff.collect { |d| { :action => d.first, :token => d.last}}
|
89
|
+
|
90
|
+
s1[@diff.size..-1].each_char do |c|
|
91
|
+
@diff << { :action => :match, :token => c}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-commit-notifier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Bodo Tasche
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-03-24 00:00:00 +01:00
|
18
|
+
default_executable: git-commit-notifier
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: diff-lcs
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: mocha
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 0
|
41
|
+
version: "0"
|
42
|
+
type: :runtime
|
43
|
+
version_requirements: *id002
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: hpricot
|
46
|
+
prerelease: false
|
47
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
type: :runtime
|
55
|
+
version_requirements: *id003
|
56
|
+
description: This git commit notifier sends html mails with nice diffs for every changed file.
|
57
|
+
email: bodo@wannawork.de
|
58
|
+
executables:
|
59
|
+
- git-commit-notifier
|
60
|
+
extensions: []
|
61
|
+
|
62
|
+
extra_rdoc_files:
|
63
|
+
- LICENSE
|
64
|
+
- README.textile
|
65
|
+
files:
|
66
|
+
- .document
|
67
|
+
- .gitignore
|
68
|
+
- LICENSE
|
69
|
+
- README.textile
|
70
|
+
- Rakefile
|
71
|
+
- VERSION
|
72
|
+
- bin/git-commit-notifier
|
73
|
+
- config/git-notifier-configl.yml.sample
|
74
|
+
- git-commit-notifier.gemspec
|
75
|
+
- lib/commit_hook.rb
|
76
|
+
- lib/diff_to_html.rb
|
77
|
+
- lib/emailer.rb
|
78
|
+
- lib/git.rb
|
79
|
+
- lib/result_processor.rb
|
80
|
+
- template/email.html.erb
|
81
|
+
- template/styles.css
|
82
|
+
- test/fixtures/git_log
|
83
|
+
- test/fixtures/git_show_51b986619d88f7ba98be7d271188785cbbb541a0
|
84
|
+
- test/fixtures/git_show_a4629e707d80a5769f7a71ca6ed9471015e14dc9
|
85
|
+
- test/fixtures/git_show_dce6ade4cdc2833b53bd600ef10f9bce83c7102d
|
86
|
+
- test/fixtures/git_show_e28ad77bba0574241e6eb64dfd0c1291b221effe
|
87
|
+
- test/test_helper.rb
|
88
|
+
- test/unit/test_commit_hook.rb
|
89
|
+
- test/unit/test_diff_to_html.rb
|
90
|
+
- test/unit/test_result_processor.rb
|
91
|
+
has_rdoc: true
|
92
|
+
homepage: http://github.com/bodo/git-commit-notifier
|
93
|
+
licenses: []
|
94
|
+
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options:
|
97
|
+
- --charset=UTF-8
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
segments:
|
112
|
+
- 0
|
113
|
+
version: "0"
|
114
|
+
requirements: []
|
115
|
+
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.3.6
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Sends git commit messages with diffs
|
121
|
+
test_files:
|
122
|
+
- test/test_helper.rb
|
123
|
+
- test/unit/test_commit_hook.rb
|
124
|
+
- test/unit/test_diff_to_html.rb
|
125
|
+
- test/unit/test_result_processor.rb
|