Skip to content

Instantly share code, notes, and snippets.

View andyl's full-sized avatar
🎯
Focusing

andyl

🎯
Focusing
View GitHub Profile
@andyl
andyl / gist:818611
Created February 9, 2011 15:08
Example Spec: Using Constants and Sinatra Extensions
require 'spec_helper'
=begin
Example One - this works
In this example, the constant (ZZZ) is set in the
Spec, and detected in the target code.
=end
module TestModule
class TestClass
@andyl
andyl / set_routes.thor
Created December 15, 2010 17:54
set_routes script
class Vhost < Thor
include Thor::Actions
no_tasks do
def initialize(*args)
@vhost_dir = File.expand_path "~/.vhost"
@app_dir = File.expand_path "~/lcl/nconf"
@adblock_file = File.expand_path "~/util/bin/templates/adblock.txt"
super args
end
----- Gemfile -----
gem 'sinatra'
----- app.rb ------
require 'vendor/gems/environment'
Bundler.require_env
get '/' do
"hello world"
end
----- Gemfile -----
gem 'sinatra'
----- app.rb ------
require 'vendor/gems/environment'
Bundler.require_env
get '/' do
"hello world"
end
require File.expand_path(File.dirname(__FILE__) + '/vendor/gems/environment')
#require 'sinatra'
Bundler.require_env(:app)
get '/' do
'Hello world!'
end
gem 'json'
only :app do
gem 'sinatra'
source 'http://gems.github.com'
gem 'famoseagle-carrot', :require_as => 'carrot'
end
only :daemon do
gem 'eventmachine'