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...
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...
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...
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?
...
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...
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
...
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"...
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.
...
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...
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 ...
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...
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...
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?
...
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.
...
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...
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...
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...
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...
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...
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...