Sha256: 6714cb8c95c5f0fe6b47ffd4ff7676d1ac6067c3146af1432b354d5a0c58bf08

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

require 'optparse'
require 'ostruct'
require 'pp'
require 'find'

#require 'rdebug/base'
require 'qasim'

module Qasim
	class Config

		attr_reader :maps_active
		attr_reader :maps
		attr_reader :mnt_dir

		def initialize


			@mnt_dir = File.join ENV['HOME'], "mnt"

			@config_dir = APP_CONFIG_DIR
			@config_file = nil
			@maps = []
			@initialize_enable = false
			@umount_enable = false
			@target = nil
			@verbose_enable = false
			@debug = false
		end

		def parse_maps &blk
			#rdebug "Config: #{@config_dir}/config"

			@maps = []
			map_dirs = [@config_dir, APP_SYSCONFIG_DIR].select{ |d|
					File.exist? d and File.directory? d 
			}
			Find.find( *map_dirs ) do |path|
				if File.file? path
					if File.basename( path ) =~ /.map$/
						begin
							map = Map.new self, path
							yield map if block_given?
							maps.push map
						rescue
							# error while parsing map
						end
					end
					#total_size += FileTest.size(path)
				end
			end
		end

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qasim-0.1.11.dev.2014102811 lib/qasim/config.rb