lib/pgit/current_project.rb in pgit-0.0.3 vs lib/pgit/current_project.rb in pgit-0.0.4
- old
+ new
@@ -25,16 +25,10 @@
@current_project["api_token"]
end
private
- def validate_pwd_match_at_least_one(matching_projects)
- if matching_projects.length == 0
- raise "None of the project paths matches the working directory"
- end
- end
-
def escape_slashes(project_path)
project_path.gsub('/','\/')
end
def find_matching_projects(projects)
@@ -48,10 +42,10 @@
def find_current_project(config_yaml)
projects = config_yaml["projects"]
matching_projects = find_matching_projects(projects)
- validate_pwd_match_at_least_one(matching_projects)
+ PGit::CurrentProject::Validator.new(matching_projects)
find_best_match(matching_projects)
end
def find_best_match(matching_projects)
matching_projects.sort! { |a,b| b["path"].length <=> a["path"].length }