Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
support for bower, haml, rspec, bootstrap, sass, mongoid
first pass at models
  • Loading branch information
tercenya committed Apr 8, 2015
0 parents commit 3c0ffab
Show file tree
Hide file tree
Showing 69 changed files with 1,501 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
@@ -0,0 +1,3 @@
{
"directory": "vendor/assets/components"
}
50 changes: 50 additions & 0 deletions .gitignore
@@ -0,0 +1,50 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Production files
public/assets
vendor/bundle

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
/tmp

# don't checkin the documentation temp files or build folders
/.yardoc
doc

data/
# for the lazy, while debugging
bin/*.txt

# don't commit the production version of the database or backend configs
config/database.yml
config/backend.yml

# don't lock the versions in development
Gemfile.lock
Berksfile.lock

*.sublime-workspace

# simplecov
/coverage

# woe unto you if you try 'git add .vagrant'
.vagrant

# dump files
**/*.rdb

# bower componets
vendor/assets/components
1 change: 1 addition & 0 deletions .powenv
@@ -0,0 +1 @@
export RAILS_ENV=development
1 change: 1 addition & 0 deletions .ruby-version
@@ -0,0 +1 @@
2.2.1
5 changes: 5 additions & 0 deletions Berksfile
@@ -0,0 +1,5 @@
source "https://api.berkshelf.com"

# needed to make the VM sane
cookbook 'afpc', path: '/code/chef/cookbooks/afpc'
cookbook 'passenger', path: '/code/chef/cookbooks/passenger'
73 changes: 73 additions & 0 deletions Gemfile
@@ -0,0 +1,73 @@

source 'https://rubygems.org'

## Rails
gem 'rails', '4.2.1'
## Rails pipeline
gem 'jquery-rails'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'

gem 'turbolinks'

# database
gem 'sqlite3'
gem 'mongoid'

case RUBY_PLATFORM
when /darwin/
# use apple's built-in javascript
else
gem 'therubyracer'
end

# Views and frontend gems
gem 'haml-rails'
gem 'kramdown'
gem 'kramdown-haml'

## Utilities
gem 'highline', require: false
gem 'rest-client'

gem 'passenger'

group :development do
gem 'thin'

# code quality
gem 'rubocop', require: false

gem 'powder'
gem 'guard-pow'
end

group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'

gem 'spring'
gem 'rspec'
gem 'shoulda'

gem 'guard-bundler'
gem 'guard-rspec'
# gem 'guard-spring'

gem 'jazz_hands', github: 'camerontaylor/jazz_hands'

gem 'letter_opener'
gem 'rb-fsevent', group: :darwin

# require these later in rails_helper, otherwise you get the wrong pieces loaded
gem 'shoulda-matchers', require: false
gem 'simplecov', require: false
gem 'factory_girl_rails', require: false
gem 'faker'
end


group :development, :doc do
gem 'yard'
end
42 changes: 42 additions & 0 deletions Guardfile
@@ -0,0 +1,42 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

clearing :on
#interactor :off

guard :bundler do
watch('Gemfile')
# watch(/^.+\.gemspec/)
end

group 'interactive' do
guard 'pow', notification: false do
watch(%r{^lib})
watch(%r{^app/(.+)\.rb})
watch(%r{^config})
end
end

group 'rspec' do
guard :rspec, cmd: 'spring rspec -fd' do
watch(%r{^spec/.+_spec\.rb$})
watch('spec/spec_helper.rb') { 'spec' }
watch('spec/rails_helper.rb') { 'spec' }

watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }

# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }

watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
watch('app/controllers/authenticated_controller.rb') { 'spec/controllers' }

# Capybara features specs
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }

watch(%r{^spec/factories/(.+)\.rb$}) { 'spec' }
end
end

28 changes: 28 additions & 0 deletions README.rdoc
@@ -0,0 +1,28 @@
== README

This README would normally document whatever steps are necessary to get the
application up and running.

Things you may want to cover:

* Ruby version

* System dependencies

* Configuration

* Database creation

* Database initialization

* How to run the test suite

* Services (job queues, cache servers, search engines, etc.)

* Deployment instructions

* ...


Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.
6 changes: 6 additions & 0 deletions Rakefile
@@ -0,0 +1,6 @@
# 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__)

Rails.application.load_tasks
43 changes: 43 additions & 0 deletions Vagrantfile
@@ -0,0 +1,43 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'berkshelf/vagrant'

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.5.0"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.berkshelf.enabled = true
config.omnibus.chef_version = :latest

config.vm.hostname = "invalesco"
config.vm.box = "trusty64"

config.vm.provider "vmware_fusion" do |v, override|
v.gui = false
v.vmx["numvcpus"] = "8"
v.vmx["memsize"] = "8096"
end

# An array of symbols representing groups of cookbook described in the Vagrantfile
# to exclusively install and copy to Vagrant's shelf.
# config.berkshelf.only = []

# An array of symbols representing groups of cookbook described in the Vagrantfile
# to skip installing and copying to Vagrant's shelf.
# config.berkshelf.except = []

config.vm.provision :chef_solo do |chef|
chef.run_list = [
"recipe[afpc::vagrant]",
]
end

config.vm.synced_folder "/code/lol/invalesco", "/opt/invalesco"

config.vm.network "forwarded_port", guest: 3000, host: 3002 # nginx
# config.vm.network "forwarded_port", guest: 6379, host: 6379 # redis
config.vm.network "forwarded_port", guest: 27017, host: 27018 # mongodb
end
Empty file added app/assets/images/.keep
Empty file.
17 changes: 17 additions & 0 deletions app/assets/javascripts/application.js
@@ -0,0 +1,17 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require bootstrap-sass/assets/javascripts/bootstrap-sprockets
3 changes: 3 additions & 0 deletions app/assets/stylesheets/application.scss
@@ -0,0 +1,3 @@
$icon-font-path: "bootstrap-sass/assets/fonts/bootstrap/";
@import "bootstrap-sass/assets/stylesheets/bootstrap-sprockets";
@import "bootstrap-sass/assets/stylesheets/bootstrap";
15 changes: 15 additions & 0 deletions app/controllers/application_controller.rb
@@ -0,0 +1,15 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

before_filter :app_name

def app_name
@app_name = 'Invalesco'
end

def sample_match
render json: Match.first.to_json
end
end
11 changes: 11 additions & 0 deletions app/controllers/champion_controller.rb
@@ -0,0 +1,11 @@
class ChampionController < ApplicationController
def index
@data = Champion.all
render json: @data.to_json
end

def urf_win_loss
@data = Urf::ChampionWinLoss.all
render json: @data.to_json
end
end
Empty file added app/controllers/concerns/.keep
Empty file.
6 changes: 6 additions & 0 deletions app/helpers/application_helper.rb
@@ -0,0 +1,6 @@
module ApplicationHelper
def champion_icon(name_or_id)
name = name_or_id.is_a?(Integer) ? Champion.find(name_or_id) : name_or_id.to_s
image_tag "http://ddragon.leagueoflegends.com/cdn/5.2.1/img/champion/#{name}.png"
end
end
Empty file added app/mailers/.keep
Empty file.
Empty file added app/models/.keep
Empty file.
7 changes: 7 additions & 0 deletions app/models/ban.rb
@@ -0,0 +1,7 @@
class Ban
include Mongoid::Document
include Mongoid::Attributes::Dynamic

field :championId, type: Integer
field :pickTurn, type: Integer
end
9 changes: 9 additions & 0 deletions app/models/champion.rb
@@ -0,0 +1,9 @@
class Champion
include Mongoid::Document
# include Mongoid::Attributes::Dynamic

field :key, type: String
field :name, type: String
field :title, type: String
field :_id, type: Integer, default: ->{ id }
end
Empty file added app/models/concerns/.keep
Empty file.
11 changes: 11 additions & 0 deletions app/models/match.rb
@@ -0,0 +1,11 @@
class Match
include Mongoid::Document
include Mongoid::Attributes::Dynamic

field :matchId, type: Integer
field :region, type: String
field :queueType, type: String

embeds_many :teams
embeds_many :participants
end
7 changes: 7 additions & 0 deletions app/models/participant.rb
@@ -0,0 +1,7 @@
class Participant
include Mongoid::Document
include Mongoid::Attributes::Dynamic

field :teamId, type: Integer
field :championId, type: Integer
end
9 changes: 9 additions & 0 deletions app/models/team.rb
@@ -0,0 +1,9 @@
class Team
include Mongoid::Document
include Mongoid::Attributes::Dynamic

field :teamId, type: Integer
field :winner, type: Boolean

embeds_many :bans
end
18 changes: 18 additions & 0 deletions app/models/urf/champion_win_loss.rb
@@ -0,0 +1,18 @@
module Urf
class ChampionWinLoss
include Mongoid::Document

field :wins, type: Integer
field :losses, type: Integer

def total
wins+losses
end

def ratio
wins/total.to_f
end

has_one :champion
end
end

0 comments on commit 3c0ffab

Please sign in to comment.