Sha256: a3da436ddede751a9e004e8ef528ee1d5c0eddb5f37559f74088342a1796726f

Contents?: true

Size: 1.68 KB

Versions: 44

Compression:

Stored size: 1.68 KB

Contents

require 'autobuild/config'
require 'autobuild/subcommand'
require 'autobuild/importer'

module Autobuild
    class DarcsImporter < Importer
	# 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'
        def initialize(source, options = {})
            @source   = source
            @program  = Autobuild.tool('darcs')
            super(options)
	    @pull = [*options[:pull]]
	    @get  = [*options[:get]]
        end
        
        private

        def update(package) # :nodoc:
	    if !File.directory?( File.join(package.srcdir, '_darcs') )
		raise ConfigException.new(package, 'import'), "#{package.srcdir} is not a Darcs repository"
	    end

	    Subprocess.run(package, :import, @program, 
	       'pull', '--all', "--repodir=#{package.srcdir}", '--set-scripts-executable', @source, *@pull)
        end

        def checkout(package) # :nodoc:
	    basedir = File.dirname(package.srcdir)
	    unless File.directory?(basedir)
		FileUtils.mkdir_p(basedir)
	    end

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

    # Returns the Darcs importer which will get the source from the Darcs repository
    # +source+. The allowed values in +options+ are described in DarcsImporter.new.
    def self.darcs(source, options = {})
        DarcsImporter.new(source, options)
    end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
autobuild-1.7.10 lib/autobuild/import/darcs.rb
autobuild-1.7.9 lib/autobuild/import/darcs.rb
autobuild-1.7.8 lib/autobuild/import/darcs.rb
autobuild-1.7.7 lib/autobuild/import/darcs.rb
autobuild-1.7.6 lib/autobuild/import/darcs.rb
autobuild-1.7.5 lib/autobuild/import/darcs.rb
autobuild-1.7.4 lib/autobuild/import/darcs.rb
autobuild-1.7.4.rc2 lib/autobuild/import/darcs.rb
autobuild-1.7.4.rc1 lib/autobuild/import/darcs.rb
autobuild-1.7.3 lib/autobuild/import/darcs.rb
autobuild-1.7.3.rc3 lib/autobuild/import/darcs.rb
autobuild-1.7.3.rc2 lib/autobuild/import/darcs.rb
autobuild-1.7.3.rc1 lib/autobuild/import/darcs.rb
autobuild-1.7.2 lib/autobuild/import/darcs.rb
autobuild-1.7.1 lib/autobuild/import/darcs.rb
autobuild-1.7.0 lib/autobuild/import/darcs.rb
autobuild-1.7.0.rc4 lib/autobuild/import/darcs.rb
autobuild-1.6.5 lib/autobuild/import/darcs.rb
autobuild-1.7.0.rc3 lib/autobuild/import/darcs.rb
autobuild-1.7.0.rc2 lib/autobuild/import/darcs.rb