Class: Ribit::CVSRepository

Inherits:
Object
  • Object
show all
Includes:
Repository
Defined in:
lib/ribit/contentstore.rb

Constant Summary

Constants included from Repository

Repository::CVS_PROJECT_NAME

Instance Method Summary collapse

Constructor Details

#initializeCVSRepository

Returns a new instance of CVSRepository.



53
54
55
# File 'lib/ribit/contentstore.rb', line 53

def initialize
  @logger = RibitLogger.new( CVSRepository )
end

Instance Method Details

#add_to_repository(directory, fileName, msg) ⇒ Object



76
77
78
# File 'lib/ribit/contentstore.rb', line 76

def add_to_repository( directory, fileName, msg )
  @cvs.add( directory, fileName, msg )
end

#commit_to_repository(fileName) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/ribit/contentstore.rb', line 81

def commit_to_repository( fileName )
  # construct proper path
  #  => find where 'content' is and take rest
  @logger.debug( "Storing the file: #{fileName}" )
  
  parts = []
  contentFound = false
  fileName.split( Constants::PATH_SEPARATOR ).each do |part|
    if ( contentFound )
      parts.push( part )
    elsif ( part == CVS_PROJECT_NAME )
      contentFound = true
    end
  end
  
  commitPath = parts.join( Constants::PATH_SEPARATOR )      
  @logger.debug( "The commit path is: #{commitPath}" )

  @cvs.commit( @dataPath, commitPath, '' )
end

#init(ribitConfig, dataPath) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/ribit/contentstore.rb', line 58

def init( ribitConfig, dataPath )
  @ribitConfig = ribitConfig
  @dataPath = dataPath
  
  # if no CVSROOT defined then we don't store to CVS    
  if ( ribitConfig[RibitConfig::CVSROOT] == nil )
    @cvsroot = nil
    @logger.info( "No CVSROOT defined" )
  else
    # Yes, CVSROOT is defined 
 @cvsroot = resolve_absolute_cvsroot_path( ribitConfig[RibitConfig::CVSROOT] )
 @logger.info( "Using CVS repository in #{@cvsroot}" )
 
 prepare_cvs
  end
end