Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Commit

Permalink
Import PPA cookbook
Browse files Browse the repository at this point in the history
git-subtree-dir: ppa
git-subtree-mainline: ae8645f
git-subtree-split: e92c0aa
  • Loading branch information
Sharpie committed May 31, 2011
2 parents ae8645f + e92c0aa commit f93430a
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
31 changes: 31 additions & 0 deletions ppa/README.md
@@ -0,0 +1,31 @@
Description
===========

Recipes
=======

Resources/Providers
===================


Usage
=====


License and Author
==================

Author:: Charlie Sharpsteen (<source@sharpsteen.net>)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

9 changes: 9 additions & 0 deletions ppa/metadata.rb
@@ -0,0 +1,9 @@
maintainer "Charlie Sharpsteen"
maintainer_email "source@sharpsteen.net"
license "Apache 2.0"
description "Manages repositories and associated GPG keys using apt-add-repository"
version "0.0.1"

%w{ ubuntu debian }.each do |os|
supports os
end
29 changes: 29 additions & 0 deletions ppa/providers/repository.rb
@@ -0,0 +1,29 @@
# TODO: Add support for cleanly adding normal deb repos. Right now this tool
# is envisaged for use with repos of the form:
# ppa:some_repository
#
action :add do
e = execute "addding ppa:#{new_resource.ppa_name}" do
command "apt-add-repository ppa:#{new_resource.ppa_name}"
action :run
end
e.run_action(:run)

e = execute "update package index" do
command "apt-get update"
action :run
end
e.run_action(:run)

new_resource.updated_by_last_action(true)
end

action :remove do
e = execute "removing ppa:#{new_resource.ppa_name}" do
command "apt-add-repository -r ppa:#{new_resource.ppa_name}"
action :run
end
e.run_action(:run)

new_resource.updated_by_last_action(true)
end
20 changes: 20 additions & 0 deletions ppa/recipes/default.rb
@@ -0,0 +1,20 @@
#
# Cookbook Name:: ppa
# Recipe:: default
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
case node[:platform]
when "debian", "ubuntu"
package "python-software-properties"
end
5 changes: 5 additions & 0 deletions ppa/resources/repository.rb
@@ -0,0 +1,5 @@
actions :add, :remove

# name of the ppa, as one big string.
# TODO: Add moar customizations
attribute :ppa_name, :kind_of => String, :name_attribute => true

0 comments on commit f93430a

Please sign in to comment.