lib/vim-flavor/flavor.rb in vim-flavor-1.0.2 vs lib/vim-flavor/flavor.rb in vim-flavor-1.0.3
- old
+ new
@@ -19,15 +19,28 @@
# Return true if this flavor's repository is already cloned.
def cached?
Dir.exists?(cached_repo_path)
end
+ def cached_version?(version)
+ system <<-"END"
+ {
+ cd '#{cached_repo_path}' &&
+ git rev-list --quiet '#{version}'
+ } >/dev/null 2>&1
+ END
+ end
+
def cached_repo_path
@cached_repo_path ||=
"#{ENV['HOME'].to_stash_path}/repos/#{@repo_name.zap}"
end
+ def make_deployment_path(flavors_path)
+ "#{flavors_path}/#{repo_name.zap}"
+ end
+
def self.github_repo_uri(user, repo)
p = (ENV['VIM_FLAVOR_GITHUB_URI_PREFIX'] ||= 'git://github.com/')
s = (ENV['VIM_FLAVOR_GITHUB_URI_SUFFIX'] ||= '.git')
"#{p}#{user}/#{repo}#{s}"
end
@@ -64,10 +77,10 @@
} 2>&1
}
end
def deploy(flavors_path)
- deployment_path = "#{flavors_path}/#{repo_name.zap}"
+ deployment_path = make_deployment_path(flavors_path)
sh %Q[
{
cd '#{cached_repo_path}' &&
git checkout -f '#{locked_version}' &&
git checkout-index -a -f --prefix='#{deployment_path}/' &&