lib/vim-flavor/flavor.rb in vim-flavor-1.0.0 vs lib/vim-flavor/flavor.rb in vim-flavor-1.0.1
- old
+ new
@@ -1,15 +1,20 @@
module Vim
module Flavor
class Flavor
+ include ShellUtility
+
# A short name of a repository.
# Possible formats are "$user/$repo", "$repo" and "$repo_uri".
attr_accessor :repo_name
# A constraint to choose a proper version.
attr_accessor :version_constraint
+ # A group which this flavor belongs to.
+ attr_accessor :group
+
# A version of a plugin to be installed.
attr_accessor :locked_version
# Return true if this flavor's repository is already cloned.
def cached?
@@ -59,12 +64,12 @@
git fetch --tags
} 2>&1
}
end
- def deploy(vimfiles_path)
- deployment_path = "#{vimfiles_path.to_flavors_path}/#{repo_name.zap}"
+ def deploy(flavors_path)
+ deployment_path = "#{flavors_path}/#{repo_name.zap}"
sh %Q[
{
cd '#{cached_repo_path}' &&
git checkout -f '#{locked_version}' &&
git checkout-index -a -f --prefix='#{deployment_path}/' &&
@@ -104,18 +109,9 @@
map {|t| Gem::Version.create(t)}
end
def list_versions()
versions_from_tags(list_tags())
- end
-
- def sh script
- output = send(:`, script)
- if $? == 0
- output
- else
- raise RuntimeError, output
- end
end
def satisfied_with?(locked_flavor)
repo_name == locked_flavor.repo_name &&
version_constraint.compatible?(locked_flavor.locked_version)