Class: ProjMgr::Cvs
Overview
A wrapper class for interacting with a cvs repository
Instance Attribute Summary
Attributes inherited from Scm
Instance Method Summary collapse
-
#checkout ⇒ String
Checks out a cvs 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 cvs 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 |
# File 'lib/projmgr/cvs.rb', line 15 def checkout if path_exists? == true return "path exists, cannot checkout onto an existing repo" else parent = project_parent_directory cmd = IO.popen "cd #{parent} && CVSROOT=#{@url} cvs co #{@project} &> /dev/null && cd #{@root}" results = cmd.readlines cmd.close return "project checked out to #{parent}/#{@project}" end end |
#has_local_changes? ⇒ Boolean
Checks for local changes in the target repository
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/projmgr/cvs.rb', line 54 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} && cvs -q status | grep ^[?F] | grep -v \"to-date\" && cd #{@root}` if results =~ /\? (.*)/ return true, "has local changes" else return false, "has no local changes" end end end |
#update ⇒ String
Checks for updates in the target repo
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/projmgr/cvs.rb', line 32 def update if path_exists? == false return "path does not exists, cannot update repository" else results = `cd #{@path} && cvs update 2>&1 && cd #{@root}` results = results.split("\n") results.delete_if do |x| x =~ /cvs update: / end if results.empty? return "Already up-to-date!" else return results.join("\n") end end end |