Class: Yay::Paths

Inherits:
Object
  • Object
show all
Defined in:
lib/yay/paths.rb

Overview

some utility functions for finding the current install and .yay paths

Constant Summary collapse

DEFAULT_YAYFILE =
'default'

Instance Method Summary collapse

Instance Method Details

#gempath_to_yaypath(gem_path) ⇒ Object

try to determine where yayfiles might be installed based on a gem path



17
18
19
# File 'lib/yay/paths.rb', line 17

def gempath_to_yaypath gem_path
	return "#{gem_path}/gems/yay-#{Yay::VERSION}/data/yay"
end

#gempathsObject

get the paths to installed gems



12
13
14
# File 'lib/yay/paths.rb', line 12

def gempaths
	return Gem.path
end

#local_yay_pathObject

get the path we store local .yay files



31
32
33
34
# File 'lib/yay/paths.rb', line 31

def local_yay_path
	raise "ENV[HOME] not found!" unless ENV['HOME']
	return "#{ENV['HOME']}/.yay"
end

#yay_pathsObject

get all the paths where we might be able to find .yay files



22
23
24
25
26
27
28
# File 'lib/yay/paths.rb', line 22

def yay_paths
	result = [local_yay_path]
	gempaths.each { |v| 
		result.push gempath_to_yaypath(v)
	}
	return result
end