Module: AndParcel

Defined in:
lib/andparcel/base.rb,
lib/andparcel/parcel.rb,
lib/andparcel/catalog.rb,
lib/andparcel/fileref.rb,
bin/parcel

Defined Under Namespace

Classes: Catalog, CatalogCommand, CatalogSet, Command, FileRef, InstallCommand, InstallRequest, LintCommand, LintRequest, ListCommand, PackageCommand, PackageRequest, Parcel, ParcelSet, RemoveCommand, RemoveRequest

Class Method Summary collapse

Class Method Details

.catalogsObject



17
18
19
20
21
# File 'lib/andparcel/base.rb', line 17

def self.catalogs
	init
	
	CatalogSet.new(home)
end

.commandsObject



24
25
26
# File 'bin/parcel', line 24

def self.commands
	@commands||={}
end

.glob(dirs_or_files, base) ⇒ Object

Given a collection of directories or files, returns a list of files. Directories are expanded into all files found inside that directory (including any subdirectories). Attempts to ignore backup files (those ending in ~).



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/andparcel/parcel.rb', line 17

def self.glob(dirs_or_files, base)
	files=[]
	
	if dirs_or_files
		dirs_or_files.each do |x|
			if x.split('').last!='~'
				path=base ? File.join(base, x) : x
				if File.directory?(path)
					files += FileRef[path]
				else
					files << FileRef.new(path, File.dirname(path))
				end
			end
		end
		
		files.delete_if {|fr| File.directory?(fr.local)}
	end
	
	files
end

.homeObject



8
9
10
# File 'lib/andparcel/base.rb', line 8

def self.home
	File.join(Dir.chdir {Dir.pwd}, '.andparcel')
end

.initObject



12
13
14
15
# File 'lib/andparcel/base.rb', line 12

def self.init
	FileUtils.mkdir_p home
	CatalogSet.new(home).add('andparcel.com', 'http://pub.andparcel.com/andparcel.json')
end

.versionObject



4
5
6
# File 'lib/andparcel/base.rb', line 4

def self.version
	"0.1"
end