lib/vim-flavor/flavor.rb in vim-flavor-1.1.5 vs lib/vim-flavor/flavor.rb in vim-flavor-2.0.0

- old
+ new

@@ -26,11 +26,11 @@ def cached_version?(version) system <<-"END" { cd '#{cached_repo_path}' && - git rev-list --quiet '#{version}' + git rev-list --quiet '#{version.to_revision}' -- } >/dev/null 2>&1 END end def cached_repo_path @@ -72,30 +72,30 @@ def fetch() sh %Q{ { cd '#{cached_repo_path}' && - git fetch --tags + git fetch origin --tags 'refs/heads/*:refs/remotes/origin/*' } 2>&1 } end def checkout() sh %Q[ { cd '#{cached_repo_path}' && - git checkout -f '#{locked_version}' + git checkout -f '#{locked_version.to_revision}' } 2>&1 ] end def deploy(flavors_path) deployment_path = make_deployment_path(flavors_path) sh %Q[ { cd '#{cached_repo_path}' && - git checkout -f '#{locked_version}' && + git checkout -f '#{locked_version.to_revision}' && git checkout-index -a -f --prefix='#{deployment_path}/' && { vim -u NONE -i NONE -n -N -e -s -c ' silent! helptags #{deployment_path}/doc qall! @@ -106,11 +106,18 @@ true end def use_appropriate_version() @locked_version = - version_constraint.find_the_best_version(list_versions) + case + when PlainVersion === version_constraint.base_version + version_constraint.find_the_best_version(list_versions) + when BranchVersion === version_constraint.base_version + make_branch_version(version_constraint.base_version.branch) + else + throw "Unexpected version_constraint: #{version_constraint}" + end end def use_specific_version(locked_version) @locked_version = locked_version end @@ -135,9 +142,17 @@ versions_from_tags(list_tags()) end def satisfied_with?(version) version_constraint.compatible?(version) + end + + def make_branch_version(branch) + revision = sh(%Q[ + cd '#{cached_repo_path}' && + git rev-list -n1 'origin/#{branch}' -- + ]).chomp + BranchVersion.new(branch, revision) end end end end