Commit d70b15ce2f142041d11518dedd60f97b382835ea

Initial Version

Commit diff

LICENSE

 
1Copyright (c) 2008, Koziarski Software Limited (michael@koziarski.com)
2
3Permission to use, copy, modify, and/or distribute this software for any
4purpose with or without fee is hereby granted, provided that the above
5copyright notice and this permission notice appear in all copies.
6
7THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
toggle raw diff

README

 
1Unaccept
2========
3
4This plugin avoids the use of the Accept header in rails applications. Requests without params[:format] are just assumed to be HTML.
5
6Copyright (c) 2008 Koziarski Software Ltd, released under the ISC license
toggle raw diff

Rakefile

 
1require 'rake'
2require 'rake/testtask'
3require 'rake/rdoctask'
4
5desc 'Default: run unit tests.'
6task :default => :test
7
8desc 'Test the unaccept plugin.'
9Rake::TestTask.new(:test) do |t|
10 t.libs << 'lib'
11 t.pattern = 'test/**/*_test.rb'
12 t.verbose = true
13end
14
15desc 'Generate documentation for the unaccept plugin.'
16Rake::RDocTask.new(:rdoc) do |rdoc|
17 rdoc.rdoc_dir = 'rdoc'
18 rdoc.title = 'Unaccept'
19 rdoc.options << '--line-numbers' << '--inline-source'
20 rdoc.rdoc_files.include('README')
21 rdoc.rdoc_files.include('lib/**/*.rb')
22end
toggle raw diff

init.rb

 
1# Include hook code here
2require 'unaccept'
3
4ActionController::AbstractRequest.send(:include, Unaccept::RequestOverrides)
toggle raw diff

install.rb

 
1# Install hook code here
toggle raw diff

lib/unaccept.rb

 
1# Unaccept
2module Unaccept
3 module RequestOverrides
4 def format
5 @format ||= Mime::Type.lookup_by_extension(parameters[:format] || 'html')
6 end
7 end
8end
toggle raw diff

tasks/unaccept_tasks.rake

 
1# desc "Explaining what the task does"
2# task :unaccept do
3# # Task goes here
4# end
toggle raw diff

test/unaccept_test.rb

 
1require 'test/unit'
2
3class UnacceptTest < Test::Unit::TestCase
4 # Replace this with your real tests.
5 def test_this_plugin
6 flunk
7 end
8end
toggle raw diff

uninstall.rb

 
1# Uninstall hook code here
toggle raw diff