Class List Method List File List

# Class: SvnParser

Inherits:
  Object
  - Object
  - SvnParser
  show all
Defined in:
  lib/wpstools/plugins/list_generator/svn_parser.rb

## Overview

This Class Parses SVN Repositories via HTTP

## Instance Attribute Summary (collapse)

- - (Object) keep_empty_dirs

  Returns the value of attribute keep_empty_dirs.

- - (Object) svn_root

  Returns the value of attribute svn_root.

- - (Object) verbose

  Returns the value of attribute verbose.

## Instance Method Summary (collapse)

- - (Object) get_root_directories private

  Gets all directories in the SVN root.

- - (SvnParser) initialize(svn_root) constructor

  A new instance of SvnParser.

- - (Object) parse

## Constructor Details

### - (`SvnParser`) initialize(svn_root)

A new instance of SvnParser

    8
    9
    10
    # File 'lib/wpstools/plugins/list_generator/svn_parser.rb', line 8

    def initialize(svn_root)
      @svn_root    = svn_root
    end

## Instance Attribute Details

### - (`Object`) keep_empty_dirs

Returns the value of attribute keep_empty_dirs

    6
    7
    8
    # File 'lib/wpstools/plugins/list_generator/svn_parser.rb', line 6

    def keep_empty_dirs
      @keep_empty_dirs
    end

### - (`Object`) svn_root

Returns the value of attribute svn_root

    6
    7
    8
    # File 'lib/wpstools/plugins/list_generator/svn_parser.rb', line 6

    def svn_root
      @svn_root
    end

### - (`Object`) verbose

Returns the value of attribute verbose

    6
    7
    8
    # File 'lib/wpstools/plugins/list_generator/svn_parser.rb', line 6

    def verbose
      @verbose
    end

## Instance Method Details

### - (`Object`) get_root_directories (private)

Gets all directories in the SVN root

    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    # File 'lib/wpstools/plugins/list_generator/svn_parser.rb', line 20

    def get_root_directories
      dirs      = []
      rootindex = Browser.get(@svn_root).body

      rootindex.scan(%r{<li><a href=".+">(.+)/</a></li>}i).each do |dir|
        dirs << dir[0]
      end

      dirs.sort!
      dirs.uniq
    end

### - (`Object`) parse

    12
    13
    14
    # File 'lib/wpstools/plugins/list_generator/svn_parser.rb', line 12

    def parse
      get_root_directories
    end