Browse files

initial import of the site

  • Loading branch information...
0 parents commit ced0173ba5e942fce942c67f2740ebab9b6039da @atmos committed Jul 7, 2009
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2009 YOUR NAME
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 README.md
@@ -0,0 +1,4 @@
+thetownhall
+===========
+
+A sinatra app the provides a gem that...
73 Rakefile
@@ -0,0 +1,73 @@
+require 'rubygems'
+require 'rake/gempackagetask'
+require 'rubygems/specification'
+require 'date'
+require 'spec/rake/spectask'
+require 'cucumber/rake/task'
+
+GEM = "thetownhall"
+GEM_VERSION = "0.0.1"
+AUTHOR = "Your Name"
+EMAIL = "Your Email"
+HOMEPAGE = "http://example.com"
+SUMMARY = "A sinatra app that provides..."
+
+spec = Gem::Specification.new do |s|
+ s.name = GEM
+ s.version = GEM_VERSION
+ s.platform = Gem::Platform::RUBY
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["LICENSE", 'TODO']
+ s.summary = SUMMARY
+ s.description = s.summary
+ s.author = AUTHOR
+ s.email = EMAIL
+ s.homepage = HOMEPAGE
+
+ s.add_dependency "sinatra", ">=0.9.2"
+ s.add_dependency "rubigen", ">= 1.5.2"
+ s.add_dependency "rack-test", "~>0.1.0"
+ s.add_dependency "webrat", "~>0.4.3"
+ s.add_dependency "fakeweb", "~>1.2.0"
+ s.add_dependency 'haml', "~>2.0.9"
+
+ s.require_path = 'lib'
+ s.autorequire = GEM
+ s.files = %w(LICENSE README.md Rakefile TODO) + Dir.glob("{lib,features}/**/*")
+end
+
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.gem_spec = spec
+end
+
+desc "install the gem locally"
+task :install => [:package] do
+ sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
+end
+
+desc "create a gemspec file"
+task :make_spec do
+ File.open("#{GEM}.gemspec", "w") do |file|
+ file.puts spec.to_ruby
+ end
+end
+
+task :default => :features
+
+desc "Run cucumber"
+Cucumber::Rake::Task.new do |t|
+ t.cucumber_opts = %w{--format pretty}
+end
+
+
+desc "Run specs"
+Spec::Rake::SpecTask.new do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.spec_opts = %w(-fs --color)
+ t.spec_opts << '--loadby' << 'random'
+
+ t.rcov_opts << '--exclude' << 'spec'
+ t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
+ t.rcov_opts << '--text-summary'
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
+end
4 TODO
@@ -0,0 +1,4 @@
+TODO:
+Fix LICENSE with your name
+Fix Rakefile with your name and contact info
+Add your code to lib/<%= name %>.rb
9 config.ru
@@ -0,0 +1,9 @@
+require 'rubygems'
+require File.dirname(__FILE__)+'/lib/thetownhall'
+
+class ThetownhallSite < Thetownhall::App
+ set :public, File.expand_path(File.dirname(__FILE__), "public")
+ set :environment, :production
+end
+
+run ThetownhallSite
7 features/step_definitions/thetownhall.rb
@@ -0,0 +1,7 @@
+When /^I visit the home page$/ do
+ get '/'
+end
+
+Then /^I should see the logo$/ do
+ last_response.should have_selector("img[src='/images/logo.png']")
+end
32 features/support/env.rb
@@ -0,0 +1,32 @@
+require 'spec'
+require 'webrat'
+require 'rack/test'
+require File.dirname(__FILE__)+'/../../lib/thetownhall'
+module Thetownhall::AppHelpers
+ begin
+ gem 'safariwatir', '~>0.3.3'
+ require 'safariwatir'
+ def browser
+ @browser ||= Watir::Safari.new
+ end
+ rescue LoadError => e
+ end
+
+ def app_host
+ 'http://localhost:9393/migration'
+ end
+
+ def app
+ @app = Rack::Builder.new do
+ run Thetownhall::App
+ end
+ end
+end
+
+World(Rack::Test::Methods)
+World(Webrat::Matchers)
+World(Thetownhall::AppHelpers)
+
+Before do
+ # insert before filtery things here
+end
6 features/thetownhall.feature
@@ -0,0 +1,6 @@
+Feature: Visiting the Home Page
+In order to display a splash page
+ As an anonymous user
+ Scenario: Seeing the splash page
+ When I visit the home page
+ Then I should see the logo
9 lib/thetownhall.rb
@@ -0,0 +1,9 @@
+require 'rubygems'
+require 'sinatra/base'
+require 'haml/util'
+require 'haml/engine'
+
+module Thetownhall
+end
+
+require File.dirname(__FILE__)+'/thetownhall/app'
8 lib/thetownhall/app.rb
@@ -0,0 +1,8 @@
+module Thetownhall
+ class App < Sinatra::Default
+ set :views, File.expand_path(File.dirname(__FILE__)+'/views')
+ get '/' do
+ haml :home
+ end
+ end
+end
1 lib/thetownhall/views/home.haml
@@ -0,0 +1 @@
+%img.logo{:src => '/images/logo.png'}
16 lib/thetownhall/views/layout.haml
@@ -0,0 +1,16 @@
+%html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"}
+ %head
+ %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"}
+ %title The Town Hall
+ %link{:href => '/css/style.css', :media => 'screen', :rel => 'stylesheet', :type => 'text/css', :media => 'screen, projection' }
+
+ %body
+ #page
+ = yield
+ #contact
+ %span
+ %a{:href => 'http://twitter.com/atmos'} Corey
+ %span
+ %a{:href => 'http://twitter.com/jlarrimore'} Jeffrey
+ %span
+ %a{:href => 'http://twitter.com/ubermajestix'} Tyler
27 public/css/style.css
@@ -0,0 +1,27 @@
+body {
+ background-color: #fff;
+ color: 000;
+}
+
+#page {
+ margin: 45px auto auto auto;
+}
+
+#contact {
+ text-align: center;
+ padding: 2px;
+}
+
+#contact span {
+ padding: 0px 4px;
+}
+
+#contact a {
+ color: #000;
+}
+
+img.logo {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
BIN public/images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
0 spec/fixtures.rb
No changes.
40 spec/spec_helper.rb
@@ -0,0 +1,40 @@
+$TESTING=true
+$:.push File.join(File.dirname(__FILE__), '..', 'lib')
+require 'rubygems'
+require 'randexp'
+require 'thetownhall'
+#require 'dm-core'
+require 'rack/test'
+require 'webrat/sinatra'
+#require 'dm-sweatshop'
+require 'fakeweb'
+require 'pp'
+
+FakeWeb.allow_net_connect = false
+
+#require File.dirname(__FILE__)+'/fixtures'
+#DataMapper.setup(:default, 'sqlite3::memory:')
+
+class Net::HTTPResponse
+ def body=(content)
+ @body = content
+ @read = true
+ end
+end
+
+Spec::Runner.configure do |config|
+ config.include(Rack::Test::Methods)
+ config.include(Webrat::Methods)
+ config.include(Webrat::Matchers)
+
+ config.before(:each) do
+ #DataMapper.auto_migrate!
+ FakeWeb.clean_registry
+ end
+
+ def app
+ @app = Rack::Builder.new do
+ run Thetownhall::App
+ end
+ end
+end
8 spec/thetownhall_spec.rb
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "Thetownhall" do
+ it "should do nothing" do
+ get '/'
+ last_response.should have_selector("h2:contains('Hello There, buddy!')")
+ end
+end

0 comments on commit ced0173

Please sign in to comment.