Created
March 12, 2012 01:55
-
-
Save yknd/2019246 to your computer and use it in GitHub Desktop.
sample guard
This file contains 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
.sass-cache/ |
This file contains 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
-c | |
-fs |
This file contains 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
$ bundle exec guard |
This file contains 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 'bundler/setup' | |
Bundler.require(:default) | |
class MyApp < Sinatra::Base | |
configure do | |
enable :inline_templates | |
set :haml, format: :html5 | |
set :haml, escape_html: true | |
end | |
configure :development do | |
register Sinatra::Reloader | |
end | |
get '/' do | |
haml :index | |
end | |
get '/css/style.css' do | |
content_type 'text/css' | |
scss :style | |
end | |
end | |
__END__ | |
@@ layout | |
!!! | |
%html | |
%head | |
%title My App | |
%link{rel: 'stylesheet', href: '/css/style.css'} | |
%body= yield | |
@@ index | |
%h1 Hello World!! | |
@@ style | |
h1 { | |
padding: 5px 0 5px 15px; | |
border-left: #4F4F4F 8px solid; | |
border-bottom: #4F4F4F 1px solid; | |
background: #E8E8E8; | |
color: #000000; | |
} |
This file contains 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 'spec_helper' | |
describe MyApp do | |
context "when get '/'" do | |
before do | |
get '/' | |
end | |
subject { last_response } | |
its(:status) { should == 200 } | |
its(:body) { should include("Hello World!!") } | |
end | |
end |
This file contains 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
$:.unshift File.join(File.dirname(__FILE__), 'lib') | |
require 'bundler' | |
Bundler.require | |
require 'app' | |
run MyApp |
This file contains 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 :rubygems | |
gem 'sinatra', require: 'sinatra/base' | |
gem 'sinatra-reloader', require: 'sinatra/reloader' | |
gem 'thin' | |
gem 'haml' | |
gem 'sass' | |
group :development do | |
gem 'rspec' | |
gem 'rack-test', require: 'rack/test' | |
gem 'guard-rspec' | |
end |
This file contains 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
GEM | |
remote: http://rubygems.org/ | |
specs: | |
backports (2.3.0) | |
daemons (1.1.6) | |
diff-lcs (1.1.3) | |
eventmachine (0.12.10) | |
ffi (1.0.11) | |
guard (1.0.0) | |
ffi (>= 0.5.0) | |
thor (~> 0.14.6) | |
guard-rspec (0.6.0) | |
guard (>= 0.10.0) | |
haml (3.1.4) | |
rack (1.4.1) | |
rack-protection (1.2.0) | |
rack | |
rack-test (0.6.1) | |
rack (>= 1.0) | |
rspec (2.8.0) | |
rspec-core (~> 2.8.0) | |
rspec-expectations (~> 2.8.0) | |
rspec-mocks (~> 2.8.0) | |
rspec-core (2.8.0) | |
rspec-expectations (2.8.0) | |
diff-lcs (~> 1.1.2) | |
rspec-mocks (2.8.0) | |
sass (3.1.12) | |
sinatra (1.3.2) | |
rack (~> 1.3, >= 1.3.6) | |
rack-protection (~> 1.2) | |
tilt (~> 1.3, >= 1.3.3) | |
sinatra-contrib (1.3.1) | |
backports (>= 2.0) | |
eventmachine | |
rack-protection | |
rack-test | |
sinatra (~> 1.3.0) | |
tilt (~> 1.3) | |
sinatra-reloader (1.0) | |
sinatra-contrib | |
thin (1.3.1) | |
daemons (>= 1.0.9) | |
eventmachine (>= 0.12.6) | |
rack (>= 1.0.0) | |
thor (0.14.6) | |
tilt (1.3.3) | |
PLATFORMS | |
ruby | |
DEPENDENCIES | |
guard-rspec | |
haml | |
rack-test | |
rspec | |
sass | |
sinatra | |
sinatra-reloader | |
thin |
This file contains 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
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
guard 'rspec', :version => 2 do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch('spec/spec_helper.rb') { "spec" } | |
end | |
This file contains 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 'bundler/setup' | |
Bundler.require(:default, :development) | |
require 'app' | |
module MyTestModule | |
def app | |
MyApp | |
end | |
end | |
RSpec.configure do |config| | |
config.include Rack::Test::Methods | |
config.include MyTestModule | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment