Class: Yay::Paths
- Inherits:
-
Object
- Object
- Yay::Paths
- 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
- #current_path ⇒ Object
-
#gempath_to_yaypath(gem_path) ⇒ Object
try to determine where yayfiles might be installed based on a gem path.
-
#gempaths ⇒ Object
get the paths to installed gems.
- #global_yay_path ⇒ Object
-
#local_yay_path ⇒ Object
get the path we store local .yay files.
-
#yay_paths ⇒ Object
get all the paths where we might be able to find .yay files.
Instance Method Details
#current_path ⇒ Object
30 31 32 |
# File 'lib/yay/paths.rb', line 30 def current_path return '.' end |
#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 |
#gempaths ⇒ Object
get the paths to installed gems
12 13 14 |
# File 'lib/yay/paths.rb', line 12 def gempaths return Gem.path end |
#global_yay_path ⇒ Object
34 35 36 |
# File 'lib/yay/paths.rb', line 34 def global_yay_path return '/etc/yay' end |
#local_yay_path ⇒ Object
get the path we store local .yay files
39 40 41 42 |
# File 'lib/yay/paths.rb', line 39 def local_yay_path raise "ENV[HOME] not found!" unless ENV['HOME'] return "#{ENV['HOME']}/.yay" end |
#yay_paths ⇒ Object
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 = [current_path,local_yay_path,global_yay_path] gempaths.each { |v| result.push gempath_to_yaypath(v) } return result end |