class Dotter::Package

Attributes

config[RW]
name[R]
repo[R]

Public Class Methods

new(name) click to toggle source
# File lib/dotter/package.rb, line 8
def initialize(name)
  @name = name
  @config = Configuration.new
  @our_config = @config.package_config(@name)
  if self.tracked?
    unless self.foreign?
      @repo = GitRepo.new(name)
    else
      @repo = ForeignGitRepo.new(name)
    end
  end
end

Public Instance Methods

foreign?() click to toggle source
# File lib/dotter/package.rb, line 62
def foreign?
  @our_config['type'] == 'git_repo'
end
private?() click to toggle source
# File lib/dotter/package.rb, line 74
def private?
  !self.public?
end
public?() click to toggle source
# File lib/dotter/package.rb, line 70
def public?
  @our_config['public'] == true
end
stow() click to toggle source
# File lib/dotter/package.rb, line 21
def stow
  go_to_dotfiles
  returned_output = `stow -v #{@name}`
  @config.set_state(@name, 'stowed')
  returned_output
end
stowed?() click to toggle source
# File lib/dotter/package.rb, line 46
def stowed?
  @our_config['state'] == 'stowed'
end
to_s() click to toggle source
# File lib/dotter/package.rb, line 66
def to_s
  @name
end
track() click to toggle source
# File lib/dotter/package.rb, line 35
def track
  @repo = GitRepo.new(@name, true)
  @config.track(@name)
end
tracked?() click to toggle source
# File lib/dotter/package.rb, line 54
def tracked?
  @our_config['tracked']
end
unstow() click to toggle source
# File lib/dotter/package.rb, line 28
def unstow
  go_to_dotfiles
  returned_output = `stow -Dv #{@name}`
  @config.set_state(@name, 'unstowed')
  returned_output
end
unstowed?() click to toggle source
# File lib/dotter/package.rb, line 50
def unstowed?
  !self.stowed?
end
untracked?() click to toggle source
# File lib/dotter/package.rb, line 58
def untracked?
  !self.tracked?
end
update() click to toggle source
# File lib/dotter/package.rb, line 40
def update
  go_to_dotfiles
  @repo.update if self.foreign?
  returned_output = `stow -Rv #{@name}`
end