A proof of concept of having Sinatra like routes inside your controllers.
Since the router is gone, feel free to remove config/routes.rb
.
Then add the file below to lib/action_controller/inline_routes.rb
inside your app.
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
#!/usr/bin/env ruby | |
# | |
# Convert blogger (blogspot) posts to jekyll posts | |
# | |
# Basic Usage | |
# ----------- | |
# | |
# ./blogger_to_jekyll.rb feed_url | |
# | |
# where `feed_url` can have the following format: |
module Sequel | |
module Plugins | |
# The paranoia plugin creates hooks that automatically set deleted | |
# timestamp fields. The field name used is configurable, and you | |
# can also set whether to overwrite existing deleted timestamps (false | |
# by default). Adapted from Timestamps plugin. | |
# | |
# Usage: | |
# | |
# # Soft deletion for all model instances using +deleted_at+ |
# RSpec matcher to spec enumerize settings | |
# usage: | |
# | |
# it { should enumerize(:sex).in(:male, :female).with_default(:male) } | |
RSpec::Matchers.define :enumerize do |attribute| | |
match do |model| | |
@attribute = attribute | |
@klass = model.class |
# Simple minitest matchers which will make your controller/functional specs less pain in the ass. | |
# | |
# ==== Dependencies | |
# | |
# gem 'minitest' | |
# gem 'minitest-matchers' | |
# | |
# ==== Matchers | |
# | |
# +must_have_status+ and its opposite +wont_have_status+ take both one argument which must be one of the following: |
module LoadResources | |
module ClassMethods | |
def load_resource(resource_class, options = {}) | |
filter_options = options.slice :only, :except, :if, :unless | |
resource_options = options.except :only, :except, :if, :unless | |
send(:before_filter, filter_options) do |controller| | |
ResourceBuilder.new(controller, resource_class, resource_options) | |
.send(:load_resource) | |
end |
////////////////////////////////////////////////////////////// | |
// Font Variables (http://cssfontstack.com/) | |
////////////////////////////////////////////////////////////// | |
// | |
// Serif font-stacks | |
// | |
$baskerville-font-stack: "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif !default; |