rake

Is there a rake task for advancing or retreating your schema version by exactly one?

Back when migration version numbers were simply incremented as you created migrations, it was easy enough to do: rake migrate VERSION=097 rake migrate VERSION=098 rake migrate VERSION=099 rake migrate VERSION=100 ...but we now have migration numbers that are something like YYYYMMDDtimeofday. Not that this is a bad thing - it keeps th...

Anyone have experience calling Rake from MSBuild for code gen and other benefits? How did it go? What are your thoughts / recommendations?

While programming in C# using Visual Studio 2008, I often wish for "automatic" code generation. If possible, I'd like to achieve it by making my MSBuild solution file call out to Rake, which would call Ruby code for the code generation, having the resulting generated files automatically appear in my solution. Here's one business exampl...

Rake Strategy, DotNet Implementation

When reading about and playing with Rails last year, one of the tools that made the biggest impression on me was Rake. A database versioning system that keeps all dev db's identical integrated right into the build...something like that would make life so much easier (and safer)! However, one of the things that I haven't been able to fi...

What is the best way for having a ruby service on rails?

I need to run a ruby-script as a service. The script needs access to the ActiveRecords of a rails-app. What would be the best way? A rake task? How can it be started as a service on both windows and linux? ...

Why is Rake running a model for which I can find no test?

When I run "rake", it's loading up one of the models among all of the classes I have in my app/models directory. The thing is, it's not one I have a test for, it's just a model I have in there that is actually used with script/runner to run in the background and perform tasks for my main Rails application. At the end of the file I've got...

What exactly is Rake ?

Dear all In simple terms, what does Rake do? What purposes does it have? I understand it's a build tool but I'm looking a bit more detail. (For a simpleton.) Many thanks Skipz ...

How to freeze rake?

I have a rails-app (2.3.2) that I need to install on a server on which rake isn't installed, and on which I haven't got privileges to install gems, so I'd like to freeze the rails gem. However, I can't figure out how to do that. I've put it in the dependencies in environment.rb, but "rake gems:unpack GEM=rake" has no effect. "rake gems"...

Make rake task from gem available everywhere?

So I'm writing a small gem and I have a '/tasks' dir in it with some specific rake tasks. How do I make those tasks available automatically everywhere, where the gem is required? For example I wish I could run 'rake mygemrake:task' inside my rails root dir after I have the gem installed. ...

Ruby on Rails: Error when running a rake task from initializer file

I have the file config/initializers/custom.rb In the file, there is only one line: `rake thinking_sphinx:start` I thought this was supposed to just execute the line like when typing it from a command line. With this line of code, when I run "ruby script/server", the server freezes and outputs no error messages. Am I missing somethi...

Data Driven Testing with Ruby's Test::Unit for Selenium

I'm pretty new to both Ruby and Selenium and I'm just trying to figure out the best way to build my test harness. I'm using Rake, Rake::TestTask, and Test::Unit to power this. I have a suite that I'd like to run once for each browser/os combination. I can't figure out how to parameterize my tests though, something I've become accustomed ...

How do I code a rake task to trigger a BackgrounDRb task?

I have a BackgrounDRb worker set up to run its 'sync' method every 15 minutes. Then, say, I want to run the method once just now. I was trying to wrap that in a rake task as follows: namespace :mytasks do task :sync do |t| worker = MiddleMan.worker(:my_worker) worker.async_sync end end But this doesn't work. It bails out w...

Directory dependencies with rake

I'm using rake to copy a directory as so: file copied_directory => original_directory do #copy directory end This works fine, except when something inside of original_directory changes. The problem is that the mod date doesn't change on the enclosing directory, so rake doesn't know to copy the directory again. Is there any way to hand...

How do I pass command line arguments to a rake task?

I've got a rake task that I am making that needs to insert a value into multiple databases. I'd like to be able to pass this value into the rake task from the command line, or from another rake task, how can I do this? ...

How do I find the source file for a rake task?

I know you can view all possible rake tasks by typing rake -T But I need to know what exactly a task does. From the output, how can I find a source file that actually has the task? For example, I'm trying to find the source for the db:schema:dump task. ...

Is rake db:migrate the correct command to re-sync schema.rb with your database schema?

I ran "rake db:migrate" to re-sync schema.db with my database schema. But it failed, saying that one of my tables already exists. I think it was trying to re-create the table. If you just want to get schema.rb updated to reflected any changes you made in the database independently of Rails, what command should you use if not "rake db:mig...

Do rails rake tasks provide access to ActiveRecord models?

I am trying to create a custom rake task, but it seems I dont have access to my models. I thought this was something implicitly included with rails task. I have the following code in lib/tasks/test.rake: namespace :test do task :new_task do puts Parent.all.inspect end end And here is what my parent model looks like: class Pa...

ActiveRecord models cached in rake tasks?

I know that in rails 2.3.2 ActiveRecord queries are cached, i.e. you may see something in the development/production log: CACHE (0.0ms) SELECT * FROM `users` WHERE `users`.`id` = 1 I was wondering if the same principles apply to rake tasks. I have a rake task that will query a lot of different models, and I want to know if I should...

Embedding Rake in a C++ app? Or is there a Lake for LUA?

I've found a couple of questions about embedding Ruby in a C++ app. Almost all of the top-voted answers suggest using Lua instead. Given that a project I have in mind would be better served by the grammar already expressed in Rake (it's a rules engine), is there any easy way to embed Rake in a C++ app, or is there a Rake-like module for...

rake spec not using the rails environment

I'm attempting to use rspec in a rails project I've just upgraded to rails 2.3.2. I've installed rspec 1.2.6 and rspec-rails 1.2.6 as plugins in the app. My problem is the specs don't have access to my app classes or any of the rails standard libraries. First I had to specify the model class I want to test by using the full path from R...

Are plugins available to a rake task?

When I run a rake task for an application that uses Models defined in a plugin I get an Uninitialized Constant error, but when I run the model process, with script/runner, that is fired in the rake task then the job runs fine? Is there some difference between script/runner that loads all my plugins that doesn't happen when I fire up a r...