My application is going into user testing and I would like to see
which "release" the user has been testing against by the release
appearing somewhere on the view. I can then check it on screen prints
etc.
I am using Git and Capistrano in a multi-stage environment.
I expect I could access the capistrano release name from the
filesystem directory somehow. Any clever way of doing this in the
application controller?
Even better would be to somehow get Capistrano to capture the SHA
(e.g. 1837213156f56b850e9045622d5c2f4a1607ef53) that it is checking
out and placing that somewhere where I can read. That way I can track
any errors based on the Git release. Perhaps just displaying the
first 4 digits would be enough. Has anyone done this somehow?
Best regards
Peter De Berdt
On 22 Apr 2010, at 18:00, Owain wrote:My application is going into user testing and I would like to see
which "release" the user has been testing against by the release
appearing somewhere on the view. I can then check it on screen prints
etc.
I am using Git and Capistrano in a multi-stage environment.
I expect I could access the capistrano release name from the
filesystem directory somehow. Any clever way of doing this in the
application controller?
Even better would be to somehow get Capistrano to capture the SHA
(e.g. 1837213156f56b850e9045622d5c2f4a1607ef53) that it is checking
out and placing that somewhere where I can read. That way I can track
any errors based on the Git release. Perhaps just displaying the
first 4 digits would be enough. Has anyone done this somehow?>> p = `cd #{RAILS_ROOT} && git rev-parse HEAD`.strip=> "031154343573f846dc4f9d31806e58438bfe783e">> q = `cd #{RAILS_ROOT} && git show-ref`.strip=> "031154343573f846dc4f9d31806e58438bfe783e refs/heads/master"Would be best if you store the result in a constant at startup, so the IO operation isn't called on every page.Hope this helps.Best regardsPeter De Berdt
>> p = `cd #{RAILS_ROOT} && git rev-parse HEAD`.strip=> "031154343573f846dc4f9d31806e58438bfe783e">> q = `cd #{RAILS_ROOT} && git show-ref`.strip=> "031154343573f846dc4f9d31806e58438bfe783e refs/heads/master"Would be best if you store the result in a constant at startup, so the IO operation isn't called on every page.Hope this helps.Best regardsPeter De BerdtYou can always use the contents of the REVISION file that cap puts in your Rails.root directoryFile.read(File.expand_path('REVISION', RAILS_ROOT))
Best regards
Peter De Berdt