Sha256: eac1c753e1094ab6ba32864e511f09f8961b7664147ba948fb7914d631b3591d

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'dotter/utilities'
require 'dotter/configuration'
require 'dotter/gitrepo'
module Dotter
	class Package
		include Utilities
		def initialize(name)
			@name = name
			@config = Configuration.new
			@our_config = @config.package_config(@name)
			if self.tracked?
				@repo = GitRepo.new(name)
			end
		end
		def stow
			go_to_dotfiles
			returned_output =  `stow -v #{@name}`
			@config.set_state(@name, 'stowed')
			returned_output
		end
		def unstow
			go_to_dotfiles
			returned_output =  `stow -Dv #{@name}`
			@config.set_state(@name, 'unstowed')
			returned_output
		end
		def track
			@repo = GitRepo.new(@name,true)
			@config.track(@name)
		end
		def update
			go_to_dotfiles
			returned_output = `stow -Rv #{@name}`
		end
		def stowed?
			@our_config['state'] == 'stowed'
		end
		def unstowed?
			!self.stowed?
		end
		def tracked?
			@our_config['tracked']
		end
		def untracked?
			!self.tracked?
		end
		def to_s
			@name
		end
		def public?
			@our_config['public'] = true
		end
		def private?
			!self.public?
		end
		attr_reader :name
		attr_accessor :config
		attr_reader :repo
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dotter_dotfiles-0.2.0 lib/dotter/package.rb
dotter_dotfiles-0.1.0 lib/dotter/package.rb