Class: ProjMgr::Scm
- Inherits:
-
Object
- Object
- ProjMgr::Scm
- Defined in:
- lib/projmgr/scm.rb
Overview
A parent class for interacting with a source code repository
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#project ⇒ Object
Returns the value of attribute project.
-
#root ⇒ Object
Returns the value of attribute root.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(project = nil, path = nil, root = nil, url = nil) ⇒ Scm
constructor
Creates a instance of a SCM repository.
-
#inspect ⇒ String
Overloaded inspect.
-
#path_exists? ⇒ Boolean
Checks to see if a path exists.
-
#project_parent_directory ⇒ String
Retrieves the parent directory of a path.
Constructor Details
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
11 12 13 |
# File 'lib/projmgr/scm.rb', line 11 def path @path end |
#project ⇒ Object
Returns the value of attribute project.
11 12 13 |
# File 'lib/projmgr/scm.rb', line 11 def project @project end |
#root ⇒ Object
Returns the value of attribute root.
11 12 13 |
# File 'lib/projmgr/scm.rb', line 11 def root @root end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/projmgr/scm.rb', line 11 def url @url end |
Instance Method Details
#inspect ⇒ String
Overloaded inspect
46 47 48 |
# File 'lib/projmgr/scm.rb', line 46 def inspect return "Project: #{@project}\n" + "Path: #{@path}\n" + "Root: #{@root}\n" + "Url: #{@url}\n" end |
#path_exists? ⇒ Boolean
Checks to see if a path exists
31 32 33 |
# File 'lib/projmgr/scm.rb', line 31 def path_exists? return File.exists?(File.(@path)) end |
#project_parent_directory ⇒ String
Retrieves the parent directory of a path
38 39 40 41 |
# File 'lib/projmgr/scm.rb', line 38 def project_parent_directory pn = Pathname.new @path return pn.parent.to_s end |