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
Empact-deprec-1.99.21 lib/vmbuilder_plugins/emerge.rb
andyh-deprec-1.99.26 lib/vmbuilder_plugins/emerge.rb
andyh-deprec-1.99.27 lib/vmbuilder_plugins/emerge.rb
isaac-deprec-1.99.30 lib/vmbuilder_plugins/emerge.rb
isaac-deprec-1.99.32 lib/vmbuilder_plugins/emerge.rb
deprec-core-3.1.15 lib/vmbuilder_plugins/emerge.rb
deprec-core-3.1.14 lib/vmbuilder_plugins/emerge.rb
deprec-core-3.1.13 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.088 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.087 lib/vmbuilder_plugins/emerge.rb
deprec-core-3.1.12 lib/vmbuilder_plugins/emerge.rb
deprec-core-3.1.10 lib/vmbuilder_plugins/emerge.rb
deprec-core-3.1.9 lib/vmbuilder_plugins/emerge.rb
deprec-core-3.1.8 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.086 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.085 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.084 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.083 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.082 lib/vmbuilder_plugins/emerge.rb
deprec-core-3.1.7 lib/vmbuilder_plugins/emerge.rb