lib/vendorificator/vendor/git.rb in vendorificator-0.1.1 vs lib/vendorificator/vendor/git.rb in vendorificator-0.2.0

- old
+ new

@@ -1,35 +1,33 @@ require 'fileutils' - -require 'grit' - require 'vendorificator/vendor' class Vendorificator::Vendor::Git < Vendorificator::Vendor arg_reader :repository, :revision, :branch - attr_reader :module_repo, :conjured_revision + attr_reader :git, :conjured_revision - def initialize(name, args={}, &block) + def initialize(environment, name, args={}, &block) unless args.include?(:repository) args[:repository] = name name = name.split('/').last.sub(/\.git$/, '') end - super(name, args, &block) + super(environment, name, args, &block) end def conjure! shell.say_status :clone, repository - Grit::Git.new('.').clone({}, repository, '.') - @module_repo = Grit::Repo.new('.') + MiniGit.git :clone, repository, '.' + @git = MiniGit.new('.') if revision - module_repo.git.checkout({:b => 'vendorified'}, revision) + git.checkout({:b => 'vendorified'}, revision) elsif branch - module_repo.git.checkout({:b => 'vendorified'}, "origin/#{branch}") + git.checkout({:b => 'vendorified'}, "origin/#{branch}") end super - @conjured_revision = module_repo.head.commit.id + + @conjured_revision = git.capturing.rev_parse('HEAD').strip FileUtils::rm_rf '.git' end def upstream_version conjured_revision