Sha256: a1c1d28efa3d99fbc498ecf65da89a24e0f15818ae5845f2a0a9e5d4c7c575f7

Contents?: true

Size: 812 Bytes

Versions: 70

Compression:

Stored size: 812 Bytes

Contents

require "bard/template/helper"

# Set up static controller
file "app/controllers/static_controller.rb", <<-END
class StaticController < ApplicationController
  def dispatch
    view_template_path = "/static/"+params[:path].join("/")
    begin
      render view_template_path, :layout => true
    rescue ActionView::MissingTemplate
      begin
        render view_template_path+"/index", :layout => true
      rescue ActionView::MissingTemplate
        raise ActiveRecord::RecordNotFound
      end
    end
  end
end
END

route "map.connect '*path', :controller => 'static', :action => 'dispatch'"
route "map.root :controller => 'static', :action => 'dispatch', :path => ['index']"  

file "app/views/static/index.html.haml", <<-END
%h1 #{project_name}
END

git :add => "."
git :commit => "-m'static controller.'"

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
bard-0.8.9 lib/bard/template/static_pages.rb
bard-0.8.8 lib/bard/template/static_pages.rb
bard-0.8.7 lib/bard/template/static_pages.rb
bard-0.8.6 lib/bard/template/static_pages.rb
bard-0.8.5 lib/bard/template/static_pages.rb
bard-0.8.4 lib/bard/template/static_pages.rb
bard-0.8.3 lib/bard/template/static_pages.rb
bard-0.8.2 lib/bard/template/static_pages.rb
bard-0.8.1 lib/bard/template/static_pages.rb
bard-0.8.0 lib/bard/template/static_pages.rb