Class: FPM::Cookery::SourceHandler::Hg

Inherits:
Template
  • Object
show all
Defined in:
lib/fpm/cookery/source_handler/hg.rb

Constant Summary collapse

CHECKSUM =
false
NAME =
:hg

Instance Attribute Summary

Attributes inherited from Template

#builddir, #cachedir, #has_checksum, #name, #options, #url

Instance Method Summary collapse

Methods inherited from Template

#checksum?, #initialize, #local_path, #source

Constructor Details

This class inherits a constructor from FPM::Cookery::SourceHandler::Template

Instance Method Details

#extractObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fpm/cookery/source_handler/hg.rb', line 26

def extract
  src = (builddir/local_path.basename('.hg').to_s).to_s

  Dir.chdir(local_path) do
    if options[:rev]
      src << "-#{options[:rev]}"
      hg('archive', '-y', '-r', options[:rev], '-t', 'files', src)
    else
      src << '-tip'
      hg('archive', '-y', '-t', 'files', src)
    end
  end

  src
end

#fetchObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fpm/cookery/source_handler/hg.rb', line 11

def fetch
  if local_path.exist?
    Dir.chdir(local_path) do
      hg('pull')
      hg('update')
    end
  else
    Dir.chdir(cachedir) do
      hg('clone', url, local_path)
    end
  end

  local_path
end