Class: Vendorificator::Vendor::Git

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

Instance Attribute Summary collapse

Attributes inherited from Vendorificator::Vendor

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

Instance Method Summary collapse

Methods inherited from Vendorificator::Vendor

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

Constructor Details

This class inherits a constructor from Vendorificator::Vendor

Instance Attribute Details

#conjured_revisionObject (readonly)

Returns the value of attribute conjured_revision.



7
8
9
# File 'lib/vendorificator/vendor/git.rb', line 7

def conjured_revision
  @conjured_revision
end

Instance Method Details

#conjure!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vendorificator/vendor/git.rb', line 9

def conjure!
  say_status :default, :clone, repository
  MiniGit.git :clone, repository, '.'
  local_git = MiniGit.new('.')

  if tag||revision
    local_git.checkout({:b => 'vendorified'}, tag||revision)
  elsif branch
    local_git.checkout({:b => 'vendorified'}, "origin/#{branch}")
  end

  super

  @conjured_revision = local_git.capturing.rev_parse('HEAD').strip
  
  FileUtils::rm_rf '.git'
end

#conjure_commit_messageObject



31
32
33
34
35
36
37
38
# File 'lib/vendorificator/vendor/git.rb', line 31

def conjure_commit_message
  rv = "Conjured git module #{name} "
  rv << "version #{version} " if version
  rv << "from tag #{tag} " if tag
  rv << "from branch #{branch} " if branch
  rv << "at revision #{conjured_revision}"
  rv
end

#upstream_versionObject



27
28
29
# File 'lib/vendorificator/vendor/git.rb', line 27

def upstream_version
  tag || conjured_revision
end