class ProjMgr::Scm
A parent class for interacting with a source code repository
@author Jacob Hammack <jacob.hammack@hammackj.com>
Attributes
path[RW]
project[RW]
root[RW]
url[RW]
Public Class Methods
new(project=nil, path=nil, root=nil, url=nil)
click to toggle source
Creates a instance of a SCM repository
@param project name of the project @param path path to the project @param root path back to the root @param url url of the repo for checkout/etc
@return [Scm] returns a new instance of the Scm
class
# File lib/projmgr/scm.rb, line 21 def initialize project=nil, path=nil, root=nil, url=nil @project = project @path = path @root = root @url = url end
Public Instance Methods
inspect()
click to toggle source
Overloaded inspect
@return [String] A representation of the class as a string
# 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?()
click to toggle source
Checks to see if a path exists
@return [Boolean] True or False based on if the @path exists
# File lib/projmgr/scm.rb, line 31 def path_exists? return File.exists?(File.expand_path(@path)) end
project_parent_directory()
click to toggle source
Retrieves the parent directory of a path
@return [String] parent directory of the @path variable
# File lib/projmgr/scm.rb, line 38 def project_parent_directory pn = Pathname.new @path return pn.parent.to_s end