-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rob Lingle
committed
May 20, 2009
0 parents
commit ea54566
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
= Moonshine_Xsendfile | ||
|
||
=== A plugin for Moonshine[http://github.com/railsmachine/moonshine] | ||
|
||
A plugin for installing and managing mod_xsendfile[http://tn123.ath.cx/mod_xsendfile] for Apache. | ||
|
||
=== Instructions | ||
|
||
* <tt>script/plugin install git://github.com/railsmachine/moonshine_xsendfile.git</tt> | ||
* Configure settings if needed (it probably isn't) | ||
configure(:xsendfile => {:x_send_file_allow_above => 'off'}) | ||
* Include the plugin and recipe(s) in your Moonshine manifest | ||
plugin :xsendfile | ||
recipe :xsendfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module Xsendfile | ||
|
||
# Define options for this plugin via the <tt>configure</tt> method | ||
# in your application manifest: | ||
# | ||
# configure(:xsendfile => {:x_send_file_allow_above => 'off'}) | ||
# | ||
# Then include the plugin and call the recipe(s) you need: | ||
# | ||
# plugin :xsendfile | ||
# recipe :xsendfile | ||
def xsendfile(options = {}) | ||
|
||
package 'apache2-threaded-dev', :ensure => :installed | ||
|
||
exec 'install_xsendfile', | ||
:cwd => '/tmp', | ||
:command => [ | ||
'wget http://tn123.ath.cx/mod_xsendfile/mod_xsendfile.c', | ||
'apxs2 -ci mod_xsendfile.c' | ||
].join(' && '), | ||
:require => package('apache2-threaded-dev'), | ||
:before => service('apache2'), | ||
:creates => '/usr/lib/apache2/modules/mod_xsendfile.so' | ||
|
||
file '/etc/apache2/mods-available/xsendfile.conf', | ||
:alias => 'xsendfile_conf', | ||
:content => """ | ||
XSendFile #{ options[:x_send_file] || 'on'} | ||
XSendFileAllowAbove #{ options[:x_send_file_allow_above] || 'on'} | ||
#{options[:extra] || ''} | ||
""", | ||
:mode => '644', | ||
:notify => service('apache2') | ||
|
||
file '/etc/apache2/mods-available/xsendfile.load', | ||
:alias => 'load_xsendfile', | ||
:content => 'LoadModule xsendfile_module /usr/lib/apache2/modules/mod_xsendfile.so', | ||
:mode => '644', | ||
:require => file('xsendfile_conf'), | ||
:notify => service('apache2') | ||
|
||
a2enmod 'xsendfile', :require => file('load_xsendfile') | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require "#{File.dirname(__FILE__)}/../lib/xsendfile.rb" | ||
|
||
include Xsendfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'rubygems' | ||
ENV['RAILS_ENV'] = 'test' | ||
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..' | ||
|
||
require File.join(File.dirname(__FILE__), '..', '..', 'moonshine', 'lib', 'moonshine.rb') | ||
require File.join(File.dirname(__FILE__), '..', 'lib', 'xsendfile.rb') | ||
|
||
require 'shadow_puppet/test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require File.join(File.dirname(__FILE__), 'spec_helper.rb') | ||
|
||
class XsendfileManifest < Moonshine::Manifest | ||
plugin :xsendfile | ||
end | ||
|
||
describe "A manifest with the Xsendfile plugin" do | ||
|
||
before do | ||
@manifest = XsendfileManifest.new | ||
@manifest.xsendfile | ||
end | ||
|
||
it "should be executable" do | ||
@manifest.should be_executable | ||
end | ||
|
||
#it "should provide packages/services/files" do | ||
# @manifest.packages.keys.should include 'foo' | ||
# @manifest.files['/etc/foo.conf'].content.should match /foo=true/ | ||
# @manifest.execs['newaliases'].refreshonly.should be_true | ||
#end | ||
|
||
end |