#rake
9 posts tagged rake. Clear filter
-
How To Use Rake to Run Your Test Suite with Sinatra
If you're using Sinatra and you want to use rake to run your test suite, you will need to create a Rakefile and put this in it. This assumes your test suite is under the 'test/' directory and the...
-
How to Add Additional Sub Directories to the Default Rails Test:Unit File Structure
Edit Rakefile in project root Add a new rake test task... E.g., rake test:lib, below everything else in that file... Alternatively, add a task in lib/tasks/ directory and plop in the same code...
-
Repost
This post is inspired by http://pupeno.com/blog/really-resetting-the-database/comment-1179. But as my blog mostly serves as a reference for my future self, I'd like to reprint this little snippet...
-
TODO and Custom Annotations in Rails Applications
While writing software it's common to leave comments for your future self. For instance, if you have written some code but realize that it should be refactored to be more efficient, you may place...
-
Load All ActiveRecord::Base Model Classes in Rails Application
Here is a simple rake task which will instantiate all of your Active Record models, provided that they are located in the RAILS\ROOT/app/models directory. Interestingly, all plugin models are...
-
Rake DB Everything, Dump, Destroy, Create, Load
I'm a big fan of the yaml\db plugin. But I don't like running rake db:data:load, only to find that my db columns mismatch my model attributes, thus aborting the data import task. To quickly...
-
Use a Cron Job to Automate Sphinx Index Refresh from Rails Rake Task
If using Sphinx, you need to refresh indexes when you add new content to your database. This is fairly easy to do by hand But if you want to automate this and use a cron, remember to set the PATH,...
-
Set Cron Job to Run Every Five Minutes for a Ruby on Rails Rake Task
First off you'll need to edit your cron file. Normally, the cron files are kept under /etc/cron.daily or /etc/cron.hourly but we can just use the command line tool, crontab and pass it the -e flag,...
-
Namespacing in Rails
With namespace routes in Rails you can easily create a prefix for select resources. For instance, if you have an admin area or an account dashboard you can give logged in users access to methods...