Class: ProjMgr::Svn
Overview
A parent class for interacting with a source code repository
Instance Attribute Summary
Attributes inherited from Scm
Instance Method Summary collapse
-
#checkout ⇒ String
Checks out a svn repo and places it, in the path specified by the @path variable.
-
#has_local_changes? ⇒ Boolean
Checks for local changes in the target repository.
-
#update ⇒ String
Checks for updates in the target repo.
Methods inherited from Scm
#initialize, #inspect, #path_exists?, #project_parent_directory
Constructor Details
This class inherits a constructor from ProjMgr::Scm
Instance Method Details
#checkout ⇒ String
Checks out a svn repo and places it, in the path specified by the @path variable
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/projmgr/svn.rb', line 15 def checkout if path_exists? == true return "path exists, cannot checkout onto an existing repo" else parent = project_parent_directory results = `cd #{parent} && svn checkout #{@url} #{@project} && cd #{@root}` if results =~ /Could not resolve hostname/ return "unable to resolve hostname" else return "project checked out to #{parent}/#{@project}" end end end |
#has_local_changes? ⇒ Boolean
Checks for local changes in the target repository
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/projmgr/svn.rb', line 51 def has_local_changes? if path_exists? == false return false, "Path does not exists, please check the path or check it out" else results = `cd #{@path} && svn stat && cd #{@root}` if results.length > 0 return true, "has local changes" else return false, "has no local changes" end end end |
#update ⇒ String
Checks for updates in the target repo
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/projmgr/svn.rb', line 34 def update if path_exists? == true results = `cd #{@path} && svn stat && svn update && cd #{@root}` else return "path does not exists, cannot update repository" end if results.split("\n").size == 1 return results.chomp else return "\n" + results end end |