rake

When I run the rake:db migrate command I get an error "Uninitialized constant CreateArticles"

Hi, I created a model ruby script/generate model Article (simple enuff) Here is the migration file create_articles.rb: def self.up create_table :articles do |t| t.column :user_id, :integer t.column :title, :string t.column :synopsis, :text, :limit => 1000 t.column :body, :text, :limit => 20000 t.column :published...

How can I modify/extend a rake file from another rake file?

I'm trying to find a way to modify/extend a RakeFile from another RakeFile without actually changing it. When I run my rake task I retrieve a solution from SVN which contains a rakefile. I want to: Change a variable in this rakefile. Add a new task to this rakefile which makes use of existing tasks. Execute the new task. I want t...

Running Rake Without Shell Access?

For a RoR installation, is there any way to run rake commands without root access? To put it another way, is there any way to get db:create and db:migrate to be run without root access (perhaps automatically or something)? Or can I run rake commands from a RoR controller? ...

Rake for .NET

What is the best way to build a .NET solution and run MbUnit tests using Rake? I'm currently invoking commands directly like this: sh "#{DOT_NET_PATH}msbuild.exe /p:Configuration=#{CONFIG} #{SOLUTION}" This works but seems a bit rubbish. Are there any gems people would recommend using? ...

Is there a Rake task for FTP?

Hi, I'm looking for a Rake task to do deployment via FTP. Does anyone know of any? Anders ...

What is the best way to write a rakefile to run commands in windows?

As an example i want to run the following command under a rake. robocopy C:\Media \\other\Media /mir The rakefile i was able to get working was def sh(str) str.tr!('|', '\\') IO.popen(str) do |pipe| pipe.each do |line| puts line end end end task :default do sh 'robocopy C:|Media ||other|Media /mir' end Howeve...

Vary the command/pathmap run in a rake rule based on which target is running

I'm trying to write a Rakefile that both builds my code normally when I run rake compile but puts the targets in a different directory and builds with -DTEST when I run rake test. I cannot for the life of me figure out how to do it, though. I've got something like this at the moment: SRC = FileList['src/*.erl'] OBJ = SRC.pathmap("%{sr...

How do I use "gets" on a rake task?

I get an error whenever I try to use the function gets within a rake task. Is there a way to make it work? The error says, "no such file or directory - (rake task name)" ...

How to run Rake tasks from within Rake tasks?

I have a Rakefile that compiles the project in two ways, according to the global variable $build_type, which can be :debug or :release (the results go in separate directories): task :build => [:some_other_tasks] do end I wish to create a task that compiles the project with both configurations in turn, something like this: task :build...

How can you link version numbers between build configurations of a TeamCity project?

I'd like to have 3 distinct builds within a TeamCity project (Development, QA, Production). With the dependencies linked (Production can't build without a successful QA, and QA can't build without a successful Development), I'd like to propagate the version numbers through the builds. Development Build => v 1.0.1.0 QA Build => on succe...

Using the basepath filter to re-write URLs in Webby?

Basepath Filter Rewriting? I'm trying to use the basepath filter in webby to rewrite all of the URLs in my project. The documentation on the basepath filter for Webby is a little bit "light" concerning this, and there just simply isn't enough of it that I can understand how to use it. If I find the solution to this, however I plan to ...

Rails task: script/runner or rake?

For ad hoc Rails tasks we have a few implementation alternatives, chief among which would seem to be script/runner some_useful_thing and rake some:other_useful_thing Which option should I prefer? If there's a clear favourite then when, if ever, should I consider using the other? If never, then why would you suppose it's still prese...

Rails: rake db:migrate *very* slow on Oracle

I'm using rails with the oracleenhanced adaptor to create a new interface for a legacy application. Database migrations work successfully, but take an incredibly long amount of time before rake finishes. The database changes happen pretty quickly (1 or 2 seconds), but the db/schema.db dump takes over an hour to complete. (See example mi...

How do I code a rake task that runs the Rails db:migrate task?

I would like to run db:migrate VERSION=0 and then db:migrate inside of my own rake task. I am confused about how to do this. Do I need a special require statement? My rake task will reside in the lib/tasks directory of a Rails app. Thanks. ...

Why does initation of [rake db:migrate] run syntax check on rake tasks in the lib/tasks directory?

I have a rake task file for a RubyOnRails app which resides in the lib/tasks directory. Running [rake db:migrate VERSION=0] seems to force the compiler to check syntax in the lib/tasks files. If there is a file with bad syntax then [rake db:migrate] does not run. Why? So what if I have a bad file in lib/tasks. What is happening her...

rake gems:refresh_specs error on unpacked gems

Following the great advice of Chris Wanstrath, I decided to vendor everything. However, whenever I run a rake task now I get an error for each of my unpacked gems stating config.gem: Unpacked gem gemname in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this. I've done this but no dice. Anyone have the...

Rake string replace in file

Hi, Does Rake have anything built in for replacing strings inside files and such or is it best to use bash commands inside 'sh', or use Ruby's own file manipulation functionality? Regards, Chris ...

Can I interact with Rails models within a Capistrano task?

I often used Rake tasks that are dependent upon the Rails environment task having loaded. I then interact with Rails Models within the Rake tasks. Can I do this in Capistrano? ...

Ruby: In unix find if user who executed the program is root

Hi, I'm writing a rake script and would like to detect (using Ruby rather than bash if possible) if the user who executed the rake script has root privileges. If it is not root then I would like to terminate the script. Regards, Chris ...

Best rails solution for a mailer that runs every minute

Hello, I have an application that checks a database every minute for any emails that are supposed to be sent out at that time. I was thinking about making this a rake task that would be run by a cron job every minute. Would there be a better solution to this? From what I have read, this isn't ideal because rake has to load the entire ra...