rake

Rake just one migration

Hi, I'm trying to run just one migration out of a whole bunch in my rails app. How can I do this? I don't want to run any of the migrations before or after it. Thanks. ...

uninitialized constant MysqlCompat::MysqlRes (using mms2r gem)

Hi, moved a rails app of mine onto a new server and had to install a few gem dependencies. However, after installing the mysql gem I get the error, uninitialized constant MysqlCompat::MysqlRes, whenever I try to run a rake command that involves the mysql database. It seems I only get this error when I require the mms2r gem. Has anyone ...

rake aborted! closed stream after upgrading to Snow Leopard

Hi all, I just upgraded my Leopard system to Snow. I had a Rails application with a suite of Spec examples running before the upgrade; it used a mysql database. After the upgrade, running rake spec would fail like this: ... ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load rake aborted! closed strea...

Rails Rake: How to pass in arguments to a task with :environment

So I am able to pass in arguments as follows desc "Testing args" task: :hello, :user, :message do |t, args| args.with_defaults(:message => "Thanks for logging on") puts "Hello #{args[:user]}. #{:message}" end I am also able to load the current environment for a Rails application desc "Testing environment" task: :hello => :environ...

Tests pass using "autotest" but not "rake test" using Authlogic

My tests fail when doing "rake test:functionals" but they pass consistently using autotest. The failing tests in question seems to be related to Authlogic not logging in the user properly when using rake. For facilitating signing in a user in tests, I have a test helper method as follows: class ActionController::TestCase def signin(...

Ruby - Executing tests in a random order with rake

How can I have the tests for my Rails app to be executed in a random order? Is there a simple solution using rake? ...

How can I capture Rake output when invoked from with a Ruby script?

I am writing a web-based dev-console for Rails development. In one of my controller actions, I am calling Rake, but I am unable to capture any of the output that Rake generates. For example, here is some sample code, from the controller: require 'rake' require 'rake/rdoctask' require 'rake/testtask' require 'tasks/rails' require 'string...

How to use rake to insert/replace html section in each file?

I'm using rake to create a Table of contents from a bunch of static HTML files. The question is how do I insert it into all files from within rake? I have a <ul id="toc"> in each file to aim for. The entire content of that I want to replace. I was thinking about using Nokogiri or similar to parse the document and replace the DOM node...

Can't run Rake commands any more, hpricot_scan.bundle no suitable image found

Hey, Since I migrated to Snow Leopard I can't run any Rake command from the command line. e.g if I try to run rake stats I get: rake aborted! dlopen(/Users/xxx/.gem/ruby/1.8/gems/hpricot-0.8.1/lib/hpricot_scan.bundle, 9): no suitable image found. Did find: /Users/xxx/.gem/ruby/1.8/gems/hpricot-0.8.1/lib/hpricot_scan.bundle: no ma...

Ruby Threads (Rake) for FTP

I have a rake task that uploads a list of files via ftp. Copying without threading works fine, but it would be faster if I could do multiple concurrent uploads. (I'm new to ruby and multithreading, so no surprise it didn't work right off the bat.) I have: files.each_slice(files.length / max_threads) do |file_set| threads << Thread....

manage multiple reputation in database & code

Trying to implement a rating system of users and postings. What is the best schema for managing the multiple reputations. A user has a reputation derived from postings and feedback(similar to SO). Postings have a reputation too (again similar to SO). My initial idea as to have one reputation table. The rows would correspond to the...

Rake CLEAN/CLOBBER not deleting

I think I'm going mad. Can anyone help? I have the folder c:\project\bin I run the following to execute my rake script cd C:\project rake In my rake script I have: require 'rake/clean' CLOBBER.include('bin') task :default => ["compile"] task :compile do # do nothing end It doesn't delete the "bin" folder nor the contents of ...

How can I retrieve the output of my comand when using rake sh?

I am running a command using sh and need to read the output of that command. e.g. sh "whoami" But sh only seems to return true rather than a string containing the output of the whoami command. Does anyone know of a solution? ...

Missing the Rails 2.3.4 gem. Even though it's installed!

Running Snow Leopard. Tried uninstalling, and re-installing. Still getting the same error whenever I run a rake task. mbpro:redmine shereef$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0] mbpro:redmine shereef$ rails -v Rails 2.3.4 mbpro:redmine shereef$ which rails /usr/local/bin/rails mbpro:redmine shereef$ gem...

Bin deploy rake (and IronRuby)

I'm on a .NET project, and I would like to migrate build script from MsBuild to Rake. I don't want to force developers (or build agent machines) to have to install anything, I want it to be self contained. If possible I'd prefer to use IronRuby. Is it possible to just drop everything in /tools/rake and /tools/IronRuby and have it just w...

How do I use helpers in rake?

Hi, Can I use helper methods in rake? Thanks. Sam ...

Setting file permissions using Rake

I'd like to set the file permissions for a copied file using a rake task. Is this possible? ...

how to do "press enter to exit" in batch

I am using rake to build my project and I have a build.bat file similar to this: @echo off cls rake When I double click on build.bat the dos window pops up and shows all the progress but closes itself when the task is finished. Is there way to do a Console.ReadLine so that user can get a chance to see the log? Thanks. Updated: I've...

How do you generate executables within a gem with Rake?

I've been learning Ruby recently, and I've not gotten into the dirty recesses of learning Rake yet. I've been playing around with NetBeans, and I made a little Ruby project with a file that simply prints "Hello, World!". I was looking at the Rakefile that NetBeans generates, and I noticed that it had commented out the s.executables line,...

Rails: rake db:migrate suddenly starts at version 0 again, should start at version 16

Hi, today I just ran rake db:migrate... well, two things happened, first it reversed from version 2 to 0, so it smashed my user db (very very annoying) and now it wants to migrate vom version 1. But it should start at version 16. Any Ideas? Shema.rb is okay and right. ...