From 3f72a912b62154b6910d03974240b4c8ad288229 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 2 Mar 2017 18:11:21 +0000 Subject: [PATCH 01/26] Wrestler pool number is now saved in db. Pool number generation moved to it's own class. --- app/models/match.rb | 2 +- app/models/weight.rb | 85 ++---------------- app/models/wrestler.rb | 8 +- .../bracket_advancement/pool_advance.rb | 4 +- .../tournament_services/pool_generation.rb | 3 +- .../weight_services/generate_pool_numbers.rb | 77 ++++++++++++++++ app/views/tournaments/_pool.html.erb | 4 +- config/application.rb | 1 + db/migrate/20170301174920_add_pool_column.rb | 5 ++ db/schema.rb | 3 +- test/fixtures/wrestlers.yml | 88 +++++++++++++++---- test/integration/single_test_test.rb | 3 +- 12 files changed, 177 insertions(+), 106 deletions(-) create mode 100644 app/services/weight_services/generate_pool_numbers.rb create mode 100644 db/migrate/20170301174920_add_pool_column.rb diff --git a/app/models/match.rb b/app/models/match.rb index af655d4..ebcd1ef 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -130,7 +130,7 @@ class Match < ActiveRecord::Base end def poolNumber if self.w1? - wrestler1.generatePoolNumber + wrestler1.pool end end diff --git a/app/models/weight.rb b/app/models/weight.rb index 1573b19..bc86549 100644 --- a/app/models/weight.rb +++ b/app/models/weight.rb @@ -17,8 +17,13 @@ class Weight < ActiveRecord::Base # self.tournament.destroyAllMatches end - def wrestlersForPool(pool) - self.wrestlers.select{|w| w.generatePoolNumber == pool} + def wrestlersForPool(poolNumber) + #For some reason this does not work + # wrestlers.select{|w| w.pool == poolNumber} + + #This does... + weightWrestlers = Wrestler.where(:weight_id => self.id) + weightWrestlers.select{|w| w.pool == poolNumber} end def allPoolMatchesFinished(pool) @@ -43,7 +48,8 @@ class Weight < ActiveRecord::Base end def poolSeedOrder(pool) - wrestlersForPool(pool).sort_by{|w| [w.original_seed ? 0 : 1, w.original_seed || 0]} + # wrestlersForPool(pool).sort_by{|w| [w.original_seed ? 0 : 1, w.original_seed || 0]} + return wrestlersForPool(pool).sort_by{|w|w.seed} end @@ -51,79 +57,6 @@ class Weight < ActiveRecord::Base SwapWrestlers.new.swapWrestlers(wrestler1_id,wrestler2_id) end - def returnPoolNumber(wrestler) - if self.pools == 4 - @wrestlers = fourPoolNumbers(self.wrestlers) - elsif self.pools == 2 - @wrestlers = twoPoolNumbers(self.wrestlers) - elsif self.pools == 1 - @wrestlers = onePoolNumbers(self.wrestlers) - end - @wrestler = @wrestlers.select{|w| w.id == wrestler.id}.first - return @wrestler.poolNumber - end - - def onePoolNumbers(poolWrestlers) - poolWrestlers.sort_by{|x| x.seed }.each do |w| - w.poolNumber = 1 - end - return poolWrestlers - end - - - def twoPoolNumbers(poolWrestlers) - pool = 1 - poolWrestlers.sort_by{|x| x.seed }.reverse.each do |w| - if w.seed == 1 - w.poolNumber = 1 - elsif w.seed == 2 - w.poolNumber = 2 - elsif w.seed == 3 - w.poolNumber = 2 - elsif w.seed == 4 - w.poolNumber = 1 - else - w.poolNumber = pool - end - if pool < 2 - pool = pool + 1 - else - pool = 1 - end - end - return poolWrestlers - end - - def fourPoolNumbers(poolWrestlers) - pool = 1 - poolWrestlers.sort_by{|x| x.seed }.reverse.each do |w| - if w.seed == 1 - w.poolNumber = 1 - elsif w.seed == 2 - w.poolNumber = 2 - elsif w.seed == 3 - w.poolNumber = 3 - elsif w.seed == 4 - w.poolNumber = 4 - elsif w.seed == 8 - w.poolNumber = 1 - elsif w.seed == 7 - w.poolNumber = 2 - elsif w.seed == 6 - w.poolNumber = 3 - elsif w.seed == 5 - w.poolNumber = 4 - else - w.poolNumber = pool - end - if pool < 4 - pool = pool + 1 - else - pool = 1 - end - end - return poolWrestlers - end def bracket_size wrestlers.size diff --git a/app/models/wrestler.rb b/app/models/wrestler.rb index 328f2f8..c20358e 100644 --- a/app/models/wrestler.rb +++ b/app/models/wrestler.rb @@ -4,7 +4,7 @@ class Wrestler < ActiveRecord::Base has_one :tournament, through: :weight has_many :matches, through: :weight has_many :deductedPoints, class_name: "Teampointadjust" - attr_accessor :poolNumber, :poolAdvancePoints, :originalId, :swapId + attr_accessor :poolAdvancePoints, :originalId, :swapId validates :name, :weight_id, :school_id, presence: true @@ -103,10 +103,6 @@ class Wrestler < ActiveRecord::Base end end - def generatePoolNumber - self.weight.returnPoolNumber(self) - end - def boutByRound(round) round_match = allMatches.select{|m| m.round == round}.first if round_match.blank? @@ -122,7 +118,7 @@ class Wrestler < ActiveRecord::Base def poolMatches pool_matches = allMatches.select{|m| m.bracket_position == "Pool"} - pool_matches.select{|m| m.poolNumber == self.generatePoolNumber} + pool_matches.select{|m| m.poolNumber == self.pool} end def hasAPoolBye diff --git a/app/services/bracket_advancement/pool_advance.rb b/app/services/bracket_advancement/pool_advance.rb index 177c292..b70855f 100644 --- a/app/services/bracket_advancement/pool_advance.rb +++ b/app/services/bracket_advancement/pool_advance.rb @@ -6,7 +6,7 @@ class PoolAdvance end def advanceWrestler - if @wrestler.weight.allPoolMatchesFinished(@wrestler.generatePoolNumber) && @wrestler.finishedBracketMatches.size == 0 + if @wrestler.weight.allPoolMatchesFinished(@wrestler.pool) && @wrestler.finishedBracketMatches.size == 0 poolToBracketAdvancment end if @wrestler.finishedBracketMatches.size > 0 @@ -15,7 +15,7 @@ class PoolAdvance end def poolToBracketAdvancment - pool = @wrestler.generatePoolNumber + pool = @wrestler.pool if @wrestler.weight.wrestlers.size > 6 poolOrder = @wrestler.weight.poolOrder(pool) #Take pool order and move winner and runner up to correct match based on w1_name and w2_name diff --git a/app/services/tournament_services/pool_generation.rb b/app/services/tournament_services/pool_generation.rb index 12a3e5c..12e3948 100644 --- a/app/services/tournament_services/pool_generation.rb +++ b/app/services/tournament_services/pool_generation.rb @@ -6,12 +6,13 @@ class PoolGeneration end def generatePools + GeneratePoolNumbers.new(@weight).savePoolNumbers pools = @weight.pools while @pool <= pools roundRobin @pool += 1 end - end + end def roundRobin wrestlers = @weight.wrestlersForPool(@pool) diff --git a/app/services/weight_services/generate_pool_numbers.rb b/app/services/weight_services/generate_pool_numbers.rb new file mode 100644 index 0000000..c8fb179 --- /dev/null +++ b/app/services/weight_services/generate_pool_numbers.rb @@ -0,0 +1,77 @@ +class GeneratePoolNumbers + def initialize( weight ) + @weight = weight + end + + def savePoolNumbers + if @weight.pools == 4 + saveFourPoolNumbers(@weight.wrestlers) + elsif @weight.pools == 2 + saveTwoPoolNumbers(@weight.wrestlers) + elsif @weight.pools == 1 + saveOnePoolNumbers(@weight.wrestlers) + end + end + + def saveOnePoolNumbers(poolWrestlers) + poolWrestlers.sort_by{|x| x.seed }.each do |w| + w.pool = 1 + w.save + end + end + + + def saveTwoPoolNumbers(poolWrestlers) + pool = 1 + poolWrestlers.sort_by{|x| x.seed }.reverse.each do |w| + if w.seed == 1 + w.pool = 1 + elsif w.seed == 2 + w.pool = 2 + elsif w.seed == 3 + w.pool = 2 + elsif w.seed == 4 + w.pool = 1 + else + w.pool = pool + end + if pool < 2 + pool = pool + 1 + else + pool = 1 + end + w.save + end + end + + def saveFourPoolNumbers(poolWrestlers) + pool = 1 + poolWrestlers.sort_by{|x| x.seed }.reverse.each do |w| + if w.seed == 1 + w.pool = 1 + elsif w.seed == 2 + w.pool = 2 + elsif w.seed == 3 + w.pool = 3 + elsif w.seed == 4 + w.pool = 4 + elsif w.seed == 8 + w.pool = 1 + elsif w.seed == 7 + w.pool = 2 + elsif w.seed == 6 + w.pool = 3 + elsif w.seed == 5 + w.pool = 4 + else + w.pool = pool + end + if pool < 4 + pool = pool + 1 + else + pool = 1 + end + w.save + end + end +end \ No newline at end of file diff --git a/app/views/tournaments/_pool.html.erb b/app/views/tournaments/_pool.html.erb index cd651df..fe1625c 100644 --- a/app/views/tournaments/_pool.html.erb +++ b/app/views/tournaments/_pool.html.erb @@ -1,6 +1,6 @@ <% @round = 1 %> <% @pool = 1 %> -<% until @wrestlers.select{|w| w.generatePoolNumber == @pool}.blank? %> +<% until @wrestlers.select{|w| w.pool == @pool}.blank? %>
Pool <%= @pool %>
@@ -15,7 +15,7 @@ - <% @wrestlers.select{|w| w.generatePoolNumber == @pool}.sort_by{|w| w.seed}.each do |w| %> + <% @wrestlers.select{|w| w.pool == @pool}.sort_by{|w| w.seed}.each do |w| %> <% @round = 1 %> diff --git a/config/application.rb b/config/application.rb index 83f26e4..183d62a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -37,6 +37,7 @@ module Wrestling config.autoload_paths += %W(#{config.root}/app/services/tournament_services) config.autoload_paths += %W(#{config.root}/app/services/wrestler_services) + config.autoload_paths += %W(#{config.root}/app/services/weight_services) config.autoload_paths += %W(#{config.root}/app/services/bracket_advancement) end diff --git a/db/migrate/20170301174920_add_pool_column.rb b/db/migrate/20170301174920_add_pool_column.rb new file mode 100644 index 0000000..6acb531 --- /dev/null +++ b/db/migrate/20170301174920_add_pool_column.rb @@ -0,0 +1,5 @@ +class AddPoolColumn < ActiveRecord::Migration + def change + add_column :wrestlers, :pool, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index e320d6e..06009f2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160126173424) do +ActiveRecord::Schema.define(version: 20170301174920) do create_table "delayed_jobs", force: :cascade do |t| t.integer "priority", default: 0, null: false @@ -154,6 +154,7 @@ ActiveRecord::Schema.define(version: 20160126173424) do t.string "criteria" t.boolean "extra" t.decimal "offical_weight" + t.integer "pool" end add_index "wrestlers", ["weight_id"], name: "index_wrestlers_on_weight_id" diff --git a/test/fixtures/wrestlers.yml b/test/fixtures/wrestlers.yml index 56dfaff..2c2aeed 100644 --- a/test/fixtures/wrestlers.yml +++ b/test/fixtures/wrestlers.yml @@ -1,4 +1,4 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + tournament_1_wrestler_1: id: 1 @@ -11,6 +11,7 @@ tournament_1_wrestler_1: season_win: 30 criteria: SQ extra: + pool: 1 tournament_1_wrestler_2: id: 2 @@ -23,6 +24,7 @@ tournament_1_wrestler_2: season_win: 30 criteria: DP 6th extra: + pool: 1 tournament_1_wrestler_3: id: 3 @@ -35,6 +37,7 @@ tournament_1_wrestler_3: season_win: 49 criteria: SP 2nd extra: + pool: 1 tournament_1_wrestler_4: id: 4 @@ -47,6 +50,7 @@ tournament_1_wrestler_4: season_win: 30 criteria: DP 5th extra: + pool: 1 tournament_1_wrestler_5: id: 5 @@ -59,6 +63,7 @@ tournament_1_wrestler_5: season_win: 49 criteria: SP 5th extra: + pool: 1 tournament_1_wrestler_6: id: 6 @@ -71,6 +76,7 @@ tournament_1_wrestler_6: season_win: 16 criteria: extra: + pool: 2 tournament_1_wrestler_7: id: 7 @@ -83,6 +89,7 @@ tournament_1_wrestler_7: season_win: 16 criteria: DQ extra: + pool: 1 tournament_1_wrestler_8: id: 8 @@ -95,6 +102,7 @@ tournament_1_wrestler_8: season_win: 50 criteria: SQ extra: + pool: 2 tournament_1_wrestler_9: id: 9 @@ -107,6 +115,7 @@ tournament_1_wrestler_9: season_win: 40 criteria: SQ extra: + pool: 2 tournament_1_wrestler_10: id: 10 @@ -119,6 +128,7 @@ tournament_1_wrestler_10: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_11: id: 11 @@ -131,6 +141,7 @@ tournament_1_wrestler_11: season_win: 20 criteria: DP 6th extra: + pool: 1 tournament_1_wrestler_12: id: 12 @@ -143,6 +154,7 @@ tournament_1_wrestler_12: season_win: 30 criteria: SP 7th extra: + pool: 1 tournament_1_wrestler_13: id: 13 @@ -155,6 +167,7 @@ tournament_1_wrestler_13: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_14: id: 14 @@ -167,6 +180,7 @@ tournament_1_wrestler_14: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_15: id: 15 @@ -179,6 +193,7 @@ tournament_1_wrestler_15: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_16: id: 16 @@ -191,6 +206,7 @@ tournament_1_wrestler_16: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_17: id: 17 @@ -203,6 +219,7 @@ tournament_1_wrestler_17: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_18: id: 18 @@ -215,6 +232,7 @@ tournament_1_wrestler_18: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_19: id: 19 @@ -227,6 +245,7 @@ tournament_1_wrestler_19: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_20: id: 20 @@ -239,6 +258,7 @@ tournament_1_wrestler_20: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_21: id: 21 @@ -251,6 +271,7 @@ tournament_1_wrestler_21: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_22: id: 22 @@ -263,6 +284,7 @@ tournament_1_wrestler_22: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_23: id: 23 @@ -275,6 +297,7 @@ tournament_1_wrestler_23: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_24: id: 24 @@ -287,6 +310,7 @@ tournament_1_wrestler_24: season_win: 50 criteria: extra: + pool: 3 tournament_1_wrestler_25: id: 25 @@ -299,6 +323,7 @@ tournament_1_wrestler_25: season_win: 50 criteria: extra: + pool: 3 tournament_1_wrestler_26: id: 26 @@ -311,6 +336,7 @@ tournament_1_wrestler_26: season_win: 50 criteria: extra: + pool: 4 tournament_1_wrestler_27: id: 27 @@ -323,6 +349,7 @@ tournament_1_wrestler_27: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_28: id: 28 @@ -335,6 +362,7 @@ tournament_1_wrestler_28: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_29: id: 29 @@ -347,6 +375,7 @@ tournament_1_wrestler_29: season_win: 50 criteria: extra: + pool: 4 tournament_1_wrestler_30: id: 30 @@ -359,6 +388,7 @@ tournament_1_wrestler_30: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_31: id: 31 @@ -371,6 +401,7 @@ tournament_1_wrestler_31: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_32: id: 32 @@ -383,6 +414,7 @@ tournament_1_wrestler_32: season_win: 50 criteria: extra: + pool: 3 tournament_1_wrestler_33: id: 33 @@ -395,6 +427,7 @@ tournament_1_wrestler_33: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_34: id: 34 @@ -407,6 +440,7 @@ tournament_1_wrestler_34: season_win: 50 criteria: extra: + pool: 3 tournament_1_wrestler_35: id: 35 @@ -419,6 +453,7 @@ tournament_1_wrestler_35: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_36: id: 36 @@ -431,6 +466,7 @@ tournament_1_wrestler_36: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_37: id: 37 @@ -443,6 +479,7 @@ tournament_1_wrestler_37: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_38: id: 38 @@ -455,6 +492,7 @@ tournament_1_wrestler_38: season_win: 50 criteria: extra: + pool: 4 tournament_1_wrestler_39: id: 39 @@ -467,6 +505,7 @@ tournament_1_wrestler_39: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_40: id: 40 @@ -479,6 +518,7 @@ tournament_1_wrestler_40: season_win: 50 criteria: extra: + pool: 4 tournament_1_wrestler_41: id: 41 @@ -491,6 +531,7 @@ tournament_1_wrestler_41: season_win: 50 criteria: extra: + pool: 3 tournament_1_wrestler_42: id: 42 @@ -503,6 +544,7 @@ tournament_1_wrestler_42: season_win: 50 criteria: extra: + pool: 4 tournament_1_wrestler_43: id: 43 @@ -515,6 +557,7 @@ tournament_1_wrestler_43: season_win: 50 criteria: extra: + pool: 3 tournament_1_wrestler_44: id: 44 @@ -527,6 +570,7 @@ tournament_1_wrestler_44: season_win: 50 criteria: extra: + pool: 2 tournament_1_wrestler_45: id: 45 @@ -539,6 +583,7 @@ tournament_1_wrestler_45: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_46: id: 46 @@ -551,6 +596,7 @@ tournament_1_wrestler_46: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_47: id: 47 @@ -563,6 +609,7 @@ tournament_1_wrestler_47: season_win: 50 criteria: extra: + pool: 3 tournament_1_wrestler_48: id: 48 @@ -575,6 +622,7 @@ tournament_1_wrestler_48: season_win: 50 criteria: extra: + pool: 4 tournament_1_wrestler_49: id: 49 @@ -582,11 +630,12 @@ tournament_1_wrestler_49: school_id: 1 weight_id: 6 original_seed: - seed: 4 + seed: 6 season_loss: 2 season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_50: id: 50 @@ -599,6 +648,7 @@ tournament_1_wrestler_50: season_win: 50 criteria: extra: + pool: 1 tournament_1_wrestler_51: id: 51 @@ -606,23 +656,25 @@ tournament_1_wrestler_51: school_id: 1 weight_id: 6 original_seed: - seed: 3 - season_loss: 2 - season_win: 50 - criteria: - extra: - -tournament_1_wrestler_52: - id: 52 - name: Guy43 - school_id: 1 - weight_id: 6 - original_seed: seed: 5 season_loss: 2 season_win: 50 criteria: extra: + pool: 1 + +tournament_1_wrestler_52: + id: 52 + name: Guy43 + school_id: 1 + weight_id: 6 + original_seed: + seed: 3 + season_loss: 2 + season_win: 50 + criteria: + extra: + pool: 1 tournament_1_wrestler_53: id: 53 @@ -630,8 +682,12 @@ tournament_1_wrestler_53: school_id: 1 weight_id: 6 original_seed: - seed: 6 + seed: 4 season_loss: 2 season_win: 50 criteria: - extra: \ No newline at end of file + extra: + pool: 1 + + + diff --git a/test/integration/single_test_test.rb b/test/integration/single_test_test.rb index 919fda3..a20d1a0 100644 --- a/test/integration/single_test_test.rb +++ b/test/integration/single_test_test.rb @@ -3,7 +3,7 @@ require 'test_helper' class SingleTestTest < ActionDispatch::IntegrationTest def setup @tournament = Tournament.find(1) - # @tournament.generateMatchups + # GenerateTournamentMatches.new(@tournament).generate end #rake test test/integration/single_test_test.rb > matches.txt @@ -47,6 +47,7 @@ class SingleTestTest < ActionDispatch::IntegrationTest # puts " season_win: #{w.season_win}" # puts " criteria: #{w.criteria}" # puts " extra: #{w.extra}" + # puts " pool: #{w.pool}" # puts "" # count += 1 # end From b37004cbbfaf63246afa2a0db0ce3fa3a5f6120b Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 31 May 2017 09:40:31 -0400 Subject: [PATCH 02/26] Removed frontend and updated production to use puma instead of pasenger --- Gemfile | 42 +- Gemfile.lock | 196 ++- Procfile | 2 +- config/application.rb | 2 - deploy/docker-compose-common.yml | 2 +- frontend/.gitignore | 9 - frontend/.npmignore | 9 - frontend/.travis.yml | 4 - frontend/Gruntfile.js | 4 - frontend/Procfile | 1 - frontend/README.md | 1 - frontend/app/css/style.css | 4 - frontend/app/img/.keep | 0 frontend/app/js/.keep | 0 frontend/app/js/app.js | 11 - .../app/js/controllers/login-controller.js | 51 - frontend/app/js/controllers/my-tournaments.js | 11 - .../js/controllers/tournament-controller.js | 86 -- .../js/controllers/tournaments-controller.js | 19 - frontend/app/js/directives/loading.js | 24 - frontend/app/js/models/wrestler.js | 18 - frontend/app/js/routes.js | 49 - .../app/js/services/tournaments-service.js | 101 -- frontend/app/pages/index.us | 98 -- frontend/app/pages/static_pages/about.html | 46 - frontend/app/pages/static_pages/home.html | 10 - .../app/pages/static_pages/tutorials.html | 17 - .../app/pages/tournaments/my-tournaments.html | 17 - .../pages/tournaments/tournaments-search.html | 25 - .../pages/tournaments/tournaments-show.html | 222 --- frontend/app/static/favicon.ico | Bin 1406 -> 0 bytes frontend/app/templates/hello.us | 3 - frontend/config/application.js | 66 - frontend/config/files.js | 26 - frontend/config/lineman.js | 1 - frontend/config/server.js | 21 - frontend/config/spec.json | 9 - frontend/package.json | 15 - frontend/spec/hello-spec.js | 4 - frontend/spec/helpers/helper.js | 2 - frontend/spec/helpers/jasmine-fixture.js | 433 ------ frontend/spec/helpers/jasmine-given.js | 373 ----- frontend/spec/helpers/jasmine-only.js | 98 -- frontend/spec/helpers/jasmine-stealth.js | 214 --- frontend/tasks/.keep | 0 frontend/vendor/css/.keep | 0 frontend/vendor/img/.keep | 0 frontend/vendor/js/devise-min.js | 10 - frontend/vendor/js/underscore.js | 1343 ----------------- frontend/vendor/static/.keep | 0 rails-apache-config.conf | 10 - rails-apache-ssl-config.conf | 21 - rails-dev-Dockerfile | 4 +- rails-prod-Dockerfile | 68 +- rails-prod.sh | 2 +- 55 files changed, 128 insertions(+), 3676 deletions(-) delete mode 100644 frontend/.gitignore delete mode 100644 frontend/.npmignore delete mode 100644 frontend/.travis.yml delete mode 100644 frontend/Gruntfile.js delete mode 100644 frontend/Procfile delete mode 100644 frontend/README.md delete mode 100644 frontend/app/css/style.css delete mode 100644 frontend/app/img/.keep delete mode 100644 frontend/app/js/.keep delete mode 100644 frontend/app/js/app.js delete mode 100644 frontend/app/js/controllers/login-controller.js delete mode 100644 frontend/app/js/controllers/my-tournaments.js delete mode 100644 frontend/app/js/controllers/tournament-controller.js delete mode 100644 frontend/app/js/controllers/tournaments-controller.js delete mode 100644 frontend/app/js/directives/loading.js delete mode 100644 frontend/app/js/models/wrestler.js delete mode 100644 frontend/app/js/routes.js delete mode 100644 frontend/app/js/services/tournaments-service.js delete mode 100644 frontend/app/pages/index.us delete mode 100644 frontend/app/pages/static_pages/about.html delete mode 100644 frontend/app/pages/static_pages/home.html delete mode 100644 frontend/app/pages/static_pages/tutorials.html delete mode 100644 frontend/app/pages/tournaments/my-tournaments.html delete mode 100644 frontend/app/pages/tournaments/tournaments-search.html delete mode 100644 frontend/app/pages/tournaments/tournaments-show.html delete mode 100644 frontend/app/static/favicon.ico delete mode 100644 frontend/app/templates/hello.us delete mode 100644 frontend/config/application.js delete mode 100644 frontend/config/files.js delete mode 100644 frontend/config/lineman.js delete mode 100644 frontend/config/server.js delete mode 100644 frontend/config/spec.json delete mode 100644 frontend/package.json delete mode 100644 frontend/spec/hello-spec.js delete mode 100644 frontend/spec/helpers/helper.js delete mode 100644 frontend/spec/helpers/jasmine-fixture.js delete mode 100644 frontend/spec/helpers/jasmine-given.js delete mode 100644 frontend/spec/helpers/jasmine-only.js delete mode 100644 frontend/spec/helpers/jasmine-stealth.js delete mode 100644 frontend/tasks/.keep delete mode 100644 frontend/vendor/css/.keep delete mode 100644 frontend/vendor/img/.keep delete mode 100644 frontend/vendor/js/devise-min.js delete mode 100644 frontend/vendor/js/underscore.js delete mode 100644 frontend/vendor/static/.keep delete mode 100644 rails-apache-config.conf delete mode 100644 rails-apache-ssl-config.conf diff --git a/Gemfile b/Gemfile index 090dcb7..adeb6f3 100644 --- a/Gemfile +++ b/Gemfile @@ -39,26 +39,24 @@ gem 'spring', :group => :development #Installed by me - #For Heroku - group :production do - gem 'rails_12factor' - gem 'mysql2' - gem 'passenger' - gem 'therubyracer' - gem 'newrelic_rpm' - gem 'dalli' - end - #Other - gem 'devise' - gem 'cancancan' - gem 'round_robin_tournament' - gem 'rb-readline' - gem 'delayed_job_active_record' - gem 'puma' - gem 'brakeman' - gem 'rails-lineman' - group :development do - - #gem 'bullet' - end +group :production do + gem 'rails_12factor' + gem 'mysql2' + gem 'therubyracer' + gem 'newrelic_rpm' + gem 'dalli' +end + +gem 'devise' +gem 'cancancan' +gem 'round_robin_tournament' +gem 'rb-readline' +gem 'delayed_job_active_record' +gem 'puma' + +group :development do + gem 'rubocop' + gem 'bullet' + gem 'brakeman' +end diff --git a/Gemfile.lock b/Gemfile.lock index c4d6ee0..d05943c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,80 +36,73 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (6.0.3) - bcrypt (3.1.10) - brakeman (3.1.5) - erubis (~> 2.6) - fastercsv (~> 1.5) - haml (>= 3.0, < 5.0) - highline (>= 1.6.20, < 2.0) - multi_json (~> 1.2) - ruby2ruby (>= 2.1.1, < 2.3.0) - ruby_parser (~> 3.7.0) - safe_yaml (>= 1.0) - sass (~> 3.0) - slim (>= 1.3.6, < 4.0) - terminal-table (~> 1.4) - builder (3.2.2) - cancancan (1.10.1) + arel (6.0.4) + ast (2.3.0) + bcrypt (3.1.11) + brakeman (3.6.1) + builder (3.2.3) + bullet (5.5.1) + activesupport (>= 3.0.0) + uniform_notifier (~> 1.10.0) + cancancan (2.0.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1.1) - concurrent-ruby (1.0.0) - dalli (2.7.5) - delayed_job (4.1.1) - activesupport (>= 3.0, < 5.0) - delayed_job_active_record (4.1.0) - activerecord (>= 3.0, < 5) + coffee-script-source (1.12.2) + concurrent-ruby (1.0.5) + dalli (2.7.6) + delayed_job (4.1.2) + activesupport (>= 3.0, < 5.1) + delayed_job_active_record (4.1.1) + activerecord (>= 3.0, < 5.1) delayed_job (>= 3.0, < 5) - devise (3.4.1) + devise (4.3.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0, < 5.2) responders - thread_safe (~> 0.1) warden (~> 1.2.3) erubis (2.7.0) - execjs (2.5.2) - fastercsv (1.5.5) - globalid (0.3.6) - activesupport (>= 4.1.0) - haml (4.0.7) - tilt - highline (1.7.8) - i18n (0.7.0) - jbuilder (2.2.13) - activesupport (>= 3.0.0, < 5) - multi_json (~> 1.2) - jquery-rails (4.0.3) - rails-dom-testing (~> 1.0) + execjs (2.7.0) + globalid (0.4.0) + activesupport (>= 4.2.0) + i18n (0.8.1) + jbuilder (2.6.4) + activesupport (>= 3.0.0) + multi_json (>= 1.2) + jquery-rails (4.3.1) + rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.8.3) - libv8 (3.16.14.7) + json (1.8.6) + libv8 (3.16.14.19) loofah (2.0.3) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.99) - mini_portile2 (2.0.0) - minitest (5.8.3) - multi_json (1.11.0) - mysql2 (0.3.18) - newrelic_rpm (3.13.2.302) - nokogiri (1.6.7) - mini_portile2 (~> 2.0.0.rc2) + mail (2.6.5) + mime-types (>= 1.16, < 4) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_portile2 (2.1.0) + minitest (5.10.2) + multi_json (1.12.1) + mysql2 (0.4.6) + newrelic_rpm (4.1.0.333) + nokogiri (1.7.2) + mini_portile2 (~> 2.1.0) orm_adapter (0.5.0) - passenger (5.0.7) + parallel (1.11.2) + parser (2.4.0.0) + ast (~> 2.2) + passenger (5.1.4) rack rake (>= 0.8.1) - puma (2.11.2) - rack (>= 1.1, < 2.0) - rack (1.6.4) + powerpack (0.1.1) + puma (3.8.2) + rack (1.6.8) rack-test (0.6.3) rack (>= 1.0) rails (4.2.5) @@ -125,71 +118,70 @@ GEM sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) + rails-dom-testing (1.0.8) activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) + nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) + rails-html-sanitizer (1.0.3) loofah (~> 2.0) rails-lineman (0.3.0) rake rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging - rails_serve_static_assets (0.0.4) - rails_stdout_logging (0.0.3) + rails_serve_static_assets (0.0.5) + rails_stdout_logging (0.0.5) railties (4.2.5) actionpack (= 4.2.5) activesupport (= 4.2.5) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.4.2) - rb-readline (0.5.2) - rdoc (4.2.0) - json (~> 1.4) - ref (1.0.5) - responders (2.1.0) - railties (>= 4.2.0, < 5) + rainbow (2.2.2) + rake + rake (12.0.0) + rb-readline (0.5.4) + rdoc (4.3.0) + ref (2.0.0) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) round_robin_tournament (0.0.1) - ruby2ruby (2.2.0) - ruby_parser (~> 3.1) - sexp_processor (~> 4.0) - ruby_parser (3.7.3) - sexp_processor (~> 4.1) - safe_yaml (1.0.4) - sass (3.4.21) - sdoc (0.4.1) + rubocop (0.49.1) + parallel (~> 1.10) + parser (>= 2.3.3.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) + sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - sexp_processor (4.6.1) - slim (3.0.6) - temple (~> 0.7.3) - tilt (>= 1.3.3, < 2.1) - spring (1.3.5) - sprockets (3.5.0) + spring (2.0.1) + activesupport (>= 4.2) + sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (2.3.3) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.10) - temple (0.7.6) - terminal-table (1.5.2) - therubyracer (0.12.2) - libv8 (~> 3.16.14.0) + sprockets-rails (3.2.0) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) ref - thor (0.19.1) - thread_safe (0.3.5) - tilt (2.0.2) - turbolinks (2.5.3) - coffee-rails - tzinfo (1.2.2) + thor (0.19.4) + thread_safe (0.3.6) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.3) + tzinfo (1.2.3) thread_safe (~> 0.1) - uglifier (2.7.1) - execjs (>= 0.3.0) - json (>= 1.8.0) - warden (1.2.3) + uglifier (3.2.0) + execjs (>= 0.3.0, < 3) + unicode-display_width (1.2.1) + uniform_notifier (1.10.0) + warden (1.2.7) rack (>= 1.0) PLATFORMS @@ -197,6 +189,7 @@ PLATFORMS DEPENDENCIES brakeman + bullet cancancan coffee-rails (~> 4.0.0) dalli @@ -213,6 +206,7 @@ DEPENDENCIES rails_12factor rb-readline round_robin_tournament + rubocop sdoc (~> 0.4.0) spring sqlite3 @@ -224,4 +218,4 @@ RUBY VERSION ruby 2.3.0p0 BUNDLED WITH - 1.13.5 + 1.14.6 diff --git a/Procfile b/Procfile index 93afc98..2561a76 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ worker: bundle exec rake jobs:work -web: bundle exec passenger start -p $PORT --max-pool-size 3 \ No newline at end of file +web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development} diff --git a/config/application.rb b/config/application.rb index 183d62a..bdf0de2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -29,8 +29,6 @@ module Wrestling config.active_job.queue_adapter = :delayed_job - config.rails_lineman.lineman_project_location = "frontend" - config.to_prepare do DeviseController.respond_to :html, :json end diff --git a/deploy/docker-compose-common.yml b/deploy/docker-compose-common.yml index 5bfe0fc..0de23b1 100644 --- a/deploy/docker-compose-common.yml +++ b/deploy/docker-compose-common.yml @@ -22,4 +22,4 @@ memcached: worker: image: wrestlingdev - command: /bin/bash -c "cd /var/www && bundle exec rake jobs:work RAILS_ENV=production" + command: /bin/bash -c "cd /rails && bundle exec rake jobs:work RAILS_ENV=production" diff --git a/frontend/.gitignore b/frontend/.gitignore deleted file mode 100644 index 275ec00..0000000 --- a/frontend/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.DS_Store - -#ignore node_modules, as the node project is not "deployed" per se: http://www.mikealrogers.com/posts/nodemodules-in-git.html -/node_modules - -/dist -/generated - -.sass-cache diff --git a/frontend/.npmignore b/frontend/.npmignore deleted file mode 100644 index 275ec00..0000000 --- a/frontend/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -.DS_Store - -#ignore node_modules, as the node project is not "deployed" per se: http://www.mikealrogers.com/posts/nodemodules-in-git.html -/node_modules - -/dist -/generated - -.sass-cache diff --git a/frontend/.travis.yml b/frontend/.travis.yml deleted file mode 100644 index 53ce7b2..0000000 --- a/frontend/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: -- 0.10 -script: "lineman spec-ci" diff --git a/frontend/Gruntfile.js b/frontend/Gruntfile.js deleted file mode 100644 index ed05645..0000000 --- a/frontend/Gruntfile.js +++ /dev/null @@ -1,4 +0,0 @@ -/*global module:false*/ -module.exports = function(grunt) { - require('./config/lineman').config.grunt.run(grunt); -}; diff --git a/frontend/Procfile b/frontend/Procfile deleted file mode 100644 index 8513c01..0000000 --- a/frontend/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: npm run production diff --git a/frontend/README.md b/frontend/README.md deleted file mode 100644 index debad91..0000000 --- a/frontend/README.md +++ /dev/null @@ -1 +0,0 @@ -# My Lineman Application \ No newline at end of file diff --git a/frontend/app/css/style.css b/frontend/app/css/style.css deleted file mode 100644 index 2c361ec..0000000 --- a/frontend/app/css/style.css +++ /dev/null @@ -1,4 +0,0 @@ -.hello { - background-color: #efefef; - border: 1px solid #dedede; -} diff --git a/frontend/app/img/.keep b/frontend/app/img/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/app/js/.keep b/frontend/app/js/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/app/js/app.js b/frontend/app/js/app.js deleted file mode 100644 index 395e7c2..0000000 --- a/frontend/app/js/app.js +++ /dev/null @@ -1,11 +0,0 @@ -var app = angular.module("wrestlingdev", ["ngRoute","Devise"]).run(function($rootScope) { - // adds some basic utilities to the $rootScope for debugging purposes - $rootScope.log = function(thing) { - console.log(thing); - }; - - $rootScope.alert = function(thing) { - alert(thing); - }; -}); - diff --git a/frontend/app/js/controllers/login-controller.js b/frontend/app/js/controllers/login-controller.js deleted file mode 100644 index c316d8b..0000000 --- a/frontend/app/js/controllers/login-controller.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; -app.controller("loginController", function($scope, $routeParams, Auth, $rootScope) { - $scope.credentials = { - email: '', - password: '' - }; - - var config = { - headers: { - 'X-HTTP-Method-Override': 'POST' - } - }; - - - $scope.login = function(){ - Auth.login($scope.credentials, config).then(function(user) { - console.log(user); // => {id: 1, ect: '...'} - $rootScope.user = user; - $rootScope.alertClass = "alert alert-success"; - $rootScope.alertMessage = "Logged in successfully"; - }, function(error) { - console.log(error); - $rootScope.alertClass = "alert alert-danger"; - $rootScope.alertMessage = "Username and/or password is incorrect"; - }); - }; - - $scope.logout = function(){ - Auth.logout(config).then(function(oldUser) { - // alert(oldUser.name + "you're signed out now."); - $rootScope.user = null; - $rootScope.alertClass = "alert alert-success"; - $rootScope.alertMessage = "Logged out successfully"; - }, function(error) { - // An error occurred logging out. - $rootScope.alertClass = "alert alert-danger"; - $rootScope.alertMessage = "There was an error logging out"; - }); - }; - - Auth.currentUser().then(function(user) { - // User was logged in, or Devise returned - // previously authenticated session. - $rootScope.user = user; - }, function(error) { - // unauthenticated error - $rootScope.user = null; - }); - - -}); \ No newline at end of file diff --git a/frontend/app/js/controllers/my-tournaments.js b/frontend/app/js/controllers/my-tournaments.js deleted file mode 100644 index 567374b..0000000 --- a/frontend/app/js/controllers/my-tournaments.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -app.controller("myTournamentsController", function($scope, tournamentsService, $rootScope) { - - tournamentsService.getMyTournaments().then(function(data) { - //this will execute when the - //AJAX call completes. - $scope.allTournaments = data; - }); - -}); \ No newline at end of file diff --git a/frontend/app/js/controllers/tournament-controller.js b/frontend/app/js/controllers/tournament-controller.js deleted file mode 100644 index 3871072..0000000 --- a/frontend/app/js/controllers/tournament-controller.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; -app.controller("tournamentController", function($scope, tournamentsService, $routeParams, Wrestler, Auth, $rootScope) { - $scope.message = "Test message in scope."; - - - // $scope.tournamentData = "test"; - tournamentsService.tournamentDetails($routeParams.id).then(function(data) { - //this will execute when the - //AJAX call completes. - $scope.tournament = data; - }); - - $scope.refreshTournamentData = function(){ - tournamentsService.tournamentDetails($routeParams.id).then(function(data) { - //this will execute when the - //AJAX call completes. - $scope.tournament = data; - }); - }; - - // refresh tournament data every 10 seconds - // setInterval(function(){ - // tournamentsService.tournamentDetails($routeParams.id).then(function(data) { - // //this will execute when the - // //AJAX call completes. - // $scope.tournament = data; - // }); - // }, 10000); - - $scope.wrestler = Wrestler; - - $scope.showSchools = false; - - $scope.toggleSchools = function(){ - $scope.showSchools = !$scope.showSchools; - }; - - $scope.showWeightSeeds = false; - - $scope.toggleWeightSeeds = function(){ - $scope.showWeightSeeds = !$scope.showWeightSeeds; - }; - - - $scope.showBoutBoard = false; - - $scope.toggleBoutBoard = function(){ - $scope.showBoutBoard = !$scope.showBoutBoard; - }; - - - $scope.isTournamentOwner = function(tournamentId,userId){ - if(userId == tournamentId){ - return true; - } else { - return false; - } - }; - - - $scope.newSchool = null; - - $scope.saveNewSchool = function(){ - $scope.newSchool.tournament_id = $scope.tournament.id; - tournamentsService.saveNewSchool($scope.newSchool).then(function(data) { - $scope.tournament.schools.push(data); - }); - $scope.newSchool = null; - $('#NewSchool').modal('hide'); - }; - - $scope.deleteSchool = function(school){ - if (confirm('Are you sure you want to delete ' + school.name + '?')) { - tournamentsService.deleteSchool(school).then(function(data) { - $scope.tournament.schools.splice( $scope.tournament.schools.indexOf(school), 1 ); - }); - } - }; - - $scope.updateSchool = function(school){ - tournamentsService.updateSchool(school); - $('#EditSchool' + school.id).modal('hide'); - }; - - -}); \ No newline at end of file diff --git a/frontend/app/js/controllers/tournaments-controller.js b/frontend/app/js/controllers/tournaments-controller.js deleted file mode 100644 index 5054906..0000000 --- a/frontend/app/js/controllers/tournaments-controller.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -app.controller("tournamentsController", function($scope, tournamentsService) { - - tournamentsService.getAllTournaments().then(function(data) { - //this will execute when the - //AJAX call completes. - $scope.allTournaments = data; - }); - - $scope.searchTournaments = function (){ - tournamentsService.searchTournaments($scope.searchTerms).then(function(data) { - //this will execute when the - //AJAX call completes. - $scope.allTournaments = data; - }); - }; - -}); \ No newline at end of file diff --git a/frontend/app/js/directives/loading.js b/frontend/app/js/directives/loading.js deleted file mode 100644 index 9635bea..0000000 --- a/frontend/app/js/directives/loading.js +++ /dev/null @@ -1,24 +0,0 @@ -(function(){ - app.directive('usSpinner', ['$http', '$rootScope' ,function ($http, $rootScope){ - return { - link: function (scope, elm, attrs) - { - $rootScope.spinnerActive = false; - scope.isLoading = function () { - return $http.pendingRequests.length > 0; - }; - - scope.$watch(scope.isLoading, function (loading) - { - $rootScope.spinnerActive = loading; - if(loading){ - elm.removeClass('ng-hide'); - }else{ - elm.addClass('ng-hide'); - } - }); - } - }; - - }]); -}).call(this); \ No newline at end of file diff --git a/frontend/app/js/models/wrestler.js b/frontend/app/js/models/wrestler.js deleted file mode 100644 index 30c2c89..0000000 --- a/frontend/app/js/models/wrestler.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -app.factory('Wrestler', function Wrestler(){ - var vm = this; - - - vm.matches = function(wrestler,matches){ - - console.log(matches); - return _.filter(matches, function(match){ - return match.w1 == wrestler.id || match.w2 == wrestler.id; - }); - - - }; - - return vm; -}); \ No newline at end of file diff --git a/frontend/app/js/routes.js b/frontend/app/js/routes.js deleted file mode 100644 index 84ba476..0000000 --- a/frontend/app/js/routes.js +++ /dev/null @@ -1,49 +0,0 @@ - - -// $routeProvider.when('/list-of-books', { -// templateUrl: 'angular/books.html', -// controller: 'BooksController' -// // uncomment if you want to see an example of a route that resolves a request prior to rendering -// // resolve: { -// // books : function(BookService) { -// // return BookService.get(); -// // } -// // } -// }); - - - -app.config(['$routeProvider', '$locationProvider', function($routeProvider,$locationProvider) { - - $routeProvider.when('/', { - templateUrl: 'home.html', - }); - - $routeProvider.when('/tournaments', { - templateUrl: 'tournaments-search.html', - controller: 'tournamentsController' - }); - - $routeProvider.when('/tournaments/user', { - templateUrl: 'my-tournaments.html', - controller: 'myTournamentsController' - }); - - $routeProvider.when('/tournaments/:id', { - templateUrl: 'tournaments-show.html', - controller: 'tournamentController' - }); - - $routeProvider.when('/about', { - templateUrl: 'about.html', - }); - - $routeProvider.when('/tutorials', { - templateUrl: 'tutorials.html', - }); - - $routeProvider.otherwise({redirectTo: '/'}); - - //this give me normal routes instead of /#/ - // $locationProvider.html5Mode(true); -}]); \ No newline at end of file diff --git a/frontend/app/js/services/tournaments-service.js b/frontend/app/js/services/tournaments-service.js deleted file mode 100644 index 4f5db46..0000000 --- a/frontend/app/js/services/tournaments-service.js +++ /dev/null @@ -1,101 +0,0 @@ - -app.factory('tournamentsService', tournamentsService); - -function tournamentsService($http,$rootScope){ - var service = {}; - - service.getMyTournaments = function(user){ - return $http({ - url: '/api/tournaments/user/', - method: "GET" - }).then(successResponse, errorCallback); - }; - - service.getAllTournaments = function(){ - return $http({ - url: '/api/tournaments/', - method: "GET" - }).then(successResponse, errorCallback); - }; - - service.searchTournaments = function(search){ - return $http({ - method: 'GET', - url: '/api/tournaments/', - params: { - search: search - } - }).then(successResponse, errorCallback); - }; - - service.tournamentDetails = function(tournamentId){ - return $http({ - url: '/api/tournaments/' + tournamentId, - method: "GET" - }).then(successResponse, errorCallback); - }; - - service.saveNewSchool = function(newSchool){ - return $http({ - url: '/schools.json', - method: "POST", - - data: { - school: { - 'name': newSchool.name, - 'tournament_id': newSchool.tournament_id - } - }, - headers: { - "Content-Type": "application/json" - } - }).then(successResponse, errorCallback); - }; - - service.deleteSchool = function(school){ - return $http({ - url: '/schools/' + school.id + '/', - method: "DELETE" - }).then(successResponse, errorCallback); - }; - - service.updateSchool = function(schoolToEdit){ - return $http({ - url: '/schools/' + schoolToEdit.id, - method: "PATCH", - data: { - school: { - 'name': schoolToEdit.name, - 'tournament_id': schoolToEdit.tournament_id - } - }, - headers: { - "Content-Type": "application/json" - } - }).then(successResponse, errorCallback); - }; - - function successResponse(response){ - // console.log("success log below"); - // console.log(response); - if(response.config.method == "POST" || response.config.method == "DELETE" || response.config.method == "PATCH"){ - $rootScope.alertClass = "alert alert-success"; - $rootScope.alertMessage = response.statusText; - } - return response.data; - } - - function errorCallback(err){ - // console.log("error log below"); - // console.log(err); - if(err.status > 0){ - $rootScope.alertClass = "alert alert-danger"; - $rootScope.alertMessage = err.statusText; - } - - return err; - } - - return service; -} - diff --git a/frontend/app/pages/index.us b/frontend/app/pages/index.us deleted file mode 100644 index 902d9da..0000000 --- a/frontend/app/pages/index.us +++ /dev/null @@ -1,98 +0,0 @@ - - - - - WrestlingDev - - - - - - - -
- - - -
-
-
- - {{alertMessage}} -
-
- -
-
-
-
-
- -
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/app/pages/static_pages/about.html b/frontend/app/pages/static_pages/about.html deleted file mode 100644 index f56e695..0000000 --- a/frontend/app/pages/static_pages/about.html +++ /dev/null @@ -1,46 +0,0 @@ -

About WrestlingDev

-
-

WrestlingDev was created to help bring wrestling into the 21st century for free. This site is open source and is supported by the ads on the sidebar.

-
-

Features

-
-

At this moment in time, WrestlingDev supports a pool to bracket type tournament for up to 16 teams. The bracket format follows OHSAA's 5 match per day rule. WrestlingDev will automatically generate brackets, generate bout numbers, generate and update a bout board, track team points, and update brackets.

-

For pool to bracket tournaments, pool tie breakers are the following:

- -

If three wrestlers are tied, they will be put through this sequence until two wrestlers are left. Once two wrestlers are left, the pool runner up will be decided by head to head.

-

For pool to bracket tournaments, team points will be calculated as follows:

- -

Finals matches will only recieve extra placement points for placing higher and bonus points for pin, tech, major, etc. Please note, only brackets with four pools place up to 8. Brackets with 1 or 2 pools only place top 4.

-
-

Future Plans

-
-

Future development plans to support normal double elimination brackets are underway and are planned to be finished in time for the 2016-2017 wrestling season.

-
-

Contact

-
-

Suggestions, criticism, and kind words are welcomed. Please contact us.

diff --git a/frontend/app/pages/static_pages/home.html b/frontend/app/pages/static_pages/home.html deleted file mode 100644 index adea8bd..0000000 --- a/frontend/app/pages/static_pages/home.html +++ /dev/null @@ -1,10 +0,0 @@ -
-

Welcome to WrestlingDev

-
-

This website was created to help wrestling coaches run their tournaments. It is 2015, why are we still running bout sheets to tables and why are we still using resources to push cards on a bout board? This website was created as a free way for coaches to run a tournament smoothly with as few workers as possible.

-
-

If you would like to run a tournament, please click log in and then click sign up.

-
-Browse Tournaments -

-
diff --git a/frontend/app/pages/static_pages/tutorials.html b/frontend/app/pages/static_pages/tutorials.html deleted file mode 100644 index 70f5141..0000000 --- a/frontend/app/pages/static_pages/tutorials.html +++ /dev/null @@ -1,17 +0,0 @@ -

Tutorials

-
-

Unfortunately, I do not have tutorials available at this moment in time. If you would like to learn how to use this software, please email me at jacob.wimer@gmail.com and I will gladly provide an overview of how to use this software. I've done my best to make the software intuitive and easy to use.

-
-

Planning on using this software?

-
-

Here is a list of features available:

-
- diff --git a/frontend/app/pages/tournaments/my-tournaments.html b/frontend/app/pages/tournaments/my-tournaments.html deleted file mode 100644 index 9038c29..0000000 --- a/frontend/app/pages/tournaments/my-tournaments.html +++ /dev/null @@ -1,17 +0,0 @@ -

My Tournaments

-
- -
<%= w.original_seed %> <%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %>
- - - - - - - - - - - - -
NameDate
{{ tournament.name }}{{ tournament.date }}
diff --git a/frontend/app/pages/tournaments/tournaments-search.html b/frontend/app/pages/tournaments/tournaments-search.html deleted file mode 100644 index 4afdaa8..0000000 --- a/frontend/app/pages/tournaments/tournaments-search.html +++ /dev/null @@ -1,25 +0,0 @@ -

Upcoming Tournaments

-
-
-
- - - - -
-
-
- - - - - - - - - - - - - -
NameDate
{{ tournament.name }}{{ tournament.date }}
diff --git a/frontend/app/pages/tournaments/tournaments-show.html b/frontend/app/pages/tournaments/tournaments-show.html deleted file mode 100644 index a0f2403..0000000 --- a/frontend/app/pages/tournaments/tournaments-show.html +++ /dev/null @@ -1,222 +0,0 @@ - - Back to browse tournaments -

- {{ tournament.name }} -

-

- Address: - {{ tournament.address }} -

-

- Director: - {{ tournament.director }} -

-

- Director email: - {{ tournament.director_email }} -

-

- Tournament Type: - {{ tournament.tournament_type }} -

-
-
- -

School Lineups and Team Scores -

-
-
-
- - - - - - - - - - - - - - - - - - -
NameScoreActions
{{ school.name }}{{ school.score }} - - -
-
-
-
- -
- -

Weights and Seeds -

-
-
-
-

Click weight class for seeds

-
- - - - - - - - - - - - - - -
Weight ClassBracket Size
{{ weight.max }}{{ weight.bracket_size }}
-
-
-
- -
- -

Mats and Bout Board -

-
-
-
-

Matches have not been generated

- - - - - - - - - - - - - - - - - - - - -
NameOn MatOn DeckIn The HoleWarm Up
{{ mat.name }}{{ mat.unfinishedMatches[0].bout_number }} {{ mat.unfinishedMatches[0].w1_name }} vs. {{ mat.unfinishedMatches[0].w2_name }}{{ mat.unfinishedMatches[1].bout_number }} {{ mat.unfinishedMatches[0].w1_name }} vs. {{ mat.unfinishedMatches[0].w2_name }}{{ mat.unfinishedMatches[2].bout_number }} {{ mat.unfinishedMatches[0].w1_name }} vs. {{ mat.unfinishedMatches[0].w2_name }}{{ mat.unfinishedMatches[3].bout_number }} {{ mat.unfinishedMatches[0].w1_name }} vs. {{ mat.unfinishedMatches[0].w2_name }}
-
-

Matches not assigned

-
- - - - - - - - - - - - - - - - - - -
RoundBout NumberWeight ClassMatchup
Round {{ match.round }}{{ match.bout_number }}{{ match.weightClass }}{{ match.w1_name }} vs. {{ match.w2_name }}
-
-
-
- - -
- -
- - - - - -
- -
- - - - - diff --git a/frontend/app/static/favicon.ico b/frontend/app/static/favicon.ico deleted file mode 100644 index bd63207474d4a6847e69d5ea3a8b494496140b93..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1406 zcmeH{%TH556vltIZz#~xLV5VYH$Fgxdt~KfY2r$ve}M~hW&Af>m|zLGK#jUm0*UU_ zO%3r;T^Pek6SOfAV`6V_YkILQ?RAE0wX$6#7ionVHmn>@cAnCsEBv@Vihch) z)!a)eAD@w*9#eN6r}p(7#lRVL)0rtH~ zYTs6 - <%= text %> - \ No newline at end of file diff --git a/frontend/config/application.js b/frontend/config/application.js deleted file mode 100644 index 5eb19e0..0000000 --- a/frontend/config/application.js +++ /dev/null @@ -1,66 +0,0 @@ -/* Exports a function which returns an object that overrides the default & - * plugin grunt configuration object. - * - * You can familiarize yourself with Lineman's defaults by looking at: - * - * - https://github.com/linemanjs/lineman/blob/master/config/application.coffee - * - https://github.com/linemanjs/lineman/blob/master/config/plugins - * - * You can also ask about Lineman's config from the command line: - * - * $ lineman config #=> to print the entire config - * $ lineman config concat_sourcemap.js #=> to see the JS config for the concat task. - */ -module.exports = function(lineman) { - //Override application configuration here. Common examples follow in the comments. - return { - - // API Proxying - // - // During development, you'll likely want to make XHR (AJAX) requests to an API on the same - // port as your lineman development server. By enabling the API proxy and setting the port, all - // requests for paths that don't match a static asset in ./generated will be forwarded to - // whatever service might be running on the specified port. - // - server: { - apiProxy: { - enabled: true, - host: 'localhost', - port: 8080 - }, - web: { - port: 8081 - } - }, - - removeTasks: { - common: ["jshint"] - }, - - // Sass - // - // Lineman supports Sass via grunt-contrib-sass, which requires you first - // have Ruby installed as well as the `sass` gem. To enable it, uncomment the - // following line: - // - // enableSass: true, - - // Asset Fingerprints - // - // Lineman can fingerprint your static assets by appending a hash to the filename - // and logging a manifest of logical-to-hashed filenames in dist/assets.json - // via grunt-asset-fingerprint - // - // enableAssetFingerprint: true, - - // LiveReload - // - // Lineman can LiveReload browsers whenever a file is changed that results in - // assets to be processed, preventing the need to hit F5/Cmd-R every time you - // make a change in each browser you're working against. To enable LiveReload, - // comment out the following line: - // - // livereload: true - - }; -}; diff --git a/frontend/config/files.js b/frontend/config/files.js deleted file mode 100644 index 255275a..0000000 --- a/frontend/config/files.js +++ /dev/null @@ -1,26 +0,0 @@ -/* Exports a function which returns an object that overrides the default & - * plugin file patterns (used widely through the app configuration) - * - * To see the default definitions for Lineman's file paths and globs, see: - * - * - https://github.com/linemanjs/lineman/blob/master/config/files.coffee - */ -module.exports = function(lineman) { - //Override file patterns here - return { - - // As an example, to override the file patterns for - // the order in which to load third party JS libs: - // - // js: { - // vendor: [ - // "vendor/js/underscore.js", - // "vendor/js/**/*.js" - // ] - // } - - //Override file patterns here - - - }; -}; diff --git a/frontend/config/lineman.js b/frontend/config/lineman.js deleted file mode 100644 index 0ce0689..0000000 --- a/frontend/config/lineman.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require(process.env['LINEMAN_MAIN']); diff --git a/frontend/config/server.js b/frontend/config/server.js deleted file mode 100644 index 1654dc1..0000000 --- a/frontend/config/server.js +++ /dev/null @@ -1,21 +0,0 @@ -/* Define custom server-side HTTP routes for lineman's development server - * These might be as simple as stubbing a little JSON to - * facilitate development of code that interacts with an HTTP service - * (presumably, mirroring one that will be reachable in a live environment). - * - * It's important to remember that any custom endpoints defined here - * will only be available in development, as lineman only builds - * static assets, it can't run server-side code. - * - * This file can be very useful for rapid prototyping or even organically - * defining a spec based on the needs of the client code that emerge. - * - */ - -module.exports = { - drawRoutes: function(app) { - // app.get('/api/greeting/:message', function(req, res){ - // res.json({ message: "OK, "+req.params.message }); - // }); - } -}; \ No newline at end of file diff --git a/frontend/config/spec.json b/frontend/config/spec.json deleted file mode 100644 index b6258d5..0000000 --- a/frontend/config/spec.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "framework" : "jasmine", - "launch_in_dev" : ["Chrome"], - "launch_in_ci" : ["PhantomJS"], - "src_files" : [ - "generated/js/app.js", - "generated/js/spec.js" - ] -} \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json deleted file mode 100644 index f70fe33..0000000 --- a/frontend/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "frontend", - "description": "Frontend for wrestlingdev", - "version": "0.0.1", - "private": true, - "author": "Jacob Cody Wimer", - "devDependencies": { - "lineman": "~0.36.6" - }, - "scripts": { - "start": "lineman run", - "test": "lineman spec-ci", - "production": "lineman clean build && npm i express@3 && node -e \"var e = require('express'), a = e(); a.use(e.static('dist/')); a.listen(process.env.PORT)\"" - } -} diff --git a/frontend/spec/hello-spec.js b/frontend/spec/hello-spec.js deleted file mode 100644 index 208eca2..0000000 --- a/frontend/spec/hello-spec.js +++ /dev/null @@ -1,4 +0,0 @@ -describe(".helloText", function(){ - When(function(){ this.result = helloText(); }); - Then(function(){ expect(this.result).toEqual("Hello, World!"); }); -}); diff --git a/frontend/spec/helpers/helper.js b/frontend/spec/helpers/helper.js deleted file mode 100644 index 3c9ebf8..0000000 --- a/frontend/spec/helpers/helper.js +++ /dev/null @@ -1,2 +0,0 @@ -window.context = window.describe; -window.xcontext = window.xdescribe; diff --git a/frontend/spec/helpers/jasmine-fixture.js b/frontend/spec/helpers/jasmine-fixture.js deleted file mode 100644 index 1d28910..0000000 --- a/frontend/spec/helpers/jasmine-fixture.js +++ /dev/null @@ -1,433 +0,0 @@ -/* jasmine-fixture - 1.3.2 - * Makes injecting HTML snippets into the DOM easy & clean! - * https://github.com/searls/jasmine-fixture - */ -(function() { - var createHTMLBlock, - __slice = [].slice; - - (function($) { - var ewwSideEffects, jasmineFixture, originalAffix, originalJasmineDotFixture, originalJasmineFixture, root, _, _ref; - root = (1, eval)('this'); - originalJasmineFixture = root.jasmineFixture; - originalJasmineDotFixture = (_ref = root.jasmine) != null ? _ref.fixture : void 0; - originalAffix = root.affix; - _ = function(list) { - return { - inject: function(iterator, memo) { - var item, _i, _len, _results; - _results = []; - for (_i = 0, _len = list.length; _i < _len; _i++) { - item = list[_i]; - _results.push(memo = iterator(memo, item)); - } - return _results; - } - }; - }; - root.jasmineFixture = function($) { - var $whatsTheRootOf, affix, create, jasmineFixture, noConflict; - affix = function(selectorOptions) { - return create.call(this, selectorOptions, true); - }; - create = function(selectorOptions, attach) { - var $top; - $top = null; - _(selectorOptions.split(/[ ](?![^\{]*\})(?=[^\]]*?(?:\[|$))/)).inject(function($parent, elementSelector) { - var $el; - if (elementSelector === ">") { - return $parent; - } - $el = createHTMLBlock($, elementSelector); - if (attach || $top) { - $el.appendTo($parent); - } - $top || ($top = $el); - return $el; - }, $whatsTheRootOf(this)); - return $top; - }; - noConflict = function() { - var currentJasmineFixture, _ref1; - currentJasmineFixture = jasmine.fixture; - root.jasmineFixture = originalJasmineFixture; - if ((_ref1 = root.jasmine) != null) { - _ref1.fixture = originalJasmineDotFixture; - } - root.affix = originalAffix; - return currentJasmineFixture; - }; - $whatsTheRootOf = function(that) { - if ((that != null ? that.jquery : void 0) != null) { - return that; - } else if ($('#jasmine_content').length > 0) { - return $('#jasmine_content'); - } else { - return $('
').appendTo('body'); - } - }; - jasmineFixture = { - affix: affix, - create: create, - noConflict: noConflict - }; - ewwSideEffects(jasmineFixture); - return jasmineFixture; - }; - ewwSideEffects = function(jasmineFixture) { - var _ref1; - if ((_ref1 = root.jasmine) != null) { - _ref1.fixture = jasmineFixture; - } - $.fn.affix = root.affix = jasmineFixture.affix; - return afterEach(function() { - return $('#jasmine_content').remove(); - }); - }; - if ($) { - return jasmineFixture = root.jasmineFixture($); - } else { - return root.affix = function() { - var nowJQueryExists; - nowJQueryExists = window.jQuery || window.$; - if (nowJQueryExists != null) { - jasmineFixture = root.jasmineFixture(nowJQueryExists); - return affix.call.apply(affix, [this].concat(__slice.call(arguments))); - } else { - throw new Error("jasmine-fixture requires jQuery to be defined at window.jQuery or window.$"); - } - }; - } - })(window.jQuery || window.$); - - createHTMLBlock = (function() { - var bindData, bindEvents, parseAttributes, parseClasses, parseContents, parseEnclosure, parseReferences, parseVariableScope, regAttr, regAttrDfn, regAttrs, regCBrace, regClass, regClasses, regData, regDatas, regEvent, regEvents, regExclamation, regId, regReference, regTag, regTagNotContent, regZenTagDfn; - createHTMLBlock = function($, ZenObject, data, functions, indexes) { - var ZenCode, arr, block, blockAttrs, blockClasses, blockHTML, blockId, blockTag, blocks, el, el2, els, forScope, indexName, inner, len, obj, origZenCode, paren, result, ret, zc, zo; - if ($.isPlainObject(ZenObject)) { - ZenCode = ZenObject.main; - } else { - ZenCode = ZenObject; - ZenObject = { - main: ZenCode - }; - } - origZenCode = ZenCode; - if (indexes === undefined) { - indexes = {}; - } - if (ZenCode.charAt(0) === "!" || $.isArray(data)) { - if ($.isArray(data)) { - forScope = ZenCode; - } else { - obj = parseEnclosure(ZenCode, "!"); - obj = obj.substring(obj.indexOf(":") + 1, obj.length - 1); - forScope = parseVariableScope(ZenCode); - } - while (forScope.charAt(0) === "@") { - forScope = parseVariableScope("!for:!" + parseReferences(forScope, ZenObject)); - } - zo = ZenObject; - zo.main = forScope; - el = $(); - if (ZenCode.substring(0, 5) === "!for:" || $.isArray(data)) { - if (!$.isArray(data) && obj.indexOf(":") > 0) { - indexName = obj.substring(0, obj.indexOf(":")); - obj = obj.substr(obj.indexOf(":") + 1); - } - arr = ($.isArray(data) ? data : data[obj]); - zc = zo.main; - if ($.isArray(arr) || $.isPlainObject(arr)) { - $.map(arr, function(value, index) { - var next; - zo.main = zc; - if (indexName !== undefined) { - indexes[indexName] = index; - } - if (!$.isPlainObject(value)) { - value = { - value: value - }; - } - next = createHTMLBlock($, zo, value, functions, indexes); - if (el.length !== 0) { - return $.each(next, function(index, value) { - return el.push(value); - }); - } - }); - } - if (!$.isArray(data)) { - ZenCode = ZenCode.substr(obj.length + 6 + forScope.length); - } else { - ZenCode = ""; - } - } else if (ZenCode.substring(0, 4) === "!if:") { - result = parseContents("!" + obj + "!", data, indexes); - if (result !== "undefined" || result !== "false" || result !== "") { - el = createHTMLBlock($, zo, data, functions, indexes); - } - ZenCode = ZenCode.substr(obj.length + 5 + forScope.length); - } - ZenObject.main = ZenCode; - } else if (ZenCode.charAt(0) === "(") { - paren = parseEnclosure(ZenCode, "(", ")"); - inner = paren.substring(1, paren.length - 1); - ZenCode = ZenCode.substr(paren.length); - zo = ZenObject; - zo.main = inner; - el = createHTMLBlock($, zo, data, functions, indexes); - } else { - blocks = ZenCode.match(regZenTagDfn); - block = blocks[0]; - if (block.length === 0) { - return ""; - } - if (block.indexOf("@") >= 0) { - ZenCode = parseReferences(ZenCode, ZenObject); - zo = ZenObject; - zo.main = ZenCode; - return createHTMLBlock($, zo, data, functions, indexes); - } - block = parseContents(block, data, indexes); - blockClasses = parseClasses($, block); - if (regId.test(block)) { - blockId = regId.exec(block)[1]; - } - blockAttrs = parseAttributes(block, data); - blockTag = (block.charAt(0) === "{" ? "span" : "div"); - if (ZenCode.charAt(0) !== "#" && ZenCode.charAt(0) !== "." && ZenCode.charAt(0) !== "{") { - blockTag = regTag.exec(block)[1]; - } - if (block.search(regCBrace) !== -1) { - blockHTML = block.match(regCBrace)[1]; - } - blockAttrs = $.extend(blockAttrs, { - id: blockId, - "class": blockClasses, - html: blockHTML - }); - el = $("<" + blockTag + ">", blockAttrs); - el.attr(blockAttrs); - el = bindEvents(block, el, functions); - el = bindData(block, el, data); - ZenCode = ZenCode.substr(blocks[0].length); - ZenObject.main = ZenCode; - } - if (ZenCode.length > 0) { - if (ZenCode.charAt(0) === ">") { - if (ZenCode.charAt(1) === "(") { - zc = parseEnclosure(ZenCode.substr(1), "(", ")"); - ZenCode = ZenCode.substr(zc.length + 1); - } else if (ZenCode.charAt(1) === "!") { - obj = parseEnclosure(ZenCode.substr(1), "!"); - forScope = parseVariableScope(ZenCode.substr(1)); - zc = obj + forScope; - ZenCode = ZenCode.substr(zc.length + 1); - } else { - len = Math.max(ZenCode.indexOf("+"), ZenCode.length); - zc = ZenCode.substring(1, len); - ZenCode = ZenCode.substr(len); - } - zo = ZenObject; - zo.main = zc; - els = $(createHTMLBlock($, zo, data, functions, indexes)); - els.appendTo(el); - } - if (ZenCode.charAt(0) === "+") { - zo = ZenObject; - zo.main = ZenCode.substr(1); - el2 = createHTMLBlock($, zo, data, functions, indexes); - $.each(el2, function(index, value) { - return el.push(value); - }); - } - } - ret = el; - return ret; - }; - bindData = function(ZenCode, el, data) { - var datas, i, split; - if (ZenCode.search(regDatas) === 0) { - return el; - } - datas = ZenCode.match(regDatas); - if (datas === null) { - return el; - } - i = 0; - while (i < datas.length) { - split = regData.exec(datas[i]); - if (split[3] === undefined) { - $(el).data(split[1], data[split[1]]); - } else { - $(el).data(split[1], data[split[3]]); - } - i++; - } - return el; - }; - bindEvents = function(ZenCode, el, functions) { - var bindings, fn, i, split; - if (ZenCode.search(regEvents) === 0) { - return el; - } - bindings = ZenCode.match(regEvents); - if (bindings === null) { - return el; - } - i = 0; - while (i < bindings.length) { - split = regEvent.exec(bindings[i]); - if (split[2] === undefined) { - fn = functions[split[1]]; - } else { - fn = functions[split[2]]; - } - $(el).bind(split[1], fn); - i++; - } - return el; - }; - parseAttributes = function(ZenBlock, data) { - var attrStrs, attrs, i, parts; - if (ZenBlock.search(regAttrDfn) === -1) { - return undefined; - } - attrStrs = ZenBlock.match(regAttrDfn); - attrs = {}; - i = 0; - while (i < attrStrs.length) { - parts = regAttr.exec(attrStrs[i]); - attrs[parts[1]] = ""; - if (parts[3] !== undefined) { - attrs[parts[1]] = parseContents(parts[3], data); - } - i++; - } - return attrs; - }; - parseClasses = function($, ZenBlock) { - var classes, clsString, i; - ZenBlock = ZenBlock.match(regTagNotContent)[0]; - if (ZenBlock.search(regClasses) === -1) { - return undefined; - } - classes = ZenBlock.match(regClasses); - clsString = ""; - i = 0; - while (i < classes.length) { - clsString += " " + regClass.exec(classes[i])[1]; - i++; - } - return $.trim(clsString); - }; - parseContents = function(ZenBlock, data, indexes) { - var html; - if (indexes === undefined) { - indexes = {}; - } - html = ZenBlock; - if (data === undefined) { - return html; - } - while (regExclamation.test(html)) { - html = html.replace(regExclamation, function(str, str2) { - var begChar, fn, val; - begChar = ""; - if (str.indexOf("!for:") > 0 || str.indexOf("!if:") > 0) { - return str; - } - if (str.charAt(0) !== "!") { - begChar = str.charAt(0); - str = str.substring(2, str.length - 1); - } - fn = new Function("data", "indexes", "var r=undefined;" + "with(data){try{r=" + str + ";}catch(e){}}" + "with(indexes){try{if(r===undefined)r=" + str + ";}catch(e){}}" + "return r;"); - val = unescape(fn(data, indexes)); - return begChar + val; - }); - } - html = html.replace(/\\./g, function(str) { - return str.charAt(1); - }); - return unescape(html); - }; - parseEnclosure = function(ZenCode, open, close, count) { - var index, ret; - if (close === undefined) { - close = open; - } - index = 1; - if (count === undefined) { - count = (ZenCode.charAt(0) === open ? 1 : 0); - } - if (count === 0) { - return; - } - while (count > 0 && index < ZenCode.length) { - if (ZenCode.charAt(index) === close && ZenCode.charAt(index - 1) !== "\\") { - count--; - } else { - if (ZenCode.charAt(index) === open && ZenCode.charAt(index - 1) !== "\\") { - count++; - } - } - index++; - } - ret = ZenCode.substring(0, index); - return ret; - }; - parseReferences = function(ZenCode, ZenObject) { - ZenCode = ZenCode.replace(regReference, function(str) { - var fn; - str = str.substr(1); - fn = new Function("objs", "var r=\"\";" + "with(objs){try{" + "r=" + str + ";" + "}catch(e){}}" + "return r;"); - return fn(ZenObject, parseReferences); - }); - return ZenCode; - }; - parseVariableScope = function(ZenCode) { - var forCode, rest, tag; - if (ZenCode.substring(0, 5) !== "!for:" && ZenCode.substring(0, 4) !== "!if:") { - return undefined; - } - forCode = parseEnclosure(ZenCode, "!"); - ZenCode = ZenCode.substr(forCode.length); - if (ZenCode.charAt(0) === "(") { - return parseEnclosure(ZenCode, "(", ")"); - } - tag = ZenCode.match(regZenTagDfn)[0]; - ZenCode = ZenCode.substr(tag.length); - if (ZenCode.length === 0 || ZenCode.charAt(0) === "+") { - return tag; - } else if (ZenCode.charAt(0) === ">") { - rest = ""; - rest = parseEnclosure(ZenCode.substr(1), "(", ")", 1); - return tag + ">" + rest; - } - return undefined; - }; - regZenTagDfn = /([#\.\@]?[\w-]+|\[([\w-!?=:"']+(="([^"]|\\")+")? {0,})+\]|\~[\w$]+=[\w$]+|&[\w$]+(=[\w$]+)?|[#\.\@]?!([^!]|\\!)+!){0,}(\{([^\}]|\\\})+\})?/i; - regTag = /(\w+)/i; - regId = /(?:^|\b)#([\w-!]+)/i; - regTagNotContent = /((([#\.]?[\w-]+)?(\[([\w!]+(="([^"]|\\")+")? {0,})+\])?)+)/i; - /* - See lookahead syntax (?!) at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp - */ - - regClasses = /(\.[\w-]+)(?!["\w])/g; - regClass = /\.([\w-]+)/i; - regReference = /(@[\w$_][\w$_\d]+)/i; - regAttrDfn = /(\[([\w-!]+(="?([^"]|\\")+"?)? {0,})+\])/ig; - regAttrs = /([\w-!]+(="([^"]|\\")+")?)/g; - regAttr = /([\w-!]+)(="?((([\w]+(\[.*?\])+)|[^"\]]|\\")+)"?)?/i; - regCBrace = /\{(([^\}]|\\\})+)\}/i; - regExclamation = /(?:([^\\]|^))!([^!]|\\!)+!/g; - regEvents = /\~[\w$]+(=[\w$]+)?/g; - regEvent = /\~([\w$]+)=([\w$]+)/i; - regDatas = /&[\w$]+(=[\w$]+)?/g; - regData = /&([\w$]+)(=([\w$]+))?/i; - return createHTMLBlock; - })(); - -}).call(this); diff --git a/frontend/spec/helpers/jasmine-given.js b/frontend/spec/helpers/jasmine-given.js deleted file mode 100644 index a1c911e..0000000 --- a/frontend/spec/helpers/jasmine-given.js +++ /dev/null @@ -1,373 +0,0 @@ -/* jasmine-given - 2.6.3 - * Adds a Given-When-Then DSL to jasmine as an alternative style for specs - * https://github.com/searls/jasmine-given - */ -/* jasmine-matcher-wrapper - 0.0.3 - * Wraps Jasmine 1.x matchers for use with Jasmine 2 - * https://github.com/testdouble/jasmine-matcher-wrapper - */ -(function() { - var __hasProp = {}.hasOwnProperty, - __slice = [].slice; - - (function(jasmine) { - var comparatorFor, createMatcher; - if (jasmine == null) { - return typeof console !== "undefined" && console !== null ? console.warn("jasmine was not found. Skipping jasmine-matcher-wrapper. Verify your script load order.") : void 0; - } - if (jasmine.matcherWrapper != null) { - return; - } - jasmine.matcherWrapper = { - wrap: function(matchers) { - var matcher, name, wrappedMatchers; - if (jasmine.addMatchers == null) { - return matchers; - } - wrappedMatchers = {}; - for (name in matchers) { - if (!__hasProp.call(matchers, name)) continue; - matcher = matchers[name]; - wrappedMatchers[name] = createMatcher(name, matcher); - } - return wrappedMatchers; - } - }; - createMatcher = function(name, matcher) { - return function() { - return { - compare: comparatorFor(matcher, false), - negativeCompare: comparatorFor(matcher, true) - }; - }; - }; - return comparatorFor = function(matcher, isNot) { - return function() { - var actual, context, message, params, pass, _ref; - actual = arguments[0], params = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - context = { - actual: actual, - isNot: isNot - }; - pass = matcher.apply(context, params); - if (isNot) { - pass = !pass; - } - if (!pass) { - message = (_ref = context.message) != null ? _ref.apply(context, params) : void 0; - } - return { - pass: pass, - message: message - }; - }; - }; - })(jasmine || getJasmineRequireObj()); - -}).call(this); - -(function() { - var __slice = [].slice; - - (function(jasmine) { - var Waterfall, additionalInsightsForErrorMessage, apparentReferenceError, attemptedEquality, cloneArray, comparisonInsight, currentSpec, declareJasmineSpec, deepEqualsNotice, doneWrapperFor, errorWithRemovedLines, evalInContextOfSpec, finalStatementFrom, getBlock, invariantList, mostRecentExpectations, mostRecentStacks, mostRecentlyUsed, o, root, stringifyExpectation, wasComparison, whenList, wrapAsExpectations; - mostRecentlyUsed = null; - root = (1, eval)('this'); - currentSpec = null; - beforeEach(function() { - return currentSpec = this; - }); - root.Given = function() { - mostRecentlyUsed = root.Given; - return beforeEach(getBlock(arguments)); - }; - whenList = []; - root.When = function() { - var b; - mostRecentlyUsed = root.When; - b = getBlock(arguments); - beforeEach(function() { - return whenList.push(b); - }); - return afterEach(function() { - return whenList.pop(); - }); - }; - invariantList = []; - root.Invariant = function() { - var invariantBehavior; - mostRecentlyUsed = root.Invariant; - invariantBehavior = getBlock(arguments); - beforeEach(function() { - return invariantList.push(invariantBehavior); - }); - return afterEach(function() { - return invariantList.pop(); - }); - }; - getBlock = function(thing) { - var assignResultTo, setupFunction; - setupFunction = o(thing).firstThat(function(arg) { - return o(arg).isFunction(); - }); - assignResultTo = o(thing).firstThat(function(arg) { - return o(arg).isString(); - }); - return doneWrapperFor(setupFunction, function(done) { - var context, result; - context = currentSpec; - result = setupFunction.call(context, done); - if (assignResultTo) { - if (!context[assignResultTo]) { - return context[assignResultTo] = result; - } else { - throw new Error("Unfortunately, the variable '" + assignResultTo + "' is already assigned to: " + context[assignResultTo]); - } - } - }); - }; - mostRecentExpectations = null; - mostRecentStacks = null; - declareJasmineSpec = function(specArgs, itFunction) { - var expectationFunction, expectations, label, stacks; - if (itFunction == null) { - itFunction = it; - } - label = o(specArgs).firstThat(function(arg) { - return o(arg).isString(); - }); - expectationFunction = o(specArgs).firstThat(function(arg) { - return o(arg).isFunction(); - }); - mostRecentlyUsed = root.subsequentThen; - mostRecentExpectations = expectations = [expectationFunction]; - mostRecentStacks = stacks = [errorWithRemovedLines("failed expectation", 3)]; - itFunction("then " + (label != null ? label : stringifyExpectation(expectations)), doneWrapperFor(expectationFunction, function(jasmineDone) { - var userCommands; - userCommands = [].concat(whenList, invariantList, wrapAsExpectations(expectations, stacks)); - return new Waterfall(userCommands, jasmineDone).flow(); - })); - return { - Then: subsequentThen, - And: subsequentThen - }; - }; - wrapAsExpectations = function(expectations, stacks) { - var expectation, i, _i, _len, _results; - _results = []; - for (i = _i = 0, _len = expectations.length; _i < _len; i = ++_i) { - expectation = expectations[i]; - _results.push((function(expectation, i) { - return doneWrapperFor(expectation, function(maybeDone) { - return expect(expectation).not.toHaveReturnedFalseFromThen(currentSpec, i + 1, stacks[i], maybeDone); - }); - })(expectation, i)); - } - return _results; - }; - doneWrapperFor = function(func, toWrap) { - if (func.length === 0) { - return function() { - return toWrap(); - }; - } else { - return function(done) { - return toWrap(done); - }; - } - }; - root.Then = function() { - return declareJasmineSpec(arguments); - }; - root.Then.only = function() { - return declareJasmineSpec(arguments, it.only); - }; - root.subsequentThen = function(additionalExpectation) { - mostRecentExpectations.push(additionalExpectation); - mostRecentStacks.push(errorWithRemovedLines("failed expectation", 3)); - return this; - }; - errorWithRemovedLines = function(msg, n) { - var error, lines, stack, _ref; - if (stack = new Error(msg).stack) { - _ref = stack.split("\n"), error = _ref[0], lines = 2 <= _ref.length ? __slice.call(_ref, 1) : []; - return "" + error + "\n" + (lines.slice(n).join("\n")); - } - }; - mostRecentlyUsed = root.Given; - root.And = function() { - return mostRecentlyUsed.apply(this, jasmine.util.argsToArray(arguments)); - }; - o = function(thing) { - return { - isFunction: function() { - return Object.prototype.toString.call(thing) === "[object Function]"; - }, - isString: function() { - return Object.prototype.toString.call(thing) === "[object String]"; - }, - firstThat: function(test) { - var i; - i = 0; - while (i < thing.length) { - if (test(thing[i]) === true) { - return thing[i]; - } - i++; - } - return void 0; - } - }; - }; - Waterfall = (function() { - function Waterfall(functions, finalCallback) { - if (functions == null) { - functions = []; - } - this.finalCallback = finalCallback != null ? finalCallback : function() {}; - this.functions = cloneArray(functions); - } - - Waterfall.prototype.flow = function() { - var func, - _this = this; - if (this.functions.length === 0) { - return this.finalCallback(); - } - func = this.functions.shift(); - if (func.length > 0) { - return func(function() { - return _this.flow(); - }); - } else { - func(); - return this.flow(); - } - }; - - return Waterfall; - - })(); - cloneArray = function(a) { - return a.slice(0); - }; - jasmine._given = { - matchers: { - toHaveReturnedFalseFromThen: function(context, n, stackTrace, done) { - var e, exception, result; - result = false; - exception = void 0; - try { - result = this.actual.call(context, done); - } catch (_error) { - e = _error; - exception = e; - } - this.message = function() { - var msg, stringyExpectation; - stringyExpectation = stringifyExpectation(this.actual); - msg = "Then clause" + (n > 1 ? " #" + n : "") + " `" + stringyExpectation + "` failed by "; - if (exception) { - msg += "throwing: " + exception.toString(); - } else { - msg += "returning false"; - } - msg += additionalInsightsForErrorMessage(stringyExpectation); - if (stackTrace != null) { - msg += "\n\n" + stackTrace; - } - return msg; - }; - return result === false; - } - }, - __Waterfall__: Waterfall - }; - stringifyExpectation = function(expectation) { - var matches; - matches = expectation.toString().replace(/\n/g, '').match(/function\s?\(.*\)\s?{\s*(return\s+)?(.*?)(;)?\s*}/i); - if (matches && matches.length >= 3) { - return matches[2].replace(/\s+/g, ' '); - } else { - return ""; - } - }; - additionalInsightsForErrorMessage = function(expectationString) { - var comparison, expectation; - expectation = finalStatementFrom(expectationString); - if (comparison = wasComparison(expectation)) { - return comparisonInsight(expectation, comparison); - } else { - return ""; - } - }; - finalStatementFrom = function(expectationString) { - var multiStatement; - if (multiStatement = expectationString.match(/.*return (.*)/)) { - return multiStatement[multiStatement.length - 1]; - } else { - return expectationString; - } - }; - wasComparison = function(expectation) { - var comparator, comparison, left, right, s; - if (comparison = expectation.match(/(.*) (===|!==|==|!=|>|>=|<|<=) (.*)/)) { - s = comparison[0], left = comparison[1], comparator = comparison[2], right = comparison[3]; - return { - left: left, - comparator: comparator, - right: right - }; - } - }; - comparisonInsight = function(expectation, comparison) { - var left, msg, right; - left = evalInContextOfSpec(comparison.left); - right = evalInContextOfSpec(comparison.right); - if (apparentReferenceError(left) && apparentReferenceError(right)) { - return ""; - } - msg = "\n\nThis comparison was detected:\n " + expectation + "\n " + left + " " + comparison.comparator + " " + right; - if (attemptedEquality(left, right, comparison.comparator)) { - msg += "\n\n" + (deepEqualsNotice(comparison.left, comparison.right)); - } - return msg; - }; - apparentReferenceError = function(result) { - return /^"; - } - }; - attemptedEquality = function(left, right, comparator) { - var _ref; - if (!(comparator === "==" || comparator === "===")) { - return false; - } - if (((_ref = jasmine.matchersUtil) != null ? _ref.equals : void 0) != null) { - return jasmine.matchersUtil.equals(left, right); - } else { - return jasmine.getEnv().equals_(left, right); - } - }; - deepEqualsNotice = function(left, right) { - return "However, these items are deeply equal! Try an expectation like this instead:\n expect(" + left + ").toEqual(" + right + ")"; - }; - return beforeEach(function() { - if (jasmine.addMatchers != null) { - return jasmine.addMatchers(jasmine.matcherWrapper.wrap(jasmine._given.matchers)); - } else { - return this.addMatchers(jasmine._given.matchers); - } - }); - })(jasmine); - -}).call(this); diff --git a/frontend/spec/helpers/jasmine-only.js b/frontend/spec/helpers/jasmine-only.js deleted file mode 100644 index c60fb0b..0000000 --- a/frontend/spec/helpers/jasmine-only.js +++ /dev/null @@ -1,98 +0,0 @@ -/* jasmine-only - 0.1.1 - * Exclusivity spec helpers for jasmine: `describe.only` and `it.only` - * https://github.com/davemo/jasmine-only - */ -(function() { - var __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - - (function(jasmine) { - var describeOnly, env, itOnly, root; - root = (1, eval)('this'); - env = jasmine.getEnv(); - describeOnly = function(description, specDefinitions) { - var suite; - suite = new jasmine.Suite(this, description, null, this.currentSuite); - suite.exclusive_ = 1; - this.exclusive_ = Math.max(this.exclusive_, 1); - return this.describe_(suite, specDefinitions); - }; - itOnly = function(description, func) { - var spec; - spec = this.it(description, func); - spec.exclusive_ = 2; - this.exclusive_ = 2; - return spec; - }; - env.exclusive_ = 0; - env.describe = function(description, specDefinitions) { - var suite; - suite = new jasmine.Suite(this, description, null, this.currentSuite); - return this.describe_(suite, specDefinitions); - }; - env.describe_ = function(suite, specDefinitions) { - var declarationError, e, parentSuite; - parentSuite = this.currentSuite; - if (parentSuite) { - parentSuite.add(suite); - } else { - this.currentRunner_.add(suite); - } - this.currentSuite = suite; - declarationError = null; - try { - specDefinitions.call(suite); - } catch (_error) { - e = _error; - declarationError = e; - } - if (declarationError) { - this.it("encountered a declaration exception", function() { - throw declarationError; - }); - } - this.currentSuite = parentSuite; - return suite; - }; - env.specFilter = function(spec) { - return this.exclusive_ <= spec.exclusive_; - }; - env.describe.only = function() { - return describeOnly.apply(env, arguments); - }; - env.it.only = function() { - return itOnly.apply(env, arguments); - }; - root.describe.only = function(description, specDefinitions) { - return env.describe.only(description, specDefinitions); - }; - root.it.only = function(description, func) { - return env.it.only(description, func); - }; - root.iit = root.it.only; - root.ddescribe = root.describe.only; - jasmine.Spec = (function(_super) { - __extends(Spec, _super); - - function Spec(env, suite, description) { - this.exclusive_ = suite.exclusive_; - Spec.__super__.constructor.call(this, env, suite, description); - } - - return Spec; - - })(jasmine.Spec); - return jasmine.Suite = (function(_super) { - __extends(Suite, _super); - - function Suite(env, suite, specDefinitions, parentSuite) { - this.exclusive_ = parentSuite && parentSuite.exclusive_ || 0; - Suite.__super__.constructor.call(this, env, suite, specDefinitions, parentSuite); - } - - return Suite; - - })(jasmine.Suite); - })(jasmine); - -}).call(this); diff --git a/frontend/spec/helpers/jasmine-stealth.js b/frontend/spec/helpers/jasmine-stealth.js deleted file mode 100644 index 774afc6..0000000 --- a/frontend/spec/helpers/jasmine-stealth.js +++ /dev/null @@ -1,214 +0,0 @@ -/* jasmine-stealth - 0.0.17 - * Makes Jasmine spies a bit more robust - * https://github.com/searls/jasmine-stealth - */ -(function() { - var __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - - (function() { - var Captor, fake, root, stubChainer, unfakes, whatToDoWhenTheSpyGetsCalled, _; - root = (1, eval)('this'); - _ = function(obj) { - return { - each: function(iterator) { - var item, _i, _len, _results; - _results = []; - for (_i = 0, _len = obj.length; _i < _len; _i++) { - item = obj[_i]; - _results.push(iterator(item)); - } - return _results; - }, - isFunction: function() { - return Object.prototype.toString.call(obj) === "[object Function]"; - }, - isString: function() { - return Object.prototype.toString.call(obj) === "[object String]"; - } - }; - }; - root.spyOnConstructor = function(owner, classToFake, methodsToSpy) { - var fakeClass, spies; - if (methodsToSpy == null) { - methodsToSpy = []; - } - if (_(methodsToSpy).isString()) { - methodsToSpy = [methodsToSpy]; - } - spies = { - constructor: jasmine.createSpy("" + classToFake + "'s constructor") - }; - fakeClass = (function() { - function _Class() { - spies.constructor.apply(this, arguments); - } - - return _Class; - - })(); - _(methodsToSpy).each(function(methodName) { - spies[methodName] = jasmine.createSpy("" + classToFake + "#" + methodName); - return fakeClass.prototype[methodName] = function() { - return spies[methodName].apply(this, arguments); - }; - }); - fake(owner, classToFake, fakeClass); - return spies; - }; - unfakes = []; - afterEach(function() { - _(unfakes).each(function(u) { - return u(); - }); - return unfakes = []; - }); - fake = function(owner, thingToFake, newThing) { - var originalThing; - originalThing = owner[thingToFake]; - owner[thingToFake] = newThing; - return unfakes.push(function() { - return owner[thingToFake] = originalThing; - }); - }; - root.stubFor = root.spyOn; - jasmine.createStub = jasmine.createSpy; - jasmine.createStubObj = function(baseName, stubbings) { - var name, obj, stubbing; - if (stubbings.constructor === Array) { - return jasmine.createSpyObj(baseName, stubbings); - } else { - obj = {}; - for (name in stubbings) { - stubbing = stubbings[name]; - obj[name] = jasmine.createSpy(baseName + "." + name); - if (_(stubbing).isFunction()) { - obj[name].andCallFake(stubbing); - } else { - obj[name].andReturn(stubbing); - } - } - return obj; - } - }; - whatToDoWhenTheSpyGetsCalled = function(spy) { - var matchesStub, priorPlan; - matchesStub = function(stubbing, args, context) { - switch (stubbing.type) { - case "args": - return jasmine.getEnv().equals_(stubbing.ifThis, jasmine.util.argsToArray(args)); - case "context": - return jasmine.getEnv().equals_(stubbing.ifThis, context); - } - }; - priorPlan = spy.plan; - return spy.andCallFake(function() { - var i, stubbing; - i = 0; - while (i < spy._stealth_stubbings.length) { - stubbing = spy._stealth_stubbings[i]; - if (matchesStub(stubbing, arguments, this)) { - if (stubbing.satisfaction === "callFake") { - return stubbing.thenThat.apply(stubbing, arguments); - } else { - return stubbing.thenThat; - } - } - i++; - } - return priorPlan.apply(spy, arguments); - }); - }; - jasmine.Spy.prototype.whenContext = function(context) { - var spy; - spy = this; - spy._stealth_stubbings || (spy._stealth_stubbings = []); - whatToDoWhenTheSpyGetsCalled(spy); - return stubChainer(spy, "context", context); - }; - jasmine.Spy.prototype.when = function() { - var ifThis, spy; - spy = this; - ifThis = jasmine.util.argsToArray(arguments); - spy._stealth_stubbings || (spy._stealth_stubbings = []); - whatToDoWhenTheSpyGetsCalled(spy); - return stubChainer(spy, "args", ifThis); - }; - stubChainer = function(spy, type, ifThis) { - var addStubbing; - addStubbing = function(satisfaction) { - return function(thenThat) { - spy._stealth_stubbings.unshift({ - type: type, - ifThis: ifThis, - satisfaction: satisfaction, - thenThat: thenThat - }); - return spy; - }; - }; - return { - thenReturn: addStubbing("return"), - thenCallFake: addStubbing("callFake") - }; - }; - jasmine.Spy.prototype.mostRecentCallThat = function(callThat, context) { - var i; - i = this.calls.length - 1; - while (i >= 0) { - if (callThat.call(context || this, this.calls[i]) === true) { - return this.calls[i]; - } - i--; - } - }; - jasmine.Matchers.ArgThat = (function(_super) { - __extends(ArgThat, _super); - - function ArgThat(matcher) { - this.matcher = matcher; - } - - ArgThat.prototype.jasmineMatches = function(actual) { - return this.matcher(actual); - }; - - return ArgThat; - - })(jasmine.Matchers.Any); - jasmine.Matchers.ArgThat.prototype.matches = jasmine.Matchers.ArgThat.prototype.jasmineMatches; - jasmine.argThat = function(expected) { - return new jasmine.Matchers.ArgThat(expected); - }; - jasmine.Matchers.Capture = (function(_super) { - __extends(Capture, _super); - - function Capture(captor) { - this.captor = captor; - } - - Capture.prototype.jasmineMatches = function(actual) { - this.captor.value = actual; - return true; - }; - - return Capture; - - })(jasmine.Matchers.Any); - jasmine.Matchers.Capture.prototype.matches = jasmine.Matchers.Capture.prototype.jasmineMatches; - Captor = (function() { - function Captor() {} - - Captor.prototype.capture = function() { - return new jasmine.Matchers.Capture(this); - }; - - return Captor; - - })(); - return jasmine.captor = function() { - return new Captor(); - }; - })(); - -}).call(this); diff --git a/frontend/tasks/.keep b/frontend/tasks/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/vendor/css/.keep b/frontend/vendor/css/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/vendor/img/.keep b/frontend/vendor/img/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/vendor/js/devise-min.js b/frontend/vendor/js/devise-min.js deleted file mode 100644 index 97a577f..0000000 --- a/frontend/vendor/js/devise-min.js +++ /dev/null @@ -1,10 +0,0 @@ -// AngularDevise -// ------------------- -// v1.2.1 -// -// Copyright (c)2016 Justin Ridgewell -// Distributed under MIT license -// -// https://github.com/cloudspace/angular_devise - -!function(a){"use strict";var b=a.module("Devise",[]);b.provider("AuthIntercept",function(){var a=!1;this.interceptAuth=function(b){return a=!!b||void 0===b,this},this.$get=["$rootScope","$q",function(b,c){return{responseError:function(d){var e=d.config.interceptAuth;if(e=!!e||a&&void 0===e,e&&401===d.status){var f=c.defer();return b.$broadcast("devise:unauthorized",d,f),f.reject(d),f.promise}return c.reject(d)}}}]}).config(["$httpProvider",function(a){a.interceptors.push("AuthIntercept")}]),b.provider("Auth",function(){function b(b,c,d){var h={method:f[b].toLowerCase(),url:e[b]};return c&&(g?(h.data={},h.data[g]=c):h.data=c),a.extend(h,d),h}function c(b,c){a.forEach(b,function(a,d){this[d+c]=function(a){return void 0===a?b[d]:(b[d]=a,this)}},this)}function d(a){return function(){return a}}var e={login:"/users/sign_in.json",logout:"/users/sign_out.json",register:"/users.json",sendResetPasswordInstructions:"/users/password.json",resetPassword:"/users/password.json"},f={login:"POST",logout:"DELETE",register:"POST",sendResetPasswordInstructions:"POST",resetPassword:"PUT"},g="user",h=function(a){return a.data};c.call(this,f,"Method"),c.call(this,e,"Path"),this.resourceName=function(a){return void 0===a?g:(g=a,this)},this.parse=function(a){return"function"!=typeof a?h:(h=a,this)},this.$get=["$q","$http","$rootScope",function(a,c,e){function f(a){return j._currentUser=a,a}function g(){f(null),j._promise=null}function i(a){return function(b){return e.$broadcast("devise:"+a,b),b}}var j={_currentUser:null,parse:h,_promise:null,reset:function(){g(),j.currentUser()},login:function(a,d){var e=arguments.length>0,g=j.isAuthenticated();return a=a||{},c(b("login",a,d)).then(j.parse).then(f).then(function(a){return e&&!g?i("new-session")(a):a}).then(i("login"))},logout:function(a){var e=d(j._currentUser);return c(b("logout",void 0,a)).then(g).then(e).then(i("logout"))},register:function(a,d){return a=a||{},c(b("register",a,d)).then(j.parse).then(f).then(i("new-registration"))},sendResetPasswordInstructions:function(a){return a=a||{},c(b("sendResetPasswordInstructions",a)).then(j.parse).then(i("send-reset-password-instructions-successfully"))},resetPassword:function(a){return a=a||{},c(b("resetPassword",a)).then(j.parse).then(f).then(i("reset-password-successfully"))},currentUser:function(){return j.isAuthenticated()?a.when(j._currentUser):(null===j._promise&&(j._promise=j.login()),j._promise)},isAuthenticated:function(){return!!j._currentUser}};return j}]})}(angular); \ No newline at end of file diff --git a/frontend/vendor/js/underscore.js b/frontend/vendor/js/underscore.js deleted file mode 100644 index 9a4cabe..0000000 --- a/frontend/vendor/js/underscore.js +++ /dev/null @@ -1,1343 +0,0 @@ -// Underscore.js 1.6.0 -// http://underscorejs.org -// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -// Underscore may be freely distributed under the MIT license. - -(function() { - - // Baseline setup - // -------------- - - // Establish the root object, `window` in the browser, or `exports` on the server. - var root = this; - - // Save the previous value of the `_` variable. - var previousUnderscore = root._; - - // Establish the object that gets returned to break out of a loop iteration. - var breaker = {}; - - // Save bytes in the minified (but not gzipped) version: - var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; - - // Create quick reference variables for speed access to core prototypes. - var - push = ArrayProto.push, - slice = ArrayProto.slice, - concat = ArrayProto.concat, - toString = ObjProto.toString, - hasOwnProperty = ObjProto.hasOwnProperty; - - // All **ECMAScript 5** native function implementations that we hope to use - // are declared here. - var - nativeForEach = ArrayProto.forEach, - nativeMap = ArrayProto.map, - nativeReduce = ArrayProto.reduce, - nativeReduceRight = ArrayProto.reduceRight, - nativeFilter = ArrayProto.filter, - nativeEvery = ArrayProto.every, - nativeSome = ArrayProto.some, - nativeIndexOf = ArrayProto.indexOf, - nativeLastIndexOf = ArrayProto.lastIndexOf, - nativeIsArray = Array.isArray, - nativeKeys = Object.keys, - nativeBind = FuncProto.bind; - - // Create a safe reference to the Underscore object for use below. - var _ = function(obj) { - if (obj instanceof _) return obj; - if (!(this instanceof _)) return new _(obj); - this._wrapped = obj; - }; - - // Export the Underscore object for **Node.js**, with - // backwards-compatibility for the old `require()` API. If we're in - // the browser, add `_` as a global object via a string identifier, - // for Closure Compiler "advanced" mode. - if (typeof exports !== 'undefined') { - if (typeof module !== 'undefined' && module.exports) { - exports = module.exports = _; - } - exports._ = _; - } else { - root._ = _; - } - - // Current version. - _.VERSION = '1.6.0'; - - // Collection Functions - // -------------------- - - // The cornerstone, an `each` implementation, aka `forEach`. - // Handles objects with the built-in `forEach`, arrays, and raw objects. - // Delegates to **ECMAScript 5**'s native `forEach` if available. - var each = _.each = _.forEach = function(obj, iterator, context) { - if (obj == null) return obj; - if (nativeForEach && obj.forEach === nativeForEach) { - obj.forEach(iterator, context); - } else if (obj.length === +obj.length) { - for (var i = 0, length = obj.length; i < length; i++) { - if (iterator.call(context, obj[i], i, obj) === breaker) return; - } - } else { - var keys = _.keys(obj); - for (var i = 0, length = keys.length; i < length; i++) { - if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return; - } - } - return obj; - }; - - // Return the results of applying the iterator to each element. - // Delegates to **ECMAScript 5**'s native `map` if available. - _.map = _.collect = function(obj, iterator, context) { - var results = []; - if (obj == null) return results; - if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); - each(obj, function(value, index, list) { - results.push(iterator.call(context, value, index, list)); - }); - return results; - }; - - var reduceError = 'Reduce of empty array with no initial value'; - - // **Reduce** builds up a single result from a list of values, aka `inject`, - // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. - _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { - var initial = arguments.length > 2; - if (obj == null) obj = []; - if (nativeReduce && obj.reduce === nativeReduce) { - if (context) iterator = _.bind(iterator, context); - return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); - } - each(obj, function(value, index, list) { - if (!initial) { - memo = value; - initial = true; - } else { - memo = iterator.call(context, memo, value, index, list); - } - }); - if (!initial) throw new TypeError(reduceError); - return memo; - }; - - // The right-associative version of reduce, also known as `foldr`. - // Delegates to **ECMAScript 5**'s native `reduceRight` if available. - _.reduceRight = _.foldr = function(obj, iterator, memo, context) { - var initial = arguments.length > 2; - if (obj == null) obj = []; - if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { - if (context) iterator = _.bind(iterator, context); - return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); - } - var length = obj.length; - if (length !== +length) { - var keys = _.keys(obj); - length = keys.length; - } - each(obj, function(value, index, list) { - index = keys ? keys[--length] : --length; - if (!initial) { - memo = obj[index]; - initial = true; - } else { - memo = iterator.call(context, memo, obj[index], index, list); - } - }); - if (!initial) throw new TypeError(reduceError); - return memo; - }; - - // Return the first value which passes a truth test. Aliased as `detect`. - _.find = _.detect = function(obj, predicate, context) { - var result; - any(obj, function(value, index, list) { - if (predicate.call(context, value, index, list)) { - result = value; - return true; - } - }); - return result; - }; - - // Return all the elements that pass a truth test. - // Delegates to **ECMAScript 5**'s native `filter` if available. - // Aliased as `select`. - _.filter = _.select = function(obj, predicate, context) { - var results = []; - if (obj == null) return results; - if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context); - each(obj, function(value, index, list) { - if (predicate.call(context, value, index, list)) results.push(value); - }); - return results; - }; - - // Return all the elements for which a truth test fails. - _.reject = function(obj, predicate, context) { - return _.filter(obj, function(value, index, list) { - return !predicate.call(context, value, index, list); - }, context); - }; - - // Determine whether all of the elements match a truth test. - // Delegates to **ECMAScript 5**'s native `every` if available. - // Aliased as `all`. - _.every = _.all = function(obj, predicate, context) { - predicate || (predicate = _.identity); - var result = true; - if (obj == null) return result; - if (nativeEvery && obj.every === nativeEvery) return obj.every(predicate, context); - each(obj, function(value, index, list) { - if (!(result = result && predicate.call(context, value, index, list))) return breaker; - }); - return !!result; - }; - - // Determine if at least one element in the object matches a truth test. - // Delegates to **ECMAScript 5**'s native `some` if available. - // Aliased as `any`. - var any = _.some = _.any = function(obj, predicate, context) { - predicate || (predicate = _.identity); - var result = false; - if (obj == null) return result; - if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context); - each(obj, function(value, index, list) { - if (result || (result = predicate.call(context, value, index, list))) return breaker; - }); - return !!result; - }; - - // Determine if the array or object contains a given value (using `===`). - // Aliased as `include`. - _.contains = _.include = function(obj, target) { - if (obj == null) return false; - if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; - return any(obj, function(value) { - return value === target; - }); - }; - - // Invoke a method (with arguments) on every item in a collection. - _.invoke = function(obj, method) { - var args = slice.call(arguments, 2); - var isFunc = _.isFunction(method); - return _.map(obj, function(value) { - return (isFunc ? method : value[method]).apply(value, args); - }); - }; - - // Convenience version of a common use case of `map`: fetching a property. - _.pluck = function(obj, key) { - return _.map(obj, _.property(key)); - }; - - // Convenience version of a common use case of `filter`: selecting only objects - // containing specific `key:value` pairs. - _.where = function(obj, attrs) { - return _.filter(obj, _.matches(attrs)); - }; - - // Convenience version of a common use case of `find`: getting the first object - // containing specific `key:value` pairs. - _.findWhere = function(obj, attrs) { - return _.find(obj, _.matches(attrs)); - }; - - // Return the maximum element or (element-based computation). - // Can't optimize arrays of integers longer than 65,535 elements. - // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797) - _.max = function(obj, iterator, context) { - if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { - return Math.max.apply(Math, obj); - } - var result = -Infinity, lastComputed = -Infinity; - each(obj, function(value, index, list) { - var computed = iterator ? iterator.call(context, value, index, list) : value; - if (computed > lastComputed) { - result = value; - lastComputed = computed; - } - }); - return result; - }; - - // Return the minimum element (or element-based computation). - _.min = function(obj, iterator, context) { - if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { - return Math.min.apply(Math, obj); - } - var result = Infinity, lastComputed = Infinity; - each(obj, function(value, index, list) { - var computed = iterator ? iterator.call(context, value, index, list) : value; - if (computed < lastComputed) { - result = value; - lastComputed = computed; - } - }); - return result; - }; - - // Shuffle an array, using the modern version of the - // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). - _.shuffle = function(obj) { - var rand; - var index = 0; - var shuffled = []; - each(obj, function(value) { - rand = _.random(index++); - shuffled[index - 1] = shuffled[rand]; - shuffled[rand] = value; - }); - return shuffled; - }; - - // Sample **n** random values from a collection. - // If **n** is not specified, returns a single random element. - // The internal `guard` argument allows it to work with `map`. - _.sample = function(obj, n, guard) { - if (n == null || guard) { - if (obj.length !== +obj.length) obj = _.values(obj); - return obj[_.random(obj.length - 1)]; - } - return _.shuffle(obj).slice(0, Math.max(0, n)); - }; - - // An internal function to generate lookup iterators. - var lookupIterator = function(value) { - if (value == null) return _.identity; - if (_.isFunction(value)) return value; - return _.property(value); - }; - - // Sort the object's values by a criterion produced by an iterator. - _.sortBy = function(obj, iterator, context) { - iterator = lookupIterator(iterator); - return _.pluck(_.map(obj, function(value, index, list) { - return { - value: value, - index: index, - criteria: iterator.call(context, value, index, list) - }; - }).sort(function(left, right) { - var a = left.criteria; - var b = right.criteria; - if (a !== b) { - if (a > b || a === void 0) return 1; - if (a < b || b === void 0) return -1; - } - return left.index - right.index; - }), 'value'); - }; - - // An internal function used for aggregate "group by" operations. - var group = function(behavior) { - return function(obj, iterator, context) { - var result = {}; - iterator = lookupIterator(iterator); - each(obj, function(value, index) { - var key = iterator.call(context, value, index, obj); - behavior(result, key, value); - }); - return result; - }; - }; - - // Groups the object's values by a criterion. Pass either a string attribute - // to group by, or a function that returns the criterion. - _.groupBy = group(function(result, key, value) { - _.has(result, key) ? result[key].push(value) : result[key] = [value]; - }); - - // Indexes the object's values by a criterion, similar to `groupBy`, but for - // when you know that your index values will be unique. - _.indexBy = group(function(result, key, value) { - result[key] = value; - }); - - // Counts instances of an object that group by a certain criterion. Pass - // either a string attribute to count by, or a function that returns the - // criterion. - _.countBy = group(function(result, key) { - _.has(result, key) ? result[key]++ : result[key] = 1; - }); - - // Use a comparator function to figure out the smallest index at which - // an object should be inserted so as to maintain order. Uses binary search. - _.sortedIndex = function(array, obj, iterator, context) { - iterator = lookupIterator(iterator); - var value = iterator.call(context, obj); - var low = 0, high = array.length; - while (low < high) { - var mid = (low + high) >>> 1; - iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid; - } - return low; - }; - - // Safely create a real, live array from anything iterable. - _.toArray = function(obj) { - if (!obj) return []; - if (_.isArray(obj)) return slice.call(obj); - if (obj.length === +obj.length) return _.map(obj, _.identity); - return _.values(obj); - }; - - // Return the number of elements in an object. - _.size = function(obj) { - if (obj == null) return 0; - return (obj.length === +obj.length) ? obj.length : _.keys(obj).length; - }; - - // Array Functions - // --------------- - - // Get the first element of an array. Passing **n** will return the first N - // values in the array. Aliased as `head` and `take`. The **guard** check - // allows it to work with `_.map`. - _.first = _.head = _.take = function(array, n, guard) { - if (array == null) return void 0; - if ((n == null) || guard) return array[0]; - if (n < 0) return []; - return slice.call(array, 0, n); - }; - - // Returns everything but the last entry of the array. Especially useful on - // the arguments object. Passing **n** will return all the values in - // the array, excluding the last N. The **guard** check allows it to work with - // `_.map`. - _.initial = function(array, n, guard) { - return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); - }; - - // Get the last element of an array. Passing **n** will return the last N - // values in the array. The **guard** check allows it to work with `_.map`. - _.last = function(array, n, guard) { - if (array == null) return void 0; - if ((n == null) || guard) return array[array.length - 1]; - return slice.call(array, Math.max(array.length - n, 0)); - }; - - // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. - // Especially useful on the arguments object. Passing an **n** will return - // the rest N values in the array. The **guard** - // check allows it to work with `_.map`. - _.rest = _.tail = _.drop = function(array, n, guard) { - return slice.call(array, (n == null) || guard ? 1 : n); - }; - - // Trim out all falsy values from an array. - _.compact = function(array) { - return _.filter(array, _.identity); - }; - - // Internal implementation of a recursive `flatten` function. - var flatten = function(input, shallow, output) { - if (shallow && _.every(input, _.isArray)) { - return concat.apply(output, input); - } - each(input, function(value) { - if (_.isArray(value) || _.isArguments(value)) { - shallow ? push.apply(output, value) : flatten(value, shallow, output); - } else { - output.push(value); - } - }); - return output; - }; - - // Flatten out an array, either recursively (by default), or just one level. - _.flatten = function(array, shallow) { - return flatten(array, shallow, []); - }; - - // Return a version of the array that does not contain the specified value(s). - _.without = function(array) { - return _.difference(array, slice.call(arguments, 1)); - }; - - // Split an array into two arrays: one whose elements all satisfy the given - // predicate, and one whose elements all do not satisfy the predicate. - _.partition = function(array, predicate) { - var pass = [], fail = []; - each(array, function(elem) { - (predicate(elem) ? pass : fail).push(elem); - }); - return [pass, fail]; - }; - - // Produce a duplicate-free version of the array. If the array has already - // been sorted, you have the option of using a faster algorithm. - // Aliased as `unique`. - _.uniq = _.unique = function(array, isSorted, iterator, context) { - if (_.isFunction(isSorted)) { - context = iterator; - iterator = isSorted; - isSorted = false; - } - var initial = iterator ? _.map(array, iterator, context) : array; - var results = []; - var seen = []; - each(initial, function(value, index) { - if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) { - seen.push(value); - results.push(array[index]); - } - }); - return results; - }; - - // Produce an array that contains the union: each distinct element from all of - // the passed-in arrays. - _.union = function() { - return _.uniq(_.flatten(arguments, true)); - }; - - // Produce an array that contains every item shared between all the - // passed-in arrays. - _.intersection = function(array) { - var rest = slice.call(arguments, 1); - return _.filter(_.uniq(array), function(item) { - return _.every(rest, function(other) { - return _.contains(other, item); - }); - }); - }; - - // Take the difference between one array and a number of other arrays. - // Only the elements present in just the first array will remain. - _.difference = function(array) { - var rest = concat.apply(ArrayProto, slice.call(arguments, 1)); - return _.filter(array, function(value){ return !_.contains(rest, value); }); - }; - - // Zip together multiple lists into a single array -- elements that share - // an index go together. - _.zip = function() { - var length = _.max(_.pluck(arguments, 'length').concat(0)); - var results = new Array(length); - for (var i = 0; i < length; i++) { - results[i] = _.pluck(arguments, '' + i); - } - return results; - }; - - // Converts lists into objects. Pass either a single array of `[key, value]` - // pairs, or two parallel arrays of the same length -- one of keys, and one of - // the corresponding values. - _.object = function(list, values) { - if (list == null) return {}; - var result = {}; - for (var i = 0, length = list.length; i < length; i++) { - if (values) { - result[list[i]] = values[i]; - } else { - result[list[i][0]] = list[i][1]; - } - } - return result; - }; - - // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), - // we need this function. Return the position of the first occurrence of an - // item in an array, or -1 if the item is not included in the array. - // Delegates to **ECMAScript 5**'s native `indexOf` if available. - // If the array is large and already in sort order, pass `true` - // for **isSorted** to use binary search. - _.indexOf = function(array, item, isSorted) { - if (array == null) return -1; - var i = 0, length = array.length; - if (isSorted) { - if (typeof isSorted == 'number') { - i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted); - } else { - i = _.sortedIndex(array, item); - return array[i] === item ? i : -1; - } - } - if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted); - for (; i < length; i++) if (array[i] === item) return i; - return -1; - }; - - // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. - _.lastIndexOf = function(array, item, from) { - if (array == null) return -1; - var hasIndex = from != null; - if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) { - return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item); - } - var i = (hasIndex ? from : array.length); - while (i--) if (array[i] === item) return i; - return -1; - }; - - // Generate an integer Array containing an arithmetic progression. A port of - // the native Python `range()` function. See - // [the Python documentation](http://docs.python.org/library/functions.html#range). - _.range = function(start, stop, step) { - if (arguments.length <= 1) { - stop = start || 0; - start = 0; - } - step = arguments[2] || 1; - - var length = Math.max(Math.ceil((stop - start) / step), 0); - var idx = 0; - var range = new Array(length); - - while(idx < length) { - range[idx++] = start; - start += step; - } - - return range; - }; - - // Function (ahem) Functions - // ------------------ - - // Reusable constructor function for prototype setting. - var ctor = function(){}; - - // Create a function bound to a given object (assigning `this`, and arguments, - // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if - // available. - _.bind = function(func, context) { - var args, bound; - if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); - if (!_.isFunction(func)) throw new TypeError; - args = slice.call(arguments, 2); - return bound = function() { - if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); - ctor.prototype = func.prototype; - var self = new ctor; - ctor.prototype = null; - var result = func.apply(self, args.concat(slice.call(arguments))); - if (Object(result) === result) return result; - return self; - }; - }; - - // Partially apply a function by creating a version that has had some of its - // arguments pre-filled, without changing its dynamic `this` context. _ acts - // as a placeholder, allowing any combination of arguments to be pre-filled. - _.partial = function(func) { - var boundArgs = slice.call(arguments, 1); - return function() { - var position = 0; - var args = boundArgs.slice(); - for (var i = 0, length = args.length; i < length; i++) { - if (args[i] === _) args[i] = arguments[position++]; - } - while (position < arguments.length) args.push(arguments[position++]); - return func.apply(this, args); - }; - }; - - // Bind a number of an object's methods to that object. Remaining arguments - // are the method names to be bound. Useful for ensuring that all callbacks - // defined on an object belong to it. - _.bindAll = function(obj) { - var funcs = slice.call(arguments, 1); - if (funcs.length === 0) throw new Error('bindAll must be passed function names'); - each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); - return obj; - }; - - // Memoize an expensive function by storing its results. - _.memoize = function(func, hasher) { - var memo = {}; - hasher || (hasher = _.identity); - return function() { - var key = hasher.apply(this, arguments); - return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); - }; - }; - - // Delays a function for the given number of milliseconds, and then calls - // it with the arguments supplied. - _.delay = function(func, wait) { - var args = slice.call(arguments, 2); - return setTimeout(function(){ return func.apply(null, args); }, wait); - }; - - // Defers a function, scheduling it to run after the current call stack has - // cleared. - _.defer = function(func) { - return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); - }; - - // Returns a function, that, when invoked, will only be triggered at most once - // during a given window of time. Normally, the throttled function will run - // as much as it can, without ever going more than once per `wait` duration; - // but if you'd like to disable the execution on the leading edge, pass - // `{leading: false}`. To disable execution on the trailing edge, ditto. - _.throttle = function(func, wait, options) { - var context, args, result; - var timeout = null; - var previous = 0; - options || (options = {}); - var later = function() { - previous = options.leading === false ? 0 : _.now(); - timeout = null; - result = func.apply(context, args); - context = args = null; - }; - return function() { - var now = _.now(); - if (!previous && options.leading === false) previous = now; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0) { - clearTimeout(timeout); - timeout = null; - previous = now; - result = func.apply(context, args); - context = args = null; - } else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; - }; - - // Returns a function, that, as long as it continues to be invoked, will not - // be triggered. The function will be called after it stops being called for - // N milliseconds. If `immediate` is passed, trigger the function on the - // leading edge, instead of the trailing. - _.debounce = function(func, wait, immediate) { - var timeout, args, context, timestamp, result; - - var later = function() { - var last = _.now() - timestamp; - if (last < wait) { - timeout = setTimeout(later, wait - last); - } else { - timeout = null; - if (!immediate) { - result = func.apply(context, args); - context = args = null; - } - } - }; - - return function() { - context = this; - args = arguments; - timestamp = _.now(); - var callNow = immediate && !timeout; - if (!timeout) { - timeout = setTimeout(later, wait); - } - if (callNow) { - result = func.apply(context, args); - context = args = null; - } - - return result; - }; - }; - - // Returns a function that will be executed at most one time, no matter how - // often you call it. Useful for lazy initialization. - _.once = function(func) { - var ran = false, memo; - return function() { - if (ran) return memo; - ran = true; - memo = func.apply(this, arguments); - func = null; - return memo; - }; - }; - - // Returns the first function passed as an argument to the second, - // allowing you to adjust arguments, run code before and after, and - // conditionally execute the original function. - _.wrap = function(func, wrapper) { - return _.partial(wrapper, func); - }; - - // Returns a function that is the composition of a list of functions, each - // consuming the return value of the function that follows. - _.compose = function() { - var funcs = arguments; - return function() { - var args = arguments; - for (var i = funcs.length - 1; i >= 0; i--) { - args = [funcs[i].apply(this, args)]; - } - return args[0]; - }; - }; - - // Returns a function that will only be executed after being called N times. - _.after = function(times, func) { - return function() { - if (--times < 1) { - return func.apply(this, arguments); - } - }; - }; - - // Object Functions - // ---------------- - - // Retrieve the names of an object's properties. - // Delegates to **ECMAScript 5**'s native `Object.keys` - _.keys = function(obj) { - if (!_.isObject(obj)) return []; - if (nativeKeys) return nativeKeys(obj); - var keys = []; - for (var key in obj) if (_.has(obj, key)) keys.push(key); - return keys; - }; - - // Retrieve the values of an object's properties. - _.values = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var values = new Array(length); - for (var i = 0; i < length; i++) { - values[i] = obj[keys[i]]; - } - return values; - }; - - // Convert an object into a list of `[key, value]` pairs. - _.pairs = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var pairs = new Array(length); - for (var i = 0; i < length; i++) { - pairs[i] = [keys[i], obj[keys[i]]]; - } - return pairs; - }; - - // Invert the keys and values of an object. The values must be serializable. - _.invert = function(obj) { - var result = {}; - var keys = _.keys(obj); - for (var i = 0, length = keys.length; i < length; i++) { - result[obj[keys[i]]] = keys[i]; - } - return result; - }; - - // Return a sorted list of the function names available on the object. - // Aliased as `methods` - _.functions = _.methods = function(obj) { - var names = []; - for (var key in obj) { - if (_.isFunction(obj[key])) names.push(key); - } - return names.sort(); - }; - - // Extend a given object with all the properties in passed-in object(s). - _.extend = function(obj) { - each(slice.call(arguments, 1), function(source) { - if (source) { - for (var prop in source) { - obj[prop] = source[prop]; - } - } - }); - return obj; - }; - - // Return a copy of the object only containing the whitelisted properties. - _.pick = function(obj) { - var copy = {}; - var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); - each(keys, function(key) { - if (key in obj) copy[key] = obj[key]; - }); - return copy; - }; - - // Return a copy of the object without the blacklisted properties. - _.omit = function(obj) { - var copy = {}; - var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); - for (var key in obj) { - if (!_.contains(keys, key)) copy[key] = obj[key]; - } - return copy; - }; - - // Fill in a given object with default properties. - _.defaults = function(obj) { - each(slice.call(arguments, 1), function(source) { - if (source) { - for (var prop in source) { - if (obj[prop] === void 0) obj[prop] = source[prop]; - } - } - }); - return obj; - }; - - // Create a (shallow-cloned) duplicate of an object. - _.clone = function(obj) { - if (!_.isObject(obj)) return obj; - return _.isArray(obj) ? obj.slice() : _.extend({}, obj); - }; - - // Invokes interceptor with the obj, and then returns obj. - // The primary purpose of this method is to "tap into" a method chain, in - // order to perform operations on intermediate results within the chain. - _.tap = function(obj, interceptor) { - interceptor(obj); - return obj; - }; - - // Internal recursive comparison function for `isEqual`. - var eq = function(a, b, aStack, bStack) { - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - if (a === b) return a !== 0 || 1 / a == 1 / b; - // A strict comparison is necessary because `null == undefined`. - if (a == null || b == null) return a === b; - // Unwrap any wrapped objects. - if (a instanceof _) a = a._wrapped; - if (b instanceof _) b = b._wrapped; - // Compare `[[Class]]` names. - var className = toString.call(a); - if (className != toString.call(b)) return false; - switch (className) { - // Strings, numbers, dates, and booleans are compared by value. - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - return a == String(b); - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for - // other numeric values. - return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - return +a == +b; - // RegExps are compared by their source patterns and flags. - case '[object RegExp]': - return a.source == b.source && - a.global == b.global && - a.multiline == b.multiline && - a.ignoreCase == b.ignoreCase; - } - if (typeof a != 'object' || typeof b != 'object') return false; - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - var length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (aStack[length] == a) return bStack[length] == b; - } - // Objects with different constructors are not equivalent, but `Object`s - // from different frames are. - var aCtor = a.constructor, bCtor = b.constructor; - if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) && - _.isFunction(bCtor) && (bCtor instanceof bCtor)) - && ('constructor' in a && 'constructor' in b)) { - return false; - } - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - var size = 0, result = true; - // Recursively compare objects and arrays. - if (className == '[object Array]') { - // Compare array lengths to determine if a deep comparison is necessary. - size = a.length; - result = size == b.length; - if (result) { - // Deep compare the contents, ignoring non-numeric properties. - while (size--) { - if (!(result = eq(a[size], b[size], aStack, bStack))) break; - } - } - } else { - // Deep compare objects. - for (var key in a) { - if (_.has(a, key)) { - // Count the expected number of properties. - size++; - // Deep compare each member. - if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break; - } - } - // Ensure that both objects contain the same number of properties. - if (result) { - for (key in b) { - if (_.has(b, key) && !(size--)) break; - } - result = !size; - } - } - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - return result; - }; - - // Perform a deep comparison to check if two objects are equal. - _.isEqual = function(a, b) { - return eq(a, b, [], []); - }; - - // Is a given array, string, or object empty? - // An "empty" object has no enumerable own-properties. - _.isEmpty = function(obj) { - if (obj == null) return true; - if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; - for (var key in obj) if (_.has(obj, key)) return false; - return true; - }; - - // Is a given value a DOM element? - _.isElement = function(obj) { - return !!(obj && obj.nodeType === 1); - }; - - // Is a given value an array? - // Delegates to ECMA5's native Array.isArray - _.isArray = nativeIsArray || function(obj) { - return toString.call(obj) == '[object Array]'; - }; - - // Is a given variable an object? - _.isObject = function(obj) { - return obj === Object(obj); - }; - - // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. - each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) { - _['is' + name] = function(obj) { - return toString.call(obj) == '[object ' + name + ']'; - }; - }); - - // Define a fallback version of the method in browsers (ahem, IE), where - // there isn't any inspectable "Arguments" type. - if (!_.isArguments(arguments)) { - _.isArguments = function(obj) { - return !!(obj && _.has(obj, 'callee')); - }; - } - - // Optimize `isFunction` if appropriate. - if (typeof (/./) !== 'function') { - _.isFunction = function(obj) { - return typeof obj === 'function'; - }; - } - - // Is a given object a finite number? - _.isFinite = function(obj) { - return isFinite(obj) && !isNaN(parseFloat(obj)); - }; - - // Is the given value `NaN`? (NaN is the only number which does not equal itself). - _.isNaN = function(obj) { - return _.isNumber(obj) && obj != +obj; - }; - - // Is a given value a boolean? - _.isBoolean = function(obj) { - return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; - }; - - // Is a given value equal to null? - _.isNull = function(obj) { - return obj === null; - }; - - // Is a given variable undefined? - _.isUndefined = function(obj) { - return obj === void 0; - }; - - // Shortcut function for checking if an object has a given property directly - // on itself (in other words, not on a prototype). - _.has = function(obj, key) { - return hasOwnProperty.call(obj, key); - }; - - // Utility Functions - // ----------------- - - // Run Underscore.js in *noConflict* mode, returning the `_` variable to its - // previous owner. Returns a reference to the Underscore object. - _.noConflict = function() { - root._ = previousUnderscore; - return this; - }; - - // Keep the identity function around for default iterators. - _.identity = function(value) { - return value; - }; - - _.constant = function(value) { - return function () { - return value; - }; - }; - - _.property = function(key) { - return function(obj) { - return obj[key]; - }; - }; - - // Returns a predicate for checking whether an object has a given set of `key:value` pairs. - _.matches = function(attrs) { - return function(obj) { - if (obj === attrs) return true; //avoid comparing an object to itself. - for (var key in attrs) { - if (attrs[key] !== obj[key]) - return false; - } - return true; - } - }; - - // Run a function **n** times. - _.times = function(n, iterator, context) { - var accum = Array(Math.max(0, n)); - for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i); - return accum; - }; - - // Return a random integer between min and max (inclusive). - _.random = function(min, max) { - if (max == null) { - max = min; - min = 0; - } - return min + Math.floor(Math.random() * (max - min + 1)); - }; - - // A (possibly faster) way to get the current timestamp as an integer. - _.now = Date.now || function() { return new Date().getTime(); }; - - // List of HTML entities for escaping. - var entityMap = { - escape: { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - } - }; - entityMap.unescape = _.invert(entityMap.escape); - - // Regexes containing the keys and values listed immediately above. - var entityRegexes = { - escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'), - unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g') - }; - - // Functions for escaping and unescaping strings to/from HTML interpolation. - _.each(['escape', 'unescape'], function(method) { - _[method] = function(string) { - if (string == null) return ''; - return ('' + string).replace(entityRegexes[method], function(match) { - return entityMap[method][match]; - }); - }; - }); - - // If the value of the named `property` is a function then invoke it with the - // `object` as context; otherwise, return it. - _.result = function(object, property) { - if (object == null) return void 0; - var value = object[property]; - return _.isFunction(value) ? value.call(object) : value; - }; - - // Add your own custom functions to the Underscore object. - _.mixin = function(obj) { - each(_.functions(obj), function(name) { - var func = _[name] = obj[name]; - _.prototype[name] = function() { - var args = [this._wrapped]; - push.apply(args, arguments); - return result.call(this, func.apply(_, args)); - }; - }); - }; - - // Generate a unique integer id (unique within the entire client session). - // Useful for temporary DOM ids. - var idCounter = 0; - _.uniqueId = function(prefix) { - var id = ++idCounter + ''; - return prefix ? prefix + id : id; - }; - - // By default, Underscore uses ERB-style template delimiters, change the - // following template settings to use alternative delimiters. - _.templateSettings = { - evaluate : /<%([\s\S]+?)%>/g, - interpolate : /<%=([\s\S]+?)%>/g, - escape : /<%-([\s\S]+?)%>/g - }; - - // When customizing `templateSettings`, if you don't want to define an - // interpolation, evaluation or escaping regex, we need one that is - // guaranteed not to match. - var noMatch = /(.)^/; - - // Certain characters need to be escaped so that they can be put into a - // string literal. - var escapes = { - "'": "'", - '\\': '\\', - '\r': 'r', - '\n': 'n', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; - - // JavaScript micro-templating, similar to John Resig's implementation. - // Underscore templating handles arbitrary delimiters, preserves whitespace, - // and correctly escapes quotes within interpolated code. - _.template = function(text, data, settings) { - var render; - settings = _.defaults({}, settings, _.templateSettings); - - // Combine delimiters into one regular expression via alternation. - var matcher = new RegExp([ - (settings.escape || noMatch).source, - (settings.interpolate || noMatch).source, - (settings.evaluate || noMatch).source - ].join('|') + '|$', 'g'); - - // Compile the template source, escaping string literals appropriately. - var index = 0; - var source = "__p+='"; - text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { - source += text.slice(index, offset) - .replace(escaper, function(match) { return '\\' + escapes[match]; }); - - if (escape) { - source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; - } - if (interpolate) { - source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; - } - if (evaluate) { - source += "';\n" + evaluate + "\n__p+='"; - } - index = offset + match.length; - return match; - }); - source += "';\n"; - - // If a variable is not specified, place data values in local scope. - if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; - - source = "var __t,__p='',__j=Array.prototype.join," + - "print=function(){__p+=__j.call(arguments,'');};\n" + - source + "return __p;\n"; - - try { - render = new Function(settings.variable || 'obj', '_', source); - } catch (e) { - e.source = source; - throw e; - } - - if (data) return render(data, _); - var template = function(data) { - return render.call(this, data, _); - }; - - // Provide the compiled function source as a convenience for precompilation. - template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; - - return template; - }; - - // Add a "chain" function, which will delegate to the wrapper. - _.chain = function(obj) { - return _(obj).chain(); - }; - - // OOP - // --------------- - // If Underscore is called as a function, it returns a wrapped object that - // can be used OO-style. This wrapper holds altered versions of all the - // underscore functions. Wrapped objects may be chained. - - // Helper function to continue chaining intermediate results. - var result = function(obj) { - return this._chain ? _(obj).chain() : obj; - }; - - // Add all of the Underscore functions to the wrapper object. - _.mixin(_); - - // Add all mutator Array functions to the wrapper. - each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - var obj = this._wrapped; - method.apply(obj, arguments); - if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0]; - return result.call(this, obj); - }; - }); - - // Add all accessor Array functions to the wrapper. - each(['concat', 'join', 'slice'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - return result.call(this, method.apply(this._wrapped, arguments)); - }; - }); - - _.extend(_.prototype, { - - // Start chaining a wrapped Underscore object. - chain: function() { - this._chain = true; - return this; - }, - - // Extracts the result from a wrapped and chained object. - value: function() { - return this._wrapped; - } - - }); - - // AMD registration happens at the end for compatibility with AMD loaders - // that may not enforce next-turn semantics on modules. Even though general - // practice for AMD registration is to be anonymous, underscore registers - // as a named module because, like jQuery, it is a base library that is - // popular enough to be bundled in a third party lib, but not be part of - // an AMD load request. Those cases could generate an error when an - // anonymous define() is called outside of a loader request. - if (typeof define === 'function' && define.amd) { - define('underscore', [], function() { - return _; - }); - } -}).call(this); diff --git a/frontend/vendor/static/.keep b/frontend/vendor/static/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/rails-apache-config.conf b/rails-apache-config.conf deleted file mode 100644 index ed66cf3..0000000 --- a/rails-apache-config.conf +++ /dev/null @@ -1,10 +0,0 @@ - - DocumentRoot /var/www/public - RailsEnv production - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - Options FollowSymLinks - Require all granted - - \ No newline at end of file diff --git a/rails-apache-ssl-config.conf b/rails-apache-ssl-config.conf deleted file mode 100644 index b1ead4e..0000000 --- a/rails-apache-ssl-config.conf +++ /dev/null @@ -1,21 +0,0 @@ - - - DocumentRoot /var/www/public - RailsEnv production - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - SSLEngine on - SSLCertificateFile /etc/apache2/ssl/apache.crt - SSLCertificateKeyFile /etc/apache2/ssl/apache.key - - SSLOptions +StdEnvVars - - - SSLOptions +StdEnvVars - - BrowserMatch "MSIE [2-6]" \ - nokeepalive ssl-unclean-shutdown \ - downgrade-1.0 force-response-1.0 - BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown - - \ No newline at end of file diff --git a/rails-dev-Dockerfile b/rails-dev-Dockerfile index 6626f8b..12c1525 100644 --- a/rails-dev-Dockerfile +++ b/rails-dev-Dockerfile @@ -3,7 +3,7 @@ FROM ruby:2.3.0 RUN apt-get update RUN apt-get install -y build-essential -RUN apt-get install -y nodejs-legacy nodejs sqlite3 npm +RUN apt-get install -y sqlite3 ENV WRESTLINGDEV_SECRET_KEY_BASE 077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2 ENV WRESTLINGDEV_DEVISE_SECRET_KEY 2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa @@ -13,8 +13,6 @@ ADD Gemfile* /tmp/ WORKDIR /tmp RUN bundle install --without production -RUN npm install -g lineman - RUN mkdir /rails WORKDIR /rails diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index 3c2716d..01e98dd 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -1,10 +1,9 @@ FROM ruby:2.3.0 - RUN apt-get clean && apt-get update RUN apt-get -y upgrade -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libssl-dev libyaml-dev libreadline-dev openssl curl git-core zlib1g-dev bison libxml2-dev libxslt1-dev libcurl4-openssl-dev libsqlite3-dev sqlite3 wget apache2 apt-transport-https nodejs nodejs-legacy npm mysql-client postfix +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libssl-dev libyaml-dev libreadline-dev openssl curl git-core zlib1g-dev bison libxml2-dev libxslt1-dev libcurl4-openssl-dev libsqlite3-dev sqlite3 wget apt-transport-https mysql-client postfix #New Relic #RUN echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list @@ -13,77 +12,28 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libssl-dev #RUN apt-get install newrelic-sysmond -y #RUN nrsysmond-config --set license_key=$NEW_RELIC_LICENSE_KEY -#Passenger -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7 -RUN echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main >> /etc/apt/sources.list.d/passenger.list -RUN chown root: /etc/apt/sources.list.d/passenger.list -RUN chmod 600 /etc/apt/sources.list.d/passenger.list -RUN apt-get update -RUN apt-get install -y libapache2-mod-passenger - -# Enable apache mods. -RUN a2enmod rewrite -RUN a2enmod proxy -RUN a2enmod proxy_http -RUN a2enmod passenger -RUN a2enmod ssl - #SSL -RUN mkdir /etc/apache2/ssl -RUN openssl req -sha256 -subj '/CN=home/O=home LTD./C=US' -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt - - -# Manually set up the apache environment variables -ENV APACHE_RUN_USER www-data -ENV APACHE_RUN_GROUP www-data -ENV APACHE_LOG_DIR /var/log/apache2 -ENV APACHE_LOCK_DIR /var/lock/apache2 -ENV APACHE_PID_FILE /var/run/apache2.pid +RUN mkdir /ssl +RUN openssl req -sha256 -subj '/CN=home/O=home LTD./C=US' -x509 -nodes -days 365 -newkey rsa:2048 -keyout /ssl/server.key -out /ssl/server.crt EXPOSE 80 EXPOSE 443 - #Cache gems so they don't install on every code change WORKDIR /tmp COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock RUN bundle install --without test -#Cache node_modules -WORKDIR /tmp -COPY frontend/package.json package.json -RUN npm install -RUN npm install lineman -RUN npm install -g lineman - # Copy site into place. -RUN rm -rf /var/www - - +RUN mkdir /rails ENV WRESTLINGDEV_SECRET_KEY_BASE 077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2 ENV WRESTLINGDEV_DEVISE_SECRET_KEY 2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa -WORKDIR /var/www/ -ADD . /var/www/ +WORKDIR /rails +ADD . /rails -#Copy node_modules to /var/www -RUN mv /tmp/node_modules /var/www/frontend/node_modules - -#RUN RAILS_ENV=production bundle exec rake db:migrate RUN RAILS_ENV=production bundle exec rake assets:precompile -#RUN cp /var/www/frontend/dist/*.html /var/www/public/ -# Update the default apache site with the config we created. -RUN rm /etc/apache2/sites-enabled/000-default.conf -ADD ./rails-apache-ssl-config.conf /etc/apache2/sites-available/default-ssl.conf -ADD ./rails-apache-config.conf /etc/apache2/sites-enabled/000-default.conf -RUN a2ensite default-ssl.conf - -# Add apache tuning stuff -RUN echo PassengerMaxPoolSize 3 >> /etc/apache2/apache2.conf -RUN echo PassengerMinInstances 3 >> /etc/apache2/apache2.conf -RUN echo PassengerPreStart *:443 >> /etc/apache2/apache2.conf - - -# By default, simply start apache. -CMD /usr/sbin/apache2ctl -D FOREGROUND +# By default, simply start puma. +WORKDIR /rails +CMD bundle exec puma -t 5:5 -b 'ssl://0.0.0.0:443?key=/ssl/server.key&verify_mode=none&cert=/ssl/server.crt' -e production diff --git a/rails-prod.sh b/rails-prod.sh index 5210542..e03aa95 100755 --- a/rails-prod.sh +++ b/rails-prod.sh @@ -13,4 +13,4 @@ docker ps | grep "Exit" | awk '{print $1}' | while read -r id ; do docker kill $id done -docker run -h $HOSTNAME -d --restart=always --env-file $WRESTLINGDEV_ENV_FILE -v /var/log/apache2:/var/log/apache2 -v /etc/localtime:/etc/localtime -p 80:80 -p 443:443 $1 +docker run -h $HOSTNAME -d --restart=always --env-file $WRESTLINGDEV_ENV_FILE -v /etc/localtime:/etc/localtime -p 80:80 -p 443:443 $1 From 63595954a18272dbe186b33e8d8e9ba6a621c018 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 31 May 2017 12:43:31 -0400 Subject: [PATCH 03/26] Needed to add a js library to dev and prod docker images --- Gemfile.lock | 9 +-------- rails-dev-Dockerfile | 2 +- rails-prod-Dockerfile | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d05943c..809fbf7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,9 +97,6 @@ GEM parallel (1.11.2) parser (2.4.0.0) ast (~> 2.2) - passenger (5.1.4) - rack - rake (>= 0.8.1) powerpack (0.1.1) puma (3.8.2) rack (1.6.8) @@ -124,8 +121,6 @@ GEM rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - rails-lineman (0.3.0) - rake rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging @@ -199,10 +194,8 @@ DEPENDENCIES jquery-rails mysql2 newrelic_rpm - passenger puma rails (= 4.2.5) - rails-lineman rails_12factor rb-readline round_robin_tournament @@ -218,4 +211,4 @@ RUBY VERSION ruby 2.3.0p0 BUNDLED WITH - 1.14.6 + 1.15.0 diff --git a/rails-dev-Dockerfile b/rails-dev-Dockerfile index 12c1525..c684759 100644 --- a/rails-dev-Dockerfile +++ b/rails-dev-Dockerfile @@ -3,7 +3,7 @@ FROM ruby:2.3.0 RUN apt-get update RUN apt-get install -y build-essential -RUN apt-get install -y sqlite3 +RUN apt-get install -y sqlite3 nodejs ENV WRESTLINGDEV_SECRET_KEY_BASE 077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2 ENV WRESTLINGDEV_DEVISE_SECRET_KEY 2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index 01e98dd..1820999 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -3,7 +3,7 @@ FROM ruby:2.3.0 RUN apt-get clean && apt-get update RUN apt-get -y upgrade -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libssl-dev libyaml-dev libreadline-dev openssl curl git-core zlib1g-dev bison libxml2-dev libxslt1-dev libcurl4-openssl-dev libsqlite3-dev sqlite3 wget apt-transport-https mysql-client postfix +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libssl-dev libyaml-dev libreadline-dev openssl curl git-core zlib1g-dev bison libxml2-dev libxslt1-dev libcurl4-openssl-dev libsqlite3-dev sqlite3 wget apt-transport-https mysql-client postfix nodejs #New Relic #RUN echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list From f409918f5b639aad84f8861b9c548bfadaafa65a Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Fri, 2 Jun 2017 21:42:30 -0400 Subject: [PATCH 04/26] Separate apt-get clean and apt-get update on multiple lines --- rails-prod-Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index 1820999..1b3072f 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -1,6 +1,7 @@ FROM ruby:2.3.0 -RUN apt-get clean && apt-get update +RUN apt-get clean +RUN apt-get update RUN apt-get -y upgrade RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libssl-dev libyaml-dev libreadline-dev openssl curl git-core zlib1g-dev bison libxml2-dev libxslt1-dev libcurl4-openssl-dev libsqlite3-dev sqlite3 wget apt-transport-https mysql-client postfix nodejs From 98e63a2ff03773d937489d7258222d3f7e29d141 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 8 Jun 2017 21:45:36 -0400 Subject: [PATCH 05/26] Upgraded to Rails 5.1.1 --- Gemfile | 12 +- Gemfile.lock | 154 +++++++++--------- app/controllers/application_controller.rb | 2 +- app/controllers/mats_controller.rb | 4 +- app/controllers/schools_controller.rb | 4 +- app/controllers/tournaments_controller.rb | 8 +- app/controllers/weights_controller.rb | 2 +- app/controllers/wrestlers_controller.rb | 2 +- config/environments/production.rb | 4 +- config/environments/test.rb | 4 +- rails-dev-Dockerfile | 2 +- rails-prod-Dockerfile | 2 +- test/controllers/matches_controller_test.rb | 6 +- test/controllers/mats_controller_test.rb | 14 +- test/controllers/schools_controller_test.rb | 14 +- .../static_pages_controller_test.rb | 2 +- .../tournaments_controller_test.rb | 80 ++++----- test/controllers/weights_controller_test.rb | 14 +- test/controllers/wrestlers_controller_test.rb | 14 +- 19 files changed, 174 insertions(+), 170 deletions(-) diff --git a/Gemfile b/Gemfile index adeb6f3..cb9522d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,15 @@ source 'https://rubygems.org' -ruby '2.3.0' +ruby '2.4.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.5' +gem 'rails', '5.1.1' # Use sqlite3 as the database for Active Record gem 'sqlite3', :group => :development # Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' +gem 'uglifier' # Use CoffeeScript for .js.coffee assets and views -gem 'coffee-rails', '~> 4.0.0' +gem 'coffee-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby @@ -18,9 +18,9 @@ gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.0' +gem 'jbuilder' # bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', :group => :doc +gem 'sdoc', :group => :doc # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring', :group => :development diff --git a/Gemfile.lock b/Gemfile.lock index 809fbf7..890e589 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,63 +1,65 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.5) - actionpack (= 4.2.5) - actionview (= 4.2.5) - activejob (= 4.2.5) + actioncable (5.1.1) + actionpack (= 5.1.1) + nio4r (~> 2.0) + websocket-driver (~> 0.6.1) + actionmailer (5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.5) - actionview (= 4.2.5) - activesupport (= 4.2.5) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.1.1) + actionview (= 5.1.1) + activesupport (= 5.1.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.5) - activesupport (= 4.2.5) + actionview (5.1.1) + activesupport (= 5.1.1) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.5) - activesupport (= 4.2.5) - globalid (>= 0.3.0) - activemodel (4.2.5) - activesupport (= 4.2.5) - builder (~> 3.1) - activerecord (4.2.5) - activemodel (= 4.2.5) - activesupport (= 4.2.5) - arel (~> 6.0) - activesupport (4.2.5) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.1.1) + activesupport (= 5.1.1) + globalid (>= 0.3.6) + activemodel (5.1.1) + activesupport (= 5.1.1) + activerecord (5.1.1) + activemodel (= 5.1.1) + activesupport (= 5.1.1) + arel (~> 8.0) + activesupport (5.1.1) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (6.0.4) + arel (8.0.0) ast (2.3.0) bcrypt (3.1.11) - brakeman (3.6.1) + brakeman (3.6.2) builder (3.2.3) bullet (5.5.1) activesupport (>= 3.0.0) uniform_notifier (~> 1.10.0) cancancan (2.0.0) - coffee-rails (4.0.1) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.0.5) dalli (2.7.6) - delayed_job (4.1.2) - activesupport (>= 3.0, < 5.1) - delayed_job_active_record (4.1.1) - activerecord (>= 3.0, < 5.1) + delayed_job (4.1.3) + activesupport (>= 3.0, < 5.2) + delayed_job_active_record (4.1.2) + activerecord (>= 3.0, < 5.2) delayed_job (>= 3.0, < 5) devise (4.3.0) bcrypt (~> 3.0) @@ -65,13 +67,13 @@ GEM railties (>= 4.1.0, < 5.2) responders warden (~> 1.2.3) - erubis (2.7.0) + erubi (1.6.0) execjs (2.7.0) globalid (0.4.0) activesupport (>= 4.2.0) - i18n (0.8.1) - jbuilder (2.6.4) - activesupport (>= 3.0.0) + i18n (0.8.4) + jbuilder (2.7.0) + activesupport (>= 4.2.0) multi_json (>= 1.2) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) @@ -83,42 +85,42 @@ GEM nokogiri (>= 1.5.9) mail (2.6.5) mime-types (>= 1.16, < 4) + method_source (0.8.2) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) + mini_portile2 (2.2.0) minitest (5.10.2) multi_json (1.12.1) mysql2 (0.4.6) - newrelic_rpm (4.1.0.333) - nokogiri (1.7.2) - mini_portile2 (~> 2.1.0) + newrelic_rpm (4.2.0.334) + nio4r (2.1.0) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) orm_adapter (0.5.0) parallel (1.11.2) parser (2.4.0.0) ast (~> 2.2) powerpack (0.1.1) - puma (3.8.2) - rack (1.6.8) + puma (3.9.1) + rack (2.0.3) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.5) - actionmailer (= 4.2.5) - actionpack (= 4.2.5) - actionview (= 4.2.5) - activejob (= 4.2.5) - activemodel (= 4.2.5) - activerecord (= 4.2.5) - activesupport (= 4.2.5) + rails (5.1.1) + actioncable (= 5.1.1) + actionmailer (= 5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) + activemodel (= 5.1.1) + activerecord (= 5.1.1) + activesupport (= 5.1.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.5) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.8) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) + railties (= 5.1.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) rails_12factor (0.0.3) @@ -126,9 +128,10 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (4.2.5) - actionpack (= 4.2.5) - activesupport (= 4.2.5) + railties (5.1.1) + actionpack (= 5.1.1) + activesupport (= 5.1.1) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.2.2) @@ -152,7 +155,7 @@ GEM sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - spring (2.0.1) + spring (2.0.2) activesupport (>= 4.2) sprockets (3.7.1) concurrent-ruby (~> 1.0) @@ -178,6 +181,9 @@ GEM uniform_notifier (1.10.0) warden (1.2.7) rack (>= 1.0) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) PLATFORMS ruby @@ -186,29 +192,29 @@ DEPENDENCIES brakeman bullet cancancan - coffee-rails (~> 4.0.0) + coffee-rails dalli delayed_job_active_record devise - jbuilder (~> 2.0) + jbuilder jquery-rails mysql2 newrelic_rpm puma - rails (= 4.2.5) + rails (= 5.1.1) rails_12factor rb-readline round_robin_tournament rubocop - sdoc (~> 0.4.0) + sdoc spring sqlite3 therubyracer turbolinks - uglifier (>= 1.3.0) + uglifier RUBY VERSION - ruby 2.3.0p0 + ruby 2.4.0p0 BUNDLED WITH - 1.15.0 + 1.15.1 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a9f6dc6..3a110d7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,7 +3,7 @@ class ApplicationController < ActionController::Base # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - after_filter :set_csrf_cookie_for_ng + after_action :set_csrf_cookie_for_ng def set_csrf_cookie_for_ng cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery? diff --git a/app/controllers/mats_controller.rb b/app/controllers/mats_controller.rb index 6b517c9..782c39e 100644 --- a/app/controllers/mats_controller.rb +++ b/app/controllers/mats_controller.rb @@ -1,7 +1,7 @@ class MatsController < ApplicationController before_action :set_mat, only: [:show, :edit, :update, :destroy] - before_filter :check_access, only: [:new,:create,:update,:destroy,:edit,:show] - before_filter :check_for_matches, only: [:show] + before_action :check_access, only: [:new,:create,:update,:destroy,:edit,:show] + before_action :check_for_matches, only: [:show] # GET /mats/1 # GET /mats/1.json diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index b651c99..41ade29 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -1,7 +1,7 @@ class SchoolsController < ApplicationController before_action :set_school, only: [:show, :edit, :update, :destroy] - before_filter :check_access_director, only: [:new,:create,:destroy] - before_filter :check_access_delegate, only: [:update,:edit] + before_action :check_access_director, only: [:new,:create,:destroy] + before_action :check_access_delegate, only: [:update,:edit] # GET /schools/1 diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 0f443b6..fede68b 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -1,9 +1,9 @@ class TournamentsController < ApplicationController before_action :set_tournament, only: [:swap,:weigh_in_sheet,:error,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:remove_delegate,:school_delegate,:delegate,:matches,:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:all_brackets] - before_filter :check_access_manage, only: [:swap,:weigh_in_sheet,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches] - before_filter :check_access_destroy, only: [:destroy,:delegate,:remove_delegate] - before_filter :check_tournament_errors, only: [:generate_matches] - before_filter :check_for_matches, only: [:up_matches,:bracket,:all_brackets] + before_action :check_access_manage, only: [:swap,:weigh_in_sheet,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches] + before_action :check_access_destroy, only: [:destroy,:delegate,:remove_delegate] + before_action :check_tournament_errors, only: [:generate_matches] + before_action :check_for_matches, only: [:up_matches,:bracket,:all_brackets] def weigh_in_sheet diff --git a/app/controllers/weights_controller.rb b/app/controllers/weights_controller.rb index 02e17af..cb5cd76 100644 --- a/app/controllers/weights_controller.rb +++ b/app/controllers/weights_controller.rb @@ -1,6 +1,6 @@ class WeightsController < ApplicationController before_action :set_weight, only: [:show, :edit, :update, :destroy,:re_gen] - before_filter :check_access, only: [:new,:create,:update,:destroy,:edit, :re_gen] + before_action :check_access, only: [:new,:create,:update,:destroy,:edit, :re_gen] # GET /weights/1 diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index e83a7c6..e671465 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -1,6 +1,6 @@ class WrestlersController < ApplicationController before_action :set_wrestler, only: [:show, :edit, :update, :destroy] - before_filter :check_access, only: [:new,:create,:update,:destroy,:edit] + before_action :check_access, only: [:new,:create,:update,:destroy,:edit] diff --git a/config/environments/production.rb b/config/environments/production.rb index 44552b6..582ed0d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -90,7 +90,7 @@ Wrestling::Application.configure do #THESE ADDED BY ME TO GET RAILS 4 WORKING IN HEROKU config.cache_classes = true - config.serve_static_files = true + config.public_file_server.enabled = true config.assets.compile = true config.assets.digest = true @@ -111,6 +111,4 @@ Wrestling::Application.configure do #Devise needs origin of email Rails.application.routes.default_url_options[:host] = 'https://wrestlingdev.com' - #For lineman creating assets - config.serve_static_files = true end diff --git a/config/environments/test.rb b/config/environments/test.rb index 476d5e3..6e4b153 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,8 +13,8 @@ Wrestling::Application.configure do config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" + config.public_file_server.enabled = true + config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } # Show full error reports and disable caching. config.consider_all_requests_local = true diff --git a/rails-dev-Dockerfile b/rails-dev-Dockerfile index c684759..17a6891 100644 --- a/rails-dev-Dockerfile +++ b/rails-dev-Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.3.0 +FROM ruby:2.4.0 RUN apt-get update diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index 1b3072f..471cd64 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.3.0 +FROM ruby:2.4.0 RUN apt-get clean RUN apt-get update diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb index 12d6ca0..e17cf75 100644 --- a/test/controllers/matches_controller_test.rb +++ b/test/controllers/matches_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class MatchesControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -10,11 +10,11 @@ class MatchesControllerTest < ActionController::TestCase end def post_update - patch :update, id: @match.id, match: {tournament_id: 1, mat_id: 1} + patch :update, params: { id: @match.id, match: {tournament_id: 1, mat_id: 1} } end def get_edit - get :edit, id: @match.id + get :edit, params: { id: @match.id } end def sign_in_owner diff --git a/test/controllers/mats_controller_test.rb b/test/controllers/mats_controller_test.rb index 38de270..77ff092 100644 --- a/test/controllers/mats_controller_test.rb +++ b/test/controllers/mats_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class MatsControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -10,27 +10,27 @@ class MatsControllerTest < ActionController::TestCase end def create - post :create, mat: {name: 'Mat100', tournament_id: 1} + post :create, params: { mat: {name: 'Mat100', tournament_id: 1} } end def new - get :new, tournament: @tournament.id + get :new, params: { tournament: @tournament.id } end def show - get :show, id: 1 + get :show, params: { id: 1 } end def post_update - patch :update, id: @mat.id, mat: {name: @mat.name, tournament_id: @mat.tournament_id} + patch :update, params: { id: @mat.id, mat: {name: @mat.name, tournament_id: @mat.tournament_id} } end def destroy - delete :destroy, id: @mat.id + delete :destroy, params: { id: @mat.id } end def get_edit - get :edit, id: @mat.id + get :edit, params: { id: @mat.id } end def sign_in_owner diff --git a/test/controllers/schools_controller_test.rb b/test/controllers/schools_controller_test.rb index eee17d7..ce4ca3f 100644 --- a/test/controllers/schools_controller_test.rb +++ b/test/controllers/schools_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class SchoolsControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -10,23 +10,23 @@ class SchoolsControllerTest < ActionController::TestCase end def create - post :create, school: {name: 'Testaasdf', tournament_id: 1} + post :create, params: { school: {name: 'Testaasdf', tournament_id: 1} } end def new - get :new, tournament: @tournament.id + get :new, params: { tournament: @tournament.id } end def post_update - patch :update, id: @school.id, school: {name: @school.name, tournament_id: @school.tournament_id} + patch :update, params: { id: @school.id, school: {name: @school.name, tournament_id: @school.tournament_id} } end def destroy - delete :destroy, id: @school.id + delete :destroy, params: { id: @school.id } end def get_edit - get :edit, id: @school.id + get :edit, params: { id: @school.id } end def sign_in_owner @@ -168,7 +168,7 @@ class SchoolsControllerTest < ActionController::TestCase end test "view school" do - get :show, id: 1 + get :show, params: { id: 1 } success end diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb index 2eb9388..fdf52cb 100644 --- a/test/controllers/static_pages_controller_test.rb +++ b/test/controllers/static_pages_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class StaticPagesControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) diff --git a/test/controllers/tournaments_controller_test.rb b/test/controllers/tournaments_controller_test.rb index 707c6b3..ae2e1c2 100644 --- a/test/controllers/tournaments_controller_test.rb +++ b/test/controllers/tournaments_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class TournamentsControllerTest < ActionController::TestCase -include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -12,11 +12,11 @@ include Devise::TestHelpers end def post_update - patch :update, id: 1, tournament: {name: @tournament.name} + patch :update, params: { id: 1, tournament: {name: @tournament.name} } end def get_edit - get :edit, id: 1 + get :edit, params: { id: 1 } end def sign_in_owner @@ -44,7 +44,7 @@ include Devise::TestHelpers end def destroy - delete :destroy, id: 1 + delete :destroy, params: { id: 1 } end def no_matches @@ -57,91 +57,91 @@ include Devise::TestHelpers test "logged in tournament owner can generate matches" do sign_in_owner - get :generate_matches, id: 1 + get :generate_matches, params: { id: 1 } success end test "logged in non tournament owner cannot generate matches" do sign_in_non_owner - get :generate_matches, id: 1 + get :generate_matches, params: { id: 1 } redirect end test "logged in school delegate cannot generate matches" do sign_in_school_delegate - get :generate_matches, id: 1 + get :generate_matches, params: { id: 1 } redirect end test "logged in tournament owner can create custom weights" do sign_in_owner - get :create_custom_weights, id: 1, customValue: 'hs' + get :create_custom_weights, params: { id: 1, customValue: 'hs' } assert_redirected_to '/tournaments/1' end test "logged in non tournament owner cannot create custom weights" do sign_in_non_owner - get :create_custom_weights, id: 1, customValue: 'hs' + get :create_custom_weights, params: { id: 1, customValue: 'hs' } redirect end test "logged in school delegate cannot create custom weights" do sign_in_school_delegate - get :create_custom_weights, id: 1, customValue: 'hs' + get :create_custom_weights, params: { id: 1, customValue: 'hs' } redirect end test "logged in tournament owner can access weigh_ins" do sign_in_owner - get :weigh_in, id: 1 + get :weigh_in, params: { id: 1 } success end test "logged in non tournament owner cannot access weigh_ins" do sign_in_non_owner - get :weigh_in, id: 1 + get :weigh_in, params: { id: 1 } redirect end test "logged in school delegate cannot access weigh_ins" do sign_in_school_delegate - get :weigh_in, id: 1 + get :weigh_in, params: { id: 1 } redirect end test "logged in tournament owner can access weigh_in_weight" do sign_in_owner - get :weigh_in, id: 1, weight: 1 + get :weigh_in, params: { id: 1, weight: 1 } success end test "logged in non tournament owner cannot access weigh_in_weight" do sign_in_non_owner - get :weigh_in_weight, id: 1, weight: 1 + get :weigh_in_weight, params: { id: 1, weight: 1 } redirect end test "logged in school delegate cannot access weigh_in_weight" do sign_in_school_delegate - get :weigh_in_weight, id: 1, weight: 1 + get :weigh_in_weight, params: { id: 1, weight: 1 } redirect end test "logged in tournament owner can access post weigh_in_weight" do sign_in_owner - post :weigh_in, id: 1, weight: 1, wrestler: @wrestlers + post :weigh_in, params: { id: 1, weight: 1, wrestler: @wrestlers } end test "logged in non tournament owner cannot access post weigh_in_weight" do sign_in_non_owner - post :weigh_in_weight, id: 1, weight: 1, wrestler: @wrestlers + post :weigh_in_weight, params: { id: 1, weight: 1, wrestler: @wrestlers } redirect end test "logged in school delegate cannot access post weigh_in_weight" do sign_in_school_delegate - post :weigh_in_weight, id: 1, weight: 1, wrestler: @wrestlers + post :weigh_in_weight, params: { id: 1, weight: 1, wrestler: @wrestlers } redirect end @@ -216,38 +216,38 @@ include Devise::TestHelpers test "redirect up_matches if no matches" do sign_in_owner wipe - get :up_matches, id: 1 + get :up_matches, params: { id: 1 } no_matches end test "redirect bracket if no matches" do sign_in_owner wipe - get :bracket, id: 1, weight: 1 + get :bracket, params: { id: 1, weight: 1 } no_matches end test "logged in tournament delegate can generate matches" do sign_in_delegate - get :generate_matches, id: 1 + get :generate_matches, params: { id: 1 } success end test "logged in tournament delegate can create custom weights" do sign_in_delegate - get :create_custom_weights, id: 1, customValue: 'hs' + get :create_custom_weights, params: { id: 1, customValue: 'hs' } assert_redirected_to '/tournaments/1' end test "logged in tournament delegate can access weigh_ins" do sign_in_delegate - get :weigh_in, id: 1 + get :weigh_in, params: { id: 1 } success end test "logged in tournament delegate can access weigh_in_weight" do sign_in_delegate - get :weigh_in, id: 1, weight: 1 + get :weigh_in, params: { id: 1, weight: 1 } success end @@ -259,7 +259,7 @@ include Devise::TestHelpers test "logged in tournament delegate can access post weigh_in_weight" do sign_in_delegate - post :weigh_in, id: 1, weight: 1, wrestler: @wrestlers + post :weigh_in, params: { id: 1, weight: 1, wrestler: @wrestlers } end test "logged in tournament delegate should post update tournament" do @@ -277,49 +277,49 @@ include Devise::TestHelpers test 'logged in tournament owner can delegate a user' do sign_in_owner - get :delegate, id: 1 + get :delegate, params: { id: 1 } success end test 'logged in tournament delegate cannot delegate a user' do sign_in_delegate - get :delegate, id: 1 + get :delegate, params: { id: 1 } redirect end test 'logged in tournament owner can delegate a school user' do sign_in_owner - get :school_delegate, id: 1 + get :school_delegate, params: { id: 1 } success end test 'logged in tournament delegate can delegate a school user' do sign_in_delegate - get :school_delegate, id: 1 + get :school_delegate, params: { id: 1 } success end test 'logged in tournament owner can delete a school delegate' do sign_in_owner - patch :remove_school_delegate, id: 1, delegate: SchoolDelegate.find(1) + patch :remove_school_delegate, params: { id: 1, delegate: SchoolDelegate.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/school_delegate" end test 'logged in tournament delegate can delete a school delegate' do sign_in_delegate - patch :remove_school_delegate, id: 1, delegate: SchoolDelegate.find(1) + patch :remove_school_delegate, params: { id: 1, delegate: SchoolDelegate.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/school_delegate" end test 'logged in tournament owner can delete a delegate' do sign_in_owner - patch :remove_delegate, id: 1, delegate: TournamentDelegate.find(1) + patch :remove_delegate, params: { id: 1, delegate: TournamentDelegate.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/delegate" end test 'logged in tournament delegate cannot delete a delegate' do sign_in_delegate - patch :remove_delegate, id: 1, delegate: TournamentDelegate.find(1) + patch :remove_delegate, params: { id: 1, delegate: TournamentDelegate.find(1) } redirect end @@ -328,37 +328,37 @@ include Devise::TestHelpers test 'logged in tournament delegate can adjust team points' do sign_in_delegate - get :teampointadjust, id: 1 + get :teampointadjust, params: { id: 1 } success end test 'logged in tournament owner can adjust team points' do sign_in_owner - get :teampointadjust, id: 1 + get :teampointadjust, params: { id: 1 } success end test 'logged in tournament delegate cannot adjust team points' do sign_in_school_delegate - get :teampointadjust, id: 1 + get :teampointadjust, params: { id: 1 } redirect end test 'logged in tournament owner can delete team point adjust' do sign_in_owner - post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1) + post :remove_teampointadjust, params: { id: 1, teampointadjust: Teampointadjust.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/teampointadjust" end test 'logged in tournament delegate can team point adjust' do sign_in_delegate - post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1) + post :remove_teampointadjust, params: { id: 1, teampointadjust: Teampointadjust.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/teampointadjust" end test 'logged in school delegate cannot delete team point adjust' do sign_in_school_delegate - post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1) + post :remove_teampointadjust, params: { id: 1, teampointadjust: Teampointadjust.find(1) } redirect end diff --git a/test/controllers/weights_controller_test.rb b/test/controllers/weights_controller_test.rb index f3e7882..8e1da47 100644 --- a/test/controllers/weights_controller_test.rb +++ b/test/controllers/weights_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class WeightsControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -10,23 +10,23 @@ class WeightsControllerTest < ActionController::TestCase end def create - post :create, weight: {max: 60000, tournament_id: 1} + post :create, params: { weight: {max: 60000, tournament_id: 1} } end def new - get :new, tournament: @tournament.id + get :new, params: { tournament: @tournament.id } end def post_update - patch :update, id: @weight.id, weight: {max: @weight.max, tournament_id: @weight.tournament_id} + patch :update, params: { id: @weight.id, weight: {max: @weight.max, tournament_id: @weight.tournament_id} } end def destroy - delete :destroy, id: @weight.id + delete :destroy, params: { id: @weight.id } end def get_edit - get :edit, id: @weight.id + get :edit, params: { id: @weight.id } end def sign_in_owner @@ -168,7 +168,7 @@ class WeightsControllerTest < ActionController::TestCase end test "view wegiht" do - get :show, id: 1 + get :show, params: { id: 1 } success end diff --git a/test/controllers/wrestlers_controller_test.rb b/test/controllers/wrestlers_controller_test.rb index 2193113..d2b6ee6 100644 --- a/test/controllers/wrestlers_controller_test.rb +++ b/test/controllers/wrestlers_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class WrestlersControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -11,23 +11,23 @@ class WrestlersControllerTest < ActionController::TestCase end def create - post :create, wrestler: {name: 'Testaasdf', weight_id: 1, school_id: 1} + post :create, params: { wrestler: {name: 'Testaasdf', weight_id: 1, school_id: 1} } end def new - get :new, school: 1 + get :new, params: { school: 1 } end def post_update - patch :update, id: @wrestler.id, wrestler: {name: @wrestler.name, weight_id: 1, school_id: 1} + patch :update, params: { id: @wrestler.id, wrestler: {name: @wrestler.name, weight_id: 1, school_id: 1} } end def destroy - delete :destroy, id: @wrestler.id + delete :destroy, params: { id: @wrestler.id } end def get_edit - get :edit, id: @wrestler.id + get :edit, params: { id: @wrestler.id } end def sign_in_owner @@ -169,7 +169,7 @@ class WrestlersControllerTest < ActionController::TestCase end test "view wrestler" do - get :show, id: @wrestler.id + get :show, params: { id: @wrestler.id } success end From a3c768b0bbd63118abb8f74f7772390fe1c605e2 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 8 Jun 2017 21:47:47 -0400 Subject: [PATCH 06/26] Updated README to reflect new versions of rails and ruby --- README.rdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rdoc b/README.rdoc index 7d37e77..f4e5f72 100644 --- a/README.rdoc +++ b/README.rdoc @@ -16,9 +16,9 @@ MIT License Development details: -* Ruby 2.3.0 +* Ruby 2.4.0 -* Rails 4.2.5 +* Rails 5.1.1 * Install gems without production bundle install --without production From 573b3c3e12cdea6e0cc4976d243ea90a0aeeebb1 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 8 Jun 2017 21:51:22 -0400 Subject: [PATCH 07/26] Updated ruby version in .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1f979c1..6763854 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: -- 2.3.0 +- 2.4.0 env: - DB=sqlite script: From 89443f770ee5401a59ded4780ea08771c3d069df Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 8 Jun 2017 21:54:33 -0400 Subject: [PATCH 08/26] Updated .travis.yml to db:migrate when deploying --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6763854..5d79363 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,4 @@ deploy: on: repo: jcwimer/wrestlingApp branch: master + run: "rake db:migrate RAILS_ENV=production" From 0fb2e7009bb9d4fa1385b4e27945f88a98b92441 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Fri, 9 Jun 2017 07:22:32 -0400 Subject: [PATCH 09/26] Updated migrations to support new rails version --- db/migrate/20131231134936_create_schools.rb | 2 +- db/migrate/20131231134955_create_weights.rb | 2 +- db/migrate/20131231135039_create_wrestlers.rb | 2 +- .../20140120175252_create_tournaments.rb | 2 +- ...20140121020833_school_add_tournament_id.rb | 2 +- .../20140122030856_devise_create_users.rb | 2 +- ...20140122151620_weight_add_tournament_id.rb | 2 +- ...0123035131_wrestler_add_win_loss_column.rb | 2 +- .../20140124015315_drop_school_score.rb | 2 +- db/migrate/20140124021031_add_school_score.rb | 2 +- db/migrate/20140124174110_create_matches.rb | 2 +- ...0125040820_add_tournament_id_to_matches.rb | 2 +- .../20140125062040_add_round_to_match.rb | 2 +- db/migrate/20140125065007_create_mats.rb | 2 +- .../20140125065443_add_mat_id_to_weights.rb | 2 +- ...125072649_add_finished_field_to_matches.rb | 2 +- .../20140130153634_drop_weight_mat_id.rb | 2 +- ...131123907_add_seed_criteria_to_wrestler.rb | 2 +- ...41226133941_assign_wrestler_pool_number.rb | 2 +- ...20150202180900_add_bout_number_to_match.rb | 2 +- ...50206025407_add_extra_flag_for_wrestler.rb | 2 +- db/migrate/20150317122709_drop_pool_number.rb | 2 +- ...150324233726_add_matchups_to_tournament.rb | 2 +- ...150325004527_rename_tournament_matchups.rb | 2 +- .../20150328183257_drop_school_score_again.rb | 2 +- db/migrate/20150425173224_matchup_to_match.rb | 2 +- .../20150426190405_add_w_names_to_match.rb | 2 +- ...50426191006_change_w_name_to_loser_name.rb | 2 +- .../20150426195714_drop_matchups_array.rb | 2 +- .../20150427163325_add_type_to_tournament.rb | 2 +- ...27163625_rename_type_to_tournament_type.rb | 2 +- ...rename_type_to_tournament_type_for_real.rb | 2 +- .../20150517075923_rename_bout_number.rb | 2 +- .../20150523121319_introduce_indexes.rb | 2 +- .../20150619142023_add_mat_id_to_match.rb | 2 +- ...0630170119_add_offical_weight_wrestlers.rb | 2 +- ...151023123932_add_user_id_to_tournaments.rb | 2 +- .../20151111130227_create_teampointadjusts.rb | 2 +- ...20151117152454_add_score_back_to_school.rb | 2 +- db/migrate/20151216154211_rename_stats.rb | 2 +- .../20151229220036_create_delayed_jobs.rb | 2 +- .../20151230163202_generating_matches.rb | 2 +- db/migrate/20151230164000_tournament_date.rb | 2 +- ...60106025920_create_tournament_delegates.rb | 2 +- .../20160106031418_create_school_delegates.rb | 2 +- ...52946_add_school_id_to_teampointsadjust.rb | 2 +- db/migrate/20170301174920_add_pool_column.rb | 2 +- db/schema.rb | 168 ++++++++---------- 48 files changed, 126 insertions(+), 136 deletions(-) diff --git a/db/migrate/20131231134936_create_schools.rb b/db/migrate/20131231134936_create_schools.rb index eb0a252..2fe0964 100644 --- a/db/migrate/20131231134936_create_schools.rb +++ b/db/migrate/20131231134936_create_schools.rb @@ -1,4 +1,4 @@ -class CreateSchools < ActiveRecord::Migration +class CreateSchools < ActiveRecord::Migration[4.2][4.2] def change create_table :schools do |t| t.string :name diff --git a/db/migrate/20131231134955_create_weights.rb b/db/migrate/20131231134955_create_weights.rb index d082d7b..6a672b6 100644 --- a/db/migrate/20131231134955_create_weights.rb +++ b/db/migrate/20131231134955_create_weights.rb @@ -1,4 +1,4 @@ -class CreateWeights < ActiveRecord::Migration +class CreateWeights < ActiveRecord::Migration[4.2] def change create_table :weights do |t| t.integer :max diff --git a/db/migrate/20131231135039_create_wrestlers.rb b/db/migrate/20131231135039_create_wrestlers.rb index 77aa744..113e44c 100644 --- a/db/migrate/20131231135039_create_wrestlers.rb +++ b/db/migrate/20131231135039_create_wrestlers.rb @@ -1,4 +1,4 @@ -class CreateWrestlers < ActiveRecord::Migration +class CreateWrestlers < ActiveRecord::Migration[4.2] def change create_table :wrestlers do |t| t.string :name diff --git a/db/migrate/20140120175252_create_tournaments.rb b/db/migrate/20140120175252_create_tournaments.rb index 3bbcb9b..5ba3857 100644 --- a/db/migrate/20140120175252_create_tournaments.rb +++ b/db/migrate/20140120175252_create_tournaments.rb @@ -1,4 +1,4 @@ -class CreateTournaments < ActiveRecord::Migration +class CreateTournaments < ActiveRecord::Migration[4.2] def change create_table :tournaments do |t| t.string :name diff --git a/db/migrate/20140121020833_school_add_tournament_id.rb b/db/migrate/20140121020833_school_add_tournament_id.rb index eda6192..8ebcef4 100644 --- a/db/migrate/20140121020833_school_add_tournament_id.rb +++ b/db/migrate/20140121020833_school_add_tournament_id.rb @@ -1,4 +1,4 @@ -class SchoolAddTournamentId < ActiveRecord::Migration +class SchoolAddTournamentId < ActiveRecord::Migration[4.2] def change add_column :schools, :tournament_id, :integer end diff --git a/db/migrate/20140122030856_devise_create_users.rb b/db/migrate/20140122030856_devise_create_users.rb index 6e5e27c..8fbd56d 100644 --- a/db/migrate/20140122030856_devise_create_users.rb +++ b/db/migrate/20140122030856_devise_create_users.rb @@ -1,4 +1,4 @@ -class DeviseCreateUsers < ActiveRecord::Migration +class DeviseCreateUsers < ActiveRecord::Migration[4.2] def change create_table(:users) do |t| ## Database authenticatable diff --git a/db/migrate/20140122151620_weight_add_tournament_id.rb b/db/migrate/20140122151620_weight_add_tournament_id.rb index e9243b3..55e2240 100644 --- a/db/migrate/20140122151620_weight_add_tournament_id.rb +++ b/db/migrate/20140122151620_weight_add_tournament_id.rb @@ -1,4 +1,4 @@ -class WeightAddTournamentId < ActiveRecord::Migration +class WeightAddTournamentId < ActiveRecord::Migration[4.2] def change add_column :weights, :tournament_id, :integer end diff --git a/db/migrate/20140123035131_wrestler_add_win_loss_column.rb b/db/migrate/20140123035131_wrestler_add_win_loss_column.rb index 7916459..99c7325 100644 --- a/db/migrate/20140123035131_wrestler_add_win_loss_column.rb +++ b/db/migrate/20140123035131_wrestler_add_win_loss_column.rb @@ -1,4 +1,4 @@ -class WrestlerAddWinLossColumn < ActiveRecord::Migration +class WrestlerAddWinLossColumn < ActiveRecord::Migration[4.2] def change add_column :wrestlers, :season_win, :integer add_column :wrestlers, :season_loss, :integer diff --git a/db/migrate/20140124015315_drop_school_score.rb b/db/migrate/20140124015315_drop_school_score.rb index 36b119f..99b7114 100644 --- a/db/migrate/20140124015315_drop_school_score.rb +++ b/db/migrate/20140124015315_drop_school_score.rb @@ -1,4 +1,4 @@ -class DropSchoolScore < ActiveRecord::Migration +class DropSchoolScore < ActiveRecord::Migration[4.2] def change remove_column :schools, :score end diff --git a/db/migrate/20140124021031_add_school_score.rb b/db/migrate/20140124021031_add_school_score.rb index 58c9dfb..24d1b27 100644 --- a/db/migrate/20140124021031_add_school_score.rb +++ b/db/migrate/20140124021031_add_school_score.rb @@ -1,4 +1,4 @@ -class AddSchoolScore < ActiveRecord::Migration +class AddSchoolScore < ActiveRecord::Migration[4.2] def change add_column :schools, :score, :integer end diff --git a/db/migrate/20140124174110_create_matches.rb b/db/migrate/20140124174110_create_matches.rb index c6023dd..cc987b3 100644 --- a/db/migrate/20140124174110_create_matches.rb +++ b/db/migrate/20140124174110_create_matches.rb @@ -1,4 +1,4 @@ -class CreateMatches < ActiveRecord::Migration +class CreateMatches < ActiveRecord::Migration[4.2] def change create_table :matches do |t| t.integer :r_id diff --git a/db/migrate/20140125040820_add_tournament_id_to_matches.rb b/db/migrate/20140125040820_add_tournament_id_to_matches.rb index cba7ed4..c217929 100644 --- a/db/migrate/20140125040820_add_tournament_id_to_matches.rb +++ b/db/migrate/20140125040820_add_tournament_id_to_matches.rb @@ -1,4 +1,4 @@ -class AddTournamentIdToMatches < ActiveRecord::Migration +class AddTournamentIdToMatches < ActiveRecord::Migration[4.2] def change add_column :matches, :tournament_id, :integer end diff --git a/db/migrate/20140125062040_add_round_to_match.rb b/db/migrate/20140125062040_add_round_to_match.rb index 7cb1fdf..8d2db08 100644 --- a/db/migrate/20140125062040_add_round_to_match.rb +++ b/db/migrate/20140125062040_add_round_to_match.rb @@ -1,4 +1,4 @@ -class AddRoundToMatch < ActiveRecord::Migration +class AddRoundToMatch < ActiveRecord::Migration[4.2] def change add_column :matches, :round, :integer end diff --git a/db/migrate/20140125065007_create_mats.rb b/db/migrate/20140125065007_create_mats.rb index 27ac2e0..4964647 100644 --- a/db/migrate/20140125065007_create_mats.rb +++ b/db/migrate/20140125065007_create_mats.rb @@ -1,4 +1,4 @@ -class CreateMats < ActiveRecord::Migration +class CreateMats < ActiveRecord::Migration[4.2] def change create_table :mats do |t| t.string :name diff --git a/db/migrate/20140125065443_add_mat_id_to_weights.rb b/db/migrate/20140125065443_add_mat_id_to_weights.rb index c04fdd6..d13f0d3 100644 --- a/db/migrate/20140125065443_add_mat_id_to_weights.rb +++ b/db/migrate/20140125065443_add_mat_id_to_weights.rb @@ -1,4 +1,4 @@ -class AddMatIdToWeights < ActiveRecord::Migration +class AddMatIdToWeights < ActiveRecord::Migration[4.2] def change add_column :weights, :mat_id, :integer end diff --git a/db/migrate/20140125072649_add_finished_field_to_matches.rb b/db/migrate/20140125072649_add_finished_field_to_matches.rb index 493d314..11680e2 100644 --- a/db/migrate/20140125072649_add_finished_field_to_matches.rb +++ b/db/migrate/20140125072649_add_finished_field_to_matches.rb @@ -1,4 +1,4 @@ -class AddFinishedFieldToMatches < ActiveRecord::Migration +class AddFinishedFieldToMatches < ActiveRecord::Migration[4.2] def change add_column :matches, :finished, :integer end diff --git a/db/migrate/20140130153634_drop_weight_mat_id.rb b/db/migrate/20140130153634_drop_weight_mat_id.rb index d1de3fb..311a8b1 100644 --- a/db/migrate/20140130153634_drop_weight_mat_id.rb +++ b/db/migrate/20140130153634_drop_weight_mat_id.rb @@ -1,4 +1,4 @@ -class DropWeightMatId < ActiveRecord::Migration +class DropWeightMatId < ActiveRecord::Migration[4.2] def change remove_column :weights, :mat_id end diff --git a/db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb b/db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb index 2b2ab59..968e069 100644 --- a/db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb +++ b/db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb @@ -1,4 +1,4 @@ -class AddSeedCriteriaToWrestler < ActiveRecord::Migration +class AddSeedCriteriaToWrestler < ActiveRecord::Migration[4.2] def change add_column :wrestlers, :criteria, :string end diff --git a/db/migrate/20141226133941_assign_wrestler_pool_number.rb b/db/migrate/20141226133941_assign_wrestler_pool_number.rb index 3a67320..152506d 100644 --- a/db/migrate/20141226133941_assign_wrestler_pool_number.rb +++ b/db/migrate/20141226133941_assign_wrestler_pool_number.rb @@ -1,4 +1,4 @@ -class AssignWrestlerPoolNumber < ActiveRecord::Migration +class AssignWrestlerPoolNumber < ActiveRecord::Migration[4.2] def change add_column :wrestlers, :poolNumber, :integer end diff --git a/db/migrate/20150202180900_add_bout_number_to_match.rb b/db/migrate/20150202180900_add_bout_number_to_match.rb index 4db5814..aa16486 100644 --- a/db/migrate/20150202180900_add_bout_number_to_match.rb +++ b/db/migrate/20150202180900_add_bout_number_to_match.rb @@ -1,4 +1,4 @@ -class AddBoutNumberToMatch < ActiveRecord::Migration +class AddBoutNumberToMatch < ActiveRecord::Migration[4.2] def change add_column :matches, :boutNumber, :integer end diff --git a/db/migrate/20150206025407_add_extra_flag_for_wrestler.rb b/db/migrate/20150206025407_add_extra_flag_for_wrestler.rb index 4aef264..e5fa3f7 100644 --- a/db/migrate/20150206025407_add_extra_flag_for_wrestler.rb +++ b/db/migrate/20150206025407_add_extra_flag_for_wrestler.rb @@ -1,4 +1,4 @@ -class AddExtraFlagForWrestler < ActiveRecord::Migration +class AddExtraFlagForWrestler < ActiveRecord::Migration[4.2] def change add_column :wrestlers, :extra, :boolean end diff --git a/db/migrate/20150317122709_drop_pool_number.rb b/db/migrate/20150317122709_drop_pool_number.rb index 337cac0..a88e75a 100644 --- a/db/migrate/20150317122709_drop_pool_number.rb +++ b/db/migrate/20150317122709_drop_pool_number.rb @@ -1,4 +1,4 @@ -class DropPoolNumber < ActiveRecord::Migration +class DropPoolNumber < ActiveRecord::Migration[4.2] def change remove_column :wrestlers, :poolNumber end diff --git a/db/migrate/20150324233726_add_matchups_to_tournament.rb b/db/migrate/20150324233726_add_matchups_to_tournament.rb index c6f1ef3..2637fce 100644 --- a/db/migrate/20150324233726_add_matchups_to_tournament.rb +++ b/db/migrate/20150324233726_add_matchups_to_tournament.rb @@ -1,4 +1,4 @@ -class AddMatchupsToTournament < ActiveRecord::Migration +class AddMatchupsToTournament < ActiveRecord::Migration[4.2] def change add_column :tournaments, :matchups, :text end diff --git a/db/migrate/20150325004527_rename_tournament_matchups.rb b/db/migrate/20150325004527_rename_tournament_matchups.rb index ec0f6e2..396589a 100644 --- a/db/migrate/20150325004527_rename_tournament_matchups.rb +++ b/db/migrate/20150325004527_rename_tournament_matchups.rb @@ -1,4 +1,4 @@ -class RenameTournamentMatchups < ActiveRecord::Migration +class RenameTournamentMatchups < ActiveRecord::Migration[4.2] def change rename_column :tournaments, :matchups, :matchups_array end diff --git a/db/migrate/20150328183257_drop_school_score_again.rb b/db/migrate/20150328183257_drop_school_score_again.rb index 82e0f7e..1e64d6a 100644 --- a/db/migrate/20150328183257_drop_school_score_again.rb +++ b/db/migrate/20150328183257_drop_school_score_again.rb @@ -1,4 +1,4 @@ -class DropSchoolScoreAgain < ActiveRecord::Migration +class DropSchoolScoreAgain < ActiveRecord::Migration[4.2] def change remove_column :schools, :score end diff --git a/db/migrate/20150425173224_matchup_to_match.rb b/db/migrate/20150425173224_matchup_to_match.rb index 34170e3..05a4cba 100644 --- a/db/migrate/20150425173224_matchup_to_match.rb +++ b/db/migrate/20150425173224_matchup_to_match.rb @@ -1,4 +1,4 @@ -class MatchupToMatch < ActiveRecord::Migration +class MatchupToMatch < ActiveRecord::Migration[4.2] def change add_column :matches, :weight_id, :integer add_column :matches, :bracket_position, :string diff --git a/db/migrate/20150426190405_add_w_names_to_match.rb b/db/migrate/20150426190405_add_w_names_to_match.rb index a2ef847..a605c9f 100644 --- a/db/migrate/20150426190405_add_w_names_to_match.rb +++ b/db/migrate/20150426190405_add_w_names_to_match.rb @@ -1,4 +1,4 @@ -class AddWNamesToMatch < ActiveRecord::Migration +class AddWNamesToMatch < ActiveRecord::Migration[4.2] def change add_column :matches, :w1_name, :string add_column :matches, :w2_name, :string diff --git a/db/migrate/20150426191006_change_w_name_to_loser_name.rb b/db/migrate/20150426191006_change_w_name_to_loser_name.rb index b8f66b5..0a5a116 100644 --- a/db/migrate/20150426191006_change_w_name_to_loser_name.rb +++ b/db/migrate/20150426191006_change_w_name_to_loser_name.rb @@ -1,4 +1,4 @@ -class ChangeWNameToLoserName < ActiveRecord::Migration +class ChangeWNameToLoserName < ActiveRecord::Migration[4.2] def change rename_column :matches, :w1_name, :loser1_name rename_column :matches, :w2_name, :loser2_name diff --git a/db/migrate/20150426195714_drop_matchups_array.rb b/db/migrate/20150426195714_drop_matchups_array.rb index a229a68..9d0f3fe 100644 --- a/db/migrate/20150426195714_drop_matchups_array.rb +++ b/db/migrate/20150426195714_drop_matchups_array.rb @@ -1,4 +1,4 @@ -class DropMatchupsArray < ActiveRecord::Migration +class DropMatchupsArray < ActiveRecord::Migration[4.2] def change remove_column :tournaments, :matchups_array end diff --git a/db/migrate/20150427163325_add_type_to_tournament.rb b/db/migrate/20150427163325_add_type_to_tournament.rb index 03fe083..330c200 100644 --- a/db/migrate/20150427163325_add_type_to_tournament.rb +++ b/db/migrate/20150427163325_add_type_to_tournament.rb @@ -1,4 +1,4 @@ -class AddTypeToTournament < ActiveRecord::Migration +class AddTypeToTournament < ActiveRecord::Migration[4.2] def change add_column :tournaments, :type, :text end diff --git a/db/migrate/20150427163625_rename_type_to_tournament_type.rb b/db/migrate/20150427163625_rename_type_to_tournament_type.rb index 94faa44..c077ec5 100644 --- a/db/migrate/20150427163625_rename_type_to_tournament_type.rb +++ b/db/migrate/20150427163625_rename_type_to_tournament_type.rb @@ -1,4 +1,4 @@ -class RenameTypeToTournamentType < ActiveRecord::Migration +class RenameTypeToTournamentType < ActiveRecord::Migration[4.2] def change end end diff --git a/db/migrate/20150427163818_rename_type_to_tournament_type_for_real.rb b/db/migrate/20150427163818_rename_type_to_tournament_type_for_real.rb index ade959e..2b4524d 100644 --- a/db/migrate/20150427163818_rename_type_to_tournament_type_for_real.rb +++ b/db/migrate/20150427163818_rename_type_to_tournament_type_for_real.rb @@ -1,4 +1,4 @@ -class RenameTypeToTournamentTypeForReal < ActiveRecord::Migration +class RenameTypeToTournamentTypeForReal < ActiveRecord::Migration[4.2] def change rename_column :tournaments, :type, :tournament_type end diff --git a/db/migrate/20150517075923_rename_bout_number.rb b/db/migrate/20150517075923_rename_bout_number.rb index 11065d4..1f1fb23 100644 --- a/db/migrate/20150517075923_rename_bout_number.rb +++ b/db/migrate/20150517075923_rename_bout_number.rb @@ -1,4 +1,4 @@ -class RenameBoutNumber < ActiveRecord::Migration +class RenameBoutNumber < ActiveRecord::Migration[4.2] def change rename_column :matches, :boutNumber, :bout_number end diff --git a/db/migrate/20150523121319_introduce_indexes.rb b/db/migrate/20150523121319_introduce_indexes.rb index f022d14..225d434 100644 --- a/db/migrate/20150523121319_introduce_indexes.rb +++ b/db/migrate/20150523121319_introduce_indexes.rb @@ -1,4 +1,4 @@ -class IntroduceIndexes < ActiveRecord::Migration +class IntroduceIndexes < ActiveRecord::Migration[4.2] def change add_index :weights, :tournament_id add_index :schools, :tournament_id diff --git a/db/migrate/20150619142023_add_mat_id_to_match.rb b/db/migrate/20150619142023_add_mat_id_to_match.rb index c51fc82..dd10798 100644 --- a/db/migrate/20150619142023_add_mat_id_to_match.rb +++ b/db/migrate/20150619142023_add_mat_id_to_match.rb @@ -1,4 +1,4 @@ -class AddMatIdToMatch < ActiveRecord::Migration +class AddMatIdToMatch < ActiveRecord::Migration[4.2] def change add_column :matches, :mat_id, :integer add_index :matches, :mat_id diff --git a/db/migrate/20150630170119_add_offical_weight_wrestlers.rb b/db/migrate/20150630170119_add_offical_weight_wrestlers.rb index 781ac84..45face0 100644 --- a/db/migrate/20150630170119_add_offical_weight_wrestlers.rb +++ b/db/migrate/20150630170119_add_offical_weight_wrestlers.rb @@ -1,4 +1,4 @@ -class AddOfficalWeightWrestlers < ActiveRecord::Migration +class AddOfficalWeightWrestlers < ActiveRecord::Migration[4.2] def change add_column :tournaments, :weigh_in_ref, :text add_column :wrestlers, :offical_weight, :decimal diff --git a/db/migrate/20151023123932_add_user_id_to_tournaments.rb b/db/migrate/20151023123932_add_user_id_to_tournaments.rb index 66926a3..efb9361 100644 --- a/db/migrate/20151023123932_add_user_id_to_tournaments.rb +++ b/db/migrate/20151023123932_add_user_id_to_tournaments.rb @@ -1,4 +1,4 @@ -class AddUserIdToTournaments < ActiveRecord::Migration +class AddUserIdToTournaments < ActiveRecord::Migration[4.2] def change add_column :tournaments, :user_id, :integer add_index :tournaments, :user_id diff --git a/db/migrate/20151111130227_create_teampointadjusts.rb b/db/migrate/20151111130227_create_teampointadjusts.rb index 039a4bb..c6e2d4c 100644 --- a/db/migrate/20151111130227_create_teampointadjusts.rb +++ b/db/migrate/20151111130227_create_teampointadjusts.rb @@ -1,4 +1,4 @@ -class CreateTeampointadjusts < ActiveRecord::Migration +class CreateTeampointadjusts < ActiveRecord::Migration[4.2] def change create_table :teampointadjusts do |t| t.integer :points diff --git a/db/migrate/20151117152454_add_score_back_to_school.rb b/db/migrate/20151117152454_add_score_back_to_school.rb index 7f8310b..9ecc9e9 100644 --- a/db/migrate/20151117152454_add_score_back_to_school.rb +++ b/db/migrate/20151117152454_add_score_back_to_school.rb @@ -1,4 +1,4 @@ -class AddScoreBackToSchool < ActiveRecord::Migration +class AddScoreBackToSchool < ActiveRecord::Migration[4.2] def change add_column :schools, :score, :decimal end diff --git a/db/migrate/20151216154211_rename_stats.rb b/db/migrate/20151216154211_rename_stats.rb index 3cc1fe7..7e0ed64 100644 --- a/db/migrate/20151216154211_rename_stats.rb +++ b/db/migrate/20151216154211_rename_stats.rb @@ -1,4 +1,4 @@ -class RenameStats < ActiveRecord::Migration +class RenameStats < ActiveRecord::Migration[4.2] def change rename_column :matches, :g_stat, :w1_stat rename_column :matches, :r_stat, :w2_stat diff --git a/db/migrate/20151229220036_create_delayed_jobs.rb b/db/migrate/20151229220036_create_delayed_jobs.rb index 27fdcf6..f90bc1b 100644 --- a/db/migrate/20151229220036_create_delayed_jobs.rb +++ b/db/migrate/20151229220036_create_delayed_jobs.rb @@ -1,4 +1,4 @@ -class CreateDelayedJobs < ActiveRecord::Migration +class CreateDelayedJobs < ActiveRecord::Migration[4.2] def self.up create_table :delayed_jobs, force: true do |table| table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue diff --git a/db/migrate/20151230163202_generating_matches.rb b/db/migrate/20151230163202_generating_matches.rb index c27f573..c719a9a 100644 --- a/db/migrate/20151230163202_generating_matches.rb +++ b/db/migrate/20151230163202_generating_matches.rb @@ -1,4 +1,4 @@ -class GeneratingMatches < ActiveRecord::Migration +class GeneratingMatches < ActiveRecord::Migration[4.2] def change add_column :tournaments, :curently_generating_matches, :integer end diff --git a/db/migrate/20151230164000_tournament_date.rb b/db/migrate/20151230164000_tournament_date.rb index 4824a3d..857feeb 100644 --- a/db/migrate/20151230164000_tournament_date.rb +++ b/db/migrate/20151230164000_tournament_date.rb @@ -1,4 +1,4 @@ -class TournamentDate < ActiveRecord::Migration +class TournamentDate < ActiveRecord::Migration[4.2] def change add_column :tournaments, :date, :date end diff --git a/db/migrate/20160106025920_create_tournament_delegates.rb b/db/migrate/20160106025920_create_tournament_delegates.rb index 8e82b12..81e9e2a 100644 --- a/db/migrate/20160106025920_create_tournament_delegates.rb +++ b/db/migrate/20160106025920_create_tournament_delegates.rb @@ -1,4 +1,4 @@ -class CreateTournamentDelegates < ActiveRecord::Migration +class CreateTournamentDelegates < ActiveRecord::Migration[4.2] def change create_table :tournament_delegates do |t| t.integer :user_id diff --git a/db/migrate/20160106031418_create_school_delegates.rb b/db/migrate/20160106031418_create_school_delegates.rb index ee15009..b77eb9a 100644 --- a/db/migrate/20160106031418_create_school_delegates.rb +++ b/db/migrate/20160106031418_create_school_delegates.rb @@ -1,4 +1,4 @@ -class CreateSchoolDelegates < ActiveRecord::Migration +class CreateSchoolDelegates < ActiveRecord::Migration[4.2] def change create_table :school_delegates do |t| t.integer :user_id diff --git a/db/migrate/20160112152946_add_school_id_to_teampointsadjust.rb b/db/migrate/20160112152946_add_school_id_to_teampointsadjust.rb index 5102f27..dbe7ba9 100644 --- a/db/migrate/20160112152946_add_school_id_to_teampointsadjust.rb +++ b/db/migrate/20160112152946_add_school_id_to_teampointsadjust.rb @@ -1,4 +1,4 @@ -class AddSchoolIdToTeampointsadjust < ActiveRecord::Migration +class AddSchoolIdToTeampointsadjust < ActiveRecord::Migration[4.2] def change add_column :teampointadjusts, :school_id, :integer end diff --git a/db/migrate/20170301174920_add_pool_column.rb b/db/migrate/20170301174920_add_pool_column.rb index 6acb531..da37b5d 100644 --- a/db/migrate/20170301174920_add_pool_column.rb +++ b/db/migrate/20170301174920_add_pool_column.rb @@ -1,4 +1,4 @@ -class AddPoolColumn < ActiveRecord::Migration +class AddPoolColumn < ActiveRecord::Migration[4.2] def change add_column :wrestlers, :pool, :integer end diff --git a/db/schema.rb b/db/schema.rb index 06009f2..a39427c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -14,149 +13,140 @@ ActiveRecord::Schema.define(version: 20170301174920) do create_table "delayed_jobs", force: :cascade do |t| - t.integer "priority", default: 0, null: false - t.integer "attempts", default: 0, null: false - t.text "handler", null: false - t.text "last_error" + t.integer "priority", default: 0, null: false + t.integer "attempts", default: 0, null: false + t.text "handler", null: false + t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" - t.string "locked_by" - t.string "queue" + t.string "locked_by" + t.string "queue" t.datetime "created_at" t.datetime "updated_at" + t.index ["priority", "run_at"], name: "delayed_jobs_priority" end - add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority" - create_table "matches", force: :cascade do |t| - t.integer "w1" - t.integer "w2" - t.text "w1_stat" - t.text "w2_stat" - t.integer "winner_id" - t.string "win_type" - t.string "score" + t.integer "w1" + t.integer "w2" + t.text "w1_stat" + t.text "w2_stat" + t.integer "winner_id" + t.string "win_type" + t.string "score" t.datetime "created_at" t.datetime "updated_at" - t.integer "tournament_id" - t.integer "round" - t.integer "finished" - t.integer "bout_number" - t.integer "weight_id" - t.string "bracket_position" - t.integer "bracket_position_number" - t.string "loser1_name" - t.string "loser2_name" - t.integer "mat_id" + t.integer "tournament_id" + t.integer "round" + t.integer "finished" + t.integer "bout_number" + t.integer "weight_id" + t.string "bracket_position" + t.integer "bracket_position_number" + t.string "loser1_name" + t.string "loser2_name" + t.integer "mat_id" + t.index ["mat_id"], name: "index_matches_on_mat_id" + t.index ["tournament_id"], name: "index_matches_on_tournament_id" + t.index ["w1", "w2"], name: "index_matches_on_w1_and_w2" end - add_index "matches", ["mat_id"], name: "index_matches_on_mat_id" - add_index "matches", ["tournament_id"], name: "index_matches_on_tournament_id" - add_index "matches", ["w1", "w2"], name: "index_matches_on_w1_and_w2" - create_table "mats", force: :cascade do |t| - t.string "name" - t.integer "tournament_id" + t.string "name" + t.integer "tournament_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["tournament_id"], name: "index_mats_on_tournament_id" end - add_index "mats", ["tournament_id"], name: "index_mats_on_tournament_id" - create_table "school_delegates", force: :cascade do |t| - t.integer "user_id" - t.integer "school_id" + t.integer "user_id" + t.integer "school_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "schools", force: :cascade do |t| - t.string "name" + t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.integer "tournament_id" - t.decimal "score" + t.integer "tournament_id" + t.decimal "score" + t.index ["tournament_id"], name: "index_schools_on_tournament_id" end - add_index "schools", ["tournament_id"], name: "index_schools_on_tournament_id" - create_table "teampointadjusts", force: :cascade do |t| - t.integer "points" - t.integer "wrestler_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "school_id" + t.integer "points" + t.integer "wrestler_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "school_id" + t.index ["wrestler_id"], name: "index_teampointadjusts_on_wrestler_id" end - add_index "teampointadjusts", ["wrestler_id"], name: "index_teampointadjusts_on_wrestler_id" - create_table "tournament_delegates", force: :cascade do |t| - t.integer "user_id" - t.integer "tournament_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id" + t.integer "tournament_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "tournaments", force: :cascade do |t| - t.string "name" - t.string "address" - t.string "director" - t.string "director_email" + t.string "name" + t.string "address" + t.string "director" + t.string "director_email" t.datetime "created_at" t.datetime "updated_at" - t.text "tournament_type" - t.text "weigh_in_ref" - t.integer "user_id" - t.integer "curently_generating_matches" - t.date "date" + t.text "tournament_type" + t.text "weigh_in_ref" + t.integer "user_id" + t.integer "curently_generating_matches" + t.date "date" + t.index ["user_id"], name: "index_tournaments_on_user_id" end - add_index "tournaments", ["user_id"], name: "index_tournaments_on_user_id" - create_table "users", force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" t.datetime "created_at" t.datetime "updated_at" + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end - add_index "users", ["email"], name: "index_users_on_email", unique: true - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - create_table "weights", force: :cascade do |t| - t.integer "max" + t.integer "max" t.datetime "created_at" t.datetime "updated_at" - t.integer "tournament_id" + t.integer "tournament_id" + t.index ["tournament_id"], name: "index_weights_on_tournament_id" end - add_index "weights", ["tournament_id"], name: "index_weights_on_tournament_id" - create_table "wrestlers", force: :cascade do |t| - t.string "name" - t.integer "school_id" - t.integer "weight_id" - t.integer "seed" - t.integer "original_seed" + t.string "name" + t.integer "school_id" + t.integer "weight_id" + t.integer "seed" + t.integer "original_seed" t.datetime "created_at" t.datetime "updated_at" - t.integer "season_win" - t.integer "season_loss" - t.string "criteria" - t.boolean "extra" - t.decimal "offical_weight" - t.integer "pool" + t.integer "season_win" + t.integer "season_loss" + t.string "criteria" + t.boolean "extra" + t.decimal "offical_weight" + t.integer "pool" + t.index ["weight_id"], name: "index_wrestlers_on_weight_id" end - add_index "wrestlers", ["weight_id"], name: "index_wrestlers_on_weight_id" - end From c839e2e843d0e5b73a6f3d219716b52c6c078f94 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Fri, 9 Jun 2017 18:00:20 -0400 Subject: [PATCH 10/26] Fixed a eager load bug --- app/controllers/tournaments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index fede68b..a53c88e 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -195,7 +195,7 @@ class TournamentsController < ApplicationController end def show - @schools = @tournament.schools(:delegates) + @schools = @tournament.schools.includes(:delegates) @weights = @tournament.weights.sort_by{|x|[x.max]} @mats = @tournament.mats end From 6fb304f5c734f902f08d30316bd35864d402ac8a Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 10 Aug 2017 20:43:18 -0400 Subject: [PATCH 11/26] Secret key base and devise key added for dev --- config/initializers/devise.rb | 6 +++++- config/initializers/secret_token.rb | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 02bcff4..54e29bc 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -4,7 +4,11 @@ Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmation, reset password and unlock tokens in the database. - config.secret_key = ENV['WRESTLINGDEV_DEVISE_SECRET_KEY'] if Rails.env.production? + if Rails.env.production? + config.secret_key = ENV['WRESTLINGDEV_DEVISE_SECRET_KEY'] + else + config.secret_key = "2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa" + end # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 2553e13..93d57d4 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -9,4 +9,8 @@ # Make sure your secret_key_base is kept private # if you're sharing your code publicly. -Wrestling::Application.config.secret_key_base = ENV['WRESTLINGDEV_SECRET_KEY_BASE'] +if Rails.env.production? + Wrestling::Application.config.secret_key_base = ENV['WRESTLINGDEV_SECRET_KEY_BASE'] +else + Wrestling::Application.config.secret_key_base = "077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2" +end From 5f31879af8d872b6c6b462b3f658229afd89d0af Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Fri, 11 Aug 2017 08:55:17 -0400 Subject: [PATCH 12/26] Remove bad ads --- app/views/tournaments/brackets.html.erb | 3 --- app/views/tournaments/up_matches.html.erb | 3 --- 2 files changed, 6 deletions(-) diff --git a/app/views/tournaments/brackets.html.erb b/app/views/tournaments/brackets.html.erb index a2dbf10..7e1c47d 100644 --- a/app/views/tournaments/brackets.html.erb +++ b/app/views/tournaments/brackets.html.erb @@ -1,6 +1,3 @@ -<% if Rails.env.production? %> - -<% end %> <%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>

diff --git a/app/views/tournaments/up_matches.html.erb b/app/views/tournaments/up_matches.html.erb index 7b880aa..70e3eec 100644 --- a/app/views/tournaments/up_matches.html.erb +++ b/app/views/tournaments/up_matches.html.erb @@ -1,6 +1,3 @@ -<% if params[:print] == nil && Rails.env.production? %> - -<% end %> <% cache ["#{@tournament.id}_up_matches", @tournament] do %> <%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default"%> -<% end %> You do not have permissions to go there. diff --git a/app/views/tournaments/no_matches.html.erb b/app/views/tournaments/no_matches.html.erb index 8b6a0a3..0dc45c3 100644 --- a/app/views/tournaments/no_matches.html.erb +++ b/app/views/tournaments/no_matches.html.erb @@ -1,6 +1,3 @@ -<% if Rails.env.production? %> - -<% end %> <%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>

From e168d0b51d33536150c79d6634cefa0aa304f04f Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 29 Aug 2017 13:02:00 -0400 Subject: [PATCH 15/26] Added functionality for a tournament director to move a wrestler to a pool that has a bye for greater flexibility --- app/controllers/wrestlers_controller.rb | 32 ++++++++++++++++--- app/models/weight.rb | 16 ++++++++++ .../weight_services/generate_pool_numbers.rb | 6 ++-- app/views/tournaments/bracket.html.erb | 16 ++++++++++ config/routes.rb | 1 + 5 files changed, 64 insertions(+), 7 deletions(-) diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index e671465..b8526ec 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -1,6 +1,6 @@ class WrestlersController < ApplicationController - before_action :set_wrestler, only: [:show, :edit, :update, :destroy] - before_action :check_access, only: [:new,:create,:update,:destroy,:edit] + before_action :set_wrestler, only: [:show, :edit, :update, :destroy, :update_pool] + before_action :check_access, only: [:new,:create,:update,:destroy,:edit,:update_pool] @@ -69,6 +69,25 @@ class WrestlersController < ApplicationController end end + def update_pool + @tournament = @wrestler.tournament + @weight = @wrestler.weight + @weights = @tournament.weights.sort_by{|w| w.max} + @school = @wrestler.school + if params[:wrestler]['pool'] + @wrestler.pool = params[:wrestler]['pool'] + respond_to do |format| + if @wrestler.update(wrestler_params) + format.html { redirect_to "/weights/#{@wrestler.weight.id}/", notice: 'Wrestler was successfully updated. Please re-generate this weight classes matches.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @wrestler.errors, status: :unprocessable_entity } + end + end + end + end + # DELETE /wrestlers/1 # DELETE /wrestlers/1.json def destroy @@ -88,14 +107,19 @@ class WrestlersController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def wrestler_params - params.require(:wrestler).permit(:name, :school_id, :weight_id, :seed, :original_seed, :season_win, :season_loss,:criteria,:extra,:offical_weight) + params.require(:wrestler).permit(:name, :school_id, :weight_id, :seed, :original_seed, :season_win, :season_loss,:criteria,:extra,:offical_weight,:pool) end def check_access if params[:school] @school = School.find(params[:school]) #@tournament = Tournament.find(@school.tournament.id) elsif params[:wrestler] - @school = School.find(params[:wrestler]["school_id"]) + if params[:wrestler]["school_id"] + @school = School.find(params[:wrestler]["school_id"]) + else + @wrestler = Wrestler.find(params[:wrestler]["id"]) + @school = @wrestler.school + end #@tournament = Tournament.find(@school.tournament.id) elsif @wrestler @school = @wrestler.school diff --git a/app/models/weight.rb b/app/models/weight.rb index bc86549..10144a1 100644 --- a/app/models/weight.rb +++ b/app/models/weight.rb @@ -17,6 +17,18 @@ class Weight < ActiveRecord::Base # self.tournament.destroyAllMatches end + def pools_with_bye + pool = 1 + pools_with_a_bye = [] + until pool > self.pools do + if wrestlersForPool(pool).first.hasAPoolBye + pools_with_a_bye << pool + end + pool = pool + 1 + end + pools_with_a_bye + end + def wrestlersForPool(poolNumber) #For some reason this does not work # wrestlers.select{|w| w.pool == poolNumber} @@ -97,5 +109,9 @@ class Weight < ActiveRecord::Base def poolOrder(pool) PoolOrder.new(wrestlersForPool(pool)).getPoolOrder end + + def wrestlersWithoutPool + wrestlers.select{|w| w.pool == nil} + end end diff --git a/app/services/weight_services/generate_pool_numbers.rb b/app/services/weight_services/generate_pool_numbers.rb index c8fb179..4844ffe 100644 --- a/app/services/weight_services/generate_pool_numbers.rb +++ b/app/services/weight_services/generate_pool_numbers.rb @@ -5,11 +5,11 @@ class GeneratePoolNumbers def savePoolNumbers if @weight.pools == 4 - saveFourPoolNumbers(@weight.wrestlers) + saveFourPoolNumbers(@weight.wrestlersWithoutPool) elsif @weight.pools == 2 - saveTwoPoolNumbers(@weight.wrestlers) + saveTwoPoolNumbers(@weight.wrestlersWithoutPool) elsif @weight.pools == 1 - saveOnePoolNumbers(@weight.wrestlers) + saveOnePoolNumbers(@weight.wrestlersWithoutPool) end end diff --git a/app/views/tournaments/bracket.html.erb b/app/views/tournaments/bracket.html.erb index 1ee6a27..442af5c 100644 --- a/app/views/tournaments/bracket.html.erb +++ b/app/views/tournaments/bracket.html.erb @@ -103,4 +103,20 @@ li:first-child,li:last-child {
<%= submit_tag "Swap", :class=>"btn btn-success"%> <% end %> +<% end %> +<% if can? :manage, @tournament %> +

+

Move wrestler to pool with a bye

+ <%= form_tag '/wrestlers/update_pool' do %> +
+ <%= label_tag 'Wrestler to move' %>
+ <%= collection_select(:wrestler, :id, @weight.wrestlers, :id, :name) %> +
+
+ <%= label_tag 'Pool to move to' %>
+ <%= select :wrestler, :pool, @weight.pools_with_bye %> +
+
+ <%= submit_tag "Move", :class=>"btn btn-success"%> + <% end %> <% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 8a0b0c2..c13e345 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -52,6 +52,7 @@ Wrestling::Application.routes.draw do post "/tournaments/:id/swap" => "tournaments#swap", :as => :swap_wrestlers post 'weights/:id/re_gen' => 'weights#re_gen', :as => :regen_weight + post "/wrestlers/update_pool" => "wrestlers#update_pool" #API get "/api/tournaments" => "api#tournaments" From 5bebc342a6d1be9f457daef1848d2a4ed20767aa Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 29 Aug 2017 13:03:30 -0400 Subject: [PATCH 16/26] Gemfile.lock should not be in source control --- .gitignore | 1 + Gemfile.lock | 220 --------------------------------------------------- 2 files changed, 1 insertion(+), 220 deletions(-) delete mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index a096644..4fb32d6 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ .rvmrc /deploy/prod.env frontend/node_modules +Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 890e589..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,220 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actioncable (5.1.1) - actionpack (= 5.1.1) - nio4r (~> 2.0) - websocket-driver (~> 0.6.1) - actionmailer (5.1.1) - actionpack (= 5.1.1) - actionview (= 5.1.1) - activejob (= 5.1.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (5.1.1) - actionview (= 5.1.1) - activesupport (= 5.1.1) - rack (~> 2.0) - rack-test (~> 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.1) - activesupport (= 5.1.1) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.1) - activesupport (= 5.1.1) - globalid (>= 0.3.6) - activemodel (5.1.1) - activesupport (= 5.1.1) - activerecord (5.1.1) - activemodel (= 5.1.1) - activesupport (= 5.1.1) - arel (~> 8.0) - activesupport (5.1.1) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) - minitest (~> 5.1) - tzinfo (~> 1.1) - arel (8.0.0) - ast (2.3.0) - bcrypt (3.1.11) - brakeman (3.6.2) - builder (3.2.3) - bullet (5.5.1) - activesupport (>= 3.0.0) - uniform_notifier (~> 1.10.0) - cancancan (2.0.0) - coffee-rails (4.2.2) - coffee-script (>= 2.2.0) - railties (>= 4.0.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - concurrent-ruby (1.0.5) - dalli (2.7.6) - delayed_job (4.1.3) - activesupport (>= 3.0, < 5.2) - delayed_job_active_record (4.1.2) - activerecord (>= 3.0, < 5.2) - delayed_job (>= 3.0, < 5) - devise (4.3.0) - bcrypt (~> 3.0) - orm_adapter (~> 0.1) - railties (>= 4.1.0, < 5.2) - responders - warden (~> 1.2.3) - erubi (1.6.0) - execjs (2.7.0) - globalid (0.4.0) - activesupport (>= 4.2.0) - i18n (0.8.4) - jbuilder (2.7.0) - activesupport (>= 4.2.0) - multi_json (>= 1.2) - jquery-rails (4.3.1) - rails-dom-testing (>= 1, < 3) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) - json (1.8.6) - libv8 (3.16.14.19) - loofah (2.0.3) - nokogiri (>= 1.5.9) - mail (2.6.5) - mime-types (>= 1.16, < 4) - method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.2.0) - minitest (5.10.2) - multi_json (1.12.1) - mysql2 (0.4.6) - newrelic_rpm (4.2.0.334) - nio4r (2.1.0) - nokogiri (1.8.0) - mini_portile2 (~> 2.2.0) - orm_adapter (0.5.0) - parallel (1.11.2) - parser (2.4.0.0) - ast (~> 2.2) - powerpack (0.1.1) - puma (3.9.1) - rack (2.0.3) - rack-test (0.6.3) - rack (>= 1.0) - rails (5.1.1) - actioncable (= 5.1.1) - actionmailer (= 5.1.1) - actionpack (= 5.1.1) - actionview (= 5.1.1) - activejob (= 5.1.1) - activemodel (= 5.1.1) - activerecord (= 5.1.1) - activesupport (= 5.1.1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.1.1) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - rails_12factor (0.0.3) - rails_serve_static_assets - rails_stdout_logging - rails_serve_static_assets (0.0.5) - rails_stdout_logging (0.0.5) - railties (5.1.1) - actionpack (= 5.1.1) - activesupport (= 5.1.1) - method_source - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (2.2.2) - rake - rake (12.0.0) - rb-readline (0.5.4) - rdoc (4.3.0) - ref (2.0.0) - responders (2.4.0) - actionpack (>= 4.2.0, < 5.3) - railties (>= 4.2.0, < 5.3) - round_robin_tournament (0.0.1) - rubocop (0.49.1) - parallel (~> 1.10) - parser (>= 2.3.3.1, < 3.0) - powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.8.1) - sdoc (0.4.2) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) - spring (2.0.2) - activesupport (>= 4.2) - sprockets (3.7.1) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.0) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.3.13) - therubyracer (0.12.3) - libv8 (~> 3.16.14.15) - ref - thor (0.19.4) - thread_safe (0.3.6) - turbolinks (5.0.1) - turbolinks-source (~> 5) - turbolinks-source (5.0.3) - tzinfo (1.2.3) - thread_safe (~> 0.1) - uglifier (3.2.0) - execjs (>= 0.3.0, < 3) - unicode-display_width (1.2.1) - uniform_notifier (1.10.0) - warden (1.2.7) - rack (>= 1.0) - websocket-driver (0.6.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) - -PLATFORMS - ruby - -DEPENDENCIES - brakeman - bullet - cancancan - coffee-rails - dalli - delayed_job_active_record - devise - jbuilder - jquery-rails - mysql2 - newrelic_rpm - puma - rails (= 5.1.1) - rails_12factor - rb-readline - round_robin_tournament - rubocop - sdoc - spring - sqlite3 - therubyracer - turbolinks - uglifier - -RUBY VERSION - ruby 2.4.0p0 - -BUNDLED WITH - 1.15.1 From 594469f4d8f580a4f249268698fad0914708cf82 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 29 Aug 2017 13:52:26 -0400 Subject: [PATCH 17/26] Gemfile.lock no longer exists in repo --- rails-prod-Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index 471cd64..00c47e4 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -23,7 +23,6 @@ EXPOSE 443 #Cache gems so they don't install on every code change WORKDIR /tmp COPY Gemfile Gemfile -COPY Gemfile.lock Gemfile.lock RUN bundle install --without test # Copy site into place. From e40851d9fc7a653dc7c16f70eb6500c1608838f9 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Sat, 2 Sep 2017 11:48:23 -0400 Subject: [PATCH 18/26] Pool numbers need swapped when wrestlers are swapped --- app/services/wrestler_services/swap_wrestlers.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/wrestler_services/swap_wrestlers.rb b/app/services/wrestler_services/swap_wrestlers.rb index c3a0502..772beaa 100644 --- a/app/services/wrestler_services/swap_wrestlers.rb +++ b/app/services/wrestler_services/swap_wrestlers.rb @@ -11,15 +11,18 @@ class SwapWrestlers w3.weight_id = w1.weight_id w3.original_seed = w1.original_seed w3.seed = w1.seed + w3.pool = w1.pool swapWrestlerMatches(w1.allMatches,w1.id,w3.id) #Swap wrestler 1 and wrestler 2 swapWrestlerMatches(w2.allMatches,w2.id,w1.id) w1.seed = w2.seed + w1.pool = w2.pool swapWrestlerMatches(w3.allMatches,w3.id,w2.id) w2.seed = w3.seed + w2.pool = w3.pool w1.save From 16d63b52cd86739dccff5249b0845aa268e11f53 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Mon, 4 Sep 2017 21:53:28 -0400 Subject: [PATCH 19/26] Made a test for the swap wrestlers service --- test/fixtures/schools.yml | 5 ++ test/fixtures/tournaments.yml | 10 ++- test/fixtures/weights.yml | 5 ++ test/fixtures/wrestlers.yml | 84 +++++++++++++++++++++++++ test/integration/swap_wrestlers_test.rb | 28 +++++++++ 5 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 test/integration/swap_wrestlers_test.rb diff --git a/test/fixtures/schools.yml b/test/fixtures/schools.yml index 5887553..da62b28 100644 --- a/test/fixtures/schools.yml +++ b/test/fixtures/schools.yml @@ -15,3 +15,8 @@ three: name: Central Crossing tournament_id: 2 +swap_wrestlers: + id: 4 + name: Central Crossing + tournament_id: 3 + diff --git a/test/fixtures/tournaments.yml b/test/fixtures/tournaments.yml index f2f3b1d..39dfba1 100644 --- a/test/fixtures/tournaments.yml +++ b/test/fixtures/tournaments.yml @@ -20,4 +20,12 @@ two: user_id: 1 date: 2015-12-30 - +swap_wrestlers_tournament: + id: 3 + name: Comet Classic 2 + address: Some Place + director: Jacob Cody Wimer + director_email: jacob.wimer@gmail.com + tournament_type: Pool to bracket + user_id: 1 + date: 2015-12-30 diff --git a/test/fixtures/weights.yml b/test/fixtures/weights.yml index 6acf337..943d92f 100644 --- a/test/fixtures/weights.yml +++ b/test/fixtures/weights.yml @@ -30,3 +30,8 @@ six: id: 6 max: 285 tournament_id: 1 + +swap_wrestlers: + id: 7 + max: 138 + tournament_id: 3 diff --git a/test/fixtures/wrestlers.yml b/test/fixtures/wrestlers.yml index 2c2aeed..2d25175 100644 --- a/test/fixtures/wrestlers.yml +++ b/test/fixtures/wrestlers.yml @@ -689,5 +689,89 @@ tournament_1_wrestler_53: extra: pool: 1 +swap_wrestlers_wrestler_1: + id: 54 + name: Guy1 + school_id: 4 + weight_id: 7 + original_seed: 1 + season_loss: 0 + season_win: 0 + criteria: + extra: + +swap_wrestlers_wrestler_2: + id: 55 + name: Guy2 + school_id: 4 + weight_id: 7 + original_seed: 2 + season_loss: 0 + season_win: 0 + criteria: + extra: + +swap_wrestlers_wrestler_3: + name: Guy3 + school_id: 4 + weight_id: 7 + original_seed: 3 + season_loss: 0 + season_win: 0 + criteria: + extra: + +swap_wrestlers_wrestler_4: + name: Guy4 + school_id: 4 + weight_id: 7 + original_seed: 4 + season_loss: 0 + season_win: 0 + criteria: + extra: + +swap_wrestlers_wrestler_5: + name: Guy5 + school_id: 4 + weight_id: 7 + original_seed: + season_loss: 0 + season_win: 0 + criteria: + extra: + +swap_wrestlers_wrestler_6: + name: Guy6 + school_id: 4 + weight_id: 7 + original_seed: + season_loss: 0 + season_win: 0 + criteria: + extra: + +swap_wrestlers_wrestler_7: + name: Guy7 + school_id: 4 + weight_id: 7 + original_seed: + season_loss: 0 + season_win: 0 + criteria: + extra: + +swap_wrestlers_wrestler_8: + name: Guy8 + school_id: 4 + weight_id: 7 + original_seed: + season_loss: 0 + season_win: 0 + criteria: + extra: + + + diff --git a/test/integration/swap_wrestlers_test.rb b/test/integration/swap_wrestlers_test.rb new file mode 100644 index 0000000..1325274 --- /dev/null +++ b/test/integration/swap_wrestlers_test.rb @@ -0,0 +1,28 @@ +require 'test_helper' + +class SwapWrestlersTest < ActionDispatch::IntegrationTest + def setup + @tournament = tournaments(:swap_wrestlers_tournament) + GenerateTournamentMatches.new(@tournament).generate + end + + test "Wrestlers from different pools are swapped matches correctly" do + wrestler1 = wrestlers(:swap_wrestlers_wrestler_1) + wrestler2 = wrestlers(:swap_wrestlers_wrestler_2) + wrestler3 = wrestlers(:swap_wrestlers_wrestler_3) + wrestler4 = wrestlers(:swap_wrestlers_wrestler_4) + SwapWrestlers.new.swapWrestlers(wrestler1.id,wrestler2.id) + + #Variable needs refreshed otherwise asserts fail + wrestler1 = Wrestler.find(54) + wrestler2 = Wrestler.find(55) + + assert_not_empty wrestler1.matchAgainst(wrestler3) + assert_equal 2, wrestler1.pool + assert_equal 2, wrestler1.seed + + assert_not_empty wrestler2.matchAgainst(wrestler4) + assert_equal 1, wrestler2.pool + assert_equal 1, wrestler2.seed + end +end From 611f54f5224b85a2c29f7f823f3b34b44949ae53 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 7 Nov 2017 12:56:27 -0500 Subject: [PATCH 20/26] Keeping Gemfile.lock for versioning of gems --- .gitignore | 1 - Gemfile.lock | 220 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index 4fb32d6..a096644 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,3 @@ .rvmrc /deploy/prod.env frontend/node_modules -Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..e78c9a0 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,220 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.1.1) + actionpack (= 5.1.1) + nio4r (~> 2.0) + websocket-driver (~> 0.6.1) + actionmailer (5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.1.1) + actionview (= 5.1.1) + activesupport (= 5.1.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.1.1) + activesupport (= 5.1.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.1.1) + activesupport (= 5.1.1) + globalid (>= 0.3.6) + activemodel (5.1.1) + activesupport (= 5.1.1) + activerecord (5.1.1) + activemodel (= 5.1.1) + activesupport (= 5.1.1) + arel (~> 8.0) + activesupport (5.1.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (~> 0.7) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (8.0.0) + ast (2.3.0) + bcrypt (3.1.11) + brakeman (3.7.2) + builder (3.2.3) + bullet (5.6.1) + activesupport (>= 3.0.0) + uniform_notifier (~> 1.10.0) + cancancan (2.0.0) + coffee-rails (4.2.2) + coffee-script (>= 2.2.0) + railties (>= 4.0.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.0.5) + dalli (2.7.6) + delayed_job (4.1.3) + activesupport (>= 3.0, < 5.2) + delayed_job_active_record (4.1.2) + activerecord (>= 3.0, < 5.2) + delayed_job (>= 3.0, < 5) + devise (4.3.0) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0, < 5.2) + responders + warden (~> 1.2.3) + erubi (1.6.1) + execjs (2.7.0) + globalid (0.4.0) + activesupport (>= 4.2.0) + i18n (0.8.6) + jbuilder (2.7.0) + activesupport (>= 4.2.0) + multi_json (>= 1.2) + jquery-rails (4.3.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json (1.8.6) + libv8 (3.16.14.19) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.6) + mime-types (>= 1.16, < 4) + method_source (0.8.2) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_portile2 (2.2.0) + minitest (5.10.3) + multi_json (1.12.2) + mysql2 (0.4.9) + newrelic_rpm (4.4.0.336) + nio4r (2.1.0) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) + orm_adapter (0.5.0) + parallel (1.12.0) + parser (2.4.0.0) + ast (~> 2.2) + powerpack (0.1.1) + puma (3.10.0) + rack (2.0.3) + rack-test (0.6.3) + rack (>= 1.0) + rails (5.1.1) + actioncable (= 5.1.1) + actionmailer (= 5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) + activemodel (= 5.1.1) + activerecord (= 5.1.1) + activesupport (= 5.1.1) + bundler (>= 1.3.0, < 2.0) + railties (= 5.1.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + rails_12factor (0.0.3) + rails_serve_static_assets + rails_stdout_logging + rails_serve_static_assets (0.0.5) + rails_stdout_logging (0.0.5) + railties (5.1.1) + actionpack (= 5.1.1) + activesupport (= 5.1.1) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rainbow (2.2.2) + rake + rake (12.1.0) + rb-readline (0.5.5) + rdoc (4.3.0) + ref (2.0.0) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) + round_robin_tournament (0.0.1) + rubocop (0.49.1) + parallel (~> 1.10) + parser (>= 2.3.3.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) + sdoc (0.4.2) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + spring (2.0.2) + activesupport (>= 4.2) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) + ref + thor (0.20.0) + thread_safe (0.3.6) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.3) + tzinfo (1.2.3) + thread_safe (~> 0.1) + uglifier (3.2.0) + execjs (>= 0.3.0, < 3) + unicode-display_width (1.3.0) + uniform_notifier (1.10.0) + warden (1.2.7) + rack (>= 1.0) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) + +PLATFORMS + ruby + +DEPENDENCIES + brakeman + bullet + cancancan + coffee-rails + dalli + delayed_job_active_record + devise + jbuilder + jquery-rails + mysql2 + newrelic_rpm + puma + rails (= 5.1.1) + rails_12factor + rb-readline + round_robin_tournament + rubocop + sdoc + spring + sqlite3 + therubyracer + turbolinks + uglifier + +RUBY VERSION + ruby 2.4.0p0 + +BUNDLED WITH + 1.15.4 From 4089d3782553c3c29e1af70650a209910d89378b Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 9 Nov 2017 08:13:29 -0500 Subject: [PATCH 21/26] Fixed query issue for advancing losing wrestlers in a 'pool to bracket' bracket --- app/services/bracket_advancement/pool_advance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/bracket_advancement/pool_advance.rb b/app/services/bracket_advancement/pool_advance.rb index b70855f..e708dd9 100644 --- a/app/services/bracket_advancement/pool_advance.rb +++ b/app/services/bracket_advancement/pool_advance.rb @@ -67,7 +67,7 @@ class PoolAdvance def loserAdvance bout = @wrestler.lastMatch.bout_number - next_match = Match.where("loser1_name = ? OR loser2_name = ? AND weight_id = ?","Loser of #{bout}","Loser of #{bout}",@wrestler.weight_id) + next_match = Match.where("(loser1_name = ? OR loser2_name = ?) AND weight_id = ?","Loser of #{bout}","Loser of #{bout}",@wrestler.weight_id) if next_match.size > 0 next_match.first.replaceLoserNameWithWrestler(@wrestler,"Loser of #{bout}") end From 94bb5affa35bef6c3d1a0ffea3759e6fe8554dcd Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 9 Nov 2017 08:53:04 -0500 Subject: [PATCH 22/26] Added Gemfile.lock to docker build --- rails-prod-Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index 00c47e4..471cd64 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -23,6 +23,7 @@ EXPOSE 443 #Cache gems so they don't install on every code change WORKDIR /tmp COPY Gemfile Gemfile +COPY Gemfile.lock Gemfile.lock RUN bundle install --without test # Copy site into place. From 5cfcfe0448abd5c4829445a4feb36a650bb53bf8 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Mon, 13 Nov 2017 08:42:16 -0500 Subject: [PATCH 23/26] Added info to match edit (mat -> show) and up_matches pages. --- .tmux.sh.swp | Bin 0 -> 12288 bytes app/views/mats/._match_edit_form.html.erb.swp | Bin 0 -> 20480 bytes app/views/mats/_match_edit_form.html.erb | 28 +++++++++--------- app/views/tournaments/up_matches.html.erb | 14 ++++----- 4 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 .tmux.sh.swp create mode 100644 app/views/mats/._match_edit_form.html.erb.swp diff --git a/.tmux.sh.swp b/.tmux.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..dd840161e1cbae35b59693f644a6b76e94010f4e GIT binary patch literal 12288 zcmeI&O-lkn7zgmj=xRmXI*k>0TGw8n2s)G*c*wvv=oG6v=#s9ov$=W6&rtL|f-ZfB zt{u8|>k9;3dnUDf3-c)a7yb-8^UTc7?c{*R6-=jB&s8qLG zx_i>2>ulMaR7N+t(DY=ZuFSxb%C987I^0uX=z1Rwwb2tWV=5SVEJzY(G~pJ1+gig33L4Yl1@G!TFQ1Rwwb z2tWV=5P$##AOHaf%%Ff}6CEuO-Es8)|GnS;AB#k}0-?N;mGRltM8FXdP9qBFN+Qy}9DG@DNsvQNC*7`5o1TZ~_R+_yBH+Q{Df>15_O=SexRjgmhf$CCzz^f{DN%Bj1;u!W&U Uk%rI?`cFga5wqyHram)$0ZM+Txc~qF literal 0 HcmV?d00001 diff --git a/app/views/mats/._match_edit_form.html.erb.swp b/app/views/mats/._match_edit_form.html.erb.swp new file mode 100644 index 0000000000000000000000000000000000000000..a70785a5560c3874d25f60167c81b04771b94ee6 GIT binary patch literal 20480 zcmeHPZHy#E8E%9_PX!b)@jFH9Wp`y~W@mQc$lmM%x9pKsZe4d*4Ydr? zy=*kmp5(ciuD810x1P7EyQ<#zwm$XIrK9X%aYn=EO`7(^H}`++Jr`fE{i&mA4cFYF z;!z)}XY$Qa)wEAi#gfN6u3zeT+z)Ka*}#qci<>%~k^yX5yyutNM&Orf__xujanlNF zP1kD|TS40{a<4v8U0xw)AZH+Apc^y`*I%YhSISdV^j`gH_LeI@5=ry#oPnHyoPnHy zoPnHyoPnHyoPnHy{{ses&c)iN(9hR|eHG^b_c2>kOMEjPSdu4eZZGqt7%sOr!LjBOM%n-H0_}M{z;&2q&gs2!!L*u9?&&Pp>hL*T z%5>JS4d2IQ;4q-zcN-1v`|@{NXRgz*t;XGRdbeX50bdJ{7ct%|PmZ0sSv1GZQ)3hQ zd~{JQ$#&IXf`V(1g|CtXlWxQ(g?*&K?`O?sgJZ;wo)oHSi)=!maUd z2J;dFtWxN3$FPH~5$2hOv%$R)1FSMRwo;~nwNj3)*&!O0Nav{8m0f2zz1WEPRW4+lUzs&$oM7cbrU{l=ZI&6Zc}EG$wt4ZDkF>4wL-qtD+$U)7S7?RbO7O?`fqo7*c_gI2h%>Oa~GqEBR`-)On6 z9Y6D{k^;F_t`y))7fWTVep|F$nbYO>vC0Ao#)FpSW0BB*i;QHjybA^sbuWOy;e-(3 zyP~_#V1J}W43>9fusoE(@*oDoF$;ZSkX8euZu4ksA}$2k)z-}XVYeH|k$I!Y&Mwwb zP;U=NFq@+pe{-{W3PVU*txk z#Y~r-!kwog#kh-BQ<`aV;hb^b5{D~fOtemUxfWIoUI$kV0wN~ z-aIAGhn7u<9yLXOX#f8l_S9EnuTA^^D1Lt)d;OPyZvo!`9t7?K=p5i6a2=on`+&b; zzyBogL)!NP_W>60Vcmd*o!Ujb);F90sE0#tyv0sq1|!3)6efk%J` z01sFLt_8}#6!0$KJkAbY0DcFY0los91RB5xfhpiB;4ID*o&kOd{1kW;_%84{zydx1 zOafN|{{$Cw{_tzyVc>qi295$H;2MDVVnF`M8ORyP8ORyP8ORyaK`ifyS)|IJY!EDqxVgN4x%{a|T$U_Mw#C)9%_bigu9 zGCfo>Gei;{HxF(xK35qm4o^P@3*%EhA#Qe^hS;L^Dq>qYK5>%P-_jx2Z4GsYB1=0% z5vs0GL@7roGSv-=DB%R9JmG>=dF+5xc}%}jo+4k7rKwkhD)EYFDDA7KRmHL!0MSe=E(w`D09FUSET(C_NJ7Jq7c0)>%azsj+c1238IwK_<=8p0$ zbU33pB;m$w?oecDXDC9|6^bb32t}s4K@laKpp++EkSdQIkSdSqSISf5E3!28iclq9 z5e=n%H8l%Nx6y5LCn#?4VA1CE^YGS^Ic}K~MG@6qreNY68y4H8cSihdOZXo5CmwLS z)}ls&6eV##r3%{rQ||twVf;VJ@4pNC`afgez5x6Ld-5Lu-v%xLK7)Pti`Y|h;C5gc z_&WB@6u-X@I05*81JK@j6*vkU1l|g~fPM4Rz+Zr$1D^#JfLUM~csKB6#QS~VIM4v< zz%+0UXBB6Ge*munPXp(W3vd?rJMa?lBJd3GIPiVotH2k52Y@Z$EQ4oDDEz8)vGoq$wB7 zS$H}eamHAwbj04usr~R$=>Pn1TK{hZtf0xLCLCmw)Gjdquo;0w3cp zRd5ZXFb=zh=`0+LvZ3RCvYFVeN(PMh6C&K3q!#+l4J}zCedCd~Nqrs5UX0VYrRWhK zS4p%$p$WQuZs>#(N3FFm?4*YyghuRsB#>mgS4NbQ_r|uRDWC~PBX>;+po(R)M z-K|O^==7fgiGH`< zwt^_l3L!&}2VKuWFwtpRUVD6O$)`{o6Ny1?Q~d5(j)P#w7)I_eTF1gcB5Kwwb8Mn0 zV`=^!ySPQh#JIWSnEb?@BIpU7V>cjmWRlIw%(40O@$s~@nD zErfC1f5eq3zjKbAOMM3oBCfj#eryH=2C8M9L#c?a1w)oRQ zNR*?IRAfs{X7Z-dwc%KgA|Op}Aq-=4gjQG`;gh?IZ1IHA?$~^m9V}EPSy}vx%9Yva znaJb>gThc5ZyC}bJQ68}i?B>B3}w#BaRTp8B7_@0uzYYt1+!tM+4e3U6Jtj7b_EtA zv5q38_@ZGbo4gL`iT%s9v`BArYnaWePy}7TPggu;W>6!`m92 z=XPolVMRPvESFL#4=HaM%Cl6&`h5Q~PAy5M7sS#3ZCz1w^`brV&N+|jT0VM8rIJCB ztG7VOWD9Z|KF};!6K6g2qw&WK&%s+=WmROWR{Goay|HkOEL;l@#9|Z0Xv3U`TN9a# z{VnXyx-;jX?24X#sC_s+iBpX|GI2+KvJR?n1HZFLS;y3cCm16&GgE?bW=mv3@A3ua n7gq}53B?}qBCR>R`}E@e#6uGU(~FVdI5NF>m#nQ1&o2Hqg;dSz literal 0 HcmV?d00001 diff --git a/app/views/mats/_match_edit_form.html.erb b/app/views/mats/_match_edit_form.html.erb index d5dd506..08dbcab 100644 --- a/app/views/mats/_match_edit_form.html.erb +++ b/app/views/mats/_match_edit_form.html.erb @@ -10,15 +10,15 @@ <% end %> -

Bout <%= @match.bout_number %>

+

Bout: <%= @match.bout_number %>

Round: <%= @match.round %>

Weight: <%= @match.weight_max %> lbs

- - @@ -94,7 +94,7 @@
<%= f.submit onclick: "return confirm('Is the name of the winner ' + document.getElementById('match_winner_id').options[document.getElementById('match_winner_id').selectedIndex].text + '?')", :class=>"btn btn-success" %> - +
<% end %> @@ -116,17 +116,17 @@ w1.stats=document.getElementById("match_w1_stat").value; w2.stats=document.getElementById("match_w2_stat").value; } - + function takedown(wrestler){ updateStats(wrestler,"T2") } - + function updateStats(wrestler,text){ updatejsvalues(); wrestler.stats = wrestler.stats + text + " "; updatehtmlvalues(); } - + //For Changing button colors function changeW1Color(color){ if (color.value == "red") { @@ -140,7 +140,7 @@ document.getElementById("w2-color").value = "red"; } } - + function changeW2Color(color){ if (color.value == "red") { w2Red(); @@ -153,15 +153,15 @@ document.getElementById("w1-color").value = "red"; } } - + function redColor(id){ document.getElementById(id).className = "btn btn-danger btn-sm"; } - + function greenColor(id){ document.getElementById(id).className = "btn btn-success btn-sm"; } - + function w1Red(){ redColor("w1-takedown"); redColor("w1-escape"); @@ -177,7 +177,7 @@ redColor("w1-stalling"); redColor("w1-caution"); } - + function w1Green(){ greenColor("w1-takedown"); greenColor("w1-escape"); @@ -193,7 +193,7 @@ greenColor("w1-stalling"); greenColor("w1-caution"); } - + function w2Red(){ redColor("w2-takedown"); redColor("w2-escape"); @@ -209,7 +209,7 @@ redColor("w2-stalling"); redColor("w2-caution"); } - + function w2Green(){ greenColor("w2-takedown"); greenColor("w2-escape"); diff --git a/app/views/tournaments/up_matches.html.erb b/app/views/tournaments/up_matches.html.erb index 70e3eec..1406d9b 100644 --- a/app/views/tournaments/up_matches.html.erb +++ b/app/views/tournaments/up_matches.html.erb @@ -24,15 +24,15 @@ - + <% @mats.each.map do |m| %> - - - - + + + + <% end %> @@ -49,7 +49,7 @@ - + <% if @matches.size > 0 %> <% @matches.each.map do |m| %> @@ -63,6 +63,6 @@ <% end %>
<%= @w1.name %> <%= @w1.name %> - <%= @w1.school.name %>
Last Match: <%= if @w1.lastMatch != nil then time_ago_in_words(@w1.lastMatch.updated_at) end%>
<%= @w2.name %> <%= @w2.name %> - <%= @w2.school.name %>
Last Match: <%= if @w2.lastMatch != nil then time_ago_in_words(@w2.lastMatch.updated_at) end%>
Warm Up
<%= m.name %><% if m.unfinishedMatches.first %><%=m.unfinishedMatches.first.bout_number%>
<%= m.unfinishedMatches.first.w1_name %> vs. <%= m.unfinishedMatches.first.w2_name %><% end %>
<% if m.unfinishedMatches.second %><%=m.unfinishedMatches.second.bout_number%>
<%= m.unfinishedMatches.second.w1_name %> vs. <%= m.unfinishedMatches.second.w2_name %><% end %>
<% if m.unfinishedMatches.third %><%=m.unfinishedMatches.third.bout_number%>
<%= m.unfinishedMatches.third.w1_name %> vs. <%= m.unfinishedMatches.third.w2_name %><% end %>
<% if m.unfinishedMatches.fourth %><%=m.unfinishedMatches.fourth.bout_number%>
<%= m.unfinishedMatches.fourth.w1_name %> vs. <%= m.unfinishedMatches.fourth.w2_name %><% end %>
<% if m.unfinishedMatches.first %><%=m.unfinishedMatches.first.bout_number%> - <%= m.unfinishedMatches.first.weight_max %> lbs
<%= m.unfinishedMatches.first.w1_name %> vs. <%= m.unfinishedMatches.first.w2_name %><% end %>
<% if m.unfinishedMatches.second %><%=m.unfinishedMatches.second.bout_number%> - <%= m.unfinishedMatches.second.weight_max %> lbs
<%= m.unfinishedMatches.second.w1_name %> vs. <%= m.unfinishedMatches.second.w2_name %><% end %>
<% if m.unfinishedMatches.third %><%=m.unfinishedMatches.third.bout_number%> - <%= m.unfinishedMatches.third.weight_max %> lbs
<%= m.unfinishedMatches.third.w1_name %> vs. <%= m.unfinishedMatches.third.w2_name %><% end %>
<% if m.unfinishedMatches.fourth %><%=m.unfinishedMatches.fourth.bout_number%> - <%= m.unfinishedMatches.fourth.weight_max %> lbs
<%= m.unfinishedMatches.fourth.w1_name %> vs. <%= m.unfinishedMatches.fourth.w2_name %><% end %>
Matchup
- +
<% end %> From da37cc9effbf49ede357322f81ef1a00e0d8fa57 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Mon, 13 Nov 2017 08:44:26 -0500 Subject: [PATCH 24/26] Did not want to add .swp files --- .tmux.sh.swp | Bin 12288 -> 0 bytes app/views/mats/._match_edit_form.html.erb.swp | Bin 20480 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .tmux.sh.swp delete mode 100644 app/views/mats/._match_edit_form.html.erb.swp diff --git a/.tmux.sh.swp b/.tmux.sh.swp deleted file mode 100644 index dd840161e1cbae35b59693f644a6b76e94010f4e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&O-lkn7zgmj=xRmXI*k>0TGw8n2s)G*c*wvv=oG6v=#s9ov$=W6&rtL|f-ZfB zt{u8|>k9;3dnUDf3-c)a7yb-8^UTc7?c{*R6-=jB&s8qLG zx_i>2>ulMaR7N+t(DY=ZuFSxb%C987I^0uX=z1Rwwb2tWV=5SVEJzY(G~pJ1+gig33L4Yl1@G!TFQ1Rwwb z2tWV=5P$##AOHaf%%Ff}6CEuO-Es8)|GnS;AB#k}0-?N;mGRltM8FXdP9qBFN+Qy}9DG@DNsvQNC*7`5o1TZ~_R+_yBH+Q{Df>15_O=SexRjgmhf$CCzz^f{DN%Bj1;u!W&U Uk%rI?`cFga5wqyHram)$0ZM+Txc~qF diff --git a/app/views/mats/._match_edit_form.html.erb.swp b/app/views/mats/._match_edit_form.html.erb.swp deleted file mode 100644 index a70785a5560c3874d25f60167c81b04771b94ee6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeHPZHy#E8E%9_PX!b)@jFH9Wp`y~W@mQc$lmM%x9pKsZe4d*4Ydr? zy=*kmp5(ciuD810x1P7EyQ<#zwm$XIrK9X%aYn=EO`7(^H}`++Jr`fE{i&mA4cFYF z;!z)}XY$Qa)wEAi#gfN6u3zeT+z)Ka*}#qci<>%~k^yX5yyutNM&Orf__xujanlNF zP1kD|TS40{a<4v8U0xw)AZH+Apc^y`*I%YhSISdV^j`gH_LeI@5=ry#oPnHyoPnHy zoPnHyoPnHyoPnHy{{ses&c)iN(9hR|eHG^b_c2>kOMEjPSdu4eZZGqt7%sOr!LjBOM%n-H0_}M{z;&2q&gs2!!L*u9?&&Pp>hL*T z%5>JS4d2IQ;4q-zcN-1v`|@{NXRgz*t;XGRdbeX50bdJ{7ct%|PmZ0sSv1GZQ)3hQ zd~{JQ$#&IXf`V(1g|CtXlWxQ(g?*&K?`O?sgJZ;wo)oHSi)=!maUd z2J;dFtWxN3$FPH~5$2hOv%$R)1FSMRwo;~nwNj3)*&!O0Nav{8m0f2zz1WEPRW4+lUzs&$oM7cbrU{l=ZI&6Zc}EG$wt4ZDkF>4wL-qtD+$U)7S7?RbO7O?`fqo7*c_gI2h%>Oa~GqEBR`-)On6 z9Y6D{k^;F_t`y))7fWTVep|F$nbYO>vC0Ao#)FpSW0BB*i;QHjybA^sbuWOy;e-(3 zyP~_#V1J}W43>9fusoE(@*oDoF$;ZSkX8euZu4ksA}$2k)z-}XVYeH|k$I!Y&Mwwb zP;U=NFq@+pe{-{W3PVU*txk z#Y~r-!kwog#kh-BQ<`aV;hb^b5{D~fOtemUxfWIoUI$kV0wN~ z-aIAGhn7u<9yLXOX#f8l_S9EnuTA^^D1Lt)d;OPyZvo!`9t7?K=p5i6a2=on`+&b; zzyBogL)!NP_W>60Vcmd*o!Ujb);F90sE0#tyv0sq1|!3)6efk%J` z01sFLt_8}#6!0$KJkAbY0DcFY0los91RB5xfhpiB;4ID*o&kOd{1kW;_%84{zydx1 zOafN|{{$Cw{_tzyVc>qi295$H;2MDVVnF`M8ORyP8ORyP8ORyaK`ifyS)|IJY!EDqxVgN4x%{a|T$U_Mw#C)9%_bigu9 zGCfo>Gei;{HxF(xK35qm4o^P@3*%EhA#Qe^hS;L^Dq>qYK5>%P-_jx2Z4GsYB1=0% z5vs0GL@7roGSv-=DB%R9JmG>=dF+5xc}%}jo+4k7rKwkhD)EYFDDA7KRmHL!0MSe=E(w`D09FUSET(C_NJ7Jq7c0)>%azsj+c1238IwK_<=8p0$ zbU33pB;m$w?oecDXDC9|6^bb32t}s4K@laKpp++EkSdQIkSdSqSISf5E3!28iclq9 z5e=n%H8l%Nx6y5LCn#?4VA1CE^YGS^Ic}K~MG@6qreNY68y4H8cSihdOZXo5CmwLS z)}ls&6eV##r3%{rQ||twVf;VJ@4pNC`afgez5x6Ld-5Lu-v%xLK7)Pti`Y|h;C5gc z_&WB@6u-X@I05*81JK@j6*vkU1l|g~fPM4Rz+Zr$1D^#JfLUM~csKB6#QS~VIM4v< zz%+0UXBB6Ge*munPXp(W3vd?rJMa?lBJd3GIPiVotH2k52Y@Z$EQ4oDDEz8)vGoq$wB7 zS$H}eamHAwbj04usr~R$=>Pn1TK{hZtf0xLCLCmw)Gjdquo;0w3cp zRd5ZXFb=zh=`0+LvZ3RCvYFVeN(PMh6C&K3q!#+l4J}zCedCd~Nqrs5UX0VYrRWhK zS4p%$p$WQuZs>#(N3FFm?4*YyghuRsB#>mgS4NbQ_r|uRDWC~PBX>;+po(R)M z-K|O^==7fgiGH`< zwt^_l3L!&}2VKuWFwtpRUVD6O$)`{o6Ny1?Q~d5(j)P#w7)I_eTF1gcB5Kwwb8Mn0 zV`=^!ySPQh#JIWSnEb?@BIpU7V>cjmWRlIw%(40O@$s~@nD zErfC1f5eq3zjKbAOMM3oBCfj#eryH=2C8M9L#c?a1w)oRQ zNR*?IRAfs{X7Z-dwc%KgA|Op}Aq-=4gjQG`;gh?IZ1IHA?$~^m9V}EPSy}vx%9Yva znaJb>gThc5ZyC}bJQ68}i?B>B3}w#BaRTp8B7_@0uzYYt1+!tM+4e3U6Jtj7b_EtA zv5q38_@ZGbo4gL`iT%s9v`BArYnaWePy}7TPggu;W>6!`m92 z=XPolVMRPvESFL#4=HaM%Cl6&`h5Q~PAy5M7sS#3ZCz1w^`brV&N+|jT0VM8rIJCB ztG7VOWD9Z|KF};!6K6g2qw&WK&%s+=WmROWR{Goay|HkOEL;l@#9|Z0Xv3U`TN9a# z{VnXyx-;jX?24X#sC_s+iBpX|GI2+KvJR?n1HZFLS;y3cCm16&GgE?bW=mv3@A3ua n7gq}53B?}qBCR>R`}E@e#6uGU(~FVdI5NF>m#nQ1&o2Hqg;dSz From 62faa4f307cdc5b463a18825d4ce6c71d5761acf Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 14 Nov 2017 07:42:21 -0500 Subject: [PATCH 25/26] Added info about bye points --- app/views/static_pages/about.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/static_pages/about.html.erb b/app/views/static_pages/about.html.erb index 2900bce..08c79b0 100644 --- a/app/views/static_pages/about.html.erb +++ b/app/views/static_pages/about.html.erb @@ -26,6 +26,7 @@
  • Win by major: 1pt extra
  • Win by tech fall: 1.5pt extra
  • Win by fall, default, dq: 2pt extra
  • +
  • BYE points: 2pt (if you win at least 1 match in a pool with a BYE)
  • 1st place: 16pt
  • 2nd place: 12pt
  • 3rd place: 10pt
  • @@ -43,4 +44,4 @@

    Contact


    -

    Suggestions, criticism, and kind words are welcomed. Please contact us.

    \ No newline at end of file +

    Suggestions, criticism, and kind words are welcomed. Please contact us.

    From 0c9af7fcb349317a7f9b31ac8db9e6b38fa19bed Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 14 Nov 2017 07:43:06 -0500 Subject: [PATCH 26/26] Added stats to wrestler -> show --- app/models/match.rb | 24 +++++++++++++++--------- app/views/wrestlers/show.html.erb | 20 +++++++++++++------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/app/models/match.rb b/app/models/match.rb index ebcd1ef..2d5d274 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -4,12 +4,12 @@ class Match < ActiveRecord::Base belongs_to :mat, touch: true has_many :wrestlers, :through => :weight - - after_update do + + after_update do after_update_actions end - + def after_update_actions if self.finished == 1 && self.winner_id != nil if self.w1 && self.w2 @@ -30,9 +30,9 @@ class Match < ActiveRecord::Base if self.w1 && self.w2 wrestler1.school.calcScore wrestler2.school.calcScore - end + end end - + def mat_assigned if self.mat @@ -41,7 +41,7 @@ class Match < ActiveRecord::Base "" end end - + def pinTime if self.win_type == "Pin" time = self.score.delete("") @@ -54,7 +54,7 @@ class Match < ActiveRecord::Base end def advance_wrestlers - if self.w1 && self.w2 + if self.w1 && self.w2 AdvanceWrestler.new(wrestler1).advance AdvanceWrestler.new(wrestler2).advance end @@ -117,7 +117,7 @@ class Match < ActiveRecord::Base def weight_max self.weight.max end - + def replaceLoserNameWithWrestler(w,loserName) if self.loser1_name == loserName self.w1 = w.id @@ -133,6 +133,12 @@ class Match < ActiveRecord::Base wrestler1.pool end end - + def list_w2_stats + "#{w2_name}: #{w2_stat}" + end + + def list_w1_stats + "#{w1_name}: #{w1_stat}" + end end diff --git a/app/views/wrestlers/show.html.erb b/app/views/wrestlers/show.html.erb index 4a7efb9..b71b3b8 100644 --- a/app/views/wrestlers/show.html.erb +++ b/app/views/wrestlers/show.html.erb @@ -1,22 +1,22 @@ - + <%= link_to "Back to #{@school.name}", "/schools/#{@school.id}", :class=>"btn btn-default" %> <% if can? :manage, @school %> | <%= link_to "Edit #{@wrestler.name}", edit_wrestler_path(@wrestler), :class=>"btn btn-primary" %> <% end %> -<% cache ["#{@wrestler.id}", @wrestler] do %> +<% cache ["#{@wrestler.id}", @wrestler] do %>

    Name: <%= @wrestler.name %>

    - +

    School: <%= @wrestler.school.name %>

    - +

    Weight: <%= @wrestler.weight.max %> @@ -33,12 +33,18 @@ Total Team Points Scored: <%= @wrestler.totalTeamPoints %>

    - +

    Matches


    <% @wrestler.allMatches.each do |m| %> -
    Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= @wrestler.resultByBout(m.bout_number) %>
    +
    Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= @wrestler.resultByBout(m.bout_number) %>
    + <% if m.w1_stat || m.w2_stat %> +
    Stats:
    +
    <%= m.list_w1_stats %>
    +
    <%= m.list_w2_stats %>
    +
    + <% end %> <% end %> -<% end %> \ No newline at end of file +<% end %>