Class: ScmWeb::ViewCvs

Inherits:
Base
  • Object
show all
Defined in:
lib/scm_web/view_cvs.rb

Overview

The variables to use in uri_specs are:

  • path

  • revision

  • previous_revision

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

classes

Constructor Details

#initialize(uri_specs = nil, cvs_host_name = nil, cvs_server_path = nil, project_unix_name = nil, module_regexp = nil) ⇒ ViewCvs

Returns a new instance of ViewCvs.



12
13
14
15
# File 'lib/scm_web/view_cvs.rb', line 12

def initialize(uri_specs=nil, cvs_host_name=nil, cvs_server_path=nil, project_unix_name=nil, module_regexp=nil)
  @uri_specs, @cvs_host_name, @cvs_server_path, @project_unix_name, @module_regexp = 
    uri_specs, cvs_host_name, cvs_server_path, project_unix_name, module_regexp
end

Instance Attribute Details

#cvs_host_nameObject

Returns the value of attribute cvs_host_name.



10
11
12
# File 'lib/scm_web/view_cvs.rb', line 10

def cvs_host_name
  @cvs_host_name
end

#cvs_server_pathObject

Returns the value of attribute cvs_server_path.



10
11
12
# File 'lib/scm_web/view_cvs.rb', line 10

def cvs_server_path
  @cvs_server_path
end

#module_regexpObject

Returns the value of attribute module_regexp.



10
11
12
# File 'lib/scm_web/view_cvs.rb', line 10

def module_regexp
  @module_regexp
end

#project_unix_nameObject

Returns the value of attribute project_unix_name.



10
11
12
# File 'lib/scm_web/view_cvs.rb', line 10

def project_unix_name
  @project_unix_name
end

#uri_specsObject

Returns the value of attribute uri_specs.



10
11
12
# File 'lib/scm_web/view_cvs.rb', line 10

def uri_specs
  @uri_specs
end

Instance Method Details

#scmsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/scm_web/view_cvs.rb', line 17

def scms
  unless(@scms)
    require 'rscm'

    @scms = []
    cvs_root = open(uri) do |data|
      data.each_line do |line|
        if line =~ @module_regexp
          mod = $1
          unless(mod == "CVSROOT")
            scm = RSCM::Cvs.new
            scm.root = ":pserver:anonymous@#{cvs_host_name}:#{cvs_server_path}/#{mod}" #TODO: is this right?
            scm.mod = mod
            @scms << scm
          end
        end
      end
    end
  end
  @scms
end

#uri(path = "", options = {:type=>"overview"}) ⇒ Object

Returns the URI for the file at path. Options are:

:type (can be one of :overview, :raw or :html)
:revision (the revision of the file. must be specified when :type is :raw or :html)


43
44
45
46
47
48
49
50
51
52
53
# File 'lib/scm_web/view_cvs.rb', line 43

def uri(path="", options={:type=>"overview"})
  type = options[:type]
  raise "No :type specified" unless type
  uri_spec = @uri_specs[type]
  raise "No uri_spec for #{type}" unless uri_spec

  project_unix_name = @project_unix_name
  revision = options[:revision]
  previous_revision = options[:previous_revision]
  eval("\"#{uri_spec}\"", binding)
end