Skip to content

Commit

Permalink
Basic setup for forem, including way to view forums
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Feb 20, 2011
0 parents commit 82ba7f8
Show file tree
Hide file tree
Showing 74 changed files with 21,068 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/
1 change: 1 addition & 0 deletions .rvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rvm use 1.9.2@forem
18 changes: 18 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source "http://rubygems.org"

gem 'rails', :git => "git://github.com/rails/rails.git"
gem 'rack', :git => "git://github.com/rack/rack.git"
gem 'arel', :git => "git://github.com/rails/arel.git"

gem 'rspec-rails'
gem 'capybara'

gem 'sqlite3-ruby', :require => 'sqlite3'

group :development do
gem 'launchy'
end

if RUBY_VERSION < '1.9'
gem "ruby-debug", ">= 0.10.3"
end
143 changes: 143 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
GIT
remote: git://github.com/rack/rack.git
revision: e3ffeac0dc04bb8d5994b7923bf12e55d549a279
specs:
rack (1.2.1)

GIT
remote: git://github.com/rails/arel.git
revision: dbc86c0f2c2fc3c8bacf35c67fb8e0967b0a8980
specs:
arel (2.0.7.beta.20110121165657)

GIT
remote: git://github.com/rails/rails.git
revision: 289cc15f1a89a179116f67e5f666f4ff6d645f03
specs:
actionmailer (3.1.0.beta)
actionpack (= 3.1.0.beta)
mail (~> 2.2.15)
actionpack (3.1.0.beta)
activemodel (= 3.1.0.beta)
activesupport (= 3.1.0.beta)
builder (~> 3.0.0)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-cache (~> 1.0.0)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.1.0.beta)
activesupport (= 3.1.0.beta)
bcrypt-ruby (~> 2.1.4)
builder (~> 3.0.0)
i18n (~> 0.5.0)
activerecord (3.1.0.beta)
activemodel (= 3.1.0.beta)
activesupport (= 3.1.0.beta)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.1.0.beta)
activemodel (= 3.1.0.beta)
activesupport (= 3.1.0.beta)
activesupport (3.1.0.beta)
rails (3.1.0.beta)
actionmailer (= 3.1.0.beta)
actionpack (= 3.1.0.beta)
activerecord (= 3.1.0.beta)
activeresource (= 3.1.0.beta)
activesupport (= 3.1.0.beta)
bundler (~> 1.0)
railties (= 3.1.0.beta)
railties (3.1.0.beta)
actionpack (= 3.1.0.beta)
activesupport (= 3.1.0.beta)
rake (>= 0.8.7)
thor (~> 0.14.4)

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
bcrypt-ruby (2.1.4)
builder (3.0.0)
capybara (0.4.1.2)
celerity (>= 0.7.9)
culerity (>= 0.2.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.3)
celerity (0.8.8)
childprocess (0.1.7)
ffi (~> 0.6.3)
configuration (1.2.0)
culerity (0.2.15)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
ffi (0.6.3)
rake (>= 0.8.7)
i18n (0.5.0)
json_pure (1.5.1)
launchy (0.3.7)
configuration (>= 0.0.5)
rake (>= 0.8.1)
mail (2.2.15)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
nokogiri (1.4.4)
polyglot (0.3.1)
rack-cache (1.0)
rack (>= 0.4)
rack-mount (0.6.13)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rake (0.8.7)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
rspec-rails (2.5.0)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.5.0)
rubyzip (0.9.4)
selenium-webdriver (0.1.3)
childprocess (~> 0.1.5)
ffi (~> 0.6.3)
json_pure
rubyzip
sqlite3 (1.3.3)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.24)
xpath (0.1.3)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
arel!
capybara
launchy
rack!
rails!
rspec-rails
sqlite3-ruby
20 changes: 20 additions & 0 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2011 YOURNAME

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.
3 changes: 3 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
= <%= camelized %>

This project rocks and uses MIT-LICENSE.
31 changes: 31 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'rake/rdoctask'

Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Forem'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end

APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'

require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end


task :default => :test
4 changes: 4 additions & 0 deletions app/controllers/forem/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Forem
class ApplicationController < ActionController::Base
end
end
7 changes: 7 additions & 0 deletions app/controllers/forem/forums_controler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Forem
class ForumsController < ApplicationController
def index
@forums = Forem::Forum.all
end
end
end
4 changes: 4 additions & 0 deletions app/helpers/forem/application_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Forem
module ApplicationHelper
end
end
11 changes: 11 additions & 0 deletions app/models/forem/forum.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Forem::Forum < ActiveRecord::Base

#temporary
def topics
[]
end

def posts
[]
end
end
13 changes: 13 additions & 0 deletions app/views/forem/forums/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<ul class="forums listing">
<% @forums.each do |forum| %>
<li class="<%= cycle("odd", "even") %>">
<h2><%= link_to forum.title, forem_forum_path(forum) %></h2>
<%= forum.description %>
<br>
<%= t("forem.forum.topics_count", :count => forum.topics.count) %> topics,
<%= t("forem.forum.posts_count", :count => forum.posts.count) %> posts
<br>
Last post was TIME AGO by NAME in TOPIC
</li>
<% end %>
</ul>
14 changes: 14 additions & 0 deletions app/views/layouts/forem/application.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Forem</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>
7 changes: 7 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
en:
forem:
forum:
topics_count:
zero: 0 topics
one: 1 topic
many: "%{count} topics"
5 changes: 5 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Rails.application.routes.draw do
namespace :forem do
resources :forums
end
end
13 changes: 13 additions & 0 deletions db/migrate/20110214221555_create_forums.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateForums < ActiveRecord::Migration
def up
create_table :forums do |t|
t.string :title
t.text :description
end

end

def down
drop_table :forums
end
end
Loading

0 comments on commit 82ba7f8

Please sign in to comment.