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.  However, this is probably even better:

ENV['GIT_DIR'] = Rails.root + '/.git'
`git describe`
ENV.delete('GIT_DIR')

Daniel
-- 
⎋ Puppet Labs Developer – http://puppetlabs.com
♲ Made with 100 percent post-consumer electrons

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to