blastr 0.0.18 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,6 +1,11 @@
1
+ == 0.0.18 2010-02-19
2
+
3
+ * Omit URLs in speech.
4
+
1
5
  == 0.0.17 2009-02-21
2
6
 
3
7
  * Removed replacement of non-ascii characters in commit messages.
8
+
4
9
  == 0.0.16 2009-02-21
5
10
 
6
11
  * Added support for HTTP-based, SSH-based, Rsync-based, and file system-based Git URLs.
data/Manifest.txt CHANGED
@@ -6,6 +6,7 @@ Rakefile
6
6
  bin/blastr
7
7
  config/website.yml
8
8
  lib/blastr.rb
9
+ lib/error.rb
9
10
  lib/people/people.rb
10
11
  lib/scm/git.rb
11
12
  lib/scm/hg.rb
@@ -15,15 +16,19 @@ lib/tts/tts.rb
15
16
  script/console
16
17
  script/destroy
17
18
  script/generate
19
+ test/people/test_people.rb
20
+ test/scm/abstract_scm_testcase.rb
21
+ test/scm/test_git.rb
22
+ test/scm/test_git_log_entry.rb
23
+ test/scm/test_git_revision.rb
24
+ test/scm/test_log_entry.rb
25
+ test/scm/test_mercurial.rb
26
+ test/scm/test_mercurial_log.rb
27
+ test/scm/test_mercurial_revision.rb
28
+ test/scm/test_svn.rb
29
+ test/scm/test_svn_log.rb
30
+ test/scm/test_svn_revision.rb
18
31
  test/test_blastr.rb
19
- test/test_git_log_entry.rb
20
- test/test_git_revision.rb
21
32
  test/test_helper.rb
22
- test/test_mercurial_log.rb
23
- test/test_mercurial_revision.rb
24
- test/test_scm_logentry.rb
25
- test/test_scm_url_matching.rb
26
- test/test_svn_log.rb
27
- test/test_svn_revision.rb
28
- test/test_tts.rb
33
+ test/tts/test_tts.rb
29
34
  website/index.html
data/README.txt CHANGED
@@ -38,12 +38,20 @@ Subversion:
38
38
 
39
39
  blastr http://svn.acme.com/foo/trunk 123
40
40
 
41
+ blastr file:///var/svnrepo
42
+
43
+ blastr /var/svnrepo
44
+
41
45
  Git:
42
46
 
43
47
  blastr git://github.com/lkoskela/blastr.git
44
48
 
45
49
  blastr git://github.com/lkoskela/blastr.git e528509fddd57194f1c497ce6583f6869e8ed62c
46
50
 
51
+ blastr file:///var/gitrepo
52
+
53
+ blastr /var/gitrepo
54
+
47
55
  Mercurial:
48
56
 
49
57
  blastr hg:http://hg.serpentine.com/tutorial/hello
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'hoe'
3
3
  $:.unshift(File.dirname(__FILE__) + "/lib")
4
- require File.dirname(__FILE__) + '/lib/blastr'
4
+ require File.expand_path(File.join(File.dirname(__FILE__), 'lib/blastr'))
5
5
 
6
6
  Hoe.spec 'blastr' do
7
7
  name = "blastr"
data/bin/blastr CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- require "#{File.dirname(__FILE__)}/../lib/blastr.rb"
4
+ require File.expand_path(File.join(File.dirname(__FILE__), '../lib/blastr.rb'))
5
+ puts "Blastr #{Blastr::VERSION}\n#{Blastr::COPYRIGHT}\n"
5
6
 
6
7
  begin
7
8
  Blastr::Process.new(ARGV).run
data/lib/blastr.rb CHANGED
@@ -1,14 +1,14 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__)) unless
2
+ $LOAD_PATH.include?(File.dirname(__FILE__)) or $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module Blastr
5
- require 'scm/scm.rb'
6
- require 'tts/tts.rb'
7
- require 'people/people.rb'
5
+ require File.expand_path(File.join(File.dirname(__FILE__), 'error.rb'))
6
+ require File.expand_path(File.join(File.dirname(__FILE__), 'scm/scm.rb'))
7
+ require File.expand_path(File.join(File.dirname(__FILE__), 'tts/tts.rb'))
8
+ require File.expand_path(File.join(File.dirname(__FILE__), 'people/people.rb'))
8
9
 
