Permalink
Browse files

Initial padrino skeleton commit

  • Loading branch information...
0 parents commit eac06d27a294da9099f3dd6732643b5df7605137 @nesquena committed Jul 2, 2010
Showing with 365 additions and 0 deletions.
  1. +7 −0 .components
  2. +20 −0 Gemfile
  3. +28 −0 README
  4. +36 −0 app/app.rb
  5. +2 −0 config.ru
  6. +25 −0 config/apps.rb
  7. +18 −0 config/boot.rb
  8. +7 −0 config/database.rb
  9. +12 −0 lib/sass_plugin.rb
  10. 0 public/favicon.ico
  11. +1 −0 public/javascripts/application.js
  12. +154 −0 public/javascripts/jquery.js
  13. +6 −0 test/test.rake
  14. +49 −0 test/test_config.rb
@@ -0,0 +1,7 @@
+---
+:test: riot
+:renderer: haml
+:orm: mongomapper
+:stylesheet: sass
+:script: jquery
+:mock: rr
20 Gemfile
@@ -0,0 +1,20 @@
+source :rubygems
+
+# Project requirements
+gem 'rake'
+gem 'rack-flash'
+gem 'thin' # or mongrel
+
+# Component requirements
+gem 'haml'
+gem 'mongo_mapper'
+gem 'mongo_ext', :require => "mongo"
+
+# Test requirements
+gem 'rr', :group => "test"
+gem 'riot', :group => "test"
+gem 'rack-test', :require => "rack/test", :group => "test"
+
+
+# Padrino
+gem 'padrino', "0.9.14"
28 README
@@ -0,0 +1,28 @@
+= IdeaGrid
+
+Note: This project is a work in progress to showcase the power of Padrino and create a cool idea
+
+== Description
+
+A port of a cool idea by George Ruan. Basically a huge site for solving the world's problems through working together over the web.
+
+Ideagrid is a community of diverse individuals with the common goal of improving the environment through communication, planning, and cooperation.
+
+An innovative community collaborating to provide solutions to local and global issues.
+
+ * Incorporate your concerns of current events in the Problems tab.
+ * Demonstrate your methods or solutions in the Idea tab.
+ * Execute your plans of improving the world in the Tasks tab.
+ * Arrange events with interested members in the People tab.
+
+Whether you change to using energy efficient light-bulbs or switch to a more fuel efficient car, your contributing to creating a greener environment.
+
+== Tools
+
+This project uses Ruby and Git along with a number of other tools and frameworks:
+
+ * Padrino Web Framework (http://padrinorb.com)
+ * MongoMapper and MongoDB
+ * jquery javascript framework
+ * riot unit testing
+ * haml and sass template engines
@@ -0,0 +1,36 @@
+class IdeaGrid < Padrino::Application
+ register Padrino::Mailer
+ register Padrino::Helpers
+ register SassInitializer
+
+
+ ##
+ # Application configuration options
+ #
+ # set :raise_errors, true # Show exceptions (default for development)
+ # set :public, "foo/bar" # Location for static assets (default root/public)
+ # 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 (defaults to app/locale/)
+ # enable :sessions # Disabled by default
+ # disable :flash # Disables rack-flash (enabled by default if sessions)
+ # layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
+ #
+
+ ##
+ # You can configure for a specified environment like:
+ #
+ # configure :development do
+ # set :foo, :bar
+ # disable :asset_stamp # no asset timestamping for dev
+ # end
+ #
+
+ ##
+ # You can manage errors like:
+ #
+ # error 404 do
+ # render 'errors/404'
+ # end
+ #
+end
@@ -0,0 +1,2 @@
+require ::File.dirname(__FILE__) + '/config/boot.rb'
+run Padrino.application
@@ -0,0 +1,25 @@
+##
+# This file mounts each app in the Padrino project to a specified sub-uri.
+# You can mount additional applications using any of these commands below:
+#
+# Padrino.mount("blog").to('/blog')
+# Padrino.mount("blog", :app_class => "BlogApp").to('/blog')
+# Padrino.mount("blog", :app_file => "path/to/blog/app.rb").to('/blog')
+#
+# You can also map apps to a specified host:
+#
+# Padrino.mount("Admin").host("admin.example.org")
+# Padrino.mount("WebSite").host(/.*\.?example.org/)
+# Padrino.mount("Foo").to("/foo").host("bar.example.org")
+#
+# Note 1: Mounted apps (by default) should be placed into the project root at '/app_name'.
+# Note 2: If you use the host matching remember to respect the order of the rules.
+#
+# By default, this file mounts the parimary app which was generated with this project.
+# However, the mounted app can be modified as needed:
+#
+# Padrino.mount(:app_file => "path/to/file", :app_class => "Blog").to('/')
+#
+
+# Mounts the core application for this project
+Padrino.mount("IdeaGrid").to('/')
@@ -0,0 +1,18 @@
+# Defines our constants
+PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development" unless defined?(PADRINO_ENV)
+PADRINO_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) unless defined?(PADRINO_ROOT)
+
+begin
+ # Require the preresolved locked set of gems.
+ require File.expand_path('../../.bundle/environment', __FILE__)
+rescue LoadError
+ # Fallback on doing the resolve at runtime.
+ require 'rubygems'
+ require 'bundler'
+ Bundler.setup
+end
+
+Bundler.require(:default, PADRINO_ENV.to_sym)
+puts "=> Located #{Padrino.bundle} Gemfile for #{Padrino.env}"
+
+Padrino.load!
@@ -0,0 +1,7 @@
+MongoMapper.connection = Mongo::Connection.new('localhost', nil, :logger => logger)
+
+case Padrino.env
+ when :development then MongoMapper.database = 'ideagrid_development'
+ when :production then MongoMapper.database = 'ideagrid_production'
+ when :test then MongoMapper.database = 'ideagrid_test'
+end
@@ -0,0 +1,12 @@
+# Enables support for SASS template reloading in rack applications.
+# See http://nex-3.com/posts/88-sass-supports-rack for more details.
+# Store SASS files (by default) within 'app/stylesheets'
+
+module SassInitializer
+ def self.registered(app)
+ require 'sass/plugin/rack'
+ Sass::Plugin.options[:template_location] = Padrino.root("app/stylesheets")
+ Sass::Plugin.options[:css_location] = Padrino.root("public/stylesheets")
+ app.use Sass::Plugin::Rack
+ end
+end
No changes.
@@ -0,0 +1 @@
+// Put your application scripts here
Oops, something went wrong.

0 comments on commit eac06d2

Please sign in to comment.