Class: XMigra::GitSpecifics::AttributesFile
- Defined in:
- lib/xmigra/vcs_support/git.rb
Instance Attribute Summary collapse
-
#access ⇒ Object
readonly
Returns the value of attribute access.
-
#effect_root ⇒ Object
readonly
Returns the value of attribute effect_root.
Instance Method Summary collapse
- #description ⇒ Object
- #file_path ⇒ Object
- #file_relative_path ⇒ Object
-
#initialize(effect_root, access = :shared) ⇒ AttributesFile
constructor
A new instance of AttributesFile.
- #open(*args, &blk) ⇒ Object
- #path_from(path) ⇒ Object
Constructor Details
#initialize(effect_root, access = :shared) ⇒ AttributesFile
Returns a new instance of AttributesFile.
14 15 16 17 |
# File 'lib/xmigra/vcs_support/git.rb', line 14 def initialize(effect_root, access=:shared) @effect_root = Pathname(effect_root) @access = access end |
Instance Attribute Details
#access ⇒ Object (readonly)
Returns the value of attribute access.
19 20 21 |
# File 'lib/xmigra/vcs_support/git.rb', line 19 def access @access end |
#effect_root ⇒ Object (readonly)
Returns the value of attribute effect_root.
19 20 21 |
# File 'lib/xmigra/vcs_support/git.rb', line 19 def effect_root @effect_root end |
Instance Method Details
#description ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/xmigra/vcs_support/git.rb', line 38 def description "".tap do |result| result << "#{path_from(Pathname.pwd)}" chars = [] if file_path.exist? chars << "exists" end case access when :local chars << "local" end unless chars.empty? result << " (#{chars.join(', ')})" end end end |
#file_path ⇒ Object
30 31 32 |
# File 'lib/xmigra/vcs_support/git.rb', line 30 def file_path @effect_root + file_relative_path end |
#file_relative_path ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/xmigra/vcs_support/git.rb', line 21 def file_relative_path case @access when :local Pathname('.git/info/attributes') else Pathname('.gitattributes') end end |
#open(*args, &blk) ⇒ Object
59 60 61 |
# File 'lib/xmigra/vcs_support/git.rb', line 59 def open(*args, &blk) file_path.open(*args, &blk) end |
#path_from(path) ⇒ Object
34 35 36 |
# File 'lib/xmigra/vcs_support/git.rb', line 34 def path_from(path) file_path.relative_path_from(Pathname(path)) end |