class XMigra::GitSpecifics::AttributesFile

Attributes

access[R]
effect_root[R]

Public Class Methods

new(effect_root, access=:shared) click to toggle source
# File lib/xmigra/vcs_support/git.rb, line 14
def initialize(effect_root, access=:shared)
  @effect_root = Pathname(effect_root)
  @access = access
end

Public Instance Methods

description() click to toggle source
# 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() click to toggle source
# File lib/xmigra/vcs_support/git.rb, line 30
def file_path
  @effect_root + file_relative_path
end
file_relative_path() click to toggle source
# 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) click to toggle source
# File lib/xmigra/vcs_support/git.rb, line 59
def open(*args, &blk)
  file_path.open(*args, &blk)
end
path_from(path) click to toggle source
# File lib/xmigra/vcs_support/git.rb, line 34
def path_from(path)
  file_path.relative_path_from(Pathname(path))
end