Class: Pot::Installers::Source

Inherits:
Pot::Installer show all
Defined in:
lib/pot/installers/source.rb

Overview

Source Package Installer

The source package installer installs software from source. It handles downloading, extracting, configuring, building, and installing software.

Configuration Options

The source installer has many configuration options:

  • prefix - The prefix directory that is configured to.

  • archives - The location all the files are downloaded to.

  • builds - The directory the package is extracted to to configure and install

Pre/Post Hooks

The source installer defines a myriad of new stages which can be hooked into:

  • prepare - Prepare is the stage which all the prefix, archives, and build directories are made.

  • download - Download is the stage which the software package is downloaded.

  • extract - Extract is the stage which the software package is extracted.

  • configure - Configure is the stage which the ./configure script is run.

  • build - Build is the stage in which ‘make` is called.

  • install - Install is the stage which ‘make install` is called.

Example Usage

First, a simple package, no configuration:

package :magic_beans do
  source 'http://magicbeansland.com/latest-1.1.1.tar.gz'
end

Second, specifying exactly where I want my files:

package :magic_beans do
  source 'http://magicbeansland.com/latest-1.1.1.tar.gz' do
    prefix    '/usr/local'
    archives  '/tmp'
    builds    '/tmp/builds'
  end
end

Third, specifying some hooks:

package :magic_beans do
  source 'http://magicbeansland.com/latest-1.1.1.tar.gz' do
    prefix    '/usr/local'

    pre :prepare { 'echo "Here we go folks."' }
    post :extract { 'echo "I believe..."' }
    pre :build { 'echo "Cross your fingers!"' }
  end
end

Fourth, specifying a custom archive name because the downloaded file name differs from the source URL:

package :gitosis do
  source 'http://github.com/crafterm/sprinkle/tarball/master' do
    custom_archive 'crafterm-sprinkle-518e33c835986c03ec7ae8ea88c657443b006f28.tar.gz'
  end
end

As you can see, setting options is as simple as creating a block and calling the option as a method with the value as its parameter.

Instance Attribute Summary collapse

Attributes inherited from Pot::Installer

#actor, #options, #package, #post, #pre

Instance Method Summary collapse

Methods inherited from Pot::Installer

#archives, #builds, #prefix, #process

Constructor Details

#initialize(parent, source, options = {}, &block) ⇒ Source

:nodoc:



72
73
74
75
76
77
78
# File 'lib/pot/installers/source.rb', line 72

def initialize(parent, source, options = {}, &block) #:nodoc:
  @source = source
  super parent, options, &block
  @options[:prefix] ||= '/usr/local'
  @options[:archives] ||= '/usr/src'
  @options[:builds] ||= '/tmp'
end

Instance Attribute Details

#sourceObject

:nodoc:



70
71
72
# File 'lib/pot/installers/source.rb', line 70

def source
  @source
end

Instance Method Details

#commandsObject

:nodoc:



80
81
82
# File 'lib/pot/installers/source.rb', line 80

def commands #:nodoc:
  prepare + download + extract + configure + build + install
end