srushti / goldberg

Goldberg is a lightweight CI server written in Ruby which worries about Bundler & RVM so that you don't have to.
Other
243 stars 29 forks source link

Error running build if RVM is missing #59

Closed rohitarondekar closed 13 years ago

rohitarondekar commented 13 years ago

I don't have RVM installed. When I start the poller, I get the following:

bash: -c: line 0: syntax error near unexpected token `;'
bash: -c: line 0: `( ; cd /root/.goldberg/projects/remindee/code;  (bundle check --no-color || bundle install --no-color) && rake default) 1>>/root/.goldberg/projects/remindee/builds/2/build_log 2>>/root/.goldberg/projects/remindee/builds/2/build_log'

I've only included the relevant part.

If I'm right the first part of this line returns nil: https://github.com/c42/goldberg/blob/master/app/models/build.rb#L58

I think we need to check if it returns nil and build an appropriate command string. What do you think?

srushti commented 13 years ago

Yeah, that was where the problem was. It's fixed in 47dec2075029e7097c5bebed5eec7cd325b2f728. I wouldn't be surprised if you find more issues when you don't have rvm installed, we haven't really tested it too much without rvm. Of the top of my head, you'll probably have an issue with bundler since goldberg will have to do sudo bundle install or install to a different path.

rohitarondekar commented 13 years ago

This actually doesn't solve the problem:

ruby-1.9.2-p180 :001 > [nil, 'aaa', 'bbb'].join(' ; ')
  => " ; aaa ; bbb" 

Which is the same as previous:

"(#{RVM.use_script(ruby, "goldberg-#{project.name}")} ; #{go_to_project_path}; #{build_command}) #{output_redirects}"

I think we'll need to explicitly build gemset_use string such as:

gemset_use = RVM.use_script(ruby, "goldberg-#{project.name}") 
gemset_use ? "#{gemset_use} ; " : ''

I can't really make that change right now, but I can send a pull request later if you'd like?

Also I actually do have RVM installed, but as root and it's installed system wide. This is the first time I've done it too so I don't know what the effects are. :P

Output of rvm info: https://gist.github.com/1b905fbc84d886d904a0

rohitarondekar commented 13 years ago

Fixed by commit a636c6