Class: SvnTransform::Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/svn-transform/dir.rb

Overview

A directory in original Subversion Repository, at a given changeset. Instances are initialized by SvnTransform#changesets.

An instance for each file in the original repo at each revision will be passed to any directory transform blocks (TODO more info)

Although more could theoretically be done (see #initialize fixture_dir param), the main thing intended to be alterable are the properties.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, node_data, rev_num, rev_props, repos, fixture_dir) ⇒ Dir

Initialize Dir instance using data passed by SvnTransform#changesets. This is data that will be available to Transformation blocks. It’s relevant to remember that all this happens within a block given to an SvnFixture::Revision.

Parameters

path<Pathname>

Full path within original Repository

node_data<Array[String, Hash]>

Array returned by SWIG::TYPE_p_svn_ra_session_t#dir. First element is a Hash of directory entries, second is Hash of properties.

rev_num<Integer>

Number of current revision

rev_props<Hash>

Properties for current revision

repos<Svn::Ra::Session>

Repo session (made available for PropsToYaml)

fixture_dir<SvnFixture::Directory>

The SvnFixture::Directory representing this directory. This could be used to add, delete files, subdirs, etc, but doing much of that is likely to lead to weird results. I certainly don’t intend to test this outside of one use case (PropsToYaml)



33
34
35
36
37
38
39
40
41
# File 'lib/svn-transform/dir.rb', line 33

def initialize(path, node_data, rev_num, rev_props, repos, fixture_dir)
  @path = path.kind_of?(Pathname) ? path : Pathname.new(path)
  @entries = node_data[0]
  @properties = node_data[1]
  @rev_num = rev_num
  @rev_props = rev_props
  @repos = repos
  @fixture_dir = fixture_dir
end

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries.



43
44
45
# File 'lib/svn-transform/dir.rb', line 43

def entries
  @entries
end

#fixture_dirObject (readonly)

Returns the value of attribute fixture_dir.



43
44
45
# File 'lib/svn-transform/dir.rb', line 43

def fixture_dir
  @fixture_dir
end

#pathObject (readonly)

Returns the value of attribute path.



43
44
45
# File 'lib/svn-transform/dir.rb', line 43

def path
  @path
end

#propertiesObject

Returns the value of attribute properties.



43
44
45
# File 'lib/svn-transform/dir.rb', line 43

def properties
  @properties
end

#reposObject (readonly)

Returns the value of attribute repos.



43
44
45
# File 'lib/svn-transform/dir.rb', line 43

def repos
  @repos
end

#rev_numObject (readonly)

Returns the value of attribute rev_num.



43
44
45
# File 'lib/svn-transform/dir.rb', line 43

def rev_num
  @rev_num
end

#rev_propsObject (readonly)

Returns the value of attribute rev_props.



43
44
45
# File 'lib/svn-transform/dir.rb', line 43

def rev_props
  @rev_props
end

Instance Method Details

#basenameObject

Get the base of the File



61
62
63
# File 'lib/svn-transform/dir.rb', line 61

def basename
  @path.basename.to_s
end