Module: Projectr

Defined in:
lib/projectr.rb,
lib/projectr/version.rb

Constant Summary collapse

PROJECT_PATH =
"#{Dir.home}/.projectr"
VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.listObject



7
8
9
10
11
12
# File 'lib/projectr.rb', line 7

def self.list
	dirs = Dir.glob("#{PROJECT_PATH}/*")
		.select { |f|File.directory? f }
		.map { |p| p.split('/').last }
	dirs.each { |dir| puts dir }
end

.load(name, dest_path = Dir.pwd) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/projectr.rb', line 13

def self.load(name, dest_path = Dir.pwd)
	src_path = "#{PROJECT_PATH}/#{name}"
	raise "#{name} is not a valid project" if !File.exist?(src_path)
	FileUtils.cp_r(Dir.glob("#{src_path}/*"), dest_path)
	projectrfile_path = "#{dest_path}/Projectrfile"
	if File.exist?(projectrfile_path)
		FileUtils.chmod('+x', projectrfile_path)
		system "#{projectrfile_path}"
		FileUtils.rm(projectrfile_path)
	end
end