Sha256: 7f9f8ac93f511b851ec0ab24d838bc663f9107ef68648c706acd21da9301e3aa
Contents?: true
Size: 865 Bytes
Versions: 2
Compression:
Stored size: 865 Bytes
Contents
require "pathname" module MavenHelperScript class ProjectHomeFinder public def findProjectDirectory(file) @originalPath = Pathname.new(File.expand_path(file)) @path = @originalPath found = false while !found found = foundProjectArtifacts(File.join(@path)) if !found if !outOfDirectoriesToCheck @path @path = @path.parent else raise MavenHelperScript::MissingProjectFolderException.new end end end File.join(@path) end private def outOfDirectoriesToCheck(currentPath) currentPath == currentPath.parent end def foundProjectArtifacts(file) FileTest.exist?(File.join(file, 'm.yml')) && FileTest.exist?(File.join(file, 'pom.xml')) end end class MissingProjectFolderException < Exception end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
maven-helper-script-0.2.1 | lib/project_home_finder.rb |
maven-helper-script-0.2.0 | lib/project_home_finder.rb |