Sha256: 1b9a01b5a1cd5a814859eae883d81c9f74171f5aca325c83facbcd8ab6a57260

Contents?: true

Size: 817 Bytes

Versions: 4

Compression:

Stored size: 817 Bytes

Contents

# These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout

module LayoutHelper
  
  def title(page_title, show_title = true)
    content_for :title, page_title.to_s
    @show_title = show_title
  end
  
  def show_title?
    @show_title
  end
  
  def version
    tag, commits, sha = `git describe`.split('-')
    major, minor, patch = tag[1..-1].split('.')
    [major, minor, patch].each { |e| e.chomp! }
    
    version = "v#{major}.#{minor}.#{patch}"
    unless commits.nil?
      version += "-#{commits}" unless commits.nil?
      version += "-#{sha.chomp}" unless sha.nil?
    end
    version += "-#{ENV['RAILS_ENV']}"
  end

end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
PeterCoulton-rotten-generators-0.7.12 rails_generators/rotten_layout/templates/helper.rb
rotten-generators-0.9.0 rails_generators/rotten_layout/templates/helper.rb
rotten-generators-0.9.2 rails_generators/rotten_layout/templates/helper.rb
rotten-rotten-generators-0.7.12 rails_generators/rotten_layout/templates/helper.rb