Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brymck committed Nov 16, 2011
0 parents commit ed364c6
Show file tree
Hide file tree
Showing 58 changed files with 963 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.bundle
db/*.sqlite3
log/*.log
tmp/
.sass-cache/
26 changes: 26 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
source 'http://rubygems.org'

gem 'rails', '3.1.1'

group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end

gem 'haml'
gem 'jquery-rails'

group :production do
gem 'pg'
end

group :development, :test do
gem 'sqlite3'
end

group :test do
gem 'autotest'
gem 'rspec'
gem 'rspec-rails'
end
139 changes: 139 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
GEM
remote: http://rubygems.org/
specs:
ZenTest (4.6.2)
actionmailer (3.1.1)
actionpack (= 3.1.1)
mail (~> 2.3.0)
actionpack (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.2)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.2)
activemodel (3.1.1)
activesupport (= 3.1.1)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
activesupport (3.1.1)
multi_json (~> 1.0)
arel (2.2.1)
autotest (4.4.6)
ZenTest (>= 4.4.1)
builder (3.0.0)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.1.3)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
multi_json (~> 1.0)
haml (3.1.3)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.17)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.1)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.0.3)
pg (0.11.0)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.1)
actionmailer (= 3.1.1)
actionpack (= 3.1.1)
activerecord (= 3.1.1)
activeresource (= 3.1.1)
activesupport (= 3.1.1)
bundler (~> 1.0)
railties (= 3.1.1)
railties (3.1.1)
actionpack (= 3.1.1)
activesupport (= 3.1.1)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.11)
json (~> 1.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
rspec-rails (2.7.0)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.7.0)
sass (3.1.10)
sass-rails (3.1.4)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (>= 3.1.4)
sprockets (~> 2.0.0)
tilt (~> 1.3.2)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.4)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)
uglifier (1.0.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)

PLATFORMS
ruby

DEPENDENCIES
autotest
coffee-rails (~> 3.1.1)
haml
jquery-rails
pg
rails (= 3.1.1)
rspec
rspec-rails
sass-rails (~> 3.1.4)
sqlite3
uglifier (>= 1.0.3)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
perktrees
=========
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

Perktrees::Application.load_tasks
Binary file added app/assets/images/rails.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
3 changes: 3 additions & 0 deletions app/assets/javascripts/skills.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
7 changes: 7 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/
56 changes: 56 additions & 0 deletions app/assets/stylesheets/scaffolds.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px; }

p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px; }

pre {
background-color: #eee;
padding: 10px;
font-size: 11px; }

a {
color: #000;
&:visited {
color: #666; }
&:hover {
color: #fff;
background-color: #000; } }

div {
&.field, &.actions {
margin-bottom: 10px; } }

#notice {
color: green; }

.field_with_errors {
padding: 2px;
background-color: red;
display: table; }

#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff; }
ul li {
font-size: 12px;
list-style: square; } }
3 changes: 3 additions & 0 deletions app/assets/stylesheets/skills.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the skills controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end
23 changes: 23 additions & 0 deletions app/controllers/skills_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class SkillsController < ApplicationController
# GET /skills
# GET /skills.json
def index
@skills = Skill.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @skills }
end
end

# GET /skills/1
# GET /skills/1.json
def show
@skill = Skill.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @skill }
end
end
end
2 changes: 2 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ApplicationHelper
end
2 changes: 2 additions & 0 deletions app/helpers/skills_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module SkillsHelper
end
Empty file added app/mailers/.gitkeep
Empty file.
Empty file added app/models/.gitkeep
Empty file.
4 changes: 4 additions & 0 deletions app/models/perk.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Perk < ActiveRecord::Base
belongs_to :skill
has_and_belongs_to_many :prerequisites, class_name: "Perk", join_table: "perks_prerequisites", foreign_key: "perk_id", association_foreign_key: "prerequisite_id"
end
8 changes: 8 additions & 0 deletions app/models/race.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Race < ActiveRecord::Base
belongs_to :major_skill, class_name: "Skill", foreign_key: "major_skill_id"
has_and_belongs_to_many :minor_skills, class_name: "Skill", join_table: "minor_skills_races", association_foreign_key: "skill_id"

def skills
[major_skill] + minor_skills
end
end
9 changes: 9 additions & 0 deletions app/models/skill.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Skill < ActiveRecord::Base
has_many :perks
has_many :major_races, class_name: "Race", foreign_key: "major_skill_id"
has_and_belongs_to_many :minor_races, class_name: "Race", join_table: "minor_skills_races", foreign_key: "skill_id"

def races
major_races + minor_races
end
end
9 changes: 9 additions & 0 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
%html
%head
%title Perk Trees
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
%body
= yield
5 changes: 5 additions & 0 deletions app/views/perks/_cell.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%td
- if perk.ranks == 1
%p Hi
- else
%p Bye
14 changes: 14 additions & 0 deletions app/views/skills/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%table
%tr
%th Name
%th Points
- @skills.each do |skill|
%tr
%td= skill.name
%td
%ul
- skill.perks.each do |perk|
- if perk.ranks == 1
%li= perk.name
- else
%li= perk.name
10 changes: 10 additions & 0 deletions app/views/skills/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<p id="notice"><%= notice %></p>

<p>
<b>Name:</b>
<%= @skill.name %>
</p>


<%= link_to 'Edit', edit_skill_path(@skill) %> |
<%= link_to 'Back', skills_path %>
4 changes: 4 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
run Perktrees::Application
Loading

0 comments on commit ed364c6

Please sign in to comment.