blastr 0.2.0 → 0.2.1
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 +4 -0
- data/Rakefile +19 -0
- data/lib/blastr.rb +1 -0
- data/lib/error.rb +1 -0
- data/lib/filesystem.rb +1 -0
- data/lib/people/people.rb +1 -0
- data/lib/scm/git.rb +6 -0
- data/lib/scm/hg.rb +1 -0
- data/lib/scm/scm.rb +4 -0
- data/lib/scm/svn.rb +2 -1
- data/lib/tts/tts.rb +1 -0
- data/lib/version.rb +2 -1
- data/test/people/test_people.rb +1 -0
- data/test/scm/abstract_scm_testcase.rb +1 -0
- data/test/scm/test_git.rb +36 -0
- data/test/scm/test_git_log_entry.rb +1 -0
- data/test/scm/test_git_revision.rb +1 -0
- data/test/scm/test_log_entry.rb +1 -0
- data/test/scm/test_mercurial.rb +25 -0
- data/test/scm/test_mercurial_revision.rb +1 -0
- data/test/scm/test_svn.rb +24 -1
- data/test/scm/test_svn_revision.rb +1 -0
- data/test/test_blastr.rb +1 -0
- data/test/test_filesystem.rb +1 -0
- data/test/test_helper.rb +1 -0
- data/test/tts/test_tts.rb +1 -0
- metadata +5 -5
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -9,4 +9,23 @@ Rake::TestTask.new do |t|
|
|
9
9
|
t.libs << "test"
|
10
10
|
t.test_files = FileList['test/**/test*.rb']
|
11
11
|
t.verbose = false
|
12
|
+
end
|
13
|
+
|
14
|
+
ENCODING_HEADER = "# encoding: UTF-8"
|
15
|
+
desc "Add UTF-8 encoding to source files"
|
16
|
+
task :encoding do
|
17
|
+
FileList['test/**/*.rb', 'lib/**/*.rb'].each do |filename|
|
18
|
+
open(filename, 'r+') do |f|
|
19
|
+
beginning_of_file = f.pos
|
20
|
+
first_line = f.readline
|
21
|
+
f.seek(beginning_of_file)
|
22
|
+
original_content = f.read
|
23
|
+
f.seek(beginning_of_file)
|
24
|
+
unless first_line.strip == ENCODING_HEADER.strip
|
25
|
+
puts "Adding '#{ENCODING_HEADER}' to #{filename}"
|
26
|
+
f.write("#{ENCODING_HEADER}\n")
|
27
|
+
f.write(original_content)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
12
31
|
end
|
data/lib/blastr.rb
CHANGED
data/lib/error.rb
CHANGED
data/lib/filesystem.rb
CHANGED
data/lib/people/people.rb
CHANGED
data/lib/scm/git.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require 'git'
|
2
3
|
require File.expand_path(File.join(File.dirname(__FILE__), 'scm.rb'))
|
3
4
|
|
@@ -33,6 +34,11 @@ module Blastr::SourceControl
|
|
33
34
|
def self.head
|
34
35
|
GitRevision.new("HEAD", nil)
|
35
36
|
end
|
37
|
+
|
38
|
+
def ==(other)
|
39
|
+
return false unless other.is_a? GitRevision
|
40
|
+
other.name == @name and other.date == @date
|
41
|
+
end
|
36
42
|
end
|
37
43
|
|
38
44
|
class Git
|
data/lib/scm/hg.rb
CHANGED
data/lib/scm/scm.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
module Blastr::SourceControl
|
2
3
|
|
3
4
|
class LogEntry
|
4
5
|
attr_accessor :revision, :author, :comment
|
6
|
+
|
5
7
|
def initialize(revision, author, comment)
|
6
8
|
@revision = revision
|
7
9
|
@author = author
|
8
10
|
@comment = comment
|
9
11
|
end
|
12
|
+
|
10
13
|
def ==(other)
|
11
14
|
@revision == other.revision and @author == other.author and @comment == other.comment
|
12
15
|
end
|
16
|
+
|
13
17
|
def to_s
|
14
18
|
"revision #{@revision} by #{@author}: #{@comment}"
|
15
19
|
end
|
data/lib/scm/svn.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require 'fileutils'
|
2
3
|
require File.expand_path(File.join(File.dirname(__FILE__), 'scm.rb'))
|
3
4
|
|
@@ -48,7 +49,7 @@ module Blastr::SourceControl
|
|
48
49
|
def latest_revision
|
49
50
|
entries = commits_since(as_revision("HEAD"))
|
50
51
|
return entries.first.revision unless entries.empty?
|
51
|
-
1
|
52
|
+
SubversionRevision.new("1")
|
52
53
|
end
|
53
54
|
|
54
55
|
def commits_since(since_revision = 1)
|
data/lib/tts/tts.rb
CHANGED
data/lib/version.rb
CHANGED
data/test/people/test_people.rb
CHANGED
data/test/scm/test_git.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
|
2
3
|
|
3
4
|
class TestGit < AbstractScmTestCase
|
@@ -51,6 +52,27 @@ class TestGit < AbstractScmTestCase
|
|
51
52
|
parent_of_git_repo = File.dirname(@local_repo)
|
52
53
|
assert_urls_are_not_understood([ parent_of_git_repo ])
|
53
54
|
end
|
55
|
+
|
56
|
+
def test_detects_latest_revision_from_commit_log
|
57
|
+
latest_commit_sha = "LaT35tR3v1510N"
|
58
|
+
head_minus_one = revision("HEAD~1")
|
59
|
+
repo = scm.new("file:///fakerepo")
|
60
|
+
repo.expects(:as_revision).with("HEAD~1").returns(head_minus_one)
|
61
|
+
repo.expects(:commits_since).with(head_minus_one).returns([
|
62
|
+
logentry(commit(latest_commit_sha))
|
63
|
+
])
|
64
|
+
assert_equal revision(latest_commit_sha), repo.latest_revision
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_latest_revision_for_empty_log_defaults_to_revision_1
|
68
|
+
head = revision("HEAD")
|
69
|
+
head_minus_one = revision("HEAD~1")
|
70
|
+
repo = scm.new("file:///fakerepo")
|
71
|
+
repo.expects(:as_revision).with("HEAD~1").returns(head_minus_one)
|
72
|
+
repo.expects(:as_revision).with("HEAD").returns(head)
|
73
|
+
repo.expects(:commits_since).with(head_minus_one).returns([])
|
74
|
+
assert_equal head, repo.latest_revision
|
75
|
+
end
|
54
76
|
|
55
77
|
private
|
56
78
|
|
@@ -60,6 +82,20 @@ class TestGit < AbstractScmTestCase
|
|
60
82
|
assert File.directory? dir
|
61
83
|
dir
|
62
84
|
end
|
85
|
+
|
86
|
+
def commit(sha, options = {})
|
87
|
+
defaults = { :date => "FAKE DATE", :author => stub(:name => "author"), :message => "message" }
|
88
|
+
commit_data = defaults.merge(options.merge(:sha => sha))
|
89
|
+
stub(commit_data)
|
90
|
+
end
|
91
|
+
|
92
|
+
def logentry(commit)
|
93
|
+
Blastr::SourceControl::GitLogEntry.new(commit)
|
94
|
+
end
|
95
|
+
|
96
|
+
def revision(sha, date = "FAKE DATE")
|
97
|
+
Blastr::SourceControl::GitRevision.new(sha, date)
|
98
|
+
end
|
63
99
|
|
64
100
|
def scm
|
65
101
|
Blastr::SourceControl::Git
|
data/test/scm/test_log_entry.rb
CHANGED
data/test/scm/test_mercurial.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
|
2
3
|
|
3
4
|
class TestMercurial < AbstractScmTestCase
|
@@ -16,8 +17,32 @@ class TestMercurial < AbstractScmTestCase
|
|
16
17
|
assert_urls_are_not_understood(["http://acme.com/foo"])
|
17
18
|
end
|
18
19
|
|
20
|
+
def test_detects_latest_revision_from_commit_log
|
21
|
+
repo = scm.new("hg:/fakerepo")
|
22
|
+
repo.expects(:commits_since).with(revision("tip")).returns([
|
23
|
+
logentry(revision("15"), "author", "comment")
|
24
|
+
])
|
25
|
+
assert_equal revision("15"), repo.latest_revision
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_latest_revision_for_empty_log_defaults_to_revision_1
|
29
|
+
repo = scm.new("hg:/fakerepo")
|
30
|
+
repo.expects(:commits_since).with(revision("tip")).returns([])
|
31
|
+
assert_equal revision("tip"), repo.latest_revision
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
19
36
|
def scm
|
20
37
|
Blastr::SourceControl::Mercurial
|
21
38
|
end
|
39
|
+
|
40
|
+
def logentry(revision, author = "johndoe", comment = "Small fix")
|
41
|
+
Blastr::SourceControl::LogEntry.new(revision, author, comment)
|
42
|
+
end
|
43
|
+
|
44
|
+
def revision(value)
|
45
|
+
Blastr::SourceControl::MercurialRevision.new(value)
|
46
|
+
end
|
22
47
|
|
23
48
|
end
|
data/test/scm/test_svn.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper.rb'))
|
2
3
|
|
3
4
|
class TestSubversion < AbstractScmTestCase
|
@@ -40,9 +41,23 @@ class TestSubversion < AbstractScmTestCase
|
|
40
41
|
assert_urls_are_not_understood([ parent_of_svn_repo ])
|
41
42
|
end
|
42
43
|
|
43
|
-
def
|
44
|
+
def test_subversion_urls_are_understood
|
44
45
|
assert_urls_are_understood(SVN_URLS)
|
45
46
|
end
|
47
|
+
|
48
|
+
def test_detects_latest_revision_from_commit_log
|
49
|
+
repo = scm.new("/fakerepo")
|
50
|
+
repo.expects(:commits_since).with(revision("HEAD")).returns([
|
51
|
+
logentry(revision("15"), "author", "comment")
|
52
|
+
])
|
53
|
+
assert_equal revision("15"), repo.latest_revision
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_latest_revision_for_empty_log_defaults_to_revision_1
|
57
|
+
repo = scm.new("/fakerepo")
|
58
|
+
repo.expects(:commits_since).with(revision("HEAD")).returns([])
|
59
|
+
assert_equal revision("1"), repo.latest_revision
|
60
|
+
end
|
46
61
|
|
47
62
|
private
|
48
63
|
|
@@ -50,6 +65,14 @@ class TestSubversion < AbstractScmTestCase
|
|
50
65
|
Blastr::SourceControl::Subversion
|
51
66
|
end
|
52
67
|
|
68
|
+
def logentry(revision, author = "johndoe", comment = "Small fix")
|
69
|
+
Blastr::SourceControl::LogEntry.new(revision, author, comment)
|
70
|
+
end
|
71
|
+
|
72
|
+
def revision(value)
|
73
|
+
Blastr::SourceControl::SubversionRevision.new(value)
|
74
|
+
end
|
75
|
+
|
53
76
|
def create_local_repo
|
54
77
|
dir = File.join(Blastr::FileSystem.temp_dir, 'svn_repo')
|
55
78
|
%x[svnadmin create #{dir}]
|
data/test/test_blastr.rb
CHANGED
data/test/test_filesystem.rb
CHANGED
data/test/test_helper.rb
CHANGED
data/test/tts/test_tts.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-12-17 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mocha
|
16
|
-
requirement: &
|
16
|
+
requirement: &70357899010860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70357899010860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: git
|
27
|
-
requirement: &
|
27
|
+
requirement: &70357899010420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70357899010420
|
36
36
|
description: Blastr observes a version control repository for commits and makes audible
|
37
37
|
announcements out of the commit messages.
|
38
38
|
email:
|