Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pkgin installer. #218

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions lib/sprinkle/installers/pkgin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,30 @@ module Installers
# pkgin 'magic_beans'
# end
#
# You may also specify multiple packages as an array:
#
# package :magic_beans do
# pkgin %w(magic_beans magic_sauce)
# end
#
class Pkgin < PackageInstaller

attr_accessor :package_name
##
# installs pkgsrc binary packages passed
# :method: pkgin
# :call-seq: pkgin(*packages)
auto_api

api do
def pkgin(package, &block)
install Pkgin.new(self, package, &block)
end
end
verify_api do
def has_pkgin(package)
@commands << "pkgin list | egrep '^#{@package_name}-'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we decide this should be grep -e?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. New commits fixed this typo.

end
end
def initialize(parent, package_name, &block) #:nodoc:
super parent, &block
@package_name = package_name
end

protected

def install_commands #:nodoc:
"sudo /opt/pkg/bin/pkgin -y install #{@package_name}"
"#{sudo_cmd}pkgin -y install #{@packages.join(' ')}"
end
end
end
Expand Down