Sha256: 0c7b39916a1fea140f0516e2de994b17bdc3650ba3a8e9cebd31cafd19f3fe73

Contents?: true

Size: 1.66 KB

Versions: 147

Compression:

Stored size: 1.66 KB

Contents

# =emerge.rb: Gentoo 'emerge' Installer library
# Capistrano task library to install and manage portage packages
#
# Copyright (c) 2007 monki(Wesley Beary)
#
# inspiration: vmbuilder by Neil Wilson, Aldur Systems Ltd
#
# Licenced under the GNU Public License v2. No warranty is provided.

require 'capistrano'

# =Purpose
# emerge is a Capistrano plugin module providing a set of methods
# that invoke the portage package manage (as used in Gentoo)
#
# Installs within Capistrano as the plugin _emerge_.
#
# =Usage
#
#   require 'marshall/plugins/emerge'
#
# Prefix all calls to the library with <tt>emerge.</tt>
#
module Emerge
  # Default emerge command - reduce interactivity to the minimum
  EMERGE="emerge -q"
  
  # Emerge a new package or packages
  def install(packages, options={})
    cmd = <<-CMD
    sh -c "#{EMERGE} #{packages.join(" ")}"
    CMD
    sudo(cmd, options)
  end
  
  # Run clean old/unused packages
  def clean(options={})
    cmd = <<-CMD
      sh -c "#{EMERGE} -clean"
    CMD
    sudo(cmd, options)
  end
  
  # Upgrade installed package list
  def upgrade(options={})
    cmd = <<-CMD
      sh -c "#{EMERGE} --sync"
    CMD
    sudo(cmd, options)
  end
  
  # Update portage
  def update_system(options={})
    cmd = <<-CMD
      sh -c "#{EMERGE} portage"
    CMD
    sudo(cmd, options)
  end
  
  # Update all installed packages
  def update(options={})
    cmd = <<-CMD
      sh -c "#{EMERGE} --update --deep --newuse world"
    CMD
    sudo(cmd, options)
  end
  
  # Boot script manipulation command
  def rc_update(packages, setting)
    packages.each do |service|
      sudo "rc_update add #{service} #{setting}"
    end
  end
end

Capistrano.plugin :emerge, Emerge

Version data entries

147 entries across 147 versions & 9 rubygems

Version Path
deprec-2.1.11 lib/vmbuilder_plugins/emerge.rb
deprec-2.1.10 lib/vmbuilder_plugins/emerge.rb
deprec-2.1.8 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.057 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.056 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.055 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.054 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.053 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.052 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.051 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.050 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.049 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.048 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.047 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.046 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.045 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.044 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.043 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.042 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.041 lib/vmbuilder_plugins/emerge.rb