On Thu, Jul 21, 2011 at 11:32, Jacob Helwig <[email protected]> wrote:
> 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? ;)

Didn't you just get it?  I just trimmed the redundant metadata out. ;)

>> 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.

If only Ruby had `let`.  Not that this code would have a chance in
heck of working if someone already had GIT_DIR set or anything. ;)

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