9
- VERSION = '0.0.18'
10
+ VERSION = '0.1.0'
10
11
  COPYRIGHT = "Copyright (c) 2009-#{Time.now.year}, Lasse Koskela. All Rights Reserved."
11
- puts "Blastr #{VERSION}\n#{COPYRIGHT}\n"
12
12
 
13
13
  def self.trap_and_exit(signal)
14
14
  trap(signal) {
@@ -24,35 +24,6 @@ module Blastr
24
24
  end
25
25
  end
26
26
 
27
- class UsageError < ArgumentError
28
-
29
- USAGE_TEXT = <<EOS
30
-
31
- Usage: blastr URL [revision]
32
-
33
- The options are as follows:
34
-
35
- URL (required) The URL identifying the source repository
36
- you want to observe. For Subversion repositories the
37
- URL could be, for example, "http://svn.foo.com/bar" or
38
- "svn://svn.foo.com/bar". For a Git repository, the URL
39
- usually looks like "git://github.com/foo/bar.git".
40
-
41
- revision (optional) The revision or commit you want to start
42
- observing from. For a Subversion repository, this
43
- would be a number (e.g. 123 or 5000). For Git, the
44
- revision would be the commit SHA hash - something that
45
- looks like "4d1863552c03bc1ff9c9376b9a24b04daabc67e2".
46
- When this option is omitted, Blastr starts observing
47
- from the latest revision onwards.
48
-
49
- EOS
50
-
51
- def initialize
52
- super(USAGE_TEXT)
53
- end
54
- end
55
-
56
27
  class Process
57
28
  def initialize(args)
58
29
  Blastr::trap_and_exit("INT")
@@ -94,6 +65,7 @@ EOS
94
65
  temp_file = Tempfile.new("tmp")
95
66
  temp_dir = temp_file.path
96
67
  temp_file.unlink
68
+ FileUtils.mkdir_p(temp_dir)
97
69
  temp_dir
98
70
  end
99
71
  end
data/lib/error.rb ADDED
@@ -0,0 +1,32 @@
1
+ module Blastr
2
+
3
+ class UsageError < ArgumentError
4
+
5
+ USAGE_TEXT = <<EOS
6
+
7
+ Usage: blastr URL [revision]
8
+
9
+ The options are as follows:
10
+
11
+ URL (required) The URL identifying the source repository
12
+ you want to observe. For Subversion repositories the
13
+ URL could be, for example, "http://svn.foo.com/bar" or
14
+ "svn://svn.foo.com/bar". For a Git repository, the URL
15
+ usually looks like "git://github.com/foo/bar.git".
16
+
17
+ revision (optional) The revision or commit you want to start
18
+ observing from. For a Subversion repository, this
19
+ would be a number (e.g. 123 or 5000). For Git, the
20
+ revision would be the commit SHA hash - something that
21
+ looks like "4d1863552c03bc1ff9c9376b9a24b04daabc67e2".
22
+ When this option is omitted, Blastr starts observing
23
+ from the latest revision onwards.
24
+
25
+ EOS
26
+
27
+ def initialize
28
+ super(USAGE_TEXT)
29
+ end
30
+ end
31
+
32
+ end
data/lib/scm/git.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'git'
2
- require File.dirname(__FILE__) + '/scm.rb'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), 'scm.rb'))
3
3
 
4
4
  module Blastr::SourceControl
5
5
 
@@ -14,9 +14,10 @@ module Blastr::SourceControl
14
14
  class GitRevision
15
15
  attr_accessor :name, :date
16
16
 
17
- def initialize(name, date = Time.now)
17
+ def initialize(name, date)
18
18
  @name = name
19
19
  @date = date
20
+ raise ArgumentError if date.nil? and name != "HEAD"
20
21
  end
21
22
 
22
23
  def to_s
@@ -26,8 +27,11 @@ module Blastr::SourceControl
26
27
  def before?(revision)
27
28
  return false if @name == "HEAD"
28
29
  return true if revision.name == "HEAD"
