Class: MetaProject::ScmWeb::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/meta_project/scm_web/browser.rb

Overview

A Browser instance is capable of generating URLs to various files and diffs in an online scm web interface.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir_spec = nil, history_spec = nil, raw_spec = nil, html_spec = nil, diff_spec = nil, child_dirs_pattern = nil, child_files_pattern = nil) ⇒ Browser

The variables to use in uri_specs are:

  • path

  • revision

  • previous_revision



17
18
19
20
21
22
23
24
25
26
# File 'lib/meta_project/scm_web/browser.rb', line 17

def initialize(dir_spec=nil, history_spec=nil, raw_spec=nil, html_spec=nil, diff_spec=nil, child_dirs_pattern=nil, child_files_pattern=nil)
  self.dir_spec     = dir_spec     unless dir_spec.nil?
  self.history_spec = history_spec unless history_spec.nil?
  self.raw_spec     = raw_spec     unless raw_spec.nil?
  self.html_spec    = html_spec    unless html_spec.nil?
  self.diff_spec    = diff_spec    unless diff_spec.nil?

  @child_dirs_pattern    = child_dirs_pattern
  @child_files_pattern   = child_files_pattern
end

Instance Attribute Details

#diff_specObject

Returns the value of attribute diff_spec.



9
10
11
# File 'lib/meta_project/scm_web/browser.rb', line 9

def diff_spec
  @diff_spec
end

#dir_specObject

Returns the value of attribute dir_spec.



9
10
11
# File 'lib/meta_project/scm_web/browser.rb', line 9

def dir_spec
  @dir_spec
end

#history_specObject

Returns the value of attribute history_spec.



9
10
11
# File 'lib/meta_project/scm_web/browser.rb', line 9

def history_spec
  @history_spec
end

#html_specObject

Returns the value of attribute html_spec.



9
10
11
# File 'lib/meta_project/scm_web/browser.rb', line 9

def html_spec
  @html_spec
end

#raw_specObject

Returns the value of attribute raw_spec.



9
10
11
# File 'lib/meta_project/scm_web/browser.rb', line 9

def raw_spec
  @raw_spec
end

Instance Method Details

#child_dirs_patternObject

The regexp used to determine child directories of a directory



79
80
81
# File 'lib/meta_project/scm_web/browser.rb', line 79

def child_dirs_pattern
  @child_dirs_pattern
end

#child_files_patternObject

The regexp used to determine child files of a directory



84
85
86
# File 'lib/meta_project/scm_web/browser.rb', line 84

def child_files_pattern
  @child_files_pattern
end

#diff(path, revision, previous_revision) ⇒ Object



74
75
76
# File 'lib/meta_project/scm_web/browser.rb', line 74

def diff(path, revision, previous_revision)
  file_uri(path, revision, @diff_spec, previous_revision)
end

#dir(path) ⇒ Object



58
59
60
# File 'lib/meta_project/scm_web/browser.rb', line 58

def dir(path)
  file_uri(path, nil, @dir_spec, nil)
end

#history(path) ⇒ Object



62
63
64
# File 'lib/meta_project/scm_web/browser.rb', line 62

def history(path)
  file_uri(path, nil, @history_spec, nil)
end

#html(path, revision) ⇒ Object



70
71
72
# File 'lib/meta_project/scm_web/browser.rb', line 70

def html(path, revision)
  file_uri(path, revision, @html_spec, nil)
end

#raw(path, revision) ⇒ Object



66
67
68
# File 'lib/meta_project/scm_web/browser.rb', line 66

def raw(path, revision)
  file_uri(path, revision, @raw_spec, nil)
end

#rootObject

Returns a Pathname representing the root directory of this browser. NOTE: The root of the browser may be at a lower level than the toplevel of the online scm web interface; It depends on the configuration of this instance.



92
93
94
# File 'lib/meta_project/scm_web/browser.rb', line 92

def root
  Pathname.new(self, nil, "", nil, true)
end