Class: Subversion::ExternalsContainer
- Inherits:
-
Object
- Object
- Subversion::ExternalsContainer
- Defined in:
- lib/svn-command/subversion.rb
Overview
Represents an “externals container”, which is a directory that has the svn:externals
property set to something useful. Each ExternalsContainer contains a set of “entries”, which are the actual directories listed in the svn:externals
property and are “pulled into” the directory.
Defined Under Namespace
Classes: ExternalItem
Instance Attribute Summary collapse
-
#container_dir ⇒ Object
readonly
Returns the value of attribute container_dir.
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #entries_structs ⇒ Object
- #has_entries? ⇒ Boolean
-
#initialize(external_dir) ⇒ ExternalsContainer
constructor
A new instance of ExternalsContainer.
- #to_s ⇒ Object
Constructor Details
#initialize(external_dir) ⇒ ExternalsContainer
Returns a new instance of ExternalsContainer.
482 483 484 485 486 |
# File 'lib/svn-command/subversion.rb', line 482 def initialize(external_dir) @container_dir = File.(external_dir) @entries = Subversion.get_property("externals", @container_dir) #p @entries end |
Instance Attribute Details
#container_dir ⇒ Object (readonly)
Returns the value of attribute container_dir.
479 480 481 |
# File 'lib/svn-command/subversion.rb', line 479 def container_dir @container_dir end |
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
480 481 482 |
# File 'lib/svn-command/subversion.rb', line 480 def entries @entries end |
Instance Method Details
#==(other) ⇒ Object
515 516 517 |
# File 'lib/svn-command/subversion.rb', line 515 def ==(other) self.container_dir == other.container_dir end |
#entries_structs ⇒ Object
492 493 494 495 496 497 |
# File 'lib/svn-command/subversion.rb', line 492 def entries_structs entries.chomp.enum(:each_line).map { |line| line =~ /^(\S+)\s*(\S+)/ ExternalItem.new($1, $2) } end |
#has_entries? ⇒ Boolean
488 489 490 |
# File 'lib/svn-command/subversion.rb', line 488 def has_entries? @entries.size > 0 end |
#to_s ⇒ Object
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/svn-command/subversion.rb', line 499 def to_s entries_structs = entries_structs() longest_item_name = [ entries_structs.map { |entry| entry.name.size }.max, 25 ].max container_dir.bold + "\n" + entries_structs.map { |entry| " * " + entry.name.ljust(longest_item_name + 1) + entry.repository_path + "\n" }.join end |