Skip to content
Browse files

Update padrino blog to work with 0.9.11

  • Loading branch information...
1 parent 2c3b4da commit 5d31da813b5cd9d99e0b1f245e183d8865389df7 @nesquena nesquena committed Jun 18, 2010
Showing with 49 additions and 69 deletions.
  1. +3 −3 Gemfile
  2. +28 −29 admin/app.rb
  3. +16 −35 app/app.rb
  4. +1 −1 app/controllers/posts.rb
  5. +1 −1 config/apps.rb
View
6 Gemfile
@@ -1,13 +1,13 @@
source :rubygems
# Project requirements
-gem 'bundler', '>= 0.9.20'
+gem 'bundler', '>= 0.9.26'
gem 'rack-flash'
gem 'thin' # or mongrel
# Component requirements
gem 'haml'
-gem 'activerecord', "= 2.3.5", :require => "active_record"
+gem 'activerecord', "= 2.3.8", :require => "active_record"
gem 'sqlite3-ruby', :require => "sqlite3"
# Test requirements
@@ -16,4 +16,4 @@ gem 'shoulda', :group => "test"
gem 'rack-test', :require => 'rack/test', :group => 'test'
# Padrino
-gem 'padrino', ">= 0.9.6"
+gem 'padrino', ">= 0.9.11"
View
57 admin/app.rb
@@ -1,33 +1,32 @@
class Admin < Padrino::Application
- configure do
- ##
- # Application-specific configuration options
- #
- # set :raise_errors, true # Show exceptions (default for development)
- # set :public, "foo/bar" # Location for static assets (default root/public)
- # set :sessions, false # Enabled by default
- # set :reload, false # Reload application files (default in development)
- # set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
- # set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
- # disable :padrino_helpers # Disables padrino markup helpers (enabled by default if present)
- # disable :padrino_mailer # Disables padrino mailer (enabled by default if present)
- # disable :flash # Disables rack-flash (enabled by default)
- # enable :authentication # Enable padrino-admin authentication (disabled by default)
- # layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
- #
- enable :authentication
- disable :store_location
- set :login_page, "/admin/sessions/new"
+ register Padrino::Helpers
+ register Padrino::Mailer
+ register Padrino::Admin::AccessControl
+
+ ##
+ # Application-specific configuration options
+ #
+ # set :raise_errors, true # Show exceptions (default for development)
+ # set :public, "foo/bar" # Location for static assets (default root/public)
+ # set :sessions, false # Enabled by default
+ # set :reload, false # Reload application files (default in development)
+ # set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
+ # set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
+ # disable :flash # Disables rack-flash (enabled by default)
+ # enable :authentication # Enable padrino-admin authentication (disabled by default)
+ # layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
+ #
+ enable :authentication
+ disable :store_location
+ set :login_page, "/admin/sessions/new"
- access_control.roles_for :any do |role|
- role.protect "/"
- role.allow "/sessions"
- end
-
- access_control.roles_for :admin do |role, account|
- role.project_module :posts, "/posts"
- role.project_module :accounts, "/accounts"
- end
+ access_control.roles_for :any do |role|
+ role.protect "/"
+ role.allow "/sessions"
+ end
+ access_control.roles_for :admin do |role, account|
+ role.project_module :posts, "/posts"
+ role.project_module :accounts, "/accounts"
end
-end
+end
View
51 app/app.rb
@@ -1,47 +1,28 @@
class SampleBlog < Padrino::Application
- configure do
- register SassInitializer # Remove if not using SASS
-
- ##
- # Application-specific configuration options
- #
- register MailerInitializer if defined?(MailerInitializer) # Remove this if your not using mailer
- # set :raise_errors, true # Show exceptions (default for development)
- # set :public, "foo/bar" # Location for static assets (default root/public)
- # set :sessions, false # Enabled by default
- # set :reload, false # Reload application files (default in development)
- # set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
- # set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
- # disable :padrino_helpers # Disables padrino markup helpers (enabled by default if present)
- # disable :padrino_mailer # Disables padrino mailer (enabled by default if present)
- # disable :flash # Disables rack-flash (enabled by default)
- # enable :authentication # Enable padrino-admin authentication (disabled by default)
- # layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
- #
- end
+ register Padrino::Helpers
+ register Padrino::Mailer
+ register SassInitializer
##
- # You can configure for a specified environment like:
- #
- # configure :development do
- # set :foo, :bar
- # end
+ # Application-specific configuration options
#
-
- ##
- # You can manage errors like:
- #
- # errors 404 do
- # render 'errors/404'
- # end
+ # set :raise_errors, true # Show exceptions (default for development)
+ # set :public, "foo/bar" # Location for static assets (default root/public)
+ # set :sessions, false # Enabled by default
+ # set :reload, false # Reload application files (default in development)
+ # set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
+ # set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
+ # disable :flash # Disables rack-flash (enabled by default)
+ # enable :authentication # Enable padrino-admin authentication (disabled by default)
+ # layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
#
-
+
get "/" do
"Hello World!"
end
-
+
get :about, :map => '/about_us' do
render :haml, "%p This is a sample blog created to demonstrate the power of Padrino!"
end
-end
+end
View
2 app/controllers/posts.rb
@@ -1,5 +1,5 @@
SampleBlog.controllers :posts do
- get :index, :respond_to => [:html, :rss, :atom] do
+ get :index, :provides => [:html, :rss, :atom] do
@posts = Post.all(:order => 'created_at desc')
render 'posts/index'
end
View
2 config/apps.rb
@@ -17,5 +17,5 @@
=end
# Mounts the core application for this project
-Padrino.mount_core("SampleBlog")
+Padrino.mount("SampleBlog").to("/")
Padrino.mount("Admin").to("/admin")

0 comments on commit 5d31da8

Please sign in to comment.
Something went wrong with that request. Please try again.