Sha256: d06565bf486e2ad6e9c4a0690445a64628cd09e517fae87376b68708a25ae983
Contents?: true
Size: 632 Bytes
Versions: 4
Compression:
Stored size: 632 Bytes
Contents
class Gator require 'pathname' class ProjectFileLocator def project_files ["gator", "gator.rb"] end def project_file_paths(dir) project_files.collect { |f| File.join(dir, f) } end def find_project_dir path=Dir.getwd file = find_project_file path File.dirname file unless file.nil? end def find_project_file path=Dir.getwd gatorfile = nil Pathname.new(path).ascend do |dir| gatorfile = project_file_paths(dir).map { |g| Dir[g] }.flatten.first break unless gatorfile.nil? || File.directory?(gatorfile) end gatorfile end end end
Version data entries
4 entries across 4 versions & 1 rubygems