Sha256: 467c385050e1d4e5664c65665bc3f158f84aff10fdc5a0be88f9a211f4b5f1de
Contents?: true
Size: 961 Bytes
Versions: 1
Compression:
Stored size: 961 Bytes
Contents
# encoding: utf-8 require 'pathname' require 'rbconfig' module Adhearsion module ScriptAhnLoader RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"] SCRIPT_AHN = File.join('script', 'ahn') def self.load_script_ahn(path = Dir.pwd) path = Pathname.new(path).expand_path until path.root? script = File.join(path, SCRIPT_AHN) if File.exists?(script) load script return true end path = path.parent end nil end def self.in_ahn_application?(path = nil) return File.exists? SCRIPT_AHN unless path Dir.chdir(path) { File.exists? SCRIPT_AHN } end def self.in_ahn_application_subdirectory?(path = nil) path = Pathname.new(path.nil? ? Dir.pwd : path) File.exists?(File.join(path, SCRIPT_AHN)) || ! path.root? && in_ahn_application_subdirectory?(path.parent) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-2.6.1 | lib/adhearsion/script_ahn_loader.rb |