Skip to content

Instantly share code, notes, and snippets.

View markbates's full-sized avatar

Mark Bates markbates

View GitHub Profile
class User
# By including Mack::Distributable this class will now
# be registered with Rinda for other Mack applications
# to use.
include Mack::Distributable
def self.all
# code here...
end
Mack::Routes.build do |r|
r.login "/users/login", :controller => :users, :action => :login
r.do_login "/users/login", :controller => :users, :action => :do_login, :method => :post
r.resource :users # Added by rake generate:scaffold name=user
r.with_options(:controller => :pages) do |map|
map.newest_pages "/pages/newest_pages/:limit", :action => :newest_pages
map.recently_updated_pages "/pages/recently_updated_pages/:limit", :action => :recently_updated_pages
## Sample load ##
# Passenger (Mod_Rails)
LoadModule passenger_module /opt/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
PassengerRoot /opt/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
PassengerRuby /opt/local/bin/ruby
## Sample virtual host ##
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot "/path/to/your/mack/app/public"
</VirtualHost>
configatron do |config|
config.email = "mark@mackframework.com"
config.database_url = "postgres://localhost/mack_framework_rocks"
# etc...
end
configatron.email # => "mark@mackframework.com"
configatron.database_url # => "postgres://localhost/mack_framework_rocks"
configatron do |config|
config.database_url = "postgres://localhost/mack_framework_rocks_development"
end
configatron.email # => "mark@mackframework.com"
configatron.database_url # => "postgres://localhost/mack_framework_rocks_development"
configatron do |config|
config.website_url = "http://www.mackframework.com"
config.namespace(:email) do |email|
email.namespace(:pop) do |pop|
pop.address = "pop.example.com"
pop.port = "110"
# etc ...
end
email.namespace(:smtp) do |smtp|
smtp.address = "smtp.example.com"
configatron.email.pop.address # => "pop.example.com"
configatron.email.smtp.address # => "smtp.example.com"
configatron.website_url # => "http://www.mackframework.com"