Michael Schuerig wrote:
> 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/
I don't see where security would be an issue here, but reusability may
be. A more generic "VERSION" file that can be loaded and read from would
be available anywhere in your application, and could be simpler to
maintain. You could do it as a plaintext file that just reads '1.1.42',
or namespace it as MyApp::VERSION etc.
You could add a post-commit hook that would write to the VERSION file,
make sure that you bump the version when you tag, or put your git call
right into the file. Automating this would prevent your deploy from
failing if you forget to state the tag as well.
Of course you don't have to do any of these things, just some ways I see
to remove human error and streamline things for you guys.
--
Posted via http://www.ruby-forum.com/.
--
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.