This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this goes in config/application.rb | |
#just before the closing "end" tag | |
#it tels rails generators to use Haml and Mongomapper | |
config.generators do |g| | |
g.orm :mongo_mapper # :active_record | |
g.template_engine :haml | |
g.stylesheet_engine = :sass | |
g.test_framework :rspec, :fixture => true, :views => false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MongoMapper.config = { | |
Rails.env => { 'uri' => ENV['MONGOHQ_URL'] || | |
"mongodb://localhost/rubyconf_simple_app-#{Rails.env}-1" } } | |
MongoMapper.connect(Rails.env) | |
if defined?(PhusionPassenger) | |
PhusionPassenger.on_event(:starting_worker_process) do |forked| | |
MongoMapper.connection.connect if forked | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TmplCompiler < Stitch::Compiler | |
extensions :tmpl | |
def compile(path) | |
content = File.read(path) | |
%{var template = jQuery.template(#{content.to_json}); | |
module.exports = (function(data){ return jQuery.tmpl(template, data); });} | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[APP_NAME]::Application.routes.draw do | |
resources :posts | |
root :to => "pages#home" | |
match 'home' => "pages#home" | |
match 'apps/app.js' => Stitch::Server.new(:paths => ["app/assets/javascripts/app", "app/assets/javascripts/lib"]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Post = require("models/post") | |
class Posts extends Spine.Controller | |
elements: | |
"#post_list" : "post_list" | |
events: | |
"click #post_list" : "on_post_click" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("spine") | |
require("ajax") | |
require("tmpl") | |
Posts = require("controllers/posts") | |
class App extends Spine.Controller | |
elements: | |
"#posts" : "postsEl" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post extends Spine.Model | |
@configure "Post", "name" | |
@extend Spine.Model.Ajax | |
module.exports = Post |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#content | |
#app_canvas | |
:javascript | |
var exports = this; | |
jQuery(function(){ | |
var App = require("app"); | |
exports.App = new App({el: $("#app_canvas") }); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rails', '3.1.0' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PagesController < ApplicationController | |
def home | |
render 'home' ,:layout => 'js' | |
end | |
end |
OlderNewer