0

I am trying to create a rakefile that runs both redis and irb. I have figured out how to run IRB (the first task runs), but when I try to run the redis task I see the error:

rake aborted! wrong number of arguments

Exactly what is wrong? My code is below:

task :default do
  require 'irb' 
  IRB.start
end

task :init do
  require 'redis'
  exec {'redis-server'}
end

Command I use to run the code:

bundle exec rake (or rake :init, depending on which one I want to run)

Carl Zulauf
  • 39,378
  • 2
  • 34
  • 47
skyfaerie
  • 33
  • 7

1 Answers1

1

You are receiving an argument error because exec expects a string argument, and you are sending it a block. exec does not do anything with your block and wants a string.

Use exec "redis-server" to execute the command correctly.

Hopefully the result is what you are looking for. Not sure why you are requiring redis at all since you aren't using the gem, you are just executing a command. The behavior of this task would be no different than just running redis-server on the command line.

Carl Zulauf
  • 39,378
  • 2
  • 34
  • 47