I'd like to be able to see from generated pages which version of the app 
has generated it. As we're using git and always deploy a specific tag, 
having that tag in the HTML head as a meta tag would be suitable.

My current idea goes like this. The layout includes a partial that looks 
like this

  <meta name="version" 
   content="<%= `git describe --tags --always --dirty`.chomp %>">

When deployed, this file is overwritten with a static one referring to 
the deployed git tag

  <meta name="version" content="v1.1.42">

Then, in the capistrano recipe,

  after "deploy:update_code", "deploy:freeze_version_partial"

  namespace :deploy do
    task :freeze_version_partial do
      put %{<meta name="version" content="#{tag}" />\n},
        File.join(current_release,
         'app/views/layouts/_version.html.erb'),
       :roles => :web
    end
  end

Deployment then requires a tag to be given

  $ cap -S tag=v1.1.42 deploy


Are there reasons not to do this or not to do it this way? I don't think 
there is a security problem of exposing to many details about the app as 
it is only for internal use.

Michael

-- 
Michael Schuerig
mailto:[email protected]
http://www.schuerig.de/michael/

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to