Class: SvnCommandHelper::SvnFileCopyTransaction
- Inherits:
-
Object
- Object
- SvnCommandHelper::SvnFileCopyTransaction
- Defined in:
- lib/svn_command_helper.rb
Overview
svn file copy transaction
Instance Attribute Summary collapse
-
#file ⇒ String
file basename.
-
#from_base ⇒ String
from base uri.
-
#to_base ⇒ String
to base uri.
Instance Method Summary collapse
-
#from ⇒ String
from uri.
-
#from_exist? ⇒ Boolean
from uri exists?.
-
#glob_transactions(recursive = false) ⇒ Array<SvnFileCopyTransaction>
filename glob (like “hoge*”) to each single file transaction.
-
#initialize(from_base:, to_base:, file:) ⇒ SvnFileCopyTransaction
constructor
A new instance of SvnFileCopyTransaction.
-
#relative_from(path) ⇒ String
relative from path from given base uri.
-
#relative_from_base(path) ⇒ String
relative from base path from given base uri.
-
#relative_to(path) ⇒ String
relative to path from given base uri.
-
#relative_to_base(path) ⇒ String
relative to base path from given base uri.
-
#to ⇒ String
to uri.
-
#to_exist? ⇒ Boolean
to uri exists?.
Constructor Details
#initialize(from_base:, to_base:, file:) ⇒ SvnFileCopyTransaction
Returns a new instance of SvnFileCopyTransaction.
305 306 307 308 309 |
# File 'lib/svn_command_helper.rb', line 305 def initialize(from_base:, to_base:, file:) @from_base = from_base @to_base = to_base @file = file end |
Instance Attribute Details
#file ⇒ String
file basename
297 298 299 |
# File 'lib/svn_command_helper.rb', line 297 def file @file end |
#from_base ⇒ String
from base uri
297 298 299 |
# File 'lib/svn_command_helper.rb', line 297 def from_base @from_base end |
#to_base ⇒ String
to base uri
297 298 299 |
# File 'lib/svn_command_helper.rb', line 297 def to_base @to_base end |
Instance Method Details
#from ⇒ String
from uri
313 314 315 |
# File 'lib/svn_command_helper.rb', line 313 def from File.join(@from_base, @file) end |
#from_exist? ⇒ Boolean
from uri exists?
334 335 336 |
# File 'lib/svn_command_helper.rb', line 334 def from_exist? Svn.exist_file?(from) end |
#glob_transactions(recursive = false) ⇒ Array<SvnFileCopyTransaction>
filename glob (like “hoge*”) to each single file transaction
326 327 328 329 330 |
# File 'lib/svn_command_helper.rb', line 326 def glob_transactions(recursive = false) Svn.list_files(@from_base, recursive) .select{|_file| File.fnmatch(@file, _file)} .map{|_file| SvnFileCopyTransaction.new(from_base: @from_base, to_base: @to_base, file: _file)} end |
#relative_from(path) ⇒ String
relative from path from given base uri
358 359 360 |
# File 'lib/svn_command_helper.rb', line 358 def relative_from(path) File.join(relative_from_base(path), @file) end |
#relative_from_base(path) ⇒ String
relative from base path from given base uri
346 347 348 |
# File 'lib/svn_command_helper.rb', line 346 def relative_from_base(path) Pathname.new(@from_base).relative_path_from(Pathname.new(path)).to_s end |
#relative_to(path) ⇒ String
relative to path from given base uri
364 365 366 |
# File 'lib/svn_command_helper.rb', line 364 def relative_to(path) File.join(relative_to_base(path), @file) end |
#relative_to_base(path) ⇒ String
relative to base path from given base uri
352 353 354 |
# File 'lib/svn_command_helper.rb', line 352 def relative_to_base(path) Pathname.new(@to_base).relative_path_from(Pathname.new(path)).to_s end |
#to ⇒ String
to uri
319 320 321 |
# File 'lib/svn_command_helper.rb', line 319 def to File.join(@to_base, @file) end |
#to_exist? ⇒ Boolean
to uri exists?
340 341 342 |
# File 'lib/svn_command_helper.rb', line 340 def to_exist? Svn.exist_file?(to) end |