Class: SvnTransform::File
- Inherits:
-
Object
- Object
- SvnTransform::File
- Defined in:
- lib/svn-transform/file.rb
Overview
A file 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 file transform blocks (TODO more info)
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#rev_num ⇒ Object
readonly
Returns the value of attribute rev_num.
-
#rev_props ⇒ Object
readonly
Returns the value of attribute rev_props.
Instance Method Summary collapse
-
#basename ⇒ Object
Get the base of the File.
-
#basename=(val) ⇒ Object
Change the basename of the File.
-
#initialize(path, node_data, rev_num, rev_props) ⇒ File
constructor
Initialize File instance using data passed by SvnTransform#changesets.
-
#skip! ⇒ Object
Skip this file at this revision (that is, don’t commit it to new repo).
-
#skip? ⇒ Boolean
Whether this file should be skipped (not committed to new repo at this revision).
Constructor Details
#initialize(path, node_data, rev_num, rev_props) ⇒ File
Initialize File 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#file. First element is node body, second is hash of properties.
- rev_num<Integer>
-
Number of current revision
- rev_props<Hash>
-
Properties for current revision
23 24 25 26 27 28 29 |
# File 'lib/svn-transform/file.rb', line 23 def initialize(path, node_data, rev_num, rev_props) @path = path.kind_of?(Pathname) ? path : Pathname.new(path) @body = node_data[0] @properties = node_data[1] @rev_num = rev_num @rev_props = rev_props end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
31 32 33 |
# File 'lib/svn-transform/file.rb', line 31 def body @body end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
31 32 33 |
# File 'lib/svn-transform/file.rb', line 31 def path @path end |
#properties ⇒ Object
Returns the value of attribute properties.
31 32 33 |
# File 'lib/svn-transform/file.rb', line 31 def properties @properties end |
#rev_num ⇒ Object (readonly)
Returns the value of attribute rev_num.
31 32 33 |
# File 'lib/svn-transform/file.rb', line 31 def rev_num @rev_num end |
#rev_props ⇒ Object (readonly)
Returns the value of attribute rev_props.
31 32 33 |
# File 'lib/svn-transform/file.rb', line 31 def rev_props @rev_props end |
Instance Method Details
#basename ⇒ Object
Get the base of the File
56 57 58 |
# File 'lib/svn-transform/file.rb', line 56 def basename @path.basename.to_s end |
#basename=(val) ⇒ Object
Change the basename of the File. Alters the #path
Parameters
- val<String>
-
New basename
64 65 66 |
# File 'lib/svn-transform/file.rb', line 64 def basename=(val) @path = @path.dirname + val end |
#skip! ⇒ Object
Skip this file at this revision (that is, don’t commit it to new repo).
69 70 71 |
# File 'lib/svn-transform/file.rb', line 69 def skip! @skip = true end |
#skip? ⇒ Boolean
Whether this file should be skipped (not committed to new repo at this revision)
75 76 77 |
# File 'lib/svn-transform/file.rb', line 75 def skip? @skip == true end |