Class: Autobuild::DarcsImporter

Inherits:
Importer
  • Object
show all
Defined in:
lib/autobuild/import/darcs.rb

Instance Attribute Summary

Attributes inherited from Importer

#interactive, #options, #post_hooks, #repository_id, #source_id

Instance Method Summary collapse

Methods inherited from Importer

#add_post_hook, add_post_hook, #apply, cache_dirs, #call_patch, #currently_applied_patches, default_cache_dirs, default_cache_dirs=, each_post_hook, #each_post_hook, #execute_post_hooks, fallback, #fallback, #fingerprint, #import, #interactive?, #parse_patch_list, #patch, #patchdir, #patches, #patches_fingerprint, #patchlist, #perform_checkout, #perform_update, #retry_count, #retry_count=, #save_patch_state, set_cache_dirs, #supports_relocation?, #unapply, unset_cache_dirs, #update_retry_count, #vcs_fingerprint

Constructor Details

#initialize(source, options = {}) ⇒ DarcsImporter

Creates a new importer which gets the source from the Darcs repository source # The following values are allowed in options:

:get

options to give to ‘darcs get’.

:pull

options to give to ‘darcs pull’.

This importer uses the ‘darcs’ tool to perform the import. It defaults to ‘darcs’ and can be configured by doing

Autobuild.programs['darcs'] = 'my_darcs_tool'


15
16
17
18
19
20
21
# File 'lib/autobuild/import/darcs.rb', line 15

def initialize(source, options = {})
    @source   = source
    @program  = Autobuild.tool('darcs')
    super(options.merge(repository_id: source))
    @pull = [*options[:pull]]
    @get  = [*options[:get]]
end

Instance Method Details

#checkout(package, _options = Hash.new) ⇒ Object

:nodoc:



40
41
42
43
44
45
46
# File 'lib/autobuild/import/darcs.rb', line 40

def checkout(package, _options = Hash.new) # :nodoc:
    basedir = File.dirname(package.srcdir)
    FileUtils.mkdir_p(basedir) unless File.directory?(basedir)

    package.run(:import, @program, 'get', '--set-scripts-executable',
                @source, package.srcdir, *@get, retry: true)
end

#update(package, options = Hash.new) ⇒ Object

:nodoc:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/autobuild/import/darcs.rb', line 23

def update(package, options = Hash.new) # :nodoc:
    if options[:only_local]
        package.warn "%s: the darcs importer does not support "\
            "local updates, skipping"
        return false
    end
    unless File.directory?(File.join(package.srcdir, '_darcs'))
        raise ConfigException.new(package, 'import'),
              "#{package.srcdir} is not a Darcs repository"
    end

    package.run(:import, @program, 'pull', '--all',
                "--repodir=#{package.srcdir}", '--set-scripts-executable',
                @source, *@pull, retry: true)
    true # no easy to know if package was updated, keep previous behavior
end