Sha256: 77ccb65bdc7ecf0d6701858144c5a82fe01326963af275992cb3be6a3b4617b9

Contents?: true

Size: 909 Bytes

Versions: 2

Compression:

Stored size: 909 Bytes

Contents

require 'dotter/utilities'
require 'inifile'
module Dotter
	class Configuration
		include Utilities
		attr_reader :config_file
		attr_accessor :config
		def initialize(config_file=package_path('dotter') + '.dotter/Dotfile')
			@config_file = config_file
			@config = IniFile.load(config_file)
		end
		def package_config(package)
			@config[package]
		end
		def save()
			@config.write()
		end
		def set_state(package, state)
			package_conf = self.package_config(package)
			package_conf['state'] = state
			self.save()
		end
		def track(package)
			package_conf = self.package_config(package)
			package_conf['tracked'] = true
			self.save()
		end
		def publish(package)
			package_conf = self.package_config(package)
			package_conf['public'] = true
			self.save()
		end
		def unpublish(package)
			package_conf = self.package_config(package)
			package_conf['public'] = false
			self.save()
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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