<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vinsol - Leading Ruby on Rails Development and Consulting Firm in India &#187; rake</title>
	<atom:link href="http://vinsol.com/blog/category/rake/feed/" rel="self" type="application/rss+xml" />
	<link>http://vinsol.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 21 May 2012 13:11:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rake task to remove the image and audio files created by captcha</title>
		<link>http://vinsol.com/blog/2006/10/16/rake-task-to-remove-the-image-and-audio-files-created-by-captcha/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rake-task-to-remove-the-image-and-audio-files-created-by-captcha</link>
		<comments>http://vinsol.com/blog/2006/10/16/rake-task-to-remove-the-image-and-audio-files-created-by-captcha/#comments</comments>
		<pubDate>Mon, 16 Oct 2006 12:33:32 +0000</pubDate>
		<dc:creator>Sur Max</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://ajaxonrails.wordpress.com/2006/10/16/rake-task-to-remove-the-image-and-audio-files-created-by-captcha/</guid>
		<description><![CDATA[To add a rake task to the rails application which removes all the image and audio files created by captcha, create a file named remove_captcha_files.rake in the lib/tasks directory.
Add the following code to the lib/tasks/remove_captcha_files.rake file&#8230;

desc "Remove captcha images and audio files"
task :remove_captcha_files do
  image_path = "#{RAILS_ROOT}/public/images/captcha/"
  audio_path = "#{RAILS_ROOT}/public/captcha_audio/"
  Dir.foreach(image_path){&#124;file&#124; File.delete(image_path+file) [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><p>To add a rake task to the rails application which removes all the image and audio files created by captcha, create a file named <strong>remove_captcha_files.rake</strong> in the lib/tasks directory.<br />
Add the following code to the <strong>lib/tasks/remove_captcha_files.rake</strong> file&#8230;</p>
<pre>
desc "Remove captcha images and audio files"
task :remove_captcha_files do
  image_path = "#{RAILS_ROOT}/public/images/captcha/"
  audio_path = "#{RAILS_ROOT}/public/captcha_audio/"
  Dir.foreach(image_path){|file| File.delete(image_path+file) if (/^.*.jpg$/).match(file)} if File.exist?(image_path)
  Dir.foreach(audio_path){|file| File.delete(audio_path+file) if (/^.*.wav$/).match(file)} if File.exist?(audio_path)
  puts "Captcha files removed."
end</pre>
<p>You can confirm that task is added to your app by running<br />
<strong>rake &#8211;task</strong></p>
<p>To remove all the files created by captcha, simply run the command<br />
<strong>rake remove_captcha_files</strong><br />
from the command line from your application root.<br />
To better view the code visit <strong><a href="http://ajaxonrails.blogspot.com/2006/10/rake-task-to-remove-image-and-audio.html">here</a></strong></p>
</div>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2006/10/16/rake-task-to-remove-the-image-and-audio-files-created-by-captcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