29
- return @date < revision.date unless @date.nil?
30
- @name < revision.name
30
+ @date < revision.date
31
+ end
32
+
33
+ def self.head
34
+ GitRevision.new("HEAD", nil)
31
35
  end
32
36
  end
33
37
 
@@ -35,6 +39,7 @@ module Blastr::SourceControl
35
39
  def name; "Git"; end
36
40
 
37
41
  def self.understands_url?(url)
42
+ return true if local_repository?(url)
38
43
  patterns = [ /^(git:)(.*)$/, /^(.*)(\.git)(\/?)$/ ]
39
44
  patterns.each do |regex|
40
45
  return true if url =~ regex
@@ -45,6 +50,10 @@ module Blastr::SourceControl
45
50
  def initialize(git_url)
46
51
  @git_url = git_url
47
52
  end
53
+
54
+ def url
55
+ @git_url
56
+ end
48
57
 
49
58
  def as_revision(arg)
50
59
  raise "Invalid revision: #{arg}" unless arg =~ /^(HEAD(~\d+)?)|([\d\w:-]+)$/
@@ -58,9 +67,9 @@ module Blastr::SourceControl
58
67
  end
59
68
 
60
69
  def latest_revision
61
- commits = commits_since(as_revision("HEAD~5"))
70
+ commits = commits_since(as_revision("HEAD~1"))
62
71
  return as_revision("HEAD") unless commits.size > 0
63
- GitRevision.new(commits.last.revision.to_s)
72
+ GitRevision.new(commits.last.revision.to_s, commits.last.revision.date)
64
73
  end
65
74
 
66
75
  def commits_since(revision)
@@ -74,6 +83,13 @@ module Blastr::SourceControl
74
83
  end
75
84
 
76
85
  private
86
+
87
+ def self.local_repository?(path)
88
+ path = path["file://".length..-1] if path.start_with? "file://"
89
+ return false unless File.directory?(path)
90
+ File.directory?(File.join(path, '.git'))
91
+ end
92
+
77
93
  def with_clone
78
94
  temp_dir = Blastr::temp_dir
79
95
  Blastr::delete_at_exit(temp_dir)
data/lib/scm/hg.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'fileutils'
2
- require File.dirname(__FILE__) + '/scm.rb'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), 'scm.rb'))
3
3
 
4
4
  module Blastr::SourceControl
5
5
 
data/lib/scm/scm.rb CHANGED
@@ -30,6 +30,6 @@ module Blastr::SourceControl
30
30
 
31
31
  end
32
32
 
33
- require File.dirname(__FILE__) + '/svn.rb'
34
- require File.dirname(__FILE__) + '/git.rb'
35
- require File.dirname(__FILE__) + '/hg.rb'
33
+ ['svn', 'git', 'hg'].each do |scm|
34
+ require File.expand_path(File.join(File.dirname(__FILE__), "#{scm}.rb"))
35
+ end
data/lib/scm/svn.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'fileutils'
2
- require File.dirname(__FILE__) + '/scm.rb'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), 'scm.rb'))
3
3
 
4
4
  module Blastr::SourceControl
5
5
 
@@ -29,11 +29,15 @@ module Blastr::SourceControl
29
29
  def name; "Subversion"; end
30
30
 
31
31
  def self.understands_url?(url)
32
- not url.match(/^(https?:|svn:)(.+)$/).nil?
32
+ local_repository?(url) or has_protocol_scheme?(url)
33
33
  end
34
34
 
35
35
  def initialize(svn_url)
36
- @svn_url = svn_url
36
+ @svn_url = with_protocol_scheme(svn_url)
37
+ end
38
+
39
+ def url
40
+ @svn_url
37
41
  end
38
42
 
39
43
  def as_revision(arg)
@@ -64,6 +68,22 @@ module Blastr::SourceControl
64
68
  end
65
69
 
66
70
  private
71
+
72
+ def with_protocol_scheme(path)
73
+ return path if Subversion.has_protocol_scheme?(path)
74
+ "file://#{path}"
75
+ end
76
+
77
+ def self.has_protocol_scheme?(path)
78
+ not path.match(/^(https?:|svn:|file:)(.+)$/).nil?
79
+ end
80
+
81
+ def self.local_repository?(path)
82
+ path = path["file://".length..-1] if path.start_with? "file://"
83
+ return false unless File.directory?(path)
84
+ File.exist?(File.join(path, 'format'))
85
+ end
86
+
67
87
  def svn_log(since_revision = as_revision("1"))
68
88
  temp_file = Tempfile.new("svn.log").path
69
89
  Blastr::delete_at_exit(temp_file)
@@ -0,0 +1,37 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
+ require 'fileutils'
3
+
4
+ class TestPeopleFile < Test::Unit::TestCase
5
+ def setup
6
+ backup_people_file
7
+ end
8
+
9
+ def teardown
10
+ restore_people_file
11
+ end
12
+
13
+ def test_with_missing_people_file
14
+ FileUtils.rm(Blastr::People::PEOPLE_FILE)
15
+ assert_equal({}, Blastr::People.people)
16
+ assert_equal "nick", Blastr::People.full_name_of("nick")
17
+ end
18
+
19
+ def test_with_existing_people_file
20
+ open(Blastr::People::PEOPLE_FILE, 'w') do |f|
21
+ f << "nick: Full Name\n"
22
+ f << "name: In Full"
23
+ end
24
+ assert_equal({"nick" => "Full Name", "name" => "In Full"}, Blastr::People.people)
25
+ assert_equal "Full Name", Blastr::People.full_name_of("nick")
26
+ end
27
+
28
+ private
29
+ def backup_people_file
30
+ people_file = Blastr::People::PEOPLE_FILE
31
+ @backup_of_people_file = File.join(Blastr::temp_dir, File.basename(people_file))
32
+ FileUtils.cp(people_file, @backup_of_people_file)
33
+ end
34
+ def restore_people_file
35
+ FileUtils.cp(@backup_of_people_file, Blastr::People::PEOPLE_FILE)
36
+ end
37
+ end
@@ -0,0 +1,19 @@
1
+ class AbstractScmTestCase < Test::Unit::TestCase
2
+ abstract
3
+
4
+ def assert_urls_are_understood(list_of_urls)
5
+ list_of_urls.each do |url|
6
+ assert scm.understands_url?(url), "#{url} should be understood by #{scm}!"
7
+ end
8
+ end
9
+
10
+ def assert_urls_are_not_understood(list_of_urls)
11
+ list_of_urls.each do |url|
12
+ assert_equal false, scm.understands_url?(url), "#{url} should not be understood by #{scm}!"
13
+ end
14
+ end
15
+
16
+ def scm
17
+ raise "#{self.class} needs to implement the method scm()"
18
+ end
19
+ end
@@ -0,0 +1,67 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
+
3
+ class TestGit < AbstractScmTestCase
4
+
5
+ GIT_URLS = [
6
+ "git://foo.com/bar.git",
7
+ "git:/path/to/repo",
8
+ "git:http://repo.com/project",
9
+ "http://github.com/user/project.git",
10
+ "http://github.com/user/project.git/",
11
+ "https://github.com/user/project.git",
12
+ "rsync://host.xz/repo.git",
13
+ "rsync://host.xz/repo.git/",
14
+ "ssh://host.xz/repo.git/",
15
+ "host.xz/repo.git",
16
+ "host.xz/repo.git/",
17
+ "user@host.xz/repo.git",
18
+ "user@host.xz/repo.git/",
19
+ "ssh://user@host.xz/repo.git/",
20
+ "ssh://user@host.xz:1234/path/to/repo.git",
21
+ "file:///path/to/local/repo.git",
22
+ "file:///path/to/local/repo.git/",
23
+ "/path/to/repo.git",
24
+ "/path/to/repo.git/" ]
25
+
26
+ def setup
27
+ @local_repo = create_local_repo
28
+ end
29
+
30
+ def teardown
31
+ FileUtils.rm_rf(@local_repo)
32
+ end
33
+
34
+ def test_knows_its_url
35
+ urls = [ "/repo", "file:///repo", "git://github.com/user/repo.git" ]
36
+ urls.each do |url|
37
+ assert_equal url, Blastr::SourceControl::Git.new(url).url
38
+ end
39
+ end
40
+
41
+ def test_git
42
+ assert_urls_are_understood(GIT_URLS)
43
+ end
44
+
45
+ def test_local_repository
46
+ local_repositories = [ @local_repo, "file://#{@local_repo}"]
47
+ assert_urls_are_understood(local_repositories)
48
+ end
49
+
50
+ def test_git_doesnt_claim_to_understand_a_local_non_repository_directory
51
+ parent_of_git_repo = File.dirname(@local_repo)
52
+ assert_urls_are_not_understood([ parent_of_git_repo ])
53
+ end
54
+
55
+ private
56
+
57
+ def create_local_repo
58
+ dir = File.join(Blastr::temp_dir, 'git_repo')
59
+ %x[git init #{dir}]
60
+ assert File.directory? dir
61
+ dir
62
+ end
63
+
64
+ def scm
65
+ Blastr::SourceControl::Git
66
+ end
67
+ end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
2
 
3
3
  class TestGitLogEntry < Test::Unit::TestCase
4
4
  COMMIT_HASH = "db4ace1c9ba6add9a2b08c153367e2b379f8fb4c"
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
+
3
+ class TestGitRevision < Test::Unit::TestCase
4
+
5
+ SAMPLE_SHA = "db4ace1c9ba6add9a2b08c153367e2b379f8fb4c"
6
+
7
+ def setup
8
+ @revision = Blastr::SourceControl::GitRevision.new(SAMPLE_SHA, Time.now - 100)
9
+ end
10
+
11
+ def test_to_s_prints_the_sha_hash
12
+ assert @revision.to_s == SAMPLE_SHA
13
+ end
14
+
15
+ def test_before_comparison_between_revisions
16
+ later_revision = Blastr::SourceControl::GitRevision.new(SAMPLE_SHA, @revision.date + 1)
17
+ assert @revision.before?(later_revision) == true
18
+ assert later_revision.before?(@revision) == false
19
+ end
20
+
21
+ def test_before_comparison_with_HEAD
22
+ head = Blastr::SourceControl::GitRevision.head
23
+ assert @revision.before?(head) == true
24
+ assert head.before?(@revision) == false
25
+ end
26
+
27
+ def test_only_HEAD_can_be_created_with_nil_date
28
+ assert_raise ArgumentError do
29
+ Blastr::SourceControl::GitRevision.new(SAMPLE_SHA, nil)
30
+ end
31
+ assert_nothing_raised do
32
+ Blastr::SourceControl::GitRevision.new("HEAD", nil)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.join(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
+ assert_not_equal create_log_entry(:revision => "1"), create_log_entry(:revision => "2")
7
+ assert_not_equal create_log_entry(:author => "John"), create_log_entry(:author => "Jane")
8
+ assert_not_equal create_log_entry(:comment => "Oh"), create_log_entry(:comment => "Yeah")
9
+ end
10
+
11
+ def test_prints_out_human_readably
12
+ entry = create_log_entry(:revision => "123", :author => "Lasse", :comment => "Fix")
13
+ assert_equal "revision 123 by Lasse: Fix", entry.to_s
14
+ end
15
+
16
+ private
17
+ def create_log_entry(args = {})
18
+ defaults = { :revision => "rev", :author => "author", :comment => "comment" }
19
+ args = defaults.update(args)
20
+ Blastr::SourceControl::LogEntry.new(args[:revision], args[:author], args[:comment])
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
+
3
+ class TestMercurial < AbstractScmTestCase
4
+
5
+ MERCURIAL_URLS = [
6
+ "hg:http://foo.com/hg",
7
+ "hg:http://foo.com/hg/",
8
+ "hg:/tmp/hg/repo",
9
+ "hg:/tmp/hg/repo/" ]
10
+
11
+ def test_mercurial_urls
12
+ assert_urls_are_understood(MERCURIAL_URLS)
13
+ end
14
+
15
+ def test_non_mercurial_urls
16
+ assert_urls_are_not_understood(["http://acme.com/foo"])
17
+ end
18
+
19
+ def scm
20
+ Blastr::SourceControl::Mercurial
21
+ end
22
+
23
+ end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
2
 
3
3
  class TestMercurialLogParsing < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
2
 
3
3
  class TestMercurialRevision < Test::Unit::TestCase
4
4
 
@@ -0,0 +1,60 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
+
3
+ class TestSubversion < AbstractScmTestCase
4
+
5
+ SVN_URLS = [
6
+ "http://foo.com/repo",
7
+ "http://foo.com/repo/",
8
+ "https://foo.com/repo",
9
+ "https://foo.com/repo/",
10
+ "svn:http://foo.com/svn",
11
+ "svn:http://foo.com/svn/",
12
+ "svn:https://foo.com/svn",
13
+ "svn://foo.com/svn" ]
14
+
15
+ def setup
16
+ @local_repo = create_local_repo
17
+ end
18
+
19
+ def teardown
20
+ FileUtils.rm_rf(@local_repo)
21
+ end
22
+
23
+ def test_knows_its_url
24
+ url = "file:///repo"
25
+ assert_equal url, scm.new(url).url
26
+ end
27
+
28
+ def test_local_repository_urls_enforce_the_file_scheme
29
+ repo = scm.new("/repo")
30
+ assert_equal "file:///repo", repo.url
31
+ end
32
+
33
+ def test_local_repository
34
+ local_repositories = [ @local_repo, "file://#{@local_repo}"]
35
+ assert_urls_are_understood(local_repositories)
36
+ end
37
+
38
+ def test_subversion_doesnt_claim_to_understand_a_local_non_repository_directory
39
+ parent_of_svn_repo = File.dirname(@local_repo)
40
+ assert_urls_are_not_understood([ parent_of_svn_repo ])
41
+ end
42
+
43
+ def test_subversion
44
+ assert_urls_are_understood(SVN_URLS)
45
+ end
46
+
47
+ private
48
+
49
+ def scm
50
+ Blastr::SourceControl::Subversion
51
+ end
52
+
53
+ def create_local_repo
54
+ dir = File.join(Blastr::temp_dir, 'svn_repo')
55
+ %x[svnadmin create #{dir}]
56
+ assert File.directory? dir
57
+ dir
58
+ end
59
+
60
+ end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
2
 
3
3
  class TestSubversionLogParsing < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
2
 
3
3
  class TestSubversionRevision < Test::Unit::TestCase
4
4
 
data/test/test_blastr.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper.rb'))
2
2
 
3
3
  class TestBlastrProcess < Test::Unit::TestCase
4
4
  def test_command_line_arguments_are_validated
data/test/test_helper.rb CHANGED
@@ -1,3 +1,19 @@
1
1
  require 'stringio'
2
2
  require 'test/unit'
3
- require File.dirname(__FILE__) + '/../lib/blastr'
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '../lib/blastr'))
4
+
5
+ class Test::Unit::TestCase
6
+ # implement a declaration 'abstract' that can be used to make
7
+ # a Test::Unit::TestCase subclass abstract without getting
8
+ # complaints about not defining any tests.
9
+ class << self
10
+ def abstract
11
+ self.class_eval do
12
+ def test_default
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ require File.expand_path(File.join(File.dirname(__FILE__), 'scm/abstract_scm_testcase.rb'))
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
2
2
  require 'mocha'
3
3
 
4
4
  class TestTTSImplementation < Test::Unit::TestCase
@@ -14,6 +14,13 @@ class TestCamelCaseSpelling < Test::Unit::TestCase
14
14
  Blastr::TTS.stubs(:resolve_tts_system).returns(@tts)
15
15
  end
16
16
 
17
+ def test_regular_statements_are_spelled_as_is
18
+ @tts.expects(:speak).with("Have you tried Blastr yet ?")
19
+ @tts.expects(:speak).with("Yes , I have .")
20
+ Blastr::TTS.speak("Have you tried Blastr yet?")
21
+ Blastr::TTS.speak("Yes, I have.")
22
+ end
23
+
17
24
  def test_spelling_out_camel_case_words
18
25
  @tts.expects(:speak).with("this is Camel Case")
19
26
  Blastr::TTS.speak("this is CamelCase")
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blastr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Lasse Koskela
@@ -9,39 +15,41 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-19 00:00:00 +02:00
18
+ date: 2010-09-23 00:00:00 +02:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: rubyforge
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
23
- version: 2.0.3
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: gemcutter
29
+ hash: 7
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 4
34
+ version: 2.0.4
27
35
  type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 0.3.0
34
- version:
36
+ version_requirements: *id001
35
37
  - !ruby/object:Gem::Dependency
36
38
  name: hoe
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
40
42
  requirements:
41
43
  - - ">="
42
44
  - !ruby/object:Gem::Version
43
- version: 2.5.0
44
- version:
45
+ hash: 19
46
+ segments:
47
+ - 2
48
+ - 6
49
+ - 2
50
+ version: 2.6.2
51
+ type: :development
52
+ version_requirements: *id002
45
53
  description: |-
46
54
  Blastr observes a version control repository for commits and makes audible
47
55
  announcements out of the commit messages. It currently supports Subversion,
@@ -70,6 +78,7 @@ files:
70
78
  - bin/blastr
71
79
  - config/website.yml
72
80
  - lib/blastr.rb
81
+ - lib/error.rb
73
82
  - lib/people/people.rb
74
83
  - lib/scm/git.rb
75
84
  - lib/scm/hg.rb
@@ -79,17 +88,21 @@ files:
79
88
  - script/console
80
89
  - script/destroy
81
90
  - script/generate
91
+ - test/people/test_people.rb
92
+ - test/scm/abstract_scm_testcase.rb
93
+ - test/scm/test_git.rb
94
+ - test/scm/test_git_log_entry.rb
95
+ - test/scm/test_git_revision.rb
96
+ - test/scm/test_log_entry.rb
97
+ - test/scm/test_mercurial.rb
98
+ - test/scm/test_mercurial_log.rb
99
+ - test/scm/test_mercurial_revision.rb
100
+ - test/scm/test_svn.rb
101
+ - test/scm/test_svn_log.rb
102
+ - test/scm/test_svn_revision.rb
82
103
  - test/test_blastr.rb
83
- - test/test_git_log_entry.rb
84
- - test/test_git_revision.rb
85
104
  - test/test_helper.rb
86
- - test/test_mercurial_log.rb
87
- - test/test_mercurial_revision.rb
88
- - test/test_scm_logentry.rb
89
- - test/test_scm_url_matching.rb
90
- - test/test_svn_log.rb
91
- - test/test_svn_revision.rb
92
- - test/test_tts.rb
105
+ - test/tts/test_tts.rb
93
106
  - website/index.html
94
107
  has_rdoc: true
95
108
  homepage: http://rubyforge.org/projects/blastr/
@@ -102,33 +115,42 @@ rdoc_options:
102
115
  require_paths:
103
116
  - lib
104
117
  required_ruby_version: !ruby/object:Gem::Requirement
118
+ none: false
105
119
  requirements:
106
120
  - - ">="
107
121
  - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
124
+ - 0
108
125
  version: "0"
109
- version:
110
126
  required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
111
128
  requirements:
112
129
  - - ">="
113
130
  - !ruby/object:Gem::Version
131
+ hash: 3
132
+ segments:
133
+ - 0
114
134
  version: "0"
115
- version:
116
135
  requirements: []
117
136
 
118
137
  rubyforge_project: blastr
119
- rubygems_version: 1.3.5
138
+ rubygems_version: 1.3.7
120
139
  signing_key:
121
140
  specification_version: 3
122
141
  summary: Blastr observes a version control repository for commits and makes audible announcements out of the commit messages
123
142
  test_files:
143
+ - test/people/test_people.rb
144
+ - test/scm/test_git.rb
145
+ - test/scm/test_git_log_entry.rb
146
+ - test/scm/test_git_revision.rb
147
+ - test/scm/test_log_entry.rb
148
+ - test/scm/test_mercurial.rb
149
+ - test/scm/test_mercurial_log.rb
150
+ - test/scm/test_mercurial_revision.rb
151
+ - test/scm/test_svn.rb
152
+ - test/scm/test_svn_log.rb
153
+ - test/scm/test_svn_revision.rb
124
154
  - test/test_blastr.rb
125
- - test/test_git_log_entry.rb
126
- - test/test_git_revision.rb
127
155
  - test/test_helper.rb
128
- - test/test_mercurial_log.rb
129
- - test/test_mercurial_revision.rb
130
- - test/test_scm_logentry.rb
131
- - test/test_scm_url_matching.rb
132
- - test/test_svn_log.rb
133
- - test/test_svn_revision.rb
134
- - test/test_tts.rb
156
+ - test/tts/test_tts.rb
@@ -1,35 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestGitRevision < Test::Unit::TestCase
4
-
5
- SAMPLE_SHA = "db4ace1c9ba6add9a2b08c153367e2b379f8fb4c"
6
-
7
- def setup
8
- @revision_with_date = Blastr::SourceControl::GitRevision.new(SAMPLE_SHA, Time.now - 100)
9
- @revision_without_date = Blastr::SourceControl::GitRevision.new(SAMPLE_SHA)
10
- end
11
-
12
- def test_to_s
13
- assert @revision_without_date.to_s == SAMPLE_SHA
14
- assert @revision_with_date.to_s == SAMPLE_SHA
15
- end
16
-
17
- def test_before_comparison_between_dated_revisions
18
- later_revision = Blastr::SourceControl::GitRevision.new(SAMPLE_SHA, @revision_with_date.date + 1)
19
- assert @revision_with_date.before?(later_revision) == true
20
- assert later_revision.before?(@revision_with_date) == false
21
- end
22
-
23
- def test_revision_defaults_its_date_to_now
24
- assert @revision_with_date.before?(@revision_without_date) == true
25
- assert @revision_without_date.before?(@revision_with_date) == false
26
- end
27
-
28
- def test_before_comparison_with_HEAD
29
- head = Blastr::SourceControl::GitRevision.new("HEAD")
30
- [@revision_with_date, @revision_without_date].each do |any_revision|
31
- assert any_revision.before?(head) == true
32
- assert head.before?(any_revision) == false
33
- end
34
- end
35
- end
@@ -1,13 +0,0 @@
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
@@ -1,58 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestScmURLMatching < Test::Unit::TestCase
4
-
5
- GIT_URLS = [
6
- "git://foo.com/bar.git",
7
- "git:/path/to/repo",
8
- "git:http://repo.com/project",
9
- "http://github.com/user/project.git",
10
- "http://github.com/user/project.git/",
11
- "https://github.com/user/project.git",
12
- "rsync://host.xz/repo.git",
13
- "rsync://host.xz/repo.git/",
14
- "ssh://host.xz/repo.git/",
15
- "host.xz/repo.git",
16
- "host.xz/repo.git/",
17
- "user@host.xz/repo.git",
18
- "user@host.xz/repo.git/",
19
- "ssh://user@host.xz/repo.git/",
20
- "ssh://user@host.xz:1234/path/to/repo.git",
21
- "file:///path/to/local/repo.git",
22
- "file:///path/to/local/repo.git/",
23
- "/path/to/repo.git",
24
- "/path/to/repo.git/" ]
25
- MERCURIAL_URLS = [
26
- "hg:http://foo.com/hg",
27
- "hg:http://foo.com/hg/",
28
- "hg:/tmp/hg/repo",
29
- "hg:/tmp/hg/repo/" ]
30
- SVN_URLS = [
31
- "http://foo.com/repo",
32
- "http://foo.com/repo/",
33
- "https://foo.com/repo",
34
- "https://foo.com/repo/",
35
- "svn:http://foo.com/svn",
36
- "svn:http://foo.com/svn/",
37
- "svn:https://foo.com/svn",
38
- "svn://foo.com/svn" ]
39
-
40
- def test_subversion
41
- assert_urls_are_understood_by(Blastr::SourceControl::Subversion, SVN_URLS)
42
- end
43
-
44
- def test_git
45
- assert_urls_are_understood_by(Blastr::SourceControl::Git, GIT_URLS)
46
- end
47
-
48
- def test_mercurial
49
- assert_urls_are_understood_by(Blastr::SourceControl::Mercurial, MERCURIAL_URLS)
50
- end
51
-
52
- private
53
- def assert_urls_are_understood_by(scm, list_of_urls)
54
- list_of_urls.each do |url|
55
- assert scm.understands_url?(url), "#{url} should be understood by #{scm}!"
56
- end
57
- end
58
- end