Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisroberts committed Sep 28, 2012
0 parents commit 4f00313
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Package Installer
=============

Simple cookbook for managing package versions on a node.

Usage
=====

Attributes
----------

Define packages (and optionally version restrictions and action type) within the role:


```ruby
override_attributes(
:package_installer => {
:packages => {
'vim' => nil,
'mailutils' => {
:version => '2.2'
},
'emacs' => {
:action => :upgrade
}
}
}
)
```

By default the :upgrade action is used. If you want to keep the package
pegged, simply specify a version or use the :install action.

Issues/Bugs/Feature Requests
----------------------------

Create a github issue or fork, fix and send me a pull request

1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default[:package_installer][:packages] = {}
7 changes: 7 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
maintainer "Chris Roberts"
maintainer_email "chrisroberts.code@gmail.com"
license "Apache 2.0"
description "Installs/Updates system packages"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.1"

11 changes: 11 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Iterate and install packages
node[:package_installer][:packages].each do |pkg_name, pkg_info|
if(pkg_info)
pkg_action = pkg_info[:action] || :install
pkg_version = pkg_info[:version]
end
package pkg_name do
action pkg_action
version pkg_version if pkg_version
end
end

0 comments on commit 4f00313

Please sign in to comment.