blastr 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Manifest.txt +6 -0
- data/README.rdoc +41 -18
- data/config/website.yml +2 -0
- data/lib/blastr.rb +3 -3
- data/lib/scm/hg.rb +92 -0
- data/lib/scm/scm.rb +1 -0
- data/lib/scm/svn.rb +1 -1
- data/test/test_blastr.rb +15 -0
- data/test/test_mercurial_revision.rb +23 -0
- data/test/test_scm_url_matching.rb +34 -0
- data/website/index.html +10 -0
- metadata +14 -5
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.0.10 2009-01-18
|
2
|
+
|
3
|
+
* Added support for Mercurial
|
4
|
+
- The URL for Mercurial repositories needs to be prefixed with "hg:" when
|
5
|
+
invoking Blastr because you can't tell by looking at a URL whether it's
|
6
|
+
a Mercurial repository or a Subversion repository.
|
7
|
+
|
1
8
|
== 0.0.9 2009-01-17
|
2
9
|
|
3
10
|
* Added usage instructions.
|
data/Manifest.txt
CHANGED
@@ -4,17 +4,23 @@ PostInstall.txt
|
|
4
4
|
README.rdoc
|
5
5
|
Rakefile
|
6
6
|
bin/blastr
|
7
|
+
config/website.yml
|
7
8
|
lib/blastr.rb
|
8
9
|
lib/people/people.rb
|
9
10
|
lib/scm/git.rb
|
11
|
+
lib/scm/hg.rb
|
10
12
|
lib/scm/scm.rb
|
11
13
|
lib/scm/svn.rb
|
12
14
|
lib/tts/tts.rb
|
13
15
|
script/console
|
14
16
|
script/destroy
|
15
17
|
script/generate
|
18
|
+
test/test_blastr.rb
|
16
19
|
test/test_git_log_entry.rb
|
17
20
|
test/test_git_revision.rb
|
18
21
|
test/test_helper.rb
|
22
|
+
test/test_mercurial_revision.rb
|
23
|
+
test/test_scm_url_matching.rb
|
19
24
|
test/test_svn_revision.rb
|
20
25
|
test/test_tts.rb
|
26
|
+
website/index.html
|
data/README.rdoc
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
=
|
1
|
+
= DESCRIPTION:
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Blastr observes a version control repository for commits and makes audible announcements out of the commit messages. It currently supports Subversion and Git on Linux and OS X, possibly on other UNIX-like operating systems as well.
|
3
|
+
Blastr observes a version control repository for commits and makes audible
|
4
|
+
announcements out of the commit messages. It currently supports Subversion
|
5
|
+
and Git on Linux and OS X, possibly on other UNIX-like operating systems as well.
|
8
6
|
|
9
7
|
== FEATURES:
|
10
8
|
|
@@ -12,32 +10,57 @@ Blastr watches for incoming commits to a source repository and voices the commit
|
|
12
10
|
messages out loud.
|
13
11
|
|
14
12
|
The supported version control systems include:
|
15
|
-
|
16
|
-
|
13
|
+
|
14
|
+
* Subversion[http://subversion.tigris.org]
|
15
|
+
* Git[http://git-scm.com]
|
16
|
+
* Mercurial[http://www.selenic.com/mercurial]
|
17
17
|
|
18
18
|
The supported operating systems (for running Blastr) include:
|
19
|
-
|
20
|
-
|
19
|
+
|
20
|
+
* Mac OS X
|
21
|
+
* Linux (requires the eSpeak[http://espeak.sourceforge.net/] or Festival[http://www.cstr.ed.ac.uk/projects/festival/] text-to-speech utility)
|
21
22
|
|
22
23
|
== SYNOPSIS:
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
blastr http://svn.acme.com/foo/trunk
|
27
|
-
|
25
|
+
Subversion:
|
26
|
+
|
27
|
+
blastr http://svn.acme.com/foo/trunk
|
28
|
+
|
29
|
+
blastr http://svn.acme.com/foo/trunk 123
|
30
|
+
|
31
|
+
Git:
|
32
|
+
|
33
|
+
blastr git://github.com/lkoskela/blastr.git
|
34
|
+
|
35
|
+
blastr git://github.com/lkoskela/blastr.git e528509fddd57194f1c497ce6583f6869e8ed62c
|
36
|
+
|
37
|
+
Mercurial:
|
38
|
+
|
39
|
+
blastr hg:http://hg.serpentine.com/tutorial/hello
|
40
|
+
|
41
|
+
blastr hg:http://hg.serpentine.com/tutorial/hello 2
|
28
42
|
|
29
43
|
== REQUIREMENTS:
|
30
44
|
|
31
|
-
Blastr depends on the
|
32
|
-
|
45
|
+
Blastr depends on the git[http://git.rubyforge.org/] gem (>= 1.0.5).
|
46
|
+
This dependency should be installed automatically when you install
|
47
|
+
Blastr with <tt>gem install blastr</tt>.
|
48
|
+
|
49
|
+
Blastr also depends on the standard command line client for the source
|
50
|
+
repository in question being in the user's PATH. For example, in order
|
51
|
+
to observe a Subversion repository the "svn" executable needs to be in
|
52
|
+
PATH. For Git, the "git" executable needs to be in PATH. For Mercurial,
|
53
|
+
"hg" needs to be in PATH.
|
33
54
|
|
34
55
|
== INSTALL:
|
35
56
|
|
36
|
-
sudo gem install blastr
|
57
|
+
sudo gem install blastr
|
37
58
|
|
38
59
|
== KNOWN PROBLEMS AND GOTCHAS:
|
39
60
|
|
40
|
-
|
61
|
+
Blastr doesn't treat non-ASCII characters in commit messages too well.
|
62
|
+
In other words, the developers make no promises whatsoever regarding
|
63
|
+
Blastr's behavior when encountering weird Norwegian scribble.
|
41
64
|
|
42
65
|
== LICENSE:
|
43
66
|
|
data/config/website.yml
ADDED
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.
|
9
|
+
VERSION = '0.0.10'
|
10
10
|
|
11
11
|
class UsageError < ArgumentError
|
12
12
|
|
@@ -38,7 +38,7 @@ EOS
|
|
38
38
|
end
|
39
39
|
|
40
40
|
class Process
|
41
|
-
def initialize(args
|
41
|
+
def initialize(args)
|
42
42
|
validate(args)
|
43
43
|
scm_url = args[0]
|
44
44
|
@scm = Blastr::SourceControl.implementation_for(scm_url)
|
@@ -68,7 +68,7 @@ EOS
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
|
-
def validate(args)
|
71
|
+
def validate(args=[])
|
72
72
|
raise UsageError.new if args.size == 0 or args.size > 2
|
73
73
|
end
|
74
74
|
end
|
data/lib/scm/hg.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require File.dirname(__FILE__) + '/scm.rb'
|
3
|
+
|
4
|
+
module Blastr::SourceControl
|
5
|
+
|
6
|
+
class MercurialRevision
|
7
|
+
attr_accessor :name
|
8
|
+
|
9
|
+
def initialize(name)
|
10
|
+
@name = name
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
@name
|
15
|
+
end
|
16
|
+
|
17
|
+
def before?(revision)
|
18
|
+
return false if @name == "tip"
|
19
|
+
return true if revision.name == "tip"
|
20
|
+
@name.to_i < revision.name.to_i
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Mercurial
|
25
|
+
def name; "Mercurial"; end
|
26
|
+
|
27
|
+
def self.understands_url?(url)
|
28
|
+
url.index("hg:http") == 0
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(repo_url)
|
32
|
+
@repo_url = $1 if repo_url =~ /hg:(.*)/
|
33
|
+
end
|
34
|
+
|
35
|
+
def as_revision(arg)
|
36
|
+
raise "Invalid revision: #{arg}" unless arg =~ /^(tip)|([\d\w:-]+)$/
|
37
|
+
MercurialRevision.new(arg)
|
38
|
+
end
|
39
|
+
|
40
|
+
def latest_revision
|
41
|
+
commits = commits_since(as_revision("tip"))
|
42
|
+
return as_revision("tip") unless commits.size > 0
|
43
|
+
MercurialRevision.new(commits.last.revision.to_s)
|
44
|
+
end
|
45
|
+
|
46
|
+
def commits_since(revision)
|
47
|
+
with_clone do
|
48
|
+
hg_log(revision.to_s)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def hg_log(revision = 0)
|
54
|
+
nonascii = /([^a-zA-Z0-9\.,:;\-_\?!"'\s]+?)/u
|
55
|
+
entries = []
|
56
|
+
current_changeset = {}
|
57
|
+
%x[hg log -r #{revision}:].each_line do |line|
|
58
|
+
if line =~ /^changeset:\s+(.+?):(.+?)$/
|
59
|
+
entries << current_changeset unless current_changeset.empty?
|
60
|
+
current_changeset = { :revision => $1, :hash => $2 }
|
61
|
+
elsif line =~ /^user:\s+(.+?)(\s<(.+?)@(.+?)>)?$/
|
62
|
+
current_changeset[:author] = $1
|
63
|
+
elsif line =~ /^summary:\s+(.+?)$/
|
64
|
+
current_changeset[:comment] = $1.strip
|
65
|
+
elsif current_changeset.key? :comment
|
66
|
+
current_changeset[:comment] = "#{current_changeset[:comment]} #{line.strip}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
entries << current_changeset unless current_changeset.empty?
|
70
|
+
|
71
|
+
entries.collect do |map|
|
72
|
+
LogEntry.new(as_revision(map[:revision]), map[:author], map[:comment].gsub(nonascii, 'X '))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def with_clone
|
77
|
+
clone_dir = Blastr::temp_dir
|
78
|
+
%x[hg clone #{@repo_url} #{clone_dir}]
|
79
|
+
current_dir = Dir.pwd
|
80
|
+
Dir.chdir(clone_dir)
|
81
|
+
begin
|
82
|
+
yield
|
83
|
+
ensure
|
84
|
+
Dir.chdir(current_dir)
|
85
|
+
FileUtils.remove_dir(clone_dir, :force => true)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
Blastr::SourceControl.register_implementation(Blastr::SourceControl::Mercurial)
|
data/lib/scm/scm.rb
CHANGED
data/lib/scm/svn.rb
CHANGED
data/test/test_blastr.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestBlastrProcess < Test::Unit::TestCase
|
4
|
+
def test_command_line_arguments_are_validated
|
5
|
+
assert_raise Blastr::UsageError do
|
6
|
+
Blastr::Process.new([])
|
7
|
+
end
|
8
|
+
assert_raise Blastr::UsageError do
|
9
|
+
Blastr::Process.new(["http://svn.com", "123", "too-much"])
|
10
|
+
end
|
11
|
+
assert_nothing_raised do
|
12
|
+
Blastr::Process.new(["http://svn.com", "123"])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestMercurialRevision < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_to_s
|
6
|
+
rev = Blastr::SourceControl::MercurialRevision.new("123")
|
7
|
+
assert rev.to_s == "123"
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_before_comparison_between_revisions
|
11
|
+
rev123 = Blastr::SourceControl::MercurialRevision.new("123")
|
12
|
+
rev456 = Blastr::SourceControl::MercurialRevision.new("456")
|
13
|
+
assert rev123.before?(rev456) == true
|
14
|
+
assert rev456.before?(rev123) == false
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_before_comparison_with_tip
|
18
|
+
rev = Blastr::SourceControl::MercurialRevision.new("100")
|
19
|
+
tip = Blastr::SourceControl::MercurialRevision.new("tip")
|
20
|
+
assert rev.before?(tip) == true
|
21
|
+
assert tip.before?(rev) == false
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestScmURLMatching < Test::Unit::TestCase
|
4
|
+
GIT_URL = "git://foo.com/bar.git"
|
5
|
+
MERCURIAL_URL = "hg:http://foo.com/svn"
|
6
|
+
SVN_HTTP_URL = "http://foo.com/svn"
|
7
|
+
SVN_HTTPS_URL = "https://foo.com/svn"
|
8
|
+
SVN_NATIVE_URL = "svn://foo.com/svn"
|
9
|
+
SVN_URLS = [ SVN_HTTP_URL, SVN_HTTPS_URL, SVN_NATIVE_URL ]
|
10
|
+
ALL_URLS = [ SVN_URLS, GIT_URL, MERCURIAL_URL ].flatten
|
11
|
+
|
12
|
+
def test_subversion
|
13
|
+
SVN_URLS.each do |url|
|
14
|
+
assert Blastr::SourceControl::Subversion.understands_url?(url), "#{url} should be a Subversion URL!"
|
15
|
+
end
|
16
|
+
ALL_URLS.reject {|url| SVN_URLS.include?(url) }.each do |url|
|
17
|
+
assert Blastr::SourceControl::Subversion.understands_url?(url) == false, "#{url} should not be a Subversion URL!"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_git
|
22
|
+
assert Blastr::SourceControl::Git.understands_url?(GIT_URL)
|
23
|
+
ALL_URLS.reject {|url| url == GIT_URL }.each do |url|
|
24
|
+
assert Blastr::SourceControl::Git.understands_url?(url) == false, "#{url} should not be a Git URL!"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_mercurial
|
29
|
+
assert Blastr::SourceControl::Mercurial.understands_url?(MERCURIAL_URL)
|
30
|
+
ALL_URLS.reject {|url| url == MERCURIAL_URL }.each do |url|
|
31
|
+
assert Blastr::SourceControl::Mercurial.understands_url?(url) == false, "#{url} should not be a Mercurial URL!"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/website/index.html
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Blastr</title>
|
5
|
+
<meta HTTP-EQUIV="REFRESH" content="0; url=http://blastr.rubyforge.org/rdoc">
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<p>Redirecting to <a href="rdoc">Blastr documentation</a>...
|
9
|
+
</body>
|
10
|
+
</html>
|
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.
|
4
|
+
version: 0.0.10
|
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-
|
12
|
+
date: 2009-01-18 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.8.0
|
44
44
|
version:
|
45
|
-
description: Blastr observes a version control repository for commits and makes audible
|
45
|
+
description: Blastr observes a version control repository for commits and makes audible announcements out of the commit messages. It currently supports Subversion and Git on Linux and OS X, possibly on other UNIX-like operating systems as well.
|
46
46
|
email:
|
47
47
|
- lasse.koskela@gmail.com
|
48
48
|
executables:
|
@@ -61,22 +61,28 @@ files:
|
|
61
61
|
- README.rdoc
|
62
62
|
- Rakefile
|
63
63
|
- bin/blastr
|
64
|
+
- config/website.yml
|
64
65
|
- lib/blastr.rb
|
65
66
|
- lib/people/people.rb
|
66
67
|
- lib/scm/git.rb
|
68
|
+
- lib/scm/hg.rb
|
67
69
|
- lib/scm/scm.rb
|
68
70
|
- lib/scm/svn.rb
|
69
71
|
- lib/tts/tts.rb
|
70
72
|
- script/console
|
71
73
|
- script/destroy
|
72
74
|
- script/generate
|
75
|
+
- test/test_blastr.rb
|
73
76
|
- test/test_git_log_entry.rb
|
74
77
|
- test/test_git_revision.rb
|
75
78
|
- test/test_helper.rb
|
79
|
+
- test/test_mercurial_revision.rb
|
80
|
+
- test/test_scm_url_matching.rb
|
76
81
|
- test/test_svn_revision.rb
|
77
82
|
- test/test_tts.rb
|
83
|
+
- website/index.html
|
78
84
|
has_rdoc: true
|
79
|
-
homepage:
|
85
|
+
homepage: "Blastr observes a version control repository for commits and makes audible "
|
80
86
|
post_install_message:
|
81
87
|
rdoc_options:
|
82
88
|
- --main
|
@@ -101,10 +107,13 @@ rubyforge_project: blastr
|
|
101
107
|
rubygems_version: 1.2.0
|
102
108
|
signing_key:
|
103
109
|
specification_version: 2
|
104
|
-
summary: Blastr observes a version control repository for commits and makes audible
|
110
|
+
summary: Blastr observes a version control repository for commits and makes audible announcements out of the commit messages
|
105
111
|
test_files:
|
112
|
+
- test/test_blastr.rb
|
106
113
|
- test/test_git_log_entry.rb
|
107
114
|
- test/test_git_revision.rb
|
108
115
|
- test/test_helper.rb
|
116
|
+
- test/test_mercurial_revision.rb
|
117
|
+
- test/test_scm_url_matching.rb
|
109
118
|
- test/test_svn_revision.rb
|
110
119
|
- test/test_tts.rb
|