diff --git a/.gitignore b/.gitignore index 83e1770..a51e579 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,5 @@ repos/* # RSpec failure-file spec/.failures.txt .idea/ + +.env diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..e925163 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +ruby 2.7.6 +nodejs 16.14.0 diff --git a/Gemfile b/Gemfile index e36c33a..799552c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,12 @@ source 'https://rubygems.org' +gem "dotenv-rails", '~> 2.7.6', groups: [:development, :test] # should be the first dependency loaded + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 4.1' +gem 'rails', '~> 5' # Use SCSS for stylesheets -gem 'sass-rails', '~> 4.0.0' +gem 'sass-rails' # Use Bootstrap for styling gem 'bootstrap-sass', '~> 3.3.1' @@ -16,13 +18,7 @@ gem 'font-awesome-rails' gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .js.coffee assets and views -gem 'coffee-rails', '~> 4.0.0' - -# Airbrake -gem 'airbrake' - -# Coveralls! -gem 'coveralls', require: false +gem 'coffee-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby @@ -33,7 +29,7 @@ gem 'jquery-rails' gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 1.2' +gem 'jbuilder' # Build google charts gem 'google_visualr' @@ -48,16 +44,20 @@ end group :test, :development do gem 'pry-byebug' + gem 'sqlite3' end group :test do gem 'rack-test' - gem 'rspec-rails' - gem 'factory_girl_rails' + gem 'rspec-rails', '~> 5.0.0' + gem 'factory_bot_rails' gem 'faker' end group :development do + # Web console + gem 'web-console' + gem 'capistrano' gem 'capistrano-rails' gem 'capistrano-passenger' @@ -104,8 +104,8 @@ gem 'friendly_id' gem 'jquery-turbolinks' # Use datenfisch (https://github.com/Iasoon/datenfisch.git) -gem 'datenfisch', git: 'git://github.com/iasoon/datenfisch-sucks.git', - ref: '4f39bb3686b5facfb2552fe186d568ce3d259993' +# gem 'datenfisch', path: "../datenfisch-lives" +gem 'datenfisch', git: 'git@github.com:ZeusWPI/datenfisch-lives.git' # Use jQuery plugin datatables (https://github.com/DataTables/DataTables) gem 'jquery-datatables-rails' @@ -120,3 +120,7 @@ gem 'high_voltage' # Use HTTParty for easier HTTP requests gem 'httparty' + +gem 'bootsnap' + +gem 'listen' diff --git a/Gemfile.lock b/Gemfile.lock index 2079a76..23355e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,303 +1,374 @@ GIT - remote: git://github.com/iasoon/datenfisch-sucks.git - revision: 4f39bb3686b5facfb2552fe186d568ce3d259993 - ref: 4f39bb3686b5facfb2552fe186d568ce3d259993 + remote: git@github.com:ZeusWPI/datenfisch-lives.git + revision: 4e89ea67cc87d212b065633002782eff817d00c4 specs: datenfisch (0.0.1) GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.8) - actionpack (= 4.1.8) - actionview (= 4.1.8) + actioncable (5.2.7) + actionpack (= 5.2.7) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.7) + actionpack (= 5.2.7) + actionview (= 5.2.7) + activejob (= 5.2.7) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.8) - actionview (= 4.1.8) - activesupport (= 4.1.8) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.8) - activesupport (= 4.1.8) + rails-dom-testing (~> 2.0) + actionpack (5.2.7) + actionview (= 5.2.7) + activesupport (= 5.2.7) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.7) + activesupport (= 5.2.7) builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.8) - activesupport (= 4.1.8) - builder (~> 3.1) - activerecord (4.1.8) - activemodel (= 4.1.8) - activesupport (= 4.1.8) - arel (~> 5.0.0) - activesupport (4.1.8) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.7) + activesupport (= 5.2.7) + globalid (>= 0.3.6) + activemodel (5.2.7) + activesupport (= 5.2.7) + activerecord (5.2.7) + activemodel (= 5.2.7) + activesupport (= 5.2.7) + arel (>= 9.0) + activestorage (5.2.7) + actionpack (= 5.2.7) + activerecord (= 5.2.7) + marcel (~> 1.0.0) + activesupport (5.2.7) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.1) tzinfo (~> 1.1) - addressable (2.3.6) - airbrake (4.1.0) - builder - multi_json - ajax-datatables-rails (0.3.1) - railties (>= 3.1) - annotate (2.6.5) - activerecord (>= 2.3.0) - rake (>= 0.8.7) - arel (5.0.1.20140414130214) - ast (2.3.0) - bcrypt (3.1.9) - bootstrap-sass (3.3.1.0) - sass (~> 3.2) - builder (3.2.2) - byebug (4.0.5) - columnize (= 0.9.0) - capistrano (3.3.3) - capistrano-stats (~> 1.0.3) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) + sshkit (>= 1.6.1, != 1.7.0) + ajax-datatables-rails (1.3.1) + zeitwerk + annotate (3.2.0) + activerecord (>= 3.2, < 8.0) + rake (>= 10.4, < 14.0) + arel (9.0.0) + ast (2.4.2) + autoprefixer-rails (10.4.2.0) + execjs (~> 2) + bcrypt (3.1.17) + bindex (0.8.1) + bootsnap (1.9.1) + msgpack (~> 1.0) + bootstrap-sass (3.3.7) + autoprefixer-rails (>= 5.2.1) + sass (>= 3.3.4) + builder (3.2.4) + byebug (11.1.3) + capistrano (3.17.0) + airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) - sshkit (~> 1.3) - capistrano-bundler (1.1.3) + sshkit (>= 1.9.0) + capistrano-bundler (2.0.1) capistrano (~> 3.1) - sshkit (~> 1.2) - capistrano-passenger (0.0.1) + capistrano-passenger (0.2.1) capistrano (~> 3.0) - capistrano-rails (1.1.2) + capistrano-rails (1.6.2) capistrano (~> 3.1) - capistrano-bundler (~> 1.1) - capistrano-rails-collection (0.0.3) - capistrano-rails (~> 1.1.0) - capistrano-rbenv (2.0.3) + capistrano-bundler (>= 1.1, < 3) + capistrano-rails-collection (0.1.0) + capistrano-rails (~> 1.1) + capistrano-rbenv (2.2.0) capistrano (~> 3.1) sshkit (~> 1.3) capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) - capistrano-stats (1.0.3) - coderay (1.1.0) - coffee-rails (4.0.1) + coderay (1.1.3) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) - coffee-script (2.3.0) + railties (>= 5.2.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.8.0) - colorize (0.7.3) - columnize (0.9.0) - coveralls (0.7.1) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor - d3-rails (3.5.5) + coffee-script-source (1.12.2) + concurrent-ruby (1.1.10) + crass (1.0.6) + d3-rails (7.0.0) railties (>= 3.1) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (3.4.1) + devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0) responders - thread_safe (~> 0.1) warden (~> 1.2.3) - diff-lcs (1.2.5) - docile (1.1.5) - erubis (2.7.0) - execjs (2.2.2) - factory_girl (4.5.0) - activesupport (>= 3.0.0) - factory_girl_rails (4.5.0) - factory_girl (~> 4.5.0) - railties (>= 3.0.0) - faker (1.4.3) - i18n (~> 0.5) - faraday (0.9.0) + diff-lcs (1.5.0) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) + erubi (1.10.0) + execjs (2.8.1) + factory_bot (6.2.1) + activesupport (>= 5.0.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) + railties (>= 5.0.0) + faker (2.20.0) + i18n (>= 1.8.11, < 2) + faraday (1.10.0) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.3) multipart-post (>= 1.2, < 3) - font-awesome-rails (4.3.0.0) - railties (>= 3.2, < 5.0) - friendly_id (5.0.4) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + ffi (1.15.5) + font-awesome-rails (4.7.0.8) + railties (>= 3.2, < 8.0) + friendly_id (5.4.2) activerecord (>= 4.0.0) - github_api (0.12.2) - addressable (~> 2.3) + github_api (0.19.0) + addressable (~> 2.4) descendants_tracker (~> 0.0.4) - faraday (~> 0.8, < 0.10) - hashie (>= 3.3) - multi_json (>= 1.7.5, < 2.0) - nokogiri (~> 1.6.3) - oauth2 + faraday (>= 0.8, < 2) + hashie (~> 3.5, >= 3.5.2) + oauth2 (~> 1.0) + globalid (1.0.0) + activesupport (>= 5.0) google_visualr (2.5.1) - hashie (3.3.2) - high_voltage (2.2.1) - hike (1.2.3) - httparty (0.13.5) - json (~> 1.8) + hashie (3.6.0) + high_voltage (3.1.2) + httparty (0.20.0) + mime-types (~> 3.0) multi_xml (>= 0.5.2) - i18n (0.7.0) - jbuilder (1.5.3) - activesupport (>= 3.0.0) - multi_json (>= 1.2.0) - jquery-datatables-rails (3.3.0) + i18n (1.10.0) + concurrent-ruby (~> 1.0) + jbuilder (2.11.5) + actionview (>= 5.0.0) + activesupport (>= 5.0.0) + jquery-datatables-rails (3.4.0) actionpack (>= 3.1) jquery-rails railties (>= 3.1) sass-rails - jquery-rails (3.1.4) - railties (>= 3.0, < 5.0) + jquery-rails (4.4.0) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-turbolinks (2.1.0) railties (>= 3.1.0) turbolinks - json (1.8.3) - jwt (1.2.0) - mail (2.6.3) - mime-types (>= 1.16, < 3) - method_source (0.8.2) - mime-types (2.4.3) - mini_portile (0.6.1) - minitest (5.8.0) - multi_json (1.11.2) - multi_xml (0.5.5) - multipart-post (2.0.0) - mysql2 (0.3.17) - net-scp (1.2.1) - net-ssh (>= 2.6.5) - net-ssh (2.9.1) - netrc (0.9.0) - nokogiri (1.6.5) - mini_portile (~> 0.6.0) - oauth2 (1.0.0) - faraday (>= 0.8, < 0.10) - jwt (~> 1.0) + jwt (2.3.0) + listen (3.5.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.16.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (1.0.2) + method_source (1.0.0) + mime-types (3.4.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2022.0105) + mini_mime (1.1.2) + minitest (5.15.0) + msgpack (1.4.2) + multi_json (1.15.0) + multi_xml (0.6.0) + multipart-post (2.1.1) + mysql2 (0.5.3) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) + nio4r (2.5.8) + nokogiri (1.13.4) + racc (~> 1.4) + oauth2 (1.4.9) + faraday (>= 0.17.3, < 3.0) + jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) - rack (~> 1.2) - omniauth (1.2.2) - hashie (>= 1.2, < 4) - rack (~> 1.0) - omniauth-github (1.1.2) - omniauth (~> 1.0) - omniauth-oauth2 (~> 1.1) - omniauth-oauth2 (1.2.0) - faraday (>= 0.8, < 0.10) - multi_json (~> 1.3) - oauth2 (~> 1.0) - omniauth (~> 1.2) + rack (>= 1.2, < 3) + omniauth (2.1.0) + hashie (>= 3.4.6) + rack (>= 2.2.3) + rack-protection + omniauth-github (2.0.0) + omniauth (~> 2.0) + omniauth-oauth2 (~> 1.7.1) + omniauth-oauth2 (1.7.2) + oauth2 (~> 1.4) + omniauth (>= 1.9, < 3) orm_adapter (0.5.0) - parser (2.3.1.2) - ast (~> 2.2) - powerpack (0.1.1) - pry (0.10.1) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pry-byebug (3.1.0) - byebug (~> 4.0) - pry (~> 0.10) - rack (1.5.5) - rack-cors (0.4.0) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.1.8) - actionmailer (= 4.1.8) - actionpack (= 4.1.8) - actionview (= 4.1.8) - activemodel (= 4.1.8) - activerecord (= 4.1.8) - activesupport (= 4.1.8) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.8) - sprockets-rails (~> 2.0) - railties (4.1.8) - actionpack (= 4.1.8) - activesupport (= 4.1.8) + parallel (1.22.1) + parser (3.1.2.0) + ast (~> 2.4.1) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.9.0) + byebug (~> 11.0) + pry (~> 0.13.0) + public_suffix (4.0.7) + racc (1.6.0) + rack (2.2.3.1) + rack-cors (1.1.1) + rack (>= 2.0.0) + rack-protection (2.2.0) + rack + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.7) + actioncable (= 5.2.7) + actionmailer (= 5.2.7) + actionpack (= 5.2.7) + actionview (= 5.2.7) + activejob (= 5.2.7) + activemodel (= 5.2.7) + activerecord (= 5.2.7) + activestorage (= 5.2.7) + activesupport (= 5.2.7) + bundler (>= 1.3.0) + railties (= 5.2.7) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.4.2) + loofah (~> 2.3) + railties (5.2.7) + actionpack (= 5.2.7) + activesupport (= 5.2.7) + method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (2.1.0) - rake (10.4.2) - rdoc (4.2.0) - json (~> 1.4) - responders (1.1.2) - railties (>= 3.2, < 4.2) - rest-client (1.7.2) - mime-types (>= 1.16, < 3.0) - netrc (~> 0.7) - rspec-core (3.3.2) - rspec-support (~> 3.3.0) - rspec-expectations (3.3.1) + thor (>= 0.19.0, < 2.0) + rainbow (3.1.1) + rake (13.0.6) + rb-fsevent (0.11.1) + rb-inotify (0.10.1) + ffi (~> 1.0) + rdoc (6.3.3) + regexp_parser (2.3.0) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rexml (3.2.5) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-mocks (3.3.2) + rspec-support (~> 3.11.0) + rspec-mocks (3.11.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-rails (3.3.3) - actionpack (>= 3.0, < 4.3) - activesupport (>= 3.0, < 4.3) - railties (>= 3.0, < 4.3) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) - rubocop (0.40.0) - parser (>= 2.3.1.0, < 3.0) - powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) + rspec-support (~> 3.11.0) + rspec-rails (5.0.3) + actionpack (>= 5.2) + activesupport (>= 5.2) + railties (>= 5.2) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) + rspec-support (3.11.0) + rubocop (1.27.0) + parallel (~> 1.10) + parser (>= 3.1.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.16.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.8.1) - rugged (0.21.2) - sass (3.2.19) - sass-rails (4.0.5) - railties (>= 4.0.0, < 5.0) - sass (~> 3.2.2) - sprockets (~> 2.8, < 3.0) - sprockets-rails (~> 2.0) - sdoc (0.4.1) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) - simplecov (0.9.1) - docile (~> 1.1.0) - multi_json (~> 1.0) - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) - slop (3.6.0) - sprockets (2.12.4) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.3.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sshkit (1.5.1) - colorize + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.17.0) + parser (>= 3.1.1.0) + ruby-progressbar (1.11.0) + ruby2_keywords (0.0.5) + rugged (1.4.3) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + sdoc (2.3.1) + rdoc (>= 5.0, < 6.4.0) + sprockets (4.0.3) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + sshkit (1.21.2) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - term-ansicolor (1.3.0) - tins (~> 1.0) - thor (0.19.1) - thread_safe (0.3.5) - tilt (1.4.1) - tins (1.3.3) - turbolinks (2.5.3) - coffee-rails - tzinfo (1.2.2) + thor (1.2.1) + thread_safe (0.3.6) + tilt (2.0.10) + turbolinks (5.2.1) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + tzinfo (1.2.9) thread_safe (~> 0.1) - uglifier (2.6.0) - execjs (>= 0.3.0) - json (>= 1.8.0) - unicode-display_width (1.0.5) - warden (1.2.3) - rack (>= 1.0) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) + unicode-display_width (2.1.0) + warden (1.2.9) + rack (>= 2.0.9) + web-console (3.7.0) + actionview (>= 5.0) + activemodel (>= 5.0) + bindex (>= 0.4.0) + railties (>= 5.0) + websocket-driver (0.7.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.5.4) PLATFORMS ruby DEPENDENCIES - airbrake ajax-datatables-rails annotate + bootsnap bootstrap-sass (~> 3.3.1) capistrano capistrano-passenger @@ -305,12 +376,12 @@ DEPENDENCIES capistrano-rails-collection capistrano-rbenv capistrano-rvm - coffee-rails (~> 4.0.0) - coveralls + coffee-rails d3-rails datenfisch! devise - factory_girl_rails + dotenv-rails (~> 2.7.6) + factory_bot_rails faker font-awesome-rails friendly_id @@ -318,24 +389,27 @@ DEPENDENCIES google_visualr high_voltage httparty - jbuilder (~> 1.2) + jbuilder jquery-datatables-rails jquery-rails jquery-turbolinks + listen mysql2 omniauth omniauth-github pry-byebug rack-cors rack-test - rails (~> 4.1) - rspec-rails + rails (~> 5) + rspec-rails (~> 5.0.0) rubocop rugged - sass-rails (~> 4.0.0) + sass-rails sdoc + sqlite3 turbolinks uglifier (>= 1.3.0) + web-console BUNDLED WITH - 1.11.2 + 2.3.11 diff --git a/README.md b/README.md index b2f3e55..4330d71 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,19 @@ Gamification of Zeus member engagement (with GitHub integration)! -## Dev +## Setup -This uses an old ruby version, use something like `rbenv` to manage it. +This uses an old ruby version, use something like `rbenv`, or preferable `asdf` to manage it. + +Set your [GitHub API token](https://github.com/settings/tokens) in `.env`: +```bash +GITHUB_TOKEN=yourtokenhere +``` + +Run `rails db:seed` + + +## Deployment This project also uses `capistrano` to manage deployment, after doing `bundle install` also intall capistrano with `gem install capistrano`. diff --git a/app/actions/publish_bounty.rb b/app/actions/publish_bounty.rb index eff92a2..eaf1ae9 100644 --- a/app/actions/publish_bounty.rb +++ b/app/actions/publish_bounty.rb @@ -9,7 +9,7 @@ def call Slack.send_text(message) end -private + private def message "#{author} plaatste #{score} op #{repository} ##{github_issue}: #{title}" diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000..b16e53d --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000..95ce07a --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,10 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true + + include Rails.application.routes.url_helpers + def base_uri + url_for(self) + rescue NoMethodError + url_for(self.class) + end +end diff --git a/app/models/bounty.rb b/app/models/bounty.rb index c5fe4bb..e289188 100644 --- a/app/models/bounty.rb +++ b/app/models/bounty.rb @@ -13,7 +13,7 @@ # updated_at :datetime # -class Bounty < ActiveRecord::Base +class Bounty < ApplicationRecord belongs_to :issue has_one :repository, through: :issue belongs_to :issuer, class_name: 'Coder', foreign_key: 'issuer_id' diff --git a/app/models/coder.rb b/app/models/coder.rb index 3255056..a4ca096 100644 --- a/app/models/coder.rb +++ b/app/models/coder.rb @@ -14,7 +14,7 @@ # updated_at :datetime # -class Coder < ActiveRecord::Base +class Coder < ApplicationRecord extend FriendlyId extend Datenfisch::Model friendly_id :github_name diff --git a/app/models/commit.rb b/app/models/commit.rb index 24f035e..cb40d51 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -13,7 +13,7 @@ # updated_at :datetime # -class Commit < ActiveRecord::Base +class Commit < ApplicationRecord belongs_to :coder belongs_to :repository diff --git a/app/models/git_identity.rb b/app/models/git_identity.rb index 0a66d3d..f595bce 100644 --- a/app/models/git_identity.rb +++ b/app/models/git_identity.rb @@ -10,6 +10,6 @@ # updated_at :datetime # -class GitIdentity < ActiveRecord::Base +class GitIdentity < ApplicationRecord belongs_to :coder end diff --git a/app/models/issue.rb b/app/models/issue.rb index 064e24a..3c0c48e 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -18,7 +18,7 @@ # updated_at :datetime # -class Issue < ActiveRecord::Base +class Issue < ApplicationRecord extend Datenfisch::Model belongs_to :issuer, class_name: :Coder, inverse_of: :created_issues, diff --git a/app/models/repository.rb b/app/models/repository.rb index ad60d13..508e2f4 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -10,7 +10,7 @@ # updated_at :datetime # -class Repository < ActiveRecord::Base +class Repository < ApplicationRecord extend FriendlyId extend Datenfisch::Model friendly_id :name @@ -49,7 +49,7 @@ def register_commits! walker = Rugged::Walker.new(r_repo) # Push all heads r_repo.branches.each { |b| walker.push b.target_id } - walker.push(r_repo.last_commit) + walker.push(r_repo.last_commit.oid) walker.each do |commit| Commit.register_rugged(self, commit, reward: false) end @@ -82,6 +82,11 @@ def self.create_or_update(repo_hash) repo.fetch_issues! end + include Rails.application.routes.url_helpers + def base_uri + repository_url(self) + end + private def path diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 642ec12..be2bccb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -41,7 +41,7 @@ destroy_session_path, :title => "Log out" %> <% else %>
  • <%= link_to raw(''), - coder_omniauth_authorize_path(:github), :title => "Log in" %>
  • + coder_github_omniauth_authorize_path, :title => "Log in" %> <% end %> diff --git a/bin/bundle b/bin/bundle index 66e9889..f19acf5 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index 728cd85..0739660 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..94fd4d7 --- /dev/null +++ b/bin/setup @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/update b/bin/update new file mode 100755 index 0000000..58bfaed --- /dev/null +++ b/bin/update @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 0000000..460dd56 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index 1acc014..8908b49 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' @@ -8,42 +8,22 @@ module Gamification class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified - # here. Application configuration should go into files in - # config/initializers -- all .rb files in that directory are automatically - # loaded. + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.0 - # Set Time.zone default to the specified zone and make Active Record - # auto-convert to this zone. Run "rake -D time" for a list of tasks for - # finding time zone names. Default is UTC. - config.time_zone = 'Brussels' - # autoload lib files - config.autoload_paths << Rails.root.join('lib') + # Settings in config/environments/* take precedence over those specified here. + # Application configuration can go into files in config/initializers + # -- all .rb files in that directory are automatically loaded after loading + # the framework and any gems in your application. + # , '~> 1.2' - # The default locale is :en and all translations from - # config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += - # Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de # Organisation to track config.organisation = 'ZeusWPI' + # Overwrite this per environment config.repository_filters = { - # only: [ 'gamification', 'Haldis' ] - except: [ - 'glowing-octo-dubstep', - 'VPW-voorbereiding-2015', - 'VPW-voorbereiding-2014', - 'contests', - 'Bestuurstaakjes', - 'SumoRoboComp', - 'kaggle-rta', - 'manage-user', - 'website-manage', - 'errbit' - ] - # private: false + only: [ 'gamification', 'Haldis' ] } # Total bounty value @@ -64,35 +44,11 @@ class Application < Rails::Application end # CORS headers - config.middleware.insert_before 0, "Rack::Cors" do + config.middleware.insert_before 0, Rack::Cors do allow do - origins /localhost(:\d+)?/, 'zeus.ugent.be' - resource '*', :headers => :any, :methods => [:get, :options] - end - end - - # Backport from Rails 4.2: custom configurations - # Just remove this block when upgrading from 4.1.8 to 4.2 - if Rails.version == '4.1.8' - class Custom - def initialize - @configurations = {} + origins /localhost(:\d+)?/, 'zeus.ugent.be' + resource '*', :headers => :any, :methods => [:get, :options] end - - def method_missing(method, *args) - if method =~ /=$/ - @configurations[$`.to_sym] = args.first - else - @configurations.fetch(method) do - @configurations[method] = ActiveSupport::OrderedOptions.new - end - end - end - end - - config.x = Custom.new - else - warn('Remove this backport at config/application:62-84') end end end diff --git a/config/boot.rb b/config/boot.rb index 5e5f0c1..b9e460c 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000..d23ee13 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: gamification_production diff --git a/config/database.yml b/config/database.yml index 6aabdaf..b1a535b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -4,12 +4,10 @@ # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' development: - adapter: mysql2 - username: gamification - database: gamification - password: hallo - host: 127.0.0.1 - port: 3306 + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". diff --git a/config/environment.rb b/config/environment.rb index ee8d90d..426333b 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index a63df55..5894b40 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,9 +1,8 @@ Rails.application.configure do - # Settings specified here will take precedence over those in - # config/application.rb. + # Settings specified here will take precedence over those in config/application.rb. - # Host, to be used for routes and Action Mailer. - config.x.host = 'localhost:3000' + Rails.application.default_url_options = { host: 'localhost', port: 3000 } + config.x.host = 'localhost' # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development @@ -13,13 +12,31 @@ # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + # Run rails dev:cache to toggle caching. + if Rails.root.join('tmp', 'caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { host: config.x.host } + + config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -27,16 +44,25 @@ # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true + # Suppress logger output for asset requests. + config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker + + config.repository_filters = { + only: [ 'Tab', 'Haldis' ] + } end diff --git a/config/environments/production.rb b/config/environments/production.rb index 40abd4f..bc14643 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,8 +1,6 @@ Rails.application.configure do - # Settings specified here will take precedence over those in - # config/application.rb. + # Settings specified here will take precedence over those in config/application.rb. - # Host, to be used for routes and Action Mailer. config.x.host = 'zeus.ugent.be' config.relative_url_root = '/game' @@ -19,14 +17,13 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like - # nginx, varnish or squid. - # config.action_dispatch.rack_cache = true + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true - # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_files = false + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -35,47 +32,45 @@ # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs. - config.assets.digest = true + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # `config.assets.precompile` has moved to config/initializers/assets.rb + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Force all access to the app over SSL, use Strict-Transport-Security, and - # use secure cookies. + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Set to :debug to see everything in the log. - config.log_level = :info + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset - # server. - # config.action_controller.asset_host = "http://assets.example.com" + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "gamification_#{Rails.env}" - # Precompile additional assets. application.js, application.css, and all - # non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to - # raise delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { - host: config.x.host, - script_name: config.relative_url_root - } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). @@ -84,15 +79,36 @@ # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false - # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false -end -# Remove me when updated to > 4.2 -Rails.application.routes.default_url_options[:script_name] = '/game' + # + config.repository_filters = { + except: [ + 'glowing-octo-dubstep', + 'VPW-voorbereiding-2015', + 'VPW-voorbereiding-2014', + 'contests', + 'Bestuurstaakjes', + 'SumoRoboComp', + 'kaggle-rta', + 'manage-user', + 'website-manage', + 'errbit' + ] + # private: false + } +end diff --git a/config/environments/test.rb b/config/environments/test.rb index e5f567f..0a38fd3 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,9 +1,5 @@ Rails.application.configure do - # Settings specified here will take precedence over those in - # config/application.rb. - - # Host, to be used for routes and Action Mailer. - config.x.host = 'localhost:3000' + # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that @@ -16,9 +12,11 @@ # preloads Rails for running tests, you may have to set it to true. 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' + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -30,11 +28,15 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test + + config.action_mailer.perform_caching = false + # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - config.action_mailer.default_url_options = { host: config.x.host } # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr diff --git a/config/initializers/ajax_datatables_rails.rb b/config/initializers/ajax_datatables_rails.rb deleted file mode 100644 index 2546cef..0000000 --- a/config/initializers/ajax_datatables_rails.rb +++ /dev/null @@ -1,7 +0,0 @@ -AjaxDatatablesRails.configure do |config| - # available options for db_adapter are: :oracle, :pg, :mysql2, :sqlite3 - config.db_adapter = :mysql2 - - # available options for paginator are: :simple_paginator, :kaminari, :will_paginate - # config.paginator = :simple_paginator -end diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000..89d2efa --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 8804604..4b828e8 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,7 +3,12 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' +# Add additional assets to the asset load path. +# Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') + # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are -# already added. -# Rails.application.config.assets.precompile += %w( search.js ) +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index cf74fe3..59385cd 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,9 +1,7 @@ # Be sure to restart your server when you modify this file. -# You can add backtrace silencers for libraries that you're using but don't -# wish to see in your backtraces. +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } -# You can also remove all the silencers if you're trying to debug a problem -# that might stem from framework code. +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 0000000..d3bcaa5 --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end + +# If you are using UJS then enable automatic nonce generation +# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } + +# Report CSP violations to a specified URI +# For further information see the following documentation: +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index ac5f8b6..5a6a32d 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.action_dispatch.cookies_serializer = :marshal +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/default_url_options.rb b/config/initializers/default_url_options.rb index 3d3fa75..400361f 100644 --- a/config/initializers/default_url_options.rb +++ b/config/initializers/default_url_options.rb @@ -1,2 +1 @@ -Rails.application.routes.default_url_options[:host] = - Rails.configuration.x.host +Rails.application.routes.default_url_options[:host] = Rails.configuration.x.host diff --git a/config/initializers/errbit.rb b/config/initializers/errbit.rb deleted file mode 100644 index eb19fc2..0000000 --- a/config/initializers/errbit.rb +++ /dev/null @@ -1,6 +0,0 @@ -Airbrake.configure do |config| - config.api_key = '347b322e04831db3e24da517849b2a2b' - config.host = 'errbit.awesomepeople.tv' - config.port = 80 - config.secure = config.port == 443 -end diff --git a/config/initializers/new_framework_defaults_5_2.rb b/config/initializers/new_framework_defaults_5_2.rb new file mode 100644 index 0000000..c383d07 --- /dev/null +++ b/config/initializers/new_framework_defaults_5_2.rb @@ -0,0 +1,38 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.2 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make Active Record use stable #cache_key alongside new #cache_version method. +# This is needed for recyclable cache keys. +# Rails.application.config.active_record.cache_versioning = true + +# Use AES-256-GCM authenticated encryption for encrypted cookies. +# Also, embed cookie expiry in signed or encrypted cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 5.2. +# +# Existing cookies will be converted on read then written with the new scheme. +# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true + +# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages +# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. +# Rails.application.config.active_support.use_authenticated_message_encryption = true + +# Add default protection from forgery to ActionController::Base instead of in +# ApplicationController. +# Rails.application.config.action_controller.default_protect_from_forgery = true + +# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and +# 'f' after migrating old data. +# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + +# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. +# Rails.application.config.active_support.use_sha1_digests = true + +# Make `form_with` generate id attributes for any generated HTML tags. +# Rails.application.config.action_view.form_with_generates_ids = true diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 6fffb71..bbfc396 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -3,13 +3,12 @@ # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. -# Enable parameter wrapping for JSON. You can disable this by setting :format -# to an empty array. +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/locales/en.yml b/config/locales/en.yml index 0653957..decc5a8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,16 @@ # # This would use the information in config/locales/es.yml. # +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. diff --git a/config/secrets.yml b/config/secrets.yml index cd0e327..97bb23c 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -12,7 +12,7 @@ development: secret_key_base: 964dfc965862690bd1575f8b8b4ae33f4aa88251dd642cc00173a0de0936879b78cdd142c6478602b8576b597b143e99c1c30522d1d18ff2af1a172b93c448b2 - github_token: #dev# + github_token: <%= ENV["GITHUB_TOKEN"] %> github_app_id: '651692db8ef2d40913ff' github_app_secret: '85a54d91e1d436483930b0e00d3b21de73c6b016' diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 0000000..d32f76e --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/db/migrate/20140630213046_create_coders.rb b/db/migrate/20140630213046_create_coders.rb index 1fdba84..221c4c4 100644 --- a/db/migrate/20140630213046_create_coders.rb +++ b/db/migrate/20140630213046_create_coders.rb @@ -1,4 +1,4 @@ -class CreateCoders < ActiveRecord::Migration +class CreateCoders < ActiveRecord::Migration[4.2] def change create_table :coders do |t| t.string :github_name, null: false diff --git a/db/migrate/20140901143444_create_bounties.rb b/db/migrate/20140901143444_create_bounties.rb index a6681d7..5dd73c5 100644 --- a/db/migrate/20140901143444_create_bounties.rb +++ b/db/migrate/20140901143444_create_bounties.rb @@ -1,4 +1,4 @@ -class CreateBounties < ActiveRecord::Migration +class CreateBounties < ActiveRecord::Migration[4.2] def change create_table :bounties do |t| t.integer :value, null: false diff --git a/db/migrate/20140902210829_create_issues.rb b/db/migrate/20140902210829_create_issues.rb index a0f888f..8224e94 100644 --- a/db/migrate/20140902210829_create_issues.rb +++ b/db/migrate/20140902210829_create_issues.rb @@ -1,4 +1,4 @@ -class CreateIssues < ActiveRecord::Migration +class CreateIssues < ActiveRecord::Migration[4.2] def change create_table :issues do |t| t.string :github_url, null: false diff --git a/db/migrate/20140930231251_create_repositories.rb b/db/migrate/20140930231251_create_repositories.rb index 87ad307..eab3887 100644 --- a/db/migrate/20140930231251_create_repositories.rb +++ b/db/migrate/20140930231251_create_repositories.rb @@ -1,4 +1,4 @@ -class CreateRepositories < ActiveRecord::Migration +class CreateRepositories < ActiveRecord::Migration[4.2] def change create_table :repositories do |t| t.string :name, index: true, unique: true, null: false diff --git a/db/migrate/20141104172317_create_commits.rb b/db/migrate/20141104172317_create_commits.rb index 53d9c8a..ee17b89 100644 --- a/db/migrate/20141104172317_create_commits.rb +++ b/db/migrate/20141104172317_create_commits.rb @@ -1,4 +1,4 @@ -class CreateCommits < ActiveRecord::Migration +class CreateCommits < ActiveRecord::Migration[4.2] def change create_table :commits do |t| t.references :coder, index: true diff --git a/db/migrate/20141203154945_create_git_identities.rb b/db/migrate/20141203154945_create_git_identities.rb index 8d80ea6..233b1f7 100644 --- a/db/migrate/20141203154945_create_git_identities.rb +++ b/db/migrate/20141203154945_create_git_identities.rb @@ -1,4 +1,4 @@ -class CreateGitIdentities < ActiveRecord::Migration +class CreateGitIdentities < ActiveRecord::Migration[4.2] def change create_table :git_identities do |t| t.string :name, null: false diff --git a/db/migrate/20150829193440_make_bounty_columns_more_logical.rb b/db/migrate/20150829193440_make_bounty_columns_more_logical.rb index 69fbe6c..09010a2 100644 --- a/db/migrate/20150829193440_make_bounty_columns_more_logical.rb +++ b/db/migrate/20150829193440_make_bounty_columns_more_logical.rb @@ -1,4 +1,4 @@ -class MakeBountyColumnsMoreLogical < ActiveRecord::Migration +class MakeBountyColumnsMoreLogical < ActiveRecord::Migration[4.2] def change rename_column :bounties, :value, :absolute_value rename_column :coders, :bounty_residual, :absolute_bounty_residual diff --git a/db/migrate/20160616201145_convert_coder_absolute_bounty_residual_to_big_int.rb b/db/migrate/20160616201145_convert_coder_absolute_bounty_residual_to_big_int.rb index 3ee0ab4..e59aa87 100644 --- a/db/migrate/20160616201145_convert_coder_absolute_bounty_residual_to_big_int.rb +++ b/db/migrate/20160616201145_convert_coder_absolute_bounty_residual_to_big_int.rb @@ -1,4 +1,4 @@ -class ConvertCoderAbsoluteBountyResidualToBigInt < ActiveRecord::Migration +class ConvertCoderAbsoluteBountyResidualToBigInt < ActiveRecord::Migration[4.2] def change change_column(:coders, :absolute_bounty_residual, :bigint) end diff --git a/db/migrate/20181024210620_convert_tables_to_utf8.rb b/db/migrate/20181024210620_convert_tables_to_utf8.rb index a030f42..e2490a4 100644 --- a/db/migrate/20181024210620_convert_tables_to_utf8.rb +++ b/db/migrate/20181024210620_convert_tables_to_utf8.rb @@ -1,5 +1,7 @@ -class ConvertTablesToUtf8 < ActiveRecord::Migration +class ConvertTablesToUtf8 < ActiveRecord::Migration[4.2] def change + return unless ActiveRecord::Base.connection.instance_values["config"][:adapter] == "mysql" + config = Rails.configuration.database_configuration db_name = config[Rails.env]["database"] collate = 'utf8mb4_bin' diff --git a/db/schema.rb b/db/schema.rb index 83259cb..fa8cae6 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. @@ -11,91 +10,89 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160616201145) do +ActiveRecord::Schema.define(version: 2018_10_24_210620) do - create_table "bounties", force: true do |t| - t.integer "absolute_value", null: false - t.integer "issue_id", null: false - t.integer "issuer_id", null: false - t.integer "claimant_id" - t.integer "claimed_value" + create_table "bounties", force: :cascade do |t| + t.integer "absolute_value", null: false + t.integer "issue_id", null: false + t.integer "issuer_id", null: false + t.integer "claimant_id" + t.integer "claimed_value" t.datetime "claimed_at" t.datetime "created_at" t.datetime "updated_at" + t.index ["claimant_id"], name: "index_bounties_on_claimant_id" + t.index ["claimed_at"], name: "index_bounties_on_claimed_at" + t.index ["issue_id", "issuer_id"], name: "index_bounties_on_issue_id_and_issuer_id" + t.index ["issue_id"], name: "index_bounties_on_issue_id" + t.index ["issuer_id"], name: "index_bounties_on_issuer_id" end - add_index "bounties", ["claimant_id"], name: "index_bounties_on_claimant_id", using: :btree - add_index "bounties", ["issue_id", "issuer_id"], name: "index_bounties_on_issue_id_and_issuer_id", using: :btree - add_index "bounties", ["issue_id"], name: "index_bounties_on_issue_id", using: :btree - add_index "bounties", ["issuer_id"], name: "index_bounties_on_issuer_id", using: :btree - - create_table "coders", force: true do |t| - t.string "github_name", null: false - t.string "full_name", default: "", null: false - t.string "avatar_url", null: false - t.string "github_url", null: false - t.integer "reward_residual", default: 0, null: false - t.integer "absolute_bounty_residual", limit: 8, default: 0, null: false - t.integer "other_score", default: 0, null: false + create_table "coders", force: :cascade do |t| + t.string "github_name", null: false + t.string "full_name", default: "", null: false + t.string "avatar_url", null: false + t.string "github_url", null: false + t.integer "reward_residual", default: 0, null: false + t.bigint "absolute_bounty_residual", default: 0, null: false + t.integer "other_score", default: 0, null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["github_name"], name: "index_coders_on_github_name", unique: true + t.index ["github_url"], name: "index_coders_on_github_url", unique: true end - add_index "coders", ["github_name"], name: "index_coders_on_github_name", unique: true, using: :btree - add_index "coders", ["github_url"], name: "index_coders_on_github_url", unique: true, using: :btree - - create_table "commits", force: true do |t| - t.integer "coder_id" - t.integer "repository_id" - t.string "sha", null: false - t.integer "additions", default: 0, null: false - t.integer "deletions", default: 0, null: false - t.datetime "date", null: false + create_table "commits", force: :cascade do |t| + t.integer "coder_id" + t.integer "repository_id" + t.string "sha", null: false + t.integer "additions", default: 0, null: false + t.integer "deletions", default: 0, null: false + t.datetime "date", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["coder_id"], name: "index_commits_on_coder_id" + t.index ["date"], name: "index_commits_on_date" + t.index ["repository_id", "sha"], name: "index_commits_on_repository_id_and_sha", unique: true + t.index ["repository_id"], name: "index_commits_on_repository_id" end - add_index "commits", ["coder_id"], name: "index_commits_on_coder_id", using: :btree - add_index "commits", ["repository_id", "sha"], name: "index_commits_on_repository_id_and_sha", unique: true, using: :btree - add_index "commits", ["repository_id"], name: "index_commits_on_repository_id", using: :btree - - create_table "git_identities", force: true do |t| - t.string "name", null: false - t.string "email", null: false - t.integer "coder_id" + create_table "git_identities", force: :cascade do |t| + t.string "name", null: false + t.string "email", null: false + t.integer "coder_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["coder_id"], name: "index_git_identities_on_coder_id" + t.index ["name", "email"], name: "index_git_identities_on_name_and_email", unique: true end - add_index "git_identities", ["coder_id"], name: "index_git_identities_on_coder_id", using: :btree - add_index "git_identities", ["name", "email"], name: "index_git_identities_on_name_and_email", unique: true, using: :btree - - create_table "issues", force: true do |t| - t.string "github_url", null: false - t.integer "number", null: false - t.string "title", default: "Untitled", null: false - t.integer "issuer_id", null: false - t.integer "repository_id", null: false - t.text "labels", null: false - t.text "body" - t.integer "assignee_id" - t.string "milestone" - t.datetime "opened_at", null: false + create_table "issues", force: :cascade do |t| + t.string "github_url", null: false + t.integer "number", null: false + t.string "title", default: "Untitled", null: false + t.integer "issuer_id", null: false + t.integer "repository_id", null: false + t.text "labels", null: false + t.text "body" + t.integer "assignee_id" + t.string "milestone" + t.datetime "opened_at", null: false t.datetime "closed_at" t.datetime "created_at" t.datetime "updated_at" + t.index ["github_url"], name: "index_issues_on_github_url", unique: true + t.index ["repository_id", "number"], name: "index_issues_on_repository_id_and_number", unique: true + t.index ["repository_id"], name: "index_issues_on_repository_id" end - add_index "issues", ["github_url"], name: "index_issues_on_github_url", unique: true, using: :btree - add_index "issues", ["repository_id", "number"], name: "index_issues_on_repository_id_and_number", unique: true, using: :btree - add_index "issues", ["repository_id"], name: "index_issues_on_repository_id", using: :btree - - create_table "repositories", force: true do |t| - t.string "name", null: false - t.string "github_url", null: false - t.string "clone_url", null: false + create_table "repositories", force: :cascade do |t| + t.string "name", null: false + t.string "github_url", null: false + t.string "clone_url", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["name"], name: "index_repositories_on_name" end end diff --git a/db/seeds.rb b/db/seeds.rb index 9a97430..a343b47 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -12,6 +12,6 @@ repos = github.repos.list :all, org: Rails.application.config.organisation repos.select { |r| RepoFilters.track? r }.each do |hash| - puts "Now creating: " + hash + puts "Now creating: " + hash.to_s Repository.create_or_update hash end diff --git a/lib/active_record_extensions.rb b/lib/active_record_extensions.rb deleted file mode 100644 index 3dcb4b5..0000000 --- a/lib/active_record_extensions.rb +++ /dev/null @@ -1,13 +0,0 @@ -# Monkey patches of ActiveRecord::Base - -module ActiveRecord - class Base - include Rails.application.routes.url_helpers - - def base_uri - url_for(self) - rescue NoMethodError - url_for(self.class) - end - end -end