bob 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bob.gemspec +2 -2
- data/lib/bob/builder.rb +1 -1
- data/lib/bob/scm/abstract.rb +1 -1
- data/lib/bob/scm/git.rb +4 -4
- data/lib/bob/scm/svn.rb +5 -5
- data/lib/bob/test/repo.rb +6 -6
- data/test/mixin/scm.rb +7 -7
- data/test/test_test.rb +2 -2
- metadata +2 -2
data/bob.gemspec
CHANGED
data/lib/bob/builder.rb
CHANGED
data/lib/bob/scm/abstract.rb
CHANGED
data/lib/bob/scm/git.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Bob
|
2
2
|
module SCM
|
3
3
|
class Git < Abstract
|
4
|
-
def
|
5
|
-
format = "---%
|
6
|
-
"<%ae>%nmessage: >-%n %s%
|
4
|
+
def metadata(commit)
|
5
|
+
format = "---%nid: %H%nauthor: %an " \
|
6
|
+
"<%ae>%nmessage: >-%n %s%ntimestamp: %ci%n"
|
7
7
|
|
8
8
|
dump = YAML.load(`cd #{dir_for(commit)} && git show -s \
|
9
9
|
--pretty=format:"#{format}" #{commit}`)
|
10
10
|
|
11
|
-
dump.update("
|
11
|
+
dump.update("timestamp" => Time.parse(dump["timestamp"]))
|
12
12
|
end
|
13
13
|
|
14
14
|
def head
|
data/lib/bob/scm/svn.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Bob
|
2
2
|
module SCM
|
3
3
|
class Svn < Abstract
|
4
|
-
def
|
4
|
+
def metadata(rev)
|
5
5
|
dump = `svn log --non-interactive --revision #{rev} #{uri}`.split("\n")
|
6
6
|
meta = dump[1].split(" | ")
|
7
7
|
|
8
|
-
{ "
|
9
|
-
"message"
|
10
|
-
"author"
|
11
|
-
"
|
8
|
+
{ "id" => rev,
|
9
|
+
"message" => dump[3],
|
10
|
+
"author" => meta[1],
|
11
|
+
"timestamp" => Time.parse(meta[2]) }
|
12
12
|
end
|
13
13
|
|
14
14
|
def head
|
data/lib/bob/test/repo.rb
CHANGED
@@ -35,7 +35,7 @@ module Bob::Test
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def head
|
38
|
-
commits.last["
|
38
|
+
commits.last["id"]
|
39
39
|
end
|
40
40
|
|
41
41
|
def short_head
|
@@ -96,8 +96,8 @@ SH
|
|
96
96
|
Dir.chdir(@path) {
|
97
97
|
`git log --pretty=oneline`.collect { |l| l.split(" ").first }.
|
98
98
|
inject([]) { |acc, sha1|
|
99
|
-
fmt = "---%nmessage: >-%n %s%ntimestamp: %ci%n"
|
100
|
-
"
|
99
|
+
fmt = "---%nmessage: >-%n %s%ntimestamp: %ci%n" \
|
100
|
+
"id: %H%nauthor: %n name: %an%n email: %ae%n"
|
101
101
|
acc << YAML.load(`git show -s --pretty=format:"#{fmt}" #{sha1}`)
|
102
102
|
}.reverse
|
103
103
|
}
|
@@ -153,9 +153,9 @@ SH
|
|
153
153
|
Dir.chdir(@path) do
|
154
154
|
doc = Hpricot::XML(`svn log --xml`)
|
155
155
|
(doc/:log/:logentry).inject([]) { |acc, c|
|
156
|
-
acc << { "
|
157
|
-
"message"
|
158
|
-
"
|
156
|
+
acc << { "id" => c["revision"],
|
157
|
+
"message" => c.at("msg").inner_html,
|
158
|
+
"timestamp" => Time.parse(c.at("date").inner_html) }
|
159
159
|
}.reverse
|
160
160
|
end
|
161
161
|
end
|
data/test/mixin/scm.rb
CHANGED
@@ -4,7 +4,7 @@ module ScmTest
|
|
4
4
|
def test_successful_build
|
5
5
|
repo.add_successful_commit
|
6
6
|
|
7
|
-
commit_id = repo.commits.last["
|
7
|
+
commit_id = repo.commits.last["id"]
|
8
8
|
|
9
9
|
buildable = BuilderStub.for(@repo, commit_id)
|
10
10
|
buildable.build
|
@@ -12,14 +12,14 @@ module ScmTest
|
|
12
12
|
assert_equal :successful, buildable.status
|
13
13
|
assert_equal "Running tests...\n", buildable.output
|
14
14
|
assert_equal "This commit will work", buildable.commit_info["message"]
|
15
|
-
assert_equal commit_id, buildable.commit_info["
|
16
|
-
assert buildable.commit_info["
|
15
|
+
assert_equal commit_id, buildable.commit_info["id"]
|
16
|
+
assert buildable.commit_info["timestamp"].is_a?(Time)
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_failed_build
|
20
20
|
repo.add_failing_commit
|
21
21
|
|
22
|
-
commit_id = repo.commits.last["
|
22
|
+
commit_id = repo.commits.last["id"]
|
23
23
|
buildable = BuilderStub.for(@repo, commit_id)
|
24
24
|
|
25
25
|
buildable.build
|
@@ -27,8 +27,8 @@ module ScmTest
|
|
27
27
|
assert_equal :failed, buildable.status
|
28
28
|
assert_equal "Running tests...\n", buildable.output
|
29
29
|
assert_equal "This commit will fail", buildable.commit_info["message"]
|
30
|
-
assert_equal commit_id, buildable.commit_info["
|
31
|
-
assert buildable.commit_info["
|
30
|
+
assert_equal commit_id, buildable.commit_info["id"]
|
31
|
+
assert buildable.commit_info["timestamp"].is_a?(Time)
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_head
|
@@ -41,6 +41,6 @@ module ScmTest
|
|
41
41
|
|
42
42
|
assert_equal :successful, buildable.status
|
43
43
|
assert_equal "Running tests...\n", buildable.output
|
44
|
-
assert_equal repo.head, buildable.commit_info["
|
44
|
+
assert_equal repo.head, buildable.commit_info["id"]
|
45
45
|
end
|
46
46
|
end
|
data/test/test_test.rb
CHANGED
@@ -10,13 +10,13 @@ class BobTestTest < Test::Unit::TestCase
|
|
10
10
|
repo.add_failing_commit
|
11
11
|
assert_equal 2, repo.commits.size
|
12
12
|
assert_equal "This commit will fail", repo.commits.last["message"]
|
13
|
-
assert_equal repo.commits.last["
|
13
|
+
assert_equal repo.commits.last["id"], repo.head
|
14
14
|
assert repo.short_head
|
15
15
|
|
16
16
|
repo.add_successful_commit
|
17
17
|
assert_equal 3, repo.commits.size
|
18
18
|
assert_equal "This commit will work", repo.commits.last["message"]
|
19
|
-
assert_equal repo.commits.last["
|
19
|
+
assert_equal repo.commits.last["id"], repo.head
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_scm_repo
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Nicol\xC3\xA1s Sanguinetti"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-11-06 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|