Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Commit

Permalink
Merge branch 'COOK-186'
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimberman committed Aug 24, 2010
2 parents 82c1408 + 4536c14 commit 1d8d06d
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 63 deletions.
25 changes: 25 additions & 0 deletions subversion/attributes/subversion.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Cookbook Name:: subversion
# Attributes:: server
#
# Copyright 2009, Daniel DeLeo
#
# 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.
#

subversion Mash.new unless attribute?("subversion")
default.subversion.repo_dir "/srv/svn"
default.subversion.repo_name "repo"
default.subversion.server_name "svn" # hostname of apache virtual host
default.subversion.user "subversion"
default.subversion.password "subversion" # please override this :)
83 changes: 44 additions & 39 deletions subversion/metadata.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
{
"recommendations": {
},
"attributes": {
},
"maintainer": "Opscode, Inc.",
"suggestions": {
},
"dependencies": {
},
"maintainer_email": "cookbooks@opscode.com",
"conflicting": {
},
"platforms": {
"debian": [
"name": "subversion",
"description": "Installs subversion",
"long_description": "",
"maintainer": "Opscode, Inc.",
"maintainer_email": "cookbooks@opscode.com",
"license": "Apache 2.0",
"platforms": {
"redhat": [

],
"fedora": [
],
"centos": [

],
"centos": [
],
"fedora": [

],
"ubuntu": [
],
"ubuntu": [

],
"redhat": [
],
"debian": [

]
},
"license": "Apache 2.0",
"version": "0.8.1",
"providing": {
},
"recipes": {
"subversion": "Installs subversion and extra svn packages"
},
"replacing": {
},
"name": "subversion",
"description": "Installs subversion",
"groupings": {
},
"long_description": ""
}
]
},
"dependencies": {
"apache2": [

]
},
"recommendations": {
},
"suggestions": {
},
"conflicting": {
},
"providing": {
},
"replacing": {
},
"attributes": {
},
"groupings": {
},
"recipes": {
"subversion": "Includes the client recipe.",
"subversion::client": "Subversion Client installs subversion and some extra svn libs",
"subversion::server": "Subversion Server (Apache2 mod_dav_svn)"
},
"version": "0.8.1"
}
8 changes: 6 additions & 2 deletions subversion/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
description "Installs subversion"
version "0.8.1"

recipe "subversion", "Installs subversion and extra svn packages"

%w{ redhat centos fedora ubuntu debian }.each do |os|
supports os
end

depends "apache2"

recipe "subversion", "Includes the client recipe."
recipe "subversion::client", "Subversion Client installs subversion and some extra svn libs"
recipe "subversion::server", "Subversion Server (Apache2 mod_dav_svn)"
39 changes: 39 additions & 0 deletions subversion/recipes/client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Cookbook Name:: subversion
# Recipe:: default
#
# Copyright 2008, OpsCode, Inc.
#
# 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.0c
#
# 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.
#

package "subversion" do
action :install
end

extra_packages = case node[:platform]
when "ubuntu","debian"
if node[:platform_version].to_f < 8.04
%w{subversion-tools libsvn-core-perl}
else
%w{subversion-tools libsvn-perl}
end
when "centos","redhat","fedora"
%w{subversion-devel subversion-perl}
end

extra_packages.each do |pkg|
package pkg do
action :install
end
end
24 changes: 2 additions & 22 deletions subversion/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Recipe:: default
#
# Copyright 2008-2009, Opscode, Inc.
# Copyright 2009, Daniel DeLeo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,25 +18,4 @@
# limitations under the License.
#

package "subversion" do
action :install
end

extra_packages = case node[:platform]
when "ubuntu"
if node[:platform_version].to_f < 8.04
%w{subversion-tools libsvn-core-perl}
else
%w{subversion-tools libsvn-perl}
end
when "debian"
%{subversion-tools libsvn-perl}
when "centos","redhat","fedora"
%w{subversion-devel subversion-perl}
end

extra_packages.each do |pkg|
package pkg do
action :install
end
end
include_recipe "subversion::client"
46 changes: 46 additions & 0 deletions subversion/recipes/server.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# Author:: Daniel DeLeo <dan@kallistec.com>
# Cookbook Name:: subversion
# Recipe:: server
#
# Copyright 2009, Daniel DeLeo
#
# 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.
#
include_recipe "apache2::mod_dav_svn"
include_recipe "subversion::client"

directory node[:subversion][:repo_dir] do
recursive true
owner node[:apache][:user]
group node[:apache][:user]
mode "0755"
end

web_app "subversion" do
template "subversion.conf.erb"
server_name "#{node[:subversion][:server_name]}.#{node[:domain]}"
notifies :restart, resources(:service => "apache2")
end

execute "svnadmin create repo" do
command "svnadmin create #{node[:subversion][:repo_dir]}/#{node[:subversion][:repo_name]}"
creates "#{node[:subversion][:repo_dir]}/#{node[:subversion][:repo_name]}"
user node[:apache][:user]
group node[:apache][:user]
end

execute "create htpasswd file" do
command "htpasswd -scb #{node[:subversion][:repo_dir]}/htpasswd #{node[:subversion][:user]} #{node[:subversion][:password]}"
creates "#{node[:subversion][:repo_name]}/htpasswd"
end
15 changes: 15 additions & 0 deletions subversion/templates/default/subversion.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Location /svn>

DAV svn

SVNPath /srv/svn/repo

AuthType Basic

AuthName "Subversion repository"

AuthUserFile /srv/svn/htpasswd

Require valid-user

</Location>

0 comments on commit 1d8d06d

Please sign in to comment.