Class: Vendorificator::Vendor::Tool

Inherits:
Vendorificator::Vendor show all
Defined in:
lib/vendorificator/vendor/tool.rb

Instance Attribute Summary

Attributes inherited from Vendorificator::Vendor

#args, #block, #environment, #name, #segment

Instance Method Summary collapse

Methods inherited from Vendorificator::Vendor

#===, arg_reader, #compute_dependencies!, #conjure_commit_message, #git_add_extra_paths, #group, #initialize, #inspect, #metadata, #version

Constructor Details

This class inherits a constructor from Vendorificator::Vendor

Instance Method Details

#before_conjure!Object



10
11
12
13
14
# File 'lib/vendorificator/vendor/tool.rb', line 10

def before_conjure!
  upstream_version # to cache the version in instance attribute,
                   # it will be needed when we don't have the
                   # specs
end

#conjure!Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/vendorificator/vendor/tool.rb', line 16

def conjure!
  Dir.chdir(git.git_work_tree) do
    git.checkout(
      "origin/#{environment.current_branch}", '--', specs_in_repo, extras_in_repo
      ) unless specs_in_repo.empty? && extras_in_repo.empty?
    git.rm({:cached => true}, extras_in_repo) unless extras_in_repo.empty?
    system self.command or raise RuntimeError, "Command failed"
    super
  end
end

#upstream_versionObject



27
28
29
30
31
# File 'lib/vendorificator/vendor/tool.rb', line 27

def upstream_version
  @upstream_version ||= git.capturing.
    log({:n => 1, :pretty => 'format:%ad-%h', :date => 'short'}, specs_in_repo).
    strip
end