blastr 0.0.12 → 0.0.13

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/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.0.13 2009-02-20
2
+
3
+ * Added support for multi-line comments in SVN.
4
+
1
5
  == 0.0.12 2009-01-19
2
6
 
3
7
  * Removed extra_dev_deps from newgem configuration (should fix the implicit
data/Manifest.txt CHANGED
@@ -20,7 +20,9 @@ test/test_git_log_entry.rb
20
20
  test/test_git_revision.rb
21
21
  test/test_helper.rb
22
22
  test/test_mercurial_revision.rb
23
+ test/test_scm_logentry.rb
23
24
  test/test_scm_url_matching.rb
25
+ test/test_svn_log.rb
24
26
  test/test_svn_revision.rb
25
27
  test/test_tts.rb
26
28
  website/index.html
data/README.rdoc CHANGED
@@ -1,5 +1,8 @@
1
1
  = Blastr, the audible commit radiator
2
2
 
3
+ See the project website at Rubyforge[http://rubyforge.org/projects/blastr/]
4
+ to file a bug report or submit a feature request.
5
+
3
6
  == DESCRIPTION:
4
7
 
5
8
  Blastr observes a version control repository for commits and makes audible
@@ -78,16 +81,16 @@ your platform.
78
81
  === KNOWN PROBLEMS AND GOTCHAS:
79
82
 
80
83
  * Blastr currently does a full clone operation on every poll for
81
- source repositories that don't support a purely remote operation (like
82
- "svn log [URL]"). This may take a while if your repository is big.
84
+ source repositories that don't support a purely remote operation (like
85
+ "svn log [URL]"). This may take a while if your repository is big.
83
86
  * Blastr doesn't treat non-ASCII characters in commit messages too well.
84
- In other words, the developers make no promises whatsoever regarding
85
- Blastr's behavior when encountering weird Norwegian scribble.
87
+ In other words, the developers make no promises whatsoever regarding
88
+ Blastr's behavior when encountering weird Norwegian scribble.
86
89
  * Some folks might want to monitor multiple repositories or multiple
87
- paths or branches within a repository at the same time. Currently,
88
- this is technically possible by running to instances of Blastr in
89
- parallel but every now and then those two instances will speak over
90
- each other (i.e. all you can hear is cacophony).
90
+ paths or branches within a repository at the same time. Currently,
91
+ this is technically possible by running to instances of Blastr in
92
+ parallel but every now and then those two instances will speak over
93
+ each other (i.e. all you can hear is cacophony).
91
94
 
92
95
  === LICENSE:
93
96
 
data/lib/blastr.rb CHANGED
@@ -6,7 +6,7 @@ module Blastr
6
6
  require 'tts/tts.rb'
7
7
  require 'people/people.rb'
8
8
 
9
- VERSION = '0.0.12'
9
+ VERSION = '0.0.13'
10
10
  COPYRIGHT = 'Copyright (c) 2009, Lasse Koskela. All Rights Reserved.'
11
11
  puts "Blastr #{VERSION}\n#{COPYRIGHT}\n"
12
12
 
data/lib/scm/scm.rb CHANGED
@@ -7,6 +7,9 @@ module Blastr::SourceControl
7
7
  @author = author
8
8
  @comment = comment
9
9
  end
10
+ def ==(other)
11
+ @revision == other.revision and @author == other.author and @comment == other.comment
12
+ end
10
13
  def to_s
11
14
  "revision #{@revision} by #{@author}: #{@comment}"
12
15
  end
data/lib/scm/svn.rb CHANGED
@@ -14,6 +14,10 @@ module Blastr::SourceControl
14
14
  @name
15
15
  end
16
16
 
17
+ def ==(other)
18
+ @name == other.name
19
+ end
20
+
17
21
  def before?(revision)
18
22
  return false if @name == "HEAD"
19
23
  return true if revision.name == "HEAD"
@@ -44,9 +48,14 @@ module Blastr::SourceControl
44
48
  end
45
49
 
46
50
  def commits_since(since_revision = 1)
51
+ svn_log_output = svn_log(since_revision)
52
+ svn_log_entries(svn_log_output)
53
+ end
54
+
55
+ def svn_log_entries(log_output)
47
56
  nonascii = /([^a-zA-Z0-9\.,:;\-_\?!"'\s]+?)/u
48
57
  entries = []
49
- svn_log(since_revision).scan(/r(\d+)\s\|\s(.*?)\s\|.*?\n\n(.*)\n-+/u).each do |entry|
58
+ log_output.scan(/r(\d+)\s\|\s(.*?)\s\|.*?\n\n(.*?)\n(-)+/mu).each do |entry|
50
59
  revision = as_revision(entry[0])
51
60
  author = entry[1]
52
61
  comment = entry[2].gsub(nonascii, 'X ')
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestLogEntry < Test::Unit::TestCase
4
+ def test_equality
5
+ assert_equal create_log_entry, create_log_entry
6
+ end
7
+
8
+ private
9
+ def create_log_entry
10
+ rev = Blastr::SourceControl::SubversionRevision.new("707")
11
+ Blastr::SourceControl::LogEntry.new(rev, "author", "comment")
12
+ end
13
+ end
@@ -0,0 +1,80 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestSubversionLogParsing < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @svn = Blastr::SourceControl::Subversion.new("svn://whatever")
7
+ end
8
+
9
+ def test_one_entry
10
+ log = <<EOS
11
+ ------------------------------------------------------------------------
12
+ r123 | username | 2009-01-21 09:02:37 +0200 (Wed, 21 Jan 2009) | 1 line
13
+
14
+ The commit message goes here
15
+ ------------------------------------------------------------------------
16
+ EOS
17
+ entries = @svn.svn_log_entries(log)
18
+ assert_equal [ Blastr::SourceControl::LogEntry.new(Blastr::SourceControl::SubversionRevision.new("123"), "username", "The commit message goes here") ], entries
19
+ end
20
+
21
+ def test_multiple_entries
22
+ log = <<EOS
23
+ ------------------------------------------------------------------------
24
+ r2 | janedoe | 2009-01-22 09:02:00 +0200 (Wed, 21 Jan 2009) | 1 line
25
+
26
+ Second revision
27
+ ------------------------------------------------------------------------
28
+ r1 | johndoe | 2009-01-21 09:03:00 +0200 (Wed, 21 Jan 2009) | 1 line
29
+
30
+ First revision
31
+ ------------------------------------------------------------------------
32
+ EOS
33
+ actual_entries = @svn.svn_log_entries(log)
34
+ expected_entries = [
35
+ create_entry("2", "janedoe", "Second revision"),
36
+ create_entry("1", "johndoe", "First revision")
37
+ ]
38
+ assert_equal expected_entries, actual_entries
39
+ end
40
+
41
+ def test_one_multiline_entry
42
+ log = <<EOS
43
+ ------------------------------------------------------------------------
44
+ r123 | username | 2009-01-21 09:02:37 +0200 (Wed, 21 Jan 2009) | 1 line
45
+
46
+ First line
47
+ Second line
48
+ Third line
49
+ ------------------------------------------------------------------------
50
+ EOS
51
+ entries = @svn.svn_log_entries(log)
52
+ assert_equal [ create_entry("123", "username", "First line\nSecond line\nThird line") ], entries
53
+ end
54
+
55
+
56
+ def test_one_multiline_entry
57
+ log = <<EOS
58
+ ------------------------------------------------------------------------
59
+ r2 | bob | 2009-01-21 09:02:00 +0200 (Wed, 21 Jan 2009) | 1 line
60
+
61
+ First line of r2
62
+ Second line of r2
63
+ ------------------------------------------------------------------------
64
+ r1 | alf | 2009-01-21 09:01:00 +0200 (Wed, 21 Jan 2009) | 1 line
65
+
66
+ First line of r1
67
+ Second line of r1
68
+ ------------------------------------------------------------------------
69
+ EOS
70
+ entries = @svn.svn_log_entries(log)
71
+ assert_equal [ create_entry("2", "bob", "First line of r2\nSecond line of r2"),
72
+ create_entry("1", "alf", "First line of r1\nSecond line of r1") ], entries
73
+ end
74
+
75
+ private
76
+ def create_entry(rev_string, author, comment)
77
+ revision = Blastr::SourceControl::SubversionRevision.new(rev_string)
78
+ Blastr::SourceControl::LogEntry.new(revision, author, comment)
79
+ end
80
+ end
@@ -6,6 +6,11 @@ class TestSubversionRevision < Test::Unit::TestCase
6
6
  rev = Blastr::SourceControl::SubversionRevision.new("123")
7
7
  assert rev.to_s == "123"
8
8
  end
9
+
10
+ def test_equality_comparison
11
+ assert_equal revision("123"), revision("123")
12
+ assert revision("456") == revision("456")
13
+ end
9
14
 
10
15
  def test_before_comparison_between_revisions
11
16
  rev123 = Blastr::SourceControl::SubversionRevision.new("123")
@@ -15,9 +20,14 @@ class TestSubversionRevision < Test::Unit::TestCase
15
20
  end
16
21
 
17
22
  def test_before_comparison_with_HEAD
18
- rev = Blastr::SourceControl::SubversionRevision.new("100")
19
- head = Blastr::SourceControl::SubversionRevision.new("HEAD")
23
+ rev = revision("100")
24
+ head = revision("HEAD")
20
25
  assert rev.before?(head) == true
21
26
  assert head.before?(rev) == false
22
27
  end
28
+
29
+ private
30
+ def revision(value)
31
+ Blastr::SourceControl::SubversionRevision.new(value)
32
+ end
23
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blastr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Koskela
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-19 00:00:00 +02:00
12
+ date: 2009-02-20 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -67,12 +67,14 @@ files:
67
67
  - test/test_git_revision.rb
68
68
  - test/test_helper.rb
69
69
  - test/test_mercurial_revision.rb
70
+ - test/test_scm_logentry.rb
70
71
  - test/test_scm_url_matching.rb
72
+ - test/test_svn_log.rb
71
73
  - test/test_svn_revision.rb
72
74
  - test/test_tts.rb
73
75
  - website/index.html
74
76
  has_rdoc: true
75
- homepage:
77
+ homepage: See the project website at Rubyforge[http://rubyforge.org/projects/blastr/]
76
78
  post_install_message:
77
79
  rdoc_options:
78
80
  - --main
@@ -104,6 +106,8 @@ test_files:
104
106
  - test/test_git_revision.rb
105
107
  - test/test_helper.rb
106
108
  - test/test_mercurial_revision.rb
109
+ - test/test_scm_logentry.rb
107
110
  - test/test_scm_url_matching.rb
111
+ - test/test_svn_log.rb
108
112
  - test/test_svn_revision.rb
109
113
  - test/test_tts.rb