lib/vendorise/tasks.rb in vendorise-0.1.1 vs lib/vendorise/tasks.rb in vendorise-0.2.0
- old
+ new
@@ -1,13 +1,15 @@
require "rake"
require_relative "parser"
+require_relative "arborist"
namespace :vendorise do
desc "Installs a gem from the specified url to /vendor/gems"
task :gem, :url do |t, args|
- url = Vendorise::Parser.gem_url(args[:url]) or raise "Please specify a valid url for the gem"
- path = "vendor/gems/#{Vendorise::Parser.gem_name(args[:url])}"
- cmd = Dir.exist?(path) ? "pull" : "add"
+ parser = Vendorise::Parser.new(args[:url])
+ url = parser.gem_url or raise "Please specify a valid url for the gem"
- system("git subtree #{cmd} --prefix #{path} #{url} master --squash")
+ command = Vendorise::Arborist.new("vendor/gems/#{parser.gem_name}", url).subtree_command
+
+ system(command)
end
end