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.29 lib/bard/template/static_pages.rb
bard-0.8.28 lib/bard/template/static_pages.rb
bard-0.8.27 lib/bard/template/static_pages.rb
bard-0.8.26 lib/bard/template/static_pages.rb
bard-0.8.25 lib/bard/template/static_pages.rb
bard-0.8.24 lib/bard/template/static_pages.rb
bard-0.8.23 lib/bard/template/static_pages.rb
bard-0.8.22 lib/bard/template/static_pages.rb
bard-0.8.21 lib/bard/template/static_pages.rb
bard-0.8.20 lib/bard/template/static_pages.rb
bard-0.8.19 lib/bard/template/static_pages.rb
bard-0.8.18 lib/bard/template/static_pages.rb
bard-0.8.17 lib/bard/template/static_pages.rb
bard-0.8.16 lib/bard/template/static_pages.rb
bard-0.8.15 lib/bard/template/static_pages.rb
bard-0.8.14 lib/bard/template/static_pages.rb
bard-0.8.13 lib/bard/template/static_pages.rb
bard-0.8.12 lib/bard/template/static_pages.rb
bard-0.8.11 lib/bard/template/static_pages.rb
bard-0.8.10 lib/bard/template/static_pages.rb