On Thu, 21 Jul 2011 11:15:52 -0700, Daniel Pittman wrote: > > On Thu, Jul 21, 2011 at 11:09, Michael Stahnke <[email protected]> wrote: > > The calling of get_app_version failed if the directory for RAILS_ROOT > > contained spaces or special characters such as a '('. This was > > especially problematic for Jenkins testing. > > > - return `cd #{Rails.root}; git describe`.strip! rescue 'unknown' > > + return `cd '#{Rails.root}'; git describe`.strip! rescue 'unknown' > > cd '#{Rails.root.gsub("'", "'\\\\''")}' && git describe > > Much more robust: now works even if there is a single quote in the > path, and doesn't run git describe in a random location if changing > directory fails.
Where's the patch? ;)
> However, this is probably even better:
>
> ENV['GIT_DIR'] = Rails.root + '/.git'
> `git describe`
> ENV.delete('GIT_DIR')
>
Except that it stomps over any pre-existing GIT_DIR env setting.
--
Jacob Helwig
,----
| Join us for PuppetConf, September 22nd and 23rd in Portland, OR
| http://bit.ly/puppetconfsig
`----
signature.asc
Description: Digital signature
