Class: Svenbot::Commit
- Inherits:
-
Object
- Object
- Svenbot::Commit
- Defined in:
- lib/svenbot/commit.rb
Overview
Representation of a commit message
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Identifier for this commit.
-
#message ⇒ Object
readonly
Why was this commit made?.
-
#path_prefix ⇒ Object
readonly
What part of the repository did this affect?.
-
#user ⇒ Object
readonly
Who made this commit?.
Class Method Summary collapse
-
.from(repo, id) ⇒ Object
Populate a new commit object from a repository.
Instance Method Summary collapse
-
#initialize(id, user, path_prefix, message) ⇒ Commit
constructor
Create a new commit.
Constructor Details
#initialize(id, user, path_prefix, message) ⇒ Commit
Create a new commit.
14 15 16 17 18 19 |
# File 'lib/svenbot/commit.rb', line 14 def initialize(id, user, path_prefix, ) @id = id @user = user @path_prefix = path_prefix = end |
Instance Attribute Details
#id ⇒ Object (readonly)
Identifier for this commit
5 6 7 |
# File 'lib/svenbot/commit.rb', line 5 def id @id end |
#message ⇒ Object (readonly)
Why was this commit made?
11 12 13 |
# File 'lib/svenbot/commit.rb', line 11 def end |
#path_prefix ⇒ Object (readonly)
What part of the repository did this affect?
9 10 11 |
# File 'lib/svenbot/commit.rb', line 9 def path_prefix @path_prefix end |
#user ⇒ Object (readonly)
Who made this commit?
7 8 9 |
# File 'lib/svenbot/commit.rb', line 7 def user @user end |
Class Method Details
.from(repo, id) ⇒ Object
Populate a new commit object from a repository
22 23 24 25 26 27 28 |
# File 'lib/svenbot/commit.rb', line 22 def self.from(repo, id) user = `svnlook author '#{repo.dir}' -r '#{id}'`.chomp = `svnlook log '#{repo.dir}' -r '#{id}'`.chomp paths = `svnlook changed '#{repo.dir}' -r '#{id}'`.split(/\n/) paths.collect! { |p| p.sub(/^..../, '').chomp } return Commit.new(id, user, pick_prefix(paths), ) end |