bob 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "bob"
3
- s.version = "0.4.1"
4
- s.date = "2009-10-12"
3
+ s.version = "0.5.0"
4
+ s.date = "2009-11-06"
5
5
 
6
6
  s.description = "Bob the Builder will build your code. Simple."
7
7
  s.summary = "Bob builds!"
@@ -8,7 +8,7 @@ module Bob
8
8
 
9
9
  def build
10
10
  scm.with_commit(buildable["commit"]) { |commit|
11
- started(scm.info(commit))
11
+ started(scm.metadata(commit))
12
12
  completed(*run)
13
13
  }
14
14
  end
@@ -31,7 +31,7 @@ module Bob
31
31
  # [<tt>author</tt>] Commit author's name and email
32
32
  # [<tt>message</tt>] Commit message
33
33
  # [<tt>committed_at</tt>] Commit date (as a <tt>Time</tt> object)
34
- def info(commit)
34
+ def metadata(commit)
35
35
  raise NotImplementedError
36
36
  end
37
37
 
@@ -1,14 +1,14 @@
1
1
  module Bob
2
2
  module SCM
3
3
  class Git < Abstract
4
- def info(commit)
5
- format = "---%nidentifier: %H%nauthor: %an " +
6
- "<%ae>%nmessage: >-%n %s%ncommitted_at: %ci%n"
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("committed_at" => Time.parse(dump["committed_at"]))
11
+ dump.update("timestamp" => Time.parse(dump["timestamp"]))
12
12
  end
13
13
 
14
14
  def head
@@ -1,14 +1,14 @@
1
1
  module Bob
2
2
  module SCM
3
3
  class Svn < Abstract
4
- def info(rev)
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
- { "identifier" => rev,
9
- "message" => dump[3],
10
- "author" => meta[1],
11
- "committed_at" => Time.parse(meta[2]) }
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
@@ -35,7 +35,7 @@ module Bob::Test
35
35
  end
36
36
 
37
37
  def head
38
- commits.last["identifier"]
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
- "identifier: %H%nauthor: %n name: %an%n email: %ae%n"
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 << { "identifier" => c["revision"],
157
- "message" => c.at("msg").inner_html,
158
- "committed_at" => Time.parse(c.at("date").inner_html) }
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
@@ -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["identifier"]
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["identifier"]
16
- assert buildable.commit_info["committed_at"].is_a?(Time)
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["identifier"]
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["identifier"]
31
- assert buildable.commit_info["committed_at"].is_a?(Time)
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["identifier"]
44
+ assert_equal repo.head, buildable.commit_info["id"]
45
45
  end
46
46
  end
@@ -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["identifier"], repo.head
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["identifier"], repo.head
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.1
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-10-12 00:00:00 +02:00
13
+ date: 2009-11-06 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency