rake

Rails Rake task errors out while console equivalent does not

I have a piece of code that works fine in the console, but in a cron-driven rake task, it errors out every time, saying that the accessor function for one of the has_many relationships is not a valid method. Example: provider has_many instances, so I'm calling provider.instances, and the rake task will throw back an error: "undefined m...

How do I uninstall a Ruby on Rails application?

Hello, I've just worked through the Rail example supplied by Apple: http://developer.apple.com/Tools/developonrailsleopard.html Now that I'm done, I'd like to clean this up and remove the web service, database etc. Obviously I still want the RoR stack in place. How? Can I do this using rake? ...

Rake: How to specify that a task has multiple dependencies?

I would like to specify that :output_core depends on :build_core :build_extension depends on :build_core :output_extension depends on :build_extension and :output_core How would I specify that last one? That in order to run the :output_extensions tasks both :build_extensions and :output_core must have completed? ...

Loading message and test results appears after running rake task in Rails application

The following output appears after running some rake tasks: Loaded suite /usr/bin/rake Started Finished in 0.00042 seconds. 0 tests, 0 assertions, 0 failures, 0 errors This output is not useful or necessary for tasks not related to testing. I'd like to prevent it from appearing. I would assume it stems from requiring a certain file ...

Rails: Create Default root user through migration? Rake task?

I'm testing my app out on Heroku (which is f***ing amazing!) and I realized that I have no way of creating my root user. I'm using Authlogic and rails_authorization_plugin. Is there someway I can add a section to one of my migration files to add this user and assign it the role of root? Or can I do this through a rake task? Any insigh...

Rake (Ruby) catch error at end of build

I'm using Ruby and Rake to do our builds at the moment for .Net projects. I call a few commandline tools, such as NCover to check the coverage is high enough. When NCover returns and exit (fail) code though, Rake exits immediately stops. Is there a hook, like on_exit, that I can use. I basically want to output "Build FAILED" in nice re...

Default task for namespace in Rake

Given something like: namespace :my_tasks do task :foo do do_something end task :bar do do_something_else end task :all => [:foo, :bar] end How do I make :all be the default task, so that running rake my_tasks will call it (instead of having to call rake my_tasks:all)? ...

Suppress rake in directory message

When I run rake, it always starts with a message like this: > rake (in /Users/peter/srcdir) ... standard output here ... I'd like to remove the (in /Users/peter/srcdir) portion. You can do it with rake -s, but then you don't get the output you want. Is there any way to disable this current directory announcement but not the rest? Ide...

Rails migration file not adding all my defined columns to the db

Hi, I'm trying to create a rails app, but somethings going wrong, I'm getting a nasty error undefined method title' for #` I've used this ling: ruby script/generate scaffold Blog title:String body:text to generate the following migration file: class CreateBlogs < ActiveRecord::Migration def self.up create_table :blogs do |t| ...

Using Rake To Scrape ASP.NET Page

Is it possible, and if so how, do I use RAKE to scrape an ASP.Net Application (very simple, just 2 login forms) - Basically a spider bot/web crawler. I only ask since I've heard this mentioned before and wonder what method I would use to go about doing it? Help greatly appreciated. ...

Oracle problems in Rails with rake, but not with site

Hi guys, I'm working on a Rails site that connects to an Oracle database, and though I didn't build the site from scratch, I'm doing maintenance work. The site uses the delayed_jobs plugin to handle some background tasks and I'd like to be able to run rake jobs:work on the development server to periodically process all jobs in the queu...

Adding sample data to database using rake for a rails engine

Hi, I am trying out Rails engines by creating a classifieds engine where users can view/post/reply to classifieds. The main application contains code for user authentication and profiles while there is an engine which I have created which will deal with the classifieds functionality. Now I want to add some sample data to the datab...

Easiest way to have a true "file tasks" in ANT

I am still learning how to use ANT well, and I wanted to understand if there is some reasonable way to do file tasks in it, similar to Rake and Make: http://martinfowler.com/articles/rake.html#FileTasks "With a file you are referring to actual files rather than task names. So 'build/dev/rake.html' and 'dev/rake.xml' are actual files. T...

Rake db:migrate uninitialized constant

In order to run rake db:migrate I need both my models and constants defined in application controller. When I run it I get this rake aborted! An error has occurred, all later migrations canceled: uninitialized constant Secondsperday All I need is rake to load the environment. It used to do this... Secondsperday is not a model, its t...

Gem specification in Rakefile vs .gemspec

I am creating a new ruby gem using NetBeans as my IDE. The initial project structure contains a Rakefile with the gem specification and other rake tasks. My question is, what is the difference between having a gem specification located in a Rakefile compared with having it located in a .gemspec file? Is there a best-practice for where t...

rake: command not found

I'm trying to install rails on Ubuntu 9.10. gem list --local *** LOCAL GEMS *** actionmailer (2.3.4, 2.3.2) actionpack (2.3.4, 2.3.2) activerecord (2.3.4, 2.3.2) activeresource (2.3.4, 2.3.2) activesupport (2.3.4, 2.3.2) rack (1.0.1) rails (2.3.4, 2.3.2) rake (0.8.7) sqlite3-ruby (1.2.5) rake The program 'rake' is currently not insta...

Multifile rake build

Hi! I have a build system that consists of several subdirectories with projects, where in each of them there's a separate rakiefile (or couple of rakefiles). No the top-level directory has a rakefile that goes through all subdirectories and calls rake via: system("rake "), gets resulting packages and sends them to appropriate machine. I...

How do I make a Rake Task run after all other tasks? (i.e. a Rake AfterBuild task)

I'm new to Rake and using it to build .net projects. What I'm interested in is having a Summary task that prints out a summary of what has been done. I want this task to always be called, no matter what tasks rake was invoked with. Is there an easy way to accomplish this? Thanks Update on the question, responding to Patrick's answ...

Rake Test is failing

Snow Leopard, Test, Shoulda, Cucumber I am running rake test and getting this error: Any ideas? /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- RMagick (MissingSourceFile) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/...

Does anyone have parsing rules for the Notepad++ Function List plugin for Ruby and Rake

I'me using Notepad++ for editing rake files and I'd like to be able to use the function list plugin. I've been unable to find any parsing rules on line, and the "Language Parsing Rules" dialog is not very clearly documented. I'm parsing methods into the list with the following, but would like to also display tasks. Function Begin: [...