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
le1t0-deprec-2.1.6.040 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.039 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.038 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.037 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.036 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.035 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.034 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.033 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.032 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.031 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.030 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.029 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.028 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.027 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.026 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.025 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.024 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.023 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.022 lib/vmbuilder_plugins/emerge.rb
le1t0-deprec-2.1.6.021 lib/vmbuilder_plugins/emerge.rb