Class: GitReport::Project
- Inherits:
-
Object
- Object
- GitReport::Project
- Defined in:
- lib/project.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#log ⇒ Object
Returns the value of attribute log.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
-
#branchname ⇒ Object
returns the branch name.
-
#data ⇒ Object
returns projects core data as a hash for transfer of a commit batch.
-
#identifier ⇒ Object
returns the projects first commits hash as an identifier.
-
#initialize(path = nil) ⇒ Project
constructor
A new instance of Project.
-
#name ⇒ Object
returns the local name of the project extracted from the project directory.
-
#path ⇒ Object
returns the local project directory.
-
#remote_branches ⇒ Object
returns an array of names of all remote branches.
-
#remotes ⇒ Object
returns an array of remote objects of the project.
-
#revlist ⇒ Object
returns the projects rev-list.
Constructor Details
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
4 5 6 |
# File 'lib/project.rb', line 4 def branch @branch end |
#log ⇒ Object
Returns the value of attribute log.
4 5 6 |
# File 'lib/project.rb', line 4 def log @log end |
#project ⇒ Object
Returns the value of attribute project.
4 5 6 |
# File 'lib/project.rb', line 4 def project @project end |
Instance Method Details
#branchname ⇒ Object
returns the branch name
44 45 46 |
# File 'lib/project.rb', line 44 def branchname @branchname ||= self.branch.name end |
#data ⇒ Object
returns projects core data as a hash for transfer of a commit batch
49 50 51 |
# File 'lib/project.rb', line 49 def data @data ||= aggregate end |
#identifier ⇒ Object
returns the projects first commits hash as an identifier
34 35 36 |
# File 'lib/project.rb', line 34 def identifier @identifier ||= self.revlist.last end |
#name ⇒ Object
returns the local name of the project extracted from the project directory
19 20 21 |
# File 'lib/project.rb', line 19 def name @name ||= @project.dir.path.match(/.*\/(.*)$/).nil? ? "unknown" : $1 end |
#path ⇒ Object
returns the local project directory
14 15 16 |
# File 'lib/project.rb', line 14 def path @path ||= @project.dir.path end |
#remote_branches ⇒ Object
returns an array of names of all remote branches
29 30 31 |
# File 'lib/project.rb', line 29 def remote_branches @remote_branches ||= @project.branches.remote.map(&:full) end |
#remotes ⇒ Object
returns an array of remote objects of the project
24 25 26 |
# File 'lib/project.rb', line 24 def remotes @remotes ||= @project.remotes end |
#revlist ⇒ Object
returns the projects rev-list
39 40 41 |
# File 'lib/project.rb', line 39 def revlist (`git rev-list --all`).split("\n") end |