Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby file: "ruby_executable_hooks" syntax error

I am trying to run the command rake db:migrate but the terminal is complaining about a possible syntax error in the file ruby_executable_hooks. I found this reference but did not help me to solve the problem. On the first line of the file it looks like title = "ruby #{ARGV*" "}" is causing the problem as the double quotes are not escaped correctly. I have tried different combinations of escaping but still no luck. So now I am not sure if the problem is really related to escaping issues or something else. Many thanks

Please see bellow the ruby_executable_hooks file

  title = "ruby #{ARGV*" "}"
  $0    = ARGV.shift
  Process.setproctitle(title) if Process.methods.include?(:setproctitle)

  require 'rubygems'

  begin
    require 'executable-hooks/hooks'
    Gem::ExecutableHooks.run($0)
    rescue LoadError
    warn "unable to load executable-hooks/hooks" if ENV.key?
   ('ExecutableHooks_DEBUG')
  end

  eval File.read($0), binding, $0

Error message:

 /Users/username/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval':
 /Users/username/.rvm/rubies/ruby-2.2.3/bin/rake:4: syntax error, unexpected
 tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
 exec "$bindir/ruby" -x "$0" "$@"
                    ^
 from /Users/username/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in
 `<main>'
like image 387
Bob Avatar asked Aug 31 '15 10:08

Bob


3 Answers

Found the solution for this problem

1 - delete the rake version from your system
2 - bundle install rake
3 - rake db:drop:all
4 - rake db:create:all
5 - rake db:migrate

For some reason when I first used the command rake db:migrate it corrupted the ruby_executable_hooks file (no idea why). Hope this will help somebody.

like image 151
Bob Avatar answered Nov 07 '22 05:11

Bob


$ gem install rake

worked for me. Didn't need to delete anything. Confusing it is, but try that before the time consuming rvm reinstalls others are proposing.

like image 38
oma Avatar answered Nov 07 '22 06:11

oma


I ran into the same problem and tried Eduardo's solution to no avail. What worked for me was simply uninstalling the ruby version I had (rvm uninstall 2.2.3) and installing it afresh again. Notice that I did not touch the database at all.

like image 2
Yevgeniy Avatar answered Nov 07 '22 06:11

Yevgeniy