File tree Expand file tree Collapse file tree 8 files changed +63
-115
lines changed Expand file tree Collapse file tree 8 files changed +63
-115
lines changed Original file line number Diff line number Diff line change 1+ ruby 3.2.0
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- ruby "2.6.6 "
3+ ruby "3.2.0 "
44
55source "https://rubygems.org"
66
7- git_source ( :github ) { |repo_name | "https://github.com/#{ repo_name } " }
8-
9- gem "sinatra" , "~> 2.1"
10- gem "rack-contrib" , "~> 2.3"
11- gem "sinatra-contrib" , "~> 2.1"
12- gem "amazing_print" , "~> 1.2"
13- gem "activerecord" , "~> 6.1"
14- gem "sinatra-activerecord" , "~> 2.0"
15-
16- group :development do
17- gem "sqlite3"
18- end
19- gem "pg" , "~> 1.2"
7+ gem "sinatra" , "~> 3.0"
8+ gem "sinatra-contrib" , "~> 3.0"
9+ gem "sinatra-cross_origin" , "~> 0.4.0"
10+ gem "puma"
2011
21- gem "rake" , "~> 13.0"
12+ gem "activerecord" , "~> 7.0"
13+ gem "sqlite3"
2214
23- gem "sinatra-cross_origin" , "~> 0.4.0"
Original file line number Diff line number Diff line change 11GEM
22 remote: https://rubygems.org/
33 specs:
4- activemodel (6.1.3 )
5- activesupport (= 6.1.3 )
6- activerecord (6.1.3 )
7- activemodel (= 6.1.3 )
8- activesupport (= 6.1.3 )
9- activesupport (6.1.3 )
4+ activemodel (7.0.4 )
5+ activesupport (= 7.0.4 )
6+ activerecord (7.0.4 )
7+ activemodel (= 7.0.4 )
8+ activesupport (= 7.0.4 )
9+ activesupport (7.0.4 )
1010 concurrent-ruby (~> 1.0 , >= 1.0.2 )
1111 i18n (>= 1.6 , < 2 )
1212 minitest (>= 5.1 )
1313 tzinfo (~> 2.0 )
14- zeitwerk (~> 2.3 )
15- amazing_print (1.2.2 )
16- concurrent-ruby (1.1.8 )
17- i18n (1.8.9 )
14+ concurrent-ruby (1.1.10 )
15+ i18n (1.12.0 )
1816 concurrent-ruby (~> 1.0 )
19- minitest (5.14.3 )
17+ mini_portile2 (2.8.1 )
18+ minitest (5.17.0 )
2019 multi_json (1.15.0 )
21- mustermann (1.1.1 )
20+ mustermann (3.0.0 )
2221 ruby2_keywords (~> 0.0.1 )
23- pg ( 1.2.3 )
24- rack ( 2.2.3 )
25- rack-contrib ( 2.3 .0 )
26- rack (~> 2.0 )
27- rack-protection (2.1.0 )
22+ nio4r ( 2.5.8 )
23+ puma ( 6.0.2 )
24+ nio4r ( ~> 2 .0 )
25+ rack (2.2.5 )
26+ rack-protection (3.0.5 )
2827 rack
29- rake (13.0.3 )
30- ruby2_keywords (0.0.4 )
31- sinatra (2.1.0 )
32- mustermann (~> 1.0 )
33- rack (~> 2.2 )
34- rack-protection (= 2.1.0 )
28+ ruby2_keywords (0.0.5 )
29+ sinatra (3.0.5 )
30+ mustermann (~> 3.0 )
31+ rack (~> 2.2 , >= 2.2.4 )
32+ rack-protection (= 3.0.5 )
3533 tilt (~> 2.0 )
36- sinatra-activerecord (2.0.22 )
37- activerecord (>= 4.1 )
38- sinatra (>= 1.0 )
39- sinatra-contrib (2.1.0 )
34+ sinatra-contrib (3.0.5 )
4035 multi_json
41- mustermann (~> 1 .0 )
42- rack-protection (= 2.1.0 )
43- sinatra (= 2.1.0 )
36+ mustermann (~> 3 .0 )
37+ rack-protection (= 3.0.5 )
38+ sinatra (= 3.0.5 )
4439 tilt (~> 2.0 )
4540 sinatra-cross_origin (0.4.0 )
46- sqlite3 (1.4.2 )
47- tilt (2.0.10 )
48- tzinfo (2.0.4 )
41+ sqlite3 (1.5.4 )
42+ mini_portile2 (~> 2.8.0 )
43+ tilt (2.0.11 )
44+ tzinfo (2.0.5 )
4945 concurrent-ruby (~> 1.0 )
50- zeitwerk (2.4.2 )
5146
5247PLATFORMS
53- ruby
48+ arm64-darwin-21
5449
5550DEPENDENCIES
56- activerecord (~> 6.1 )
57- amazing_print (~> 1.2 )
58- pg (~> 1.2 )
59- rack-contrib (~> 2.3 )
60- rake (~> 13.0 )
61- sinatra (~> 2.1 )
62- sinatra-activerecord (~> 2.0 )
63- sinatra-contrib (~> 2.1 )
51+ activerecord (~> 7.0 )
52+ puma
53+ sinatra (~> 3.0 )
54+ sinatra-contrib (~> 3.0 )
6455 sinatra-cross_origin (~> 0.4.0 )
6556 sqlite3
6657
6758RUBY VERSION
68- ruby 2.6.6p146
59+ ruby 3.2.0p0
6960
7061BUNDLED WITH
71- 2.1.4
62+ 2.4.1
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11require "sinatra"
22require "sinatra/json"
3- require "sinatra/activerecord"
43require "json"
5- require "amazing_print"
64
75require_relative "./game.rb"
86
97if ENV [ "PORT" ]
108 set :port , ENV [ "PORT" ]
119end
1210
13- if ENV [ "RACK_ENV" ] != "production"
14- set :database_file , "./config/database.yml"
15- end
16-
1711configure do
1812 enable :cross_origin
1913end
3933
4034 # Remove all the old games.
4135 # This makes sure that we do not fill the database
42- Game . where ( "created_at < ?" , Date . today - 30 ) . delete_all
36+ Game . where ( "created_at < ?" , Date . today - 3 ) . delete_all
4337
4438 game = Game . create ( difficulty : data [ "difficulty" ] . to_i , state : "new" )
4539
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ require "active_record"
2+
3+ ActiveRecord ::Base . establish_connection (
4+ adapter : 'sqlite3' ,
5+ database : 'db.sqlite3'
6+ )
7+
8+ ActiveRecord ::Schema . define do
9+ create_table :games do |t |
10+ t . string :game
11+ t . string :state
12+ t . string :board
13+ t . string :mine_locations
14+ t . integer :difficulty
15+ t . timestamps
16+ end
17+ end
18+
119class Game < ActiveRecord ::Base
220 serialize :board , Array
321 serialize :mine_locations , Array
You can’t perform that action at this time.
0 commit comments