diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-30 13:29:08 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-30 13:29:08 -0500 |
commit | 0929719a845897cc8567cf972e07a69a71f0fa6f (patch) | |
tree | 2b6f69c1d906abb6e0abf8a0f1d51725bc78087d | |
parent | 01c1947537e4e23ded0c16812a7cd9d49ad88356 (diff) | |
download | wittle-0929719a845897cc8567cf972e07a69a71f0fa6f.tar.gz wittle-0929719a845897cc8567cf972e07a69a71f0fa6f.tar.bz2 wittle-0929719a845897cc8567cf972e07a69a71f0fa6f.zip |
Migrate to a full rails app
-rw-r--r-- | .gitattributes | 9 | ||||
-rw-r--r-- | .gitignore | 46 | ||||
-rw-r--r-- | .ruby-version | 1 | ||||
-rw-r--r-- | Gemfile | 82 | ||||
-rw-r--r-- | Gemfile.lock | 224 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | Rakefile | 12 | ||||
-rw-r--r-- | app/assets/audio/panel_abort_tracing.aac (renamed from app/assets/audio/wittle/panel_abort_tracing.aac) | bin | 5606 -> 5606 bytes | |||
-rw-r--r-- | app/assets/audio/panel_failure.aac (renamed from app/assets/audio/wittle/panel_failure.aac) | bin | 8543 -> 8543 bytes | |||
-rw-r--r-- | app/assets/audio/panel_start_tracing.aac (renamed from app/assets/audio/wittle/panel_start_tracing.aac) | bin | 12082 -> 12082 bytes | |||
-rw-r--r-- | app/assets/audio/panel_success.aac (renamed from app/assets/audio/wittle/panel_success.aac) | bin | 46061 -> 46061 bytes | |||
-rw-r--r-- | app/assets/config/manifest.js | 6 | ||||
-rw-r--r-- | app/assets/config/wittle_manifest.js | 4 | ||||
-rw-r--r-- | app/assets/images/.keep (renamed from app/assets/audio/wittle/.keep) | 0 | ||||
-rw-r--r-- | app/assets/images/slider.png (renamed from app/assets/images/wittle/slider.png) | bin | 20100 -> 20100 bytes | |||
-rw-r--r-- | app/assets/images/wittle_expert.png (renamed from app/assets/images/wittle/wittle_expert.png) | bin | 155050 -> 155050 bytes | |||
-rw-r--r-- | app/assets/images/wittle_hard.png (renamed from app/assets/images/wittle/wittle_hard.png) | bin | 92194 -> 92194 bytes | |||
-rw-r--r-- | app/assets/images/wittle_header.png (renamed from app/assets/images/wittle/wittle_header.png) | bin | 82868 -> 82868 bytes | |||
-rw-r--r-- | app/assets/images/wittle_normal.png (renamed from app/assets/images/wittle/wittle_normal.png) | bin | 81341 -> 81341 bytes | |||
-rw-r--r-- | app/assets/javascripts/application.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/custom_mechanics.js (renamed from app/assets/javascripts/wittle/custom_mechanics.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/display2.js (renamed from app/assets/javascripts/wittle/display2.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/polyominos.js (renamed from app/assets/javascripts/wittle/polyominos.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/puzzle.js (renamed from app/assets/javascripts/wittle/puzzle.js) | 2 | ||||
-rw-r--r-- | app/assets/javascripts/serializer.js (renamed from app/assets/javascripts/wittle/serializer.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/solve.js (renamed from app/assets/javascripts/wittle/solve.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/svg.js (renamed from app/assets/javascripts/wittle/svg.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/trace2.js (renamed from app/assets/javascripts/wittle/trace2.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/utilities.js.erb (renamed from app/assets/javascripts/wittle/utilities.js.erb) | 8 | ||||
-rw-r--r-- | app/assets/javascripts/validate.js (renamed from app/assets/javascripts/wittle/validate.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/wittle.js (renamed from app/assets/javascripts/wittle/wittle.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/wittle/application.js | 14 | ||||
-rw-r--r-- | app/assets/stylesheets/application.css (renamed from test/dummy/app/assets/stylesheets/application.css) | 6 | ||||
-rw-r--r-- | app/assets/stylesheets/general.css.scss (renamed from app/assets/stylesheets/wittle/general.css.scss) | 14 | ||||
-rw-r--r-- | app/assets/stylesheets/wittle/application.css | 15 | ||||
-rw-r--r-- | app/channels/application_cable/channel.rb (renamed from test/dummy/app/channels/application_cable/channel.rb) | 0 | ||||
-rw-r--r-- | app/channels/application_cable/connection.rb (renamed from test/dummy/app/channels/application_cable/connection.rb) | 0 | ||||
-rw-r--r-- | app/controllers/application_controller.rb (renamed from test/dummy/app/controllers/application_controller.rb) | 0 | ||||
-rw-r--r-- | app/controllers/puzzles_controller.rb | 109 | ||||
-rw-r--r-- | app/controllers/wittle/application_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/wittle/puzzles_controller.rb | 120 | ||||
-rw-r--r-- | app/helpers/application_helper.rb (renamed from test/dummy/app/helpers/application_helper.rb) | 0 | ||||
-rw-r--r-- | app/helpers/puzzles_helper.rb | 7 | ||||
-rw-r--r-- | app/helpers/wittle/application_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/wittle/puzzles_helper.rb | 9 | ||||
-rw-r--r-- | app/jobs/application_job.rb (renamed from test/dummy/app/jobs/application_job.rb) | 0 | ||||
-rw-r--r-- | app/jobs/wittle/application_job.rb | 4 | ||||
-rw-r--r-- | app/mailers/application_mailer.rb (renamed from test/dummy/app/mailers/application_mailer.rb) | 0 | ||||
-rw-r--r-- | app/mailers/wittle/application_mailer.rb | 6 | ||||
-rw-r--r-- | app/models/application_record.rb (renamed from test/dummy/app/models/application_record.rb) | 0 | ||||
-rw-r--r-- | app/models/puzzle.rb | 14 | ||||
-rw-r--r-- | app/models/score.rb | 7 | ||||
-rw-r--r-- | app/models/wittle/application_record.rb | 5 | ||||
-rw-r--r-- | app/models/wittle/puzzle.rb | 16 | ||||
-rw-r--r-- | app/models/wittle/score.rb | 9 | ||||
-rw-r--r-- | app/views/layouts/application.html.haml (renamed from app/views/layouts/wittle/application.html.haml) | 4 | ||||
-rw-r--r-- | app/views/layouts/mailer.html.erb (renamed from test/dummy/app/views/layouts/mailer.html.erb) | 0 | ||||
-rw-r--r-- | app/views/layouts/mailer.text.erb (renamed from test/dummy/app/views/layouts/mailer.text.erb) | 0 | ||||
-rw-r--r-- | app/views/puzzles/_handle_puzzle.html.erb (renamed from app/views/wittle/puzzles/_handle_puzzle.html.erb) | 0 | ||||
-rw-r--r-- | app/views/puzzles/_submission.html.haml (renamed from app/views/wittle/puzzles/_submission.html.haml) | 0 | ||||
-rw-r--r-- | app/views/puzzles/about.html.haml (renamed from app/views/wittle/puzzles/about.html.haml) | 0 | ||||
-rw-r--r-- | app/views/puzzles/index.html.haml (renamed from app/views/wittle/puzzles/index.html.haml) | 0 | ||||
-rw-r--r-- | app/views/puzzles/show.html.haml (renamed from app/views/wittle/puzzles/show.html.haml) | 0 | ||||
-rw-r--r-- | app/views/puzzles/solve.js.erb (renamed from app/views/wittle/puzzles/solve.js.erb) | 0 | ||||
-rwxr-xr-x | bin/bundle | 109 | ||||
-rwxr-xr-x | bin/rails | 16 | ||||
-rwxr-xr-x | bin/rake (renamed from test/dummy/bin/rake) | 0 | ||||
-rwxr-xr-x | bin/setup (renamed from test/dummy/bin/setup) | 0 | ||||
-rw-r--r-- | config.ru (renamed from test/dummy/config.ru) | 0 | ||||
-rw-r--r-- | config/application.rb (renamed from test/dummy/config/application.rb) | 8 | ||||
-rw-r--r-- | config/boot.rb | 4 | ||||
-rw-r--r-- | config/cable.yml (renamed from test/dummy/config/cable.yml) | 2 | ||||
-rw-r--r-- | config/credentials.yml.enc | 1 | ||||
-rw-r--r-- | config/database.yml (renamed from test/dummy/config/database.yml) | 0 | ||||
-rw-r--r-- | config/environment.rb (renamed from test/dummy/config/environment.rb) | 0 | ||||
-rw-r--r-- | config/environments/development.rb (renamed from test/dummy/config/environments/development.rb) | 0 | ||||
-rw-r--r-- | config/environments/production.rb (renamed from test/dummy/config/environments/production.rb) | 11 | ||||
-rw-r--r-- | config/environments/test.rb (renamed from test/dummy/config/environments/test.rb) | 4 | ||||
-rw-r--r-- | config/initializers/assets.rb (renamed from test/dummy/config/initializers/assets.rb) | 0 | ||||
-rw-r--r-- | config/initializers/content_security_policy.rb (renamed from test/dummy/config/initializers/content_security_policy.rb) | 0 | ||||
-rw-r--r-- | config/initializers/filter_parameter_logging.rb (renamed from test/dummy/config/initializers/filter_parameter_logging.rb) | 0 | ||||
-rw-r--r-- | config/initializers/inflections.rb (renamed from test/dummy/config/initializers/inflections.rb) | 0 | ||||
-rw-r--r-- | config/initializers/permissions_policy.rb (renamed from test/dummy/config/initializers/permissions_policy.rb) | 0 | ||||
-rw-r--r-- | config/locales/en.yml (renamed from test/dummy/config/locales/en.yml) | 0 | ||||
-rw-r--r-- | config/puma.rb (renamed from test/dummy/config/puma.rb) | 0 | ||||
-rw-r--r-- | config/routes.rb | 2 | ||||
-rw-r--r-- | config/storage.yml (renamed from test/dummy/config/storage.yml) | 0 | ||||
-rw-r--r-- | db/migrate/20231130173455_create_puzzles.rb (renamed from db/migrate/20231028205751_create_wittle_puzzles.rb) | 4 | ||||
-rw-r--r-- | db/migrate/20231130173513_create_scores.rb (renamed from db/migrate/20231028210722_create_wittle_scores.rb) | 4 | ||||
-rw-r--r-- | db/schema.rb (renamed from test/dummy/db/schema.rb) | 8 | ||||
-rw-r--r-- | db/seeds.rb | 9 | ||||
-rw-r--r-- | lib/assets/.keep (renamed from test/dummy/app/assets/images/.keep) | 0 | ||||
-rw-r--r-- | lib/tasks/.keep (renamed from test/dummy/app/controllers/concerns/.keep) | 0 | ||||
-rw-r--r-- | lib/tasks/wittle_tasks.rake | 8 | ||||
-rw-r--r-- | lib/wittle.rb | 6 | ||||
-rw-r--r-- | lib/wittle/engine.rb | 11 | ||||
-rw-r--r-- | lib/wittle/version.rb | 3 | ||||
-rw-r--r-- | log/.keep (renamed from test/dummy/app/models/concerns/.keep) | 0 | ||||
-rw-r--r-- | public/404.html (renamed from test/dummy/public/404.html) | 0 | ||||
-rw-r--r-- | public/422.html (renamed from test/dummy/public/422.html) | 0 | ||||
-rw-r--r-- | public/500.html (renamed from test/dummy/public/500.html) | 0 | ||||
-rw-r--r-- | public/apple-touch-icon-precomposed.png (renamed from test/dummy/public/apple-touch-icon-precomposed.png) | 0 | ||||
-rw-r--r-- | public/apple-touch-icon.png (renamed from test/dummy/public/apple-touch-icon.png) | 0 | ||||
-rw-r--r-- | public/favicon.ico (renamed from test/dummy/public/favicon.ico) | 0 | ||||
-rw-r--r-- | public/robots.txt | 1 | ||||
-rw-r--r-- | storage/.keep (renamed from test/dummy/lib/assets/.keep) | 0 | ||||
-rw-r--r-- | test/application_system_test_case.rb | 5 | ||||
-rw-r--r-- | test/channels/application_cable/connection_test.rb | 13 | ||||
-rw-r--r-- | test/controllers/puzzles_controller_test.rb | 7 | ||||
-rw-r--r-- | test/controllers/wittle/puzzles_controller_test.rb | 12 | ||||
-rw-r--r-- | test/dummy/Rakefile | 6 | ||||
-rw-r--r-- | test/dummy/app/assets/config/manifest.js | 3 | ||||
-rw-r--r-- | test/dummy/app/views/layouts/application.html.erb | 15 | ||||
-rwxr-xr-x | test/dummy/bin/rails | 4 | ||||
-rw-r--r-- | test/dummy/config/boot.rb | 5 | ||||
-rw-r--r-- | test/dummy/config/routes.rb | 3 | ||||
-rw-r--r-- | test/fixtures/puzzles.yml (renamed from test/fixtures/wittle/puzzles.yml) | 0 | ||||
-rw-r--r-- | test/fixtures/scores.yml (renamed from test/fixtures/wittle/scores.yml) | 0 | ||||
-rw-r--r-- | test/models/puzzle_test.rb (renamed from test/integration/navigation_test.rb) | 2 | ||||
-rw-r--r-- | test/models/score_test.rb | 7 | ||||
-rw-r--r-- | test/models/wittle/puzzle_test.rb | 9 | ||||
-rw-r--r-- | test/models/wittle/score_test.rb | 9 | ||||
-rw-r--r-- | test/system/.keep (renamed from lib/keep) | 0 | ||||
-rw-r--r-- | test/test_helper.rb | 24 | ||||
-rw-r--r-- | test/wittle_test.rb | 7 | ||||
-rw-r--r-- | tmp/.keep | 0 | ||||
-rw-r--r-- | tmp/pids/.keep | 0 | ||||
-rw-r--r-- | tmp/storage/.keep | 0 | ||||
-rw-r--r-- | vendor/.keep | 0 | ||||
-rw-r--r-- | vendor/javascript/.keep | 0 | ||||
-rw-r--r-- | wittle.gemspec | 24 |
131 files changed, 625 insertions, 506 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8dc4323 --- /dev/null +++ b/.gitattributes | |||
@@ -0,0 +1,9 @@ | |||
1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files. | ||
2 | |||
3 | # Mark the database schema as having been generated. | ||
4 | db/schema.rb linguist-generated | ||
5 | |||
6 | # Mark any vendored files as having been vendored. | ||
7 | vendor/* linguist-vendored | ||
8 | config/credentials/*.yml.enc diff=rails_credentials | ||
9 | config/credentials.yml.enc diff=rails_credentials | ||
diff --git a/.gitignore b/.gitignore index 162e77e..b03f305 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -1,14 +1,40 @@ | |||
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
2 | # | ||
3 | # If you find yourself ignoring temporary files generated by your text editor | ||
4 | # or operating system, you probably want to add a global ignore instead: | ||
5 | # git config --global core.excludesfile '~/.gitignore_global' | ||
6 | |||
7 | # Ignore bundler config. | ||
8 | /.bundle | ||
9 | |||
10 | # Ignore all environment files (except templates). | ||
11 | /.env* | ||
12 | !/.env*.erb | ||
13 | |||
14 | # Ignore all logfiles and tempfiles. | ||
15 | /log/* | ||
16 | /tmp/* | ||
17 | !/log/.keep | ||
18 | !/tmp/.keep | ||
19 | |||
20 | # Ignore pidfiles, but keep the directory. | ||
21 | /tmp/pids/* | ||
22 | !/tmp/pids/ | ||
23 | !/tmp/pids/.keep | ||
24 | |||
25 | # Ignore storage (uploaded files in development and any SQLite databases). | ||
26 | /storage/* | ||
27 | !/storage/.keep | ||
28 | /tmp/storage/* | ||
29 | !/tmp/storage/ | ||
30 | !/tmp/storage/.keep | ||
31 | |||
32 | /public/assets | ||
33 | |||
34 | # Ignore master key for decrypting credentials and more. | ||
35 | /config/master.key | ||
36 | |||
1 | ext/wittle_generator/build | 37 | ext/wittle_generator/build |
2 | *.o | 38 | *.o |
3 | mkmf.log | 39 | mkmf.log |
4 | wittle_generator.bundle | 40 | wittle_generator.bundle |
5 | /.bundle/ | ||
6 | /doc/ | ||
7 | /log/*.log | ||
8 | /pkg/ | ||
9 | /tmp/ | ||
10 | /test/dummy/db/*.sqlite3 | ||
11 | /test/dummy/db/*.sqlite3-* | ||
12 | /test/dummy/log/*.log | ||
13 | /test/dummy/storage/ | ||
14 | /test/dummy/tmp/ | ||
diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..9e79f6c --- /dev/null +++ b/.ruby-version | |||
@@ -0,0 +1 @@ | |||
ruby-3.2.2 | |||
diff --git a/Gemfile b/Gemfile index a4414ee..0baa41c 100644 --- a/Gemfile +++ b/Gemfile | |||
@@ -1,15 +1,79 @@ | |||
1 | source "https://rubygems.org" | 1 | source "https://rubygems.org" |
2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } | ||
3 | 2 | ||
4 | # Specify your gem's dependencies in wittle.gemspec. | 3 | ruby "3.2.2" |
5 | gemspec | ||
6 | 4 | ||
7 | gem "puma" | 5 | # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" |
8 | 6 | gem "rails", "~> 7.1.2" | |
9 | gem "sqlite3" | ||
10 | 7 | ||
8 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] | ||
11 | gem "sprockets-rails" | 9 | gem "sprockets-rails" |
12 | gem "rake-compiler" | ||
13 | 10 | ||
14 | # Start debugger with binding.b [https://github.com/ruby/debug] | 11 | # Use sqlite3 as the database for Active Record |
15 | # gem "debug", ">= 1.0.0" | 12 | gem "sqlite3", "~> 1.4" |
13 | |||
14 | # Use the Puma web server [https://github.com/puma/puma] | ||
15 | gem "puma", ">= 5.0" | ||
16 | |||
17 | # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] | ||
18 | #gem "importmap-rails" | ||
19 | |||
20 | # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] | ||
21 | #gem "turbo-rails" | ||
22 | |||
23 | # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] | ||
24 | # gem "stimulus-rails" | ||
25 | |||
26 | # Build JSON APIs with ease [https://github.com/rails/jbuilder] | ||
27 | gem "jbuilder" | ||
28 | |||
29 | # Use Redis adapter to run Action Cable in production | ||
30 | # gem "redis", ">= 4.0.1" | ||
31 | |||
32 | # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] | ||
33 | # gem "kredis" | ||
34 | |||
35 | # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] | ||
36 | # gem "bcrypt", "~> 3.1.7" | ||
37 | |||
38 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
39 | gem "tzinfo-data", platforms: %i[ windows jruby ] | ||
40 | |||
41 | # Reduces boot times through caching; required in config/boot.rb | ||
42 | gem "bootsnap", require: false | ||
43 | |||
44 | # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] | ||
45 | # gem "image_processing", "~> 1.2" | ||
46 | |||
47 | # Use Uglifier as compressor for JavaScript assets | ||
48 | gem 'terser', '~> 1.1.19' | ||
49 | # See https://github.com/rails/execjs#readme for more supported runtimes | ||
50 | gem 'mini_racer' | ||
51 | |||
52 | group :development, :test do | ||
53 | # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem | ||
54 | gem "debug", platforms: %i[ mri windows ] | ||
55 | end | ||
56 | |||
57 | group :development do | ||
58 | # Use console on exceptions pages [https://github.com/rails/web-console] | ||
59 | gem "web-console" | ||
60 | |||
61 | # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] | ||
62 | # gem "rack-mini-profiler" | ||
63 | |||
64 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring] | ||
65 | # gem "spring" | ||
66 | end | ||
67 | |||
68 | group :test do | ||
69 | # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] | ||
70 | gem "capybara" | ||
71 | gem "selenium-webdriver" | ||
72 | end | ||
73 | |||
74 | gem "rice" | ||
75 | gem "haml" | ||
76 | gem "enumerize" | ||
77 | gem "sassc-rails" | ||
78 | gem "jquery-rails" | ||
79 | gem "rake-compiler" | ||
diff --git a/Gemfile.lock b/Gemfile.lock index 11ce5d5..86a8335 100644 --- a/Gemfile.lock +++ b/Gemfile.lock | |||
@@ -1,81 +1,71 @@ | |||
1 | PATH | ||
2 | remote: . | ||
3 | specs: | ||
4 | wittle (0.1.0) | ||
5 | enumerize | ||
6 | haml | ||
7 | jquery-rails | ||
8 | rails (>= 7.1.1) | ||
9 | rice | ||
10 | sassc-rails | ||
11 | |||
12 | GEM | 1 | GEM |
13 | remote: https://rubygems.org/ | 2 | remote: https://rubygems.org/ |
14 | specs: | 3 | specs: |
15 | actioncable (7.1.1) | 4 | actioncable (7.1.2) |
16 | actionpack (= 7.1.1) | 5 | actionpack (= 7.1.2) |
17 | activesupport (= 7.1.1) | 6 | activesupport (= 7.1.2) |
18 | nio4r (~> 2.0) | 7 | nio4r (~> 2.0) |
19 | websocket-driver (>= 0.6.1) | 8 | websocket-driver (>= 0.6.1) |
20 | zeitwerk (~> 2.6) | 9 | zeitwerk (~> 2.6) |
21 | actionmailbox (7.1.1) | 10 | actionmailbox (7.1.2) |
22 | actionpack (= 7.1.1) | 11 | actionpack (= 7.1.2) |
23 | activejob (= 7.1.1) | 12 | activejob (= 7.1.2) |
24 | activerecord (= 7.1.1) | 13 | activerecord (= 7.1.2) |
25 | activestorage (= 7.1.1) | 14 | activestorage (= 7.1.2) |
26 | activesupport (= 7.1.1) | 15 | activesupport (= 7.1.2) |
27 | mail (>= 2.7.1) | 16 | mail (>= 2.7.1) |
28 | net-imap | 17 | net-imap |
29 | net-pop | 18 | net-pop |
30 | net-smtp | 19 | net-smtp |
31 | actionmailer (7.1.1) | 20 | actionmailer (7.1.2) |
32 | actionpack (= 7.1.1) | 21 | actionpack (= 7.1.2) |
33 | actionview (= 7.1.1) | 22 | actionview (= 7.1.2) |
34 | activejob (= 7.1.1) | 23 | activejob (= 7.1.2) |
35 | activesupport (= 7.1.1) | 24 | activesupport (= 7.1.2) |
36 | mail (~> 2.5, >= 2.5.4) | 25 | mail (~> 2.5, >= 2.5.4) |
37 | net-imap | 26 | net-imap |
38 | net-pop | 27 | net-pop |
39 | net-smtp | 28 | net-smtp |
40 | rails-dom-testing (~> 2.2) | 29 | rails-dom-testing (~> 2.2) |
41 | actionpack (7.1.1) | 30 | actionpack (7.1.2) |
42 | actionview (= 7.1.1) | 31 | actionview (= 7.1.2) |
43 | activesupport (= 7.1.1) | 32 | activesupport (= 7.1.2) |
44 | nokogiri (>= 1.8.5) | 33 | nokogiri (>= 1.8.5) |
34 | racc | ||
45 | rack (>= 2.2.4) | 35 | rack (>= 2.2.4) |
46 | rack-session (>= 1.0.1) | 36 | rack-session (>= 1.0.1) |
47 | rack-test (>= 0.6.3) | 37 | rack-test (>= 0.6.3) |
48 | rails-dom-testing (~> 2.2) | 38 | rails-dom-testing (~> 2.2) |
49 | rails-html-sanitizer (~> 1.6) | 39 | rails-html-sanitizer (~> 1.6) |
50 | actiontext (7.1.1) | 40 | actiontext (7.1.2) |
51 | actionpack (= 7.1.1) | 41 | actionpack (= 7.1.2) |
52 | activerecord (= 7.1.1) | 42 | activerecord (= 7.1.2) |
53 | activestorage (= 7.1.1) | 43 | activestorage (= 7.1.2) |
54 | activesupport (= 7.1.1) | 44 | activesupport (= 7.1.2) |
55 | globalid (>= 0.6.0) | 45 | globalid (>= 0.6.0) |
56 | nokogiri (>= 1.8.5) | 46 | nokogiri (>= 1.8.5) |
57 | actionview (7.1.1) | 47 | actionview (7.1.2) |
58 | activesupport (= 7.1.1) | 48 | activesupport (= 7.1.2) |
59 | builder (~> 3.1) | 49 | builder (~> 3.1) |
60 | erubi (~> 1.11) | 50 | erubi (~> 1.11) |
61 | rails-dom-testing (~> 2.2) | 51 | rails-dom-testing (~> 2.2) |
62 | rails-html-sanitizer (~> 1.6) | 52 | rails-html-sanitizer (~> 1.6) |
63 | activejob (7.1.1) | 53 | activejob (7.1.2) |
64 | activesupport (= 7.1.1) | 54 | activesupport (= 7.1.2) |
65 | globalid (>= 0.3.6) | 55 | globalid (>= 0.3.6) |
66 | activemodel (7.1.1) | 56 | activemodel (7.1.2) |
67 | activesupport (= 7.1.1) | 57 | activesupport (= 7.1.2) |
68 | activerecord (7.1.1) | 58 | activerecord (7.1.2) |
69 | activemodel (= 7.1.1) | 59 | activemodel (= 7.1.2) |
70 | activesupport (= 7.1.1) | 60 | activesupport (= 7.1.2) |
71 | timeout (>= 0.4.0) | 61 | timeout (>= 0.4.0) |
72 | activestorage (7.1.1) | 62 | activestorage (7.1.2) |
73 | actionpack (= 7.1.1) | 63 | actionpack (= 7.1.2) |
74 | activejob (= 7.1.1) | 64 | activejob (= 7.1.2) |
75 | activerecord (= 7.1.1) | 65 | activerecord (= 7.1.2) |
76 | activesupport (= 7.1.1) | 66 | activesupport (= 7.1.2) |
77 | marcel (~> 1.0) | 67 | marcel (~> 1.0) |
78 | activesupport (7.1.1) | 68 | activesupport (7.1.2) |
79 | base64 | 69 | base64 |
80 | bigdecimal | 70 | bigdecimal |
81 | concurrent-ruby (~> 1.0, >= 1.0.2) | 71 | concurrent-ruby (~> 1.0, >= 1.0.2) |
@@ -85,18 +75,36 @@ GEM | |||
85 | minitest (>= 5.1) | 75 | minitest (>= 5.1) |
86 | mutex_m | 76 | mutex_m |
87 | tzinfo (~> 2.0) | 77 | tzinfo (~> 2.0) |
88 | base64 (0.1.1) | 78 | addressable (2.8.5) |
79 | public_suffix (>= 2.0.2, < 6.0) | ||
80 | base64 (0.2.0) | ||
89 | bigdecimal (3.1.4) | 81 | bigdecimal (3.1.4) |
82 | bindex (0.8.1) | ||
83 | bootsnap (1.17.0) | ||
84 | msgpack (~> 1.2) | ||
90 | builder (3.2.4) | 85 | builder (3.2.4) |
86 | capybara (3.39.2) | ||
87 | addressable | ||
88 | matrix | ||
89 | mini_mime (>= 0.1.3) | ||
90 | nokogiri (~> 1.8) | ||
91 | rack (>= 1.6.0) | ||
92 | rack-test (>= 0.6.3) | ||
93 | regexp_parser (>= 1.5, < 3.0) | ||
94 | xpath (~> 3.2) | ||
91 | concurrent-ruby (1.2.2) | 95 | concurrent-ruby (1.2.2) |
92 | connection_pool (2.4.1) | 96 | connection_pool (2.4.1) |
93 | crass (1.0.6) | 97 | crass (1.0.6) |
94 | date (3.3.3) | 98 | date (3.3.4) |
95 | drb (2.1.1) | 99 | debug (1.8.0) |
100 | irb (>= 1.5.0) | ||
101 | reline (>= 0.3.1) | ||
102 | drb (2.2.0) | ||
96 | ruby2_keywords | 103 | ruby2_keywords |
97 | enumerize (2.7.0) | 104 | enumerize (2.7.0) |
98 | activesupport (>= 3.2) | 105 | activesupport (>= 3.2) |
99 | erubi (1.12.0) | 106 | erubi (1.12.0) |
107 | execjs (2.9.1) | ||
100 | ffi (1.16.3) | 108 | ffi (1.16.3) |
101 | globalid (1.2.1) | 109 | globalid (1.2.1) |
102 | activesupport (>= 6.1) | 110 | activesupport (>= 6.1) |
@@ -107,14 +115,19 @@ GEM | |||
107 | i18n (1.14.1) | 115 | i18n (1.14.1) |
108 | concurrent-ruby (~> 1.0) | 116 | concurrent-ruby (~> 1.0) |
109 | io-console (0.6.0) | 117 | io-console (0.6.0) |
110 | irb (1.8.3) | 118 | irb (1.9.1) |
111 | rdoc | 119 | rdoc |
112 | reline (>= 0.3.8) | 120 | reline (>= 0.3.8) |
121 | jbuilder (2.11.5) | ||
122 | actionview (>= 5.0.0) | ||
123 | activesupport (>= 5.0.0) | ||
113 | jquery-rails (4.6.0) | 124 | jquery-rails (4.6.0) |
114 | rails-dom-testing (>= 1, < 3) | 125 | rails-dom-testing (>= 1, < 3) |
115 | railties (>= 4.2.0) | 126 | railties (>= 4.2.0) |
116 | thor (>= 0.14, < 2.0) | 127 | thor (>= 0.14, < 2.0) |
117 | loofah (2.21.4) | 128 | libv8-node (18.16.0.0-x86_64-darwin) |
129 | libv8-node (18.16.0.0-x86_64-linux) | ||
130 | loofah (2.22.0) | ||
118 | crass (~> 1.0.2) | 131 | crass (~> 1.0.2) |
119 | nokogiri (>= 1.12.0) | 132 | nokogiri (>= 1.12.0) |
120 | mail (2.8.1) | 133 | mail (2.8.1) |
@@ -123,26 +136,33 @@ GEM | |||
123 | net-pop | 136 | net-pop |
124 | net-smtp | 137 | net-smtp |
125 | marcel (1.0.2) | 138 | marcel (1.0.2) |
139 | matrix (0.4.2) | ||
126 | mini_mime (1.1.5) | 140 | mini_mime (1.1.5) |
141 | mini_racer (0.8.0) | ||
142 | libv8-node (~> 18.16.0.0) | ||
127 | minitest (5.20.0) | 143 | minitest (5.20.0) |
128 | mutex_m (0.1.2) | 144 | msgpack (1.7.2) |
129 | net-imap (0.4.2) | 145 | mutex_m (0.2.0) |
146 | net-imap (0.4.7) | ||
130 | date | 147 | date |
131 | net-protocol | 148 | net-protocol |
132 | net-pop (0.1.2) | 149 | net-pop (0.1.2) |
133 | net-protocol | 150 | net-protocol |
134 | net-protocol (0.2.1) | 151 | net-protocol (0.2.2) |
135 | timeout | 152 | timeout |
136 | net-smtp (0.4.0) | 153 | net-smtp (0.4.0) |
137 | net-protocol | 154 | net-protocol |
138 | nio4r (2.5.9) | 155 | nio4r (2.6.1) |
139 | nokogiri (1.15.4-x86_64-darwin) | 156 | nokogiri (1.15.5-x86_64-darwin) |
157 | racc (~> 1.4) | ||
158 | nokogiri (1.15.5-x86_64-linux) | ||
140 | racc (~> 1.4) | 159 | racc (~> 1.4) |
141 | psych (5.1.1.1) | 160 | psych (5.1.1.1) |
142 | stringio | 161 | stringio |
162 | public_suffix (5.0.4) | ||
143 | puma (6.4.0) | 163 | puma (6.4.0) |
144 | nio4r (~> 2.0) | 164 | nio4r (~> 2.0) |
145 | racc (1.7.1) | 165 | racc (1.7.3) |
146 | rack (3.0.8) | 166 | rack (3.0.8) |
147 | rack-session (2.0.0) | 167 | rack-session (2.0.0) |
148 | rack (>= 3.0.0) | 168 | rack (>= 3.0.0) |
@@ -151,20 +171,20 @@ GEM | |||
151 | rackup (2.1.0) | 171 | rackup (2.1.0) |
152 | rack (>= 3) | 172 | rack (>= 3) |
153 | webrick (~> 1.8) | 173 | webrick (~> 1.8) |
154 | rails (7.1.1) | 174 | rails (7.1.2) |
155 | actioncable (= 7.1.1) | 175 | actioncable (= 7.1.2) |
156 | actionmailbox (= 7.1.1) | 176 | actionmailbox (= 7.1.2) |
157 | actionmailer (= 7.1.1) | 177 | actionmailer (= 7.1.2) |
158 | actionpack (= 7.1.1) | 178 | actionpack (= 7.1.2) |
159 | actiontext (= 7.1.1) | 179 | actiontext (= 7.1.2) |
160 | actionview (= 7.1.1) | 180 | actionview (= 7.1.2) |
161 | activejob (= 7.1.1) | 181 | activejob (= 7.1.2) |
162 | activemodel (= 7.1.1) | 182 | activemodel (= 7.1.2) |
163 | activerecord (= 7.1.1) | 183 | activerecord (= 7.1.2) |
164 | activestorage (= 7.1.1) | 184 | activestorage (= 7.1.2) |
165 | activesupport (= 7.1.1) | 185 | activesupport (= 7.1.2) |
166 | bundler (>= 1.15.0) | 186 | bundler (>= 1.15.0) |
167 | railties (= 7.1.1) | 187 | railties (= 7.1.2) |
168 | rails-dom-testing (2.2.0) | 188 | rails-dom-testing (2.2.0) |
169 | activesupport (>= 5.0.0) | 189 | activesupport (>= 5.0.0) |
170 | minitest | 190 | minitest |
@@ -172,9 +192,9 @@ GEM | |||
172 | rails-html-sanitizer (1.6.0) | 192 | rails-html-sanitizer (1.6.0) |
173 | loofah (~> 2.21) | 193 | loofah (~> 2.21) |
174 | nokogiri (~> 1.14) | 194 | nokogiri (~> 1.14) |
175 | railties (7.1.1) | 195 | railties (7.1.2) |
176 | actionpack (= 7.1.1) | 196 | actionpack (= 7.1.2) |
177 | activesupport (= 7.1.1) | 197 | activesupport (= 7.1.2) |
178 | irb | 198 | irb |
179 | rackup (>= 1.0.0) | 199 | rackup (>= 1.0.0) |
180 | rake (>= 12.2) | 200 | rake (>= 12.2) |
@@ -183,12 +203,15 @@ GEM | |||
183 | rake (13.1.0) | 203 | rake (13.1.0) |
184 | rake-compiler (1.2.5) | 204 | rake-compiler (1.2.5) |
185 | rake | 205 | rake |
186 | rdoc (6.5.0) | 206 | rdoc (6.6.0) |
187 | psych (>= 4.0.0) | 207 | psych (>= 4.0.0) |
188 | reline (0.3.9) | 208 | regexp_parser (2.8.2) |
209 | reline (0.4.1) | ||
189 | io-console (~> 0.5) | 210 | io-console (~> 0.5) |
211 | rexml (3.2.6) | ||
190 | rice (4.1.0) | 212 | rice (4.1.0) |
191 | ruby2_keywords (0.0.5) | 213 | ruby2_keywords (0.0.5) |
214 | rubyzip (2.3.2) | ||
192 | sassc (2.4.0) | 215 | sassc (2.4.0) |
193 | ffi (~> 1.9) | 216 | ffi (~> 1.9) |
194 | sassc-rails (2.1.2) | 217 | sassc-rails (2.1.2) |
@@ -197,6 +220,10 @@ GEM | |||
197 | sprockets (> 3.0) | 220 | sprockets (> 3.0) |
198 | sprockets-rails | 221 | sprockets-rails |
199 | tilt | 222 | tilt |
223 | selenium-webdriver (4.15.0) | ||
224 | rexml (~> 3.2, >= 3.2.5) | ||
225 | rubyzip (>= 1.2.2, < 3.0) | ||
226 | websocket (~> 1.0) | ||
200 | sprockets (4.2.1) | 227 | sprockets (4.2.1) |
201 | concurrent-ruby (~> 1.0) | 228 | concurrent-ruby (~> 1.0) |
202 | rack (>= 2.2.4, < 4) | 229 | rack (>= 2.2.4, < 4) |
@@ -204,29 +231,58 @@ GEM | |||
204 | actionpack (>= 5.2) | 231 | actionpack (>= 5.2) |
205 | activesupport (>= 5.2) | 232 | activesupport (>= 5.2) |
206 | sprockets (>= 3.0.0) | 233 | sprockets (>= 3.0.0) |
207 | sqlite3 (1.6.7-x86_64-darwin) | 234 | sqlite3 (1.6.9-x86_64-darwin) |
208 | stringio (3.0.8) | 235 | sqlite3 (1.6.9-x86_64-linux) |
236 | stringio (3.1.0) | ||
209 | temple (0.10.3) | 237 | temple (0.10.3) |
238 | terser (1.1.20) | ||
239 | execjs (>= 0.3.0, < 3) | ||
210 | thor (1.3.0) | 240 | thor (1.3.0) |
211 | tilt (2.3.0) | 241 | tilt (2.3.0) |
212 | timeout (0.4.0) | 242 | timeout (0.4.1) |
213 | tzinfo (2.0.6) | 243 | tzinfo (2.0.6) |
214 | concurrent-ruby (~> 1.0) | 244 | concurrent-ruby (~> 1.0) |
245 | web-console (4.2.1) | ||
246 | actionview (>= 6.0.0) | ||
247 | activemodel (>= 6.0.0) | ||
248 | bindex (>= 0.4.0) | ||
249 | railties (>= 6.0.0) | ||
215 | webrick (1.8.1) | 250 | webrick (1.8.1) |
251 | websocket (1.2.10) | ||
216 | websocket-driver (0.7.6) | 252 | websocket-driver (0.7.6) |
217 | websocket-extensions (>= 0.1.0) | 253 | websocket-extensions (>= 0.1.0) |
218 | websocket-extensions (0.1.5) | 254 | websocket-extensions (0.1.5) |
255 | xpath (3.2.0) | ||
256 | nokogiri (~> 1.8) | ||
219 | zeitwerk (2.6.12) | 257 | zeitwerk (2.6.12) |
220 | 258 | ||
221 | PLATFORMS | 259 | PLATFORMS |
222 | x86_64-darwin-22 | 260 | x86_64-darwin-22 |
261 | x86_64-linux | ||
223 | 262 | ||
224 | DEPENDENCIES | 263 | DEPENDENCIES |
225 | puma | 264 | bootsnap |
265 | capybara | ||
266 | debug | ||
267 | enumerize | ||
268 | haml | ||
269 | jbuilder | ||
270 | jquery-rails | ||
271 | mini_racer | ||
272 | puma (>= 5.0) | ||
273 | rails (~> 7.1.2) | ||
226 | rake-compiler | 274 | rake-compiler |
275 | rice | ||
276 | sassc-rails | ||
277 | selenium-webdriver | ||
227 | sprockets-rails | 278 | sprockets-rails |
228 | sqlite3 | 279 | sqlite3 (~> 1.4) |
229 | wittle! | 280 | terser (~> 1.1.19) |
281 | tzinfo-data | ||
282 | web-console | ||
283 | |||
284 | RUBY VERSION | ||
285 | ruby 3.2.2p53 | ||
230 | 286 | ||
231 | BUNDLED WITH | 287 | BUNDLED WITH |
232 | 2.4.10 | 288 | 2.4.21 |
diff --git a/README.md b/README.md index f42a9fe..96ee4dd 100644 --- a/README.md +++ b/README.md | |||
@@ -1,3 +1,3 @@ | |||
1 | # wittle | 1 | # wittle |
2 | 2 | ||
3 | Rails engine that generates Witness puzzles daily and presents them on a website. Adapted from [Sigma144's Witness Random Puzzle Generator](https://github.com/sigma144/witness-randomizer), which is itself based on [darkid's Witness Randomizer](https://github.com/darkid/witness-randomizer). The tracing UI is adapted from [darkid's witness-puzzles website](https://github.com/jbzdarkid/jbzdarkid.github.io). | 3 | Rails app that generates Witness puzzles daily and presents them on a website. Adapted from [Sigma144's Witness Random Puzzle Generator](https://github.com/sigma144/witness-randomizer), which is itself based on [darkid's Witness Randomizer](https://github.com/darkid/witness-randomizer). The tracing UI is adapted from [darkid's witness-puzzles website](https://github.com/jbzdarkid/jbzdarkid.github.io). |
diff --git a/Rakefile b/Rakefile index 41a438f..e63c405 100644 --- a/Rakefile +++ b/Rakefile | |||
@@ -1,12 +1,10 @@ | |||
1 | require "bundler/setup" | 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, |
2 | require "rake/extensiontask" | 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. |
3 | |||
4 | APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__) | ||
5 | load "rails/tasks/engine.rake" | ||
6 | 3 | ||
7 | load "rails/tasks/statistics.rake" | 4 | require "rake/extensiontask" |
5 | require_relative "config/application" | ||
8 | 6 | ||
9 | require "bundler/gem_tasks" | 7 | Rails.application.load_tasks |
10 | 8 | ||
11 | Rake::ExtensionTask.new "wittle_generator" do |ext| | 9 | Rake::ExtensionTask.new "wittle_generator" do |ext| |
12 | ext.lib_dir = "lib" | 10 | ext.lib_dir = "lib" |
diff --git a/app/assets/audio/wittle/panel_abort_tracing.aac b/app/assets/audio/panel_abort_tracing.aac index 1871586..1871586 100644 --- a/app/assets/audio/wittle/panel_abort_tracing.aac +++ b/app/assets/audio/panel_abort_tracing.aac | |||
Binary files differ | |||
diff --git a/app/assets/audio/wittle/panel_failure.aac b/app/assets/audio/panel_failure.aac index c61fe94..c61fe94 100644 --- a/app/assets/audio/wittle/panel_failure.aac +++ b/app/assets/audio/panel_failure.aac | |||
Binary files differ | |||
diff --git a/app/assets/audio/wittle/panel_start_tracing.aac b/app/assets/audio/panel_start_tracing.aac index 9b828f1..9b828f1 100644 --- a/app/assets/audio/wittle/panel_start_tracing.aac +++ b/app/assets/audio/panel_start_tracing.aac | |||
Binary files differ | |||
diff --git a/app/assets/audio/wittle/panel_success.aac b/app/assets/audio/panel_success.aac index d6e75fe..d6e75fe 100644 --- a/app/assets/audio/wittle/panel_success.aac +++ b/app/assets/audio/panel_success.aac | |||
Binary files differ | |||
diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000..70ff62e --- /dev/null +++ b/app/assets/config/manifest.js | |||
@@ -0,0 +1,6 @@ | |||
1 | //= link_tree ../images | ||
2 | //= link_directory ../stylesheets .css | ||
3 | //= link_directory ../javascripts .js | ||
4 | //= link_tree ../../../vendor/javascript .js | ||
5 | //= link_directory ../audio .aac | ||
6 | //= link jquery.min.js | ||
diff --git a/app/assets/config/wittle_manifest.js b/app/assets/config/wittle_manifest.js deleted file mode 100644 index 46aea2a..0000000 --- a/app/assets/config/wittle_manifest.js +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | //= link_directory ../stylesheets/wittle .css | ||
2 | //= link_directory ../javascripts/wittle .js | ||
3 | //= link_directory ../audio/wittle .aac | ||
4 | //= link_directory ../images/wittle .png | ||
diff --git a/app/assets/audio/wittle/.keep b/app/assets/images/.keep index e69de29..e69de29 100644 --- a/app/assets/audio/wittle/.keep +++ b/app/assets/images/.keep | |||
diff --git a/app/assets/images/wittle/slider.png b/app/assets/images/slider.png index f093f89..f093f89 100644 --- a/app/assets/images/wittle/slider.png +++ b/app/assets/images/slider.png | |||
Binary files differ | |||
diff --git a/app/assets/images/wittle/wittle_expert.png b/app/assets/images/wittle_expert.png index b806b57..b806b57 100644 --- a/app/assets/images/wittle/wittle_expert.png +++ b/app/assets/images/wittle_expert.png | |||
Binary files differ | |||
diff --git a/app/assets/images/wittle/wittle_hard.png b/app/assets/images/wittle_hard.png index e993e9b..e993e9b 100644 --- a/app/assets/images/wittle/wittle_hard.png +++ b/app/assets/images/wittle_hard.png | |||
Binary files differ | |||
diff --git a/app/assets/images/wittle/wittle_header.png b/app/assets/images/wittle_header.png index a082f8e..a082f8e 100644 --- a/app/assets/images/wittle/wittle_header.png +++ b/app/assets/images/wittle_header.png | |||
Binary files differ | |||
diff --git a/app/assets/images/wittle/wittle_normal.png b/app/assets/images/wittle_normal.png index adc0943..adc0943 100644 --- a/app/assets/images/wittle/wittle_normal.png +++ b/app/assets/images/wittle_normal.png | |||
Binary files differ | |||
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..e614ed0 --- /dev/null +++ b/app/assets/javascripts/application.js | |||
@@ -0,0 +1,2 @@ | |||
1 | //= require jquery3 | ||
2 | //= require_tree . | ||
diff --git a/app/assets/javascripts/wittle/custom_mechanics.js b/app/assets/javascripts/custom_mechanics.js index d4733db..d4733db 100644 --- a/app/assets/javascripts/wittle/custom_mechanics.js +++ b/app/assets/javascripts/custom_mechanics.js | |||
diff --git a/app/assets/javascripts/wittle/display2.js b/app/assets/javascripts/display2.js index ddf3968..ddf3968 100644 --- a/app/assets/javascripts/wittle/display2.js +++ b/app/assets/javascripts/display2.js | |||
diff --git a/app/assets/javascripts/wittle/polyominos.js b/app/assets/javascripts/polyominos.js index 4d8be6e..4d8be6e 100644 --- a/app/assets/javascripts/wittle/polyominos.js +++ b/app/assets/javascripts/polyominos.js | |||
diff --git a/app/assets/javascripts/wittle/puzzle.js b/app/assets/javascripts/puzzle.js index cb0b20a..4889e96 100644 --- a/app/assets/javascripts/wittle/puzzle.js +++ b/app/assets/javascripts/puzzle.js | |||
@@ -148,7 +148,7 @@ window.Puzzle = class { | |||
148 | this.grid[x] = [] | 148 | this.grid[x] = [] |
149 | for (var y=0; y<height; y++) { | 149 | for (var y=0; y<height; y++) { |
150 | if (x%2 === 1 && y%2 === 1) this.grid[x][y] = null | 150 | if (x%2 === 1 && y%2 === 1) this.grid[x][y] = null |
151 | else this.grid[x][y] = {'type':'line', 'line':LINE_NONE} | 151 | else this.grid[x][y] = {'type':'line', 'line':window.LINE_NONE} |
152 | } | 152 | } |
153 | } | 153 | } |
154 | // Performance: A large value which is === 0 to be used for pillar wrapping. | 154 | // Performance: A large value which is === 0 to be used for pillar wrapping. |
diff --git a/app/assets/javascripts/wittle/serializer.js b/app/assets/javascripts/serializer.js index 70c7f0f..70c7f0f 100644 --- a/app/assets/javascripts/wittle/serializer.js +++ b/app/assets/javascripts/serializer.js | |||
diff --git a/app/assets/javascripts/wittle/solve.js b/app/assets/javascripts/solve.js index 8695291..8695291 100644 --- a/app/assets/javascripts/wittle/solve.js +++ b/app/assets/javascripts/solve.js | |||
diff --git a/app/assets/javascripts/wittle/svg.js b/app/assets/javascripts/svg.js index c103b94..c103b94 100644 --- a/app/assets/javascripts/wittle/svg.js +++ b/app/assets/javascripts/svg.js | |||
diff --git a/app/assets/javascripts/wittle/trace2.js b/app/assets/javascripts/trace2.js index 000e60b..000e60b 100644 --- a/app/assets/javascripts/wittle/trace2.js +++ b/app/assets/javascripts/trace2.js | |||
diff --git a/app/assets/javascripts/wittle/utilities.js.erb b/app/assets/javascripts/utilities.js.erb index b621003..0414ce8 100644 --- a/app/assets/javascripts/wittle/utilities.js.erb +++ b/app/assets/javascripts/utilities.js.erb | |||
@@ -75,10 +75,10 @@ var proxy = { | |||
75 | window.settings = new Proxy({}, proxy.init()) | 75 | window.settings = new Proxy({}, proxy.init()) |
76 | 76 | ||
77 | var tracks = { | 77 | var tracks = { |
78 | 'start': new Audio(src = '<%= asset_url("wittle/panel_start_tracing.aac") %>'), | 78 | 'start': new Audio(src = '<%= asset_url("panel_start_tracing.aac") %>'), |
79 | 'success': new Audio(src = '<%= asset_url("wittle/panel_success.aac") %>'), | 79 | 'success': new Audio(src = '<%= asset_url("panel_success.aac") %>'), |
80 | 'fail': new Audio(src = '<%= asset_url("wittle/panel_failure.aac") %>'), | 80 | 'fail': new Audio(src = '<%= asset_url("panel_failure.aac") %>'), |
81 | 'abort': new Audio(src = '<%= asset_url("wittle/panel_abort_tracing.aac") %>'), | 81 | 'abort': new Audio(src = '<%= asset_url("panel_abort_tracing.aac") %>'), |
82 | } | 82 | } |
83 | 83 | ||
84 | var currentAudio = null | 84 | var currentAudio = null |
diff --git a/app/assets/javascripts/wittle/validate.js b/app/assets/javascripts/validate.js index d6e6484..d6e6484 100644 --- a/app/assets/javascripts/wittle/validate.js +++ b/app/assets/javascripts/validate.js | |||
diff --git a/app/assets/javascripts/wittle/wittle.js b/app/assets/javascripts/wittle.js index 883a4b8..883a4b8 100644 --- a/app/assets/javascripts/wittle/wittle.js +++ b/app/assets/javascripts/wittle.js | |||
diff --git a/app/assets/javascripts/wittle/application.js b/app/assets/javascripts/wittle/application.js deleted file mode 100644 index 52d2214..0000000 --- a/app/assets/javascripts/wittle/application.js +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files | ||
2 | // listed below. | ||
3 | // | ||
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. | ||
6 | // | ||
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. | ||
9 | // | ||
10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details | ||
11 | // about supported directives. | ||
12 | // | ||
13 | //= require jquery3 | ||
14 | //= require_tree . | ||
diff --git a/test/dummy/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 0ebd7fe..288b9ab 100644 --- a/test/dummy/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css | |||
@@ -2,11 +2,11 @@ | |||
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files | 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files |
3 | * listed below. | 3 | * listed below. |
4 | * | 4 | * |
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | 5 | * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's |
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. |
7 | * | 7 | * |
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the | 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the |
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS | 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS |
10 | * files in this directory. Styles in this file should be added after the last require_* statement. | 10 | * files in this directory. Styles in this file should be added after the last require_* statement. |
11 | * It is generally better to create a new file per style scope. | 11 | * It is generally better to create a new file per style scope. |
12 | * | 12 | * |
diff --git a/app/assets/stylesheets/wittle/general.css.scss b/app/assets/stylesheets/general.css.scss index 12e5486..7ee3169 100644 --- a/app/assets/stylesheets/wittle/general.css.scss +++ b/app/assets/stylesheets/general.css.scss | |||
@@ -3,7 +3,7 @@ | |||
3 | } | 3 | } |
4 | 4 | ||
5 | #banner { | 5 | #banner { |
6 | background-image: image-url("wittle/wittle_header.png"); | 6 | background-image: image-url("wittle_header.png"); |
7 | background-size: cover; | 7 | background-size: cover; |
8 | width: 600px; | 8 | width: 600px; |
9 | height: 245px; | 9 | height: 245px; |
@@ -65,7 +65,7 @@ input[type="range"]::-webkit-slider-thumb { | |||
65 | appearance: none; | 65 | appearance: none; |
66 | -moz-appearance: none; | 66 | -moz-appearance: none; |
67 | -webkit-appearance: none; | 67 | -webkit-appearance: none; |
68 | background: image-url('wittle/slider.png'); | 68 | background: image-url('slider.png'); |
69 | background-size: 17px 33px; | 69 | background-size: 17px 33px; |
70 | height: 33px; | 70 | height: 33px; |
71 | width: 17px; | 71 | width: 17px; |
@@ -74,7 +74,7 @@ input[type="range"]::-moz-range-thumb { | |||
74 | appearance: none; | 74 | appearance: none; |
75 | -moz-appearance: none; | 75 | -moz-appearance: none; |
76 | -webkit-appearance: none; | 76 | -webkit-appearance: none; |
77 | background: image-url('wittle/slider.png'); | 77 | background: image-url('slider.png'); |
78 | background-size: 17px 33px; | 78 | background-size: 17px 33px; |
79 | height: 33px; | 79 | height: 33px; |
80 | width: 17px; | 80 | width: 17px; |
@@ -83,7 +83,7 @@ input[type="range"]::-ms-thumb { | |||
83 | appearance: none; | 83 | appearance: none; |
84 | -moz-appearance: none; | 84 | -moz-appearance: none; |
85 | -webkit-appearance: none; | 85 | -webkit-appearance: none; |
86 | background: image-url('wittle/slider.png'); | 86 | background: image-url('slider.png'); |
87 | background-size: 17px 33px; | 87 | background-size: 17px 33px; |
88 | height: 33px; | 88 | height: 33px; |
89 | width: 17px; | 89 | width: 17px; |
@@ -190,7 +190,7 @@ input[type="range"]::-ms-thumb { | |||
190 | margin-right: 1em; | 190 | margin-right: 1em; |
191 | 191 | ||
192 | a { | 192 | a { |
193 | background-image: image-url("wittle/wittle_normal.png"); | 193 | background-image: image-url("wittle_normal.png"); |
194 | background-size: cover; | 194 | background-size: cover; |
195 | display: block; | 195 | display: block; |
196 | width: 215px; | 196 | width: 215px; |
@@ -206,7 +206,7 @@ input[type="range"]::-ms-thumb { | |||
206 | margin-right: 1em; | 206 | margin-right: 1em; |
207 | 207 | ||
208 | a { | 208 | a { |
209 | background-image: image-url("wittle/wittle_hard.png"); | 209 | background-image: image-url("wittle_hard.png"); |
210 | background-size: cover; | 210 | background-size: cover; |
211 | display: block; | 211 | display: block; |
212 | width: 215px; | 212 | width: 215px; |
@@ -221,7 +221,7 @@ input[type="range"]::-ms-thumb { | |||
221 | width: 215px; | 221 | width: 215px; |
222 | 222 | ||
223 | a { | 223 | a { |
224 | background-image: image-url("wittle/wittle_expert.png"); | 224 | background-image: image-url("wittle_expert.png"); |
225 | background-size: cover; | 225 | background-size: cover; |
226 | display: block; | 226 | display: block; |
227 | width: 215px; | 227 | width: 215px; |
diff --git a/app/assets/stylesheets/wittle/application.css b/app/assets/stylesheets/wittle/application.css deleted file mode 100644 index 0ebd7fe..0000000 --- a/app/assets/stylesheets/wittle/application.css +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files | ||
3 | * listed below. | ||
4 | * | ||
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
7 | * | ||
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS | ||
10 | * files in this directory. Styles in this file should be added after the last require_* statement. | ||
11 | * It is generally better to create a new file per style scope. | ||
12 | * | ||
13 | *= require_tree . | ||
14 | *= require_self | ||
15 | */ | ||
diff --git a/test/dummy/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index d672697..d672697 100644 --- a/test/dummy/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb | |||
diff --git a/test/dummy/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 0ff5442..0ff5442 100644 --- a/test/dummy/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb | |||
diff --git a/test/dummy/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09705d1..09705d1 100644 --- a/test/dummy/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb | |||
diff --git a/app/controllers/puzzles_controller.rb b/app/controllers/puzzles_controller.rb new file mode 100644 index 0000000..b996022 --- /dev/null +++ b/app/controllers/puzzles_controller.rb | |||
@@ -0,0 +1,109 @@ | |||
1 | class PuzzlesController < ApplicationController | ||
2 | before_action :prepare_session | ||
3 | |||
4 | def about | ||
5 | @normal_puzzle = Puzzle.normal.order(created_at: :desc).first | ||
6 | if session[:puzzles]["normal"]["id"] == @normal_puzzle.id | ||
7 | @normal_started = session[:puzzles]["normal"]["started"] | ||
8 | @normal_solved = session[:puzzles]["normal"]["solved"] | ||
9 | else | ||
10 | @normal_started = false | ||
11 | @normal_solved = false | ||
12 | end | ||
13 | |||
14 | @hard_puzzle = Puzzle.hard.order(created_at: :desc).first | ||
15 | if session[:puzzles]["hard"]["id"] == @hard_puzzle.id | ||
16 | @hard_started = session[:puzzles]["hard"]["started"] | ||
17 | @hard_solved = session[:puzzles]["hard"]["solved"] | ||
18 | else | ||
19 | @hard_started = false | ||
20 | @hard_solved = false | ||
21 | end | ||
22 | |||
23 | @expert_puzzle = Puzzle.expert.order(created_at: :desc).first | ||
24 | if session[:puzzles]["expert"]["id"] == @expert_puzzle.id | ||
25 | @expert_started = session[:puzzles]["expert"]["started"] | ||
26 | @expert_solved = session[:puzzles]["expert"]["solved"] | ||
27 | else | ||
28 | @expert_started = false | ||
29 | @expert_solved = false | ||
30 | end | ||
31 | end | ||
32 | |||
33 | def index | ||
34 | @puzzles = Puzzle.select(:id, :created_at, :category).order(created_at: :asc).all.chunk { |puzzle| puzzle.created_at.localtime.to_date }.to_h.transform_values { |by_date| by_date.sort_by(&:category).chunk { |puzzle| puzzle.category }.to_h } | ||
35 | end | ||
36 | |||
37 | def show | ||
38 | @puzzle = Puzzle.find(params["id"]) | ||
39 | |||
40 | if @puzzle.latest? | ||
41 | if session[:puzzles][@puzzle.category]["id"] == @puzzle.id | ||
42 | @playable = !(session[:puzzles][@puzzle.category]["solved"]) | ||
43 | @already_started = session[:puzzles][@puzzle.category]["started"] | ||
44 | |||
45 | unless @playable | ||
46 | @solution = session[:puzzles][@puzzle.category]["path"] | ||
47 | end | ||
48 | else | ||
49 | @playable = true | ||
50 | @already_started = false | ||
51 | end | ||
52 | else | ||
53 | @playable = false | ||
54 | @already_started = false | ||
55 | @solution = @puzzle.solved_data | ||
56 | end | ||
57 | end | ||
58 | |||
59 | def start | ||
60 | @puzzle = Puzzle.find(params["id"]) | ||
61 | |||
62 | if session[:puzzles][@puzzle.category]["id"] != @puzzle.id | ||
63 | session[:puzzles][@puzzle.category] = { "id" => @puzzle.id } | ||
64 | end | ||
65 | |||
66 | session[:puzzles][@puzzle.category]["started"] = true | ||
67 | end | ||
68 | |||
69 | def solve | ||
70 | @puzzle = Puzzle.find(params["id"]) | ||
71 | |||
72 | raise ActiveRecord::RecordNotFound unless @puzzle.latest? | ||
73 | |||
74 | if @puzzle.solved_data.nil? | ||
75 | @puzzle.solved_data = params["solved"] | ||
76 | @puzzle.save! | ||
77 | end | ||
78 | |||
79 | @time = (params.include? :time) ? params[:time] : nil | ||
80 | |||
81 | if session[:puzzles][@puzzle.category]["id"] != @puzzle.id | ||
82 | session[:puzzles][@puzzle.category] = { "id" => @puzzle.id } | ||
83 | end | ||
84 | |||
85 | session[:puzzles][@puzzle.category]["solved"] = true | ||
86 | session[:puzzles][@puzzle.category]["path"] = params["solved"] | ||
87 | end | ||
88 | |||
89 | def submit | ||
90 | @puzzle = Puzzle.find(params["id"]) | ||
91 | |||
92 | raise ActiveRecord::RecordNotFound unless @puzzle.latest? | ||
93 | |||
94 | @puzzle.scores.create(name: params[:name], ip: request.ip, seconds_taken: (params.include? :time) ? params[:time] : nil) | ||
95 | |||
96 | redirect_to @puzzle | ||
97 | end | ||
98 | |||
99 | private | ||
100 | |||
101 | def prepare_session | ||
102 | session[:puzzles] ||= { | ||
103 | normal: { "id" => 0 }, | ||
104 | hard: { "id" => 0 }, | ||
105 | expert: { "id" => 0 }, | ||
106 | } | ||
107 | end | ||
108 | |||
109 | end | ||
diff --git a/app/controllers/wittle/application_controller.rb b/app/controllers/wittle/application_controller.rb deleted file mode 100644 index 252a28e..0000000 --- a/app/controllers/wittle/application_controller.rb +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | module Wittle | ||
2 | class ApplicationController < ActionController::Base | ||
3 | end | ||
4 | end | ||
diff --git a/app/controllers/wittle/puzzles_controller.rb b/app/controllers/wittle/puzzles_controller.rb deleted file mode 100644 index a937aa1..0000000 --- a/app/controllers/wittle/puzzles_controller.rb +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | module Wittle | ||
2 | class PuzzlesController < ApplicationController | ||
3 | before_action :prepare_session | ||
4 | after_action :commit_session | ||
5 | |||
6 | def about | ||
7 | @normal_puzzle = Puzzle.normal.order(created_at: :desc).first | ||
8 | if @session_puzzles["normal"]["id"] == @normal_puzzle.id | ||
9 | @normal_started = @session_puzzles["normal"]["started"] | ||
10 | @normal_solved = @session_puzzles["normal"]["solved"] | ||
11 | else | ||
12 | @normal_started = false | ||
13 | @normal_solved = false | ||
14 | end | ||
15 | |||
16 | @hard_puzzle = Puzzle.hard.order(created_at: :desc).first | ||
17 | if @session_puzzles["hard"]["id"] == @hard_puzzle.id | ||
18 | @hard_started = @session_puzzles["hard"]["started"] | ||
19 | @hard_solved = @session_puzzles["hard"]["solved"] | ||
20 | else | ||
21 | @hard_started = false | ||
22 | @hard_solved = false | ||
23 | end | ||
24 | |||
25 | @expert_puzzle = Puzzle.expert.order(created_at: :desc).first | ||
26 | if @session_puzzles["expert"]["id"] == @expert_puzzle.id | ||
27 | @expert_started = @session_puzzles["expert"]["started"] | ||
28 | @expert_solved = @session_puzzles["expert"]["solved"] | ||
29 | else | ||
30 | @expert_started = false | ||
31 | @expert_solved = false | ||
32 | end | ||
33 | end | ||
34 | |||
35 | def index | ||
36 | @puzzles = Puzzle.select(:id, :created_at, :category).order(created_at: :asc).all.chunk { |puzzle| puzzle.created_at.localtime.to_date }.to_h.transform_values { |by_date| by_date.sort_by(&:category).chunk { |puzzle| puzzle.category }.to_h } | ||
37 | end | ||
38 | |||
39 | def show | ||
40 | @puzzle = Puzzle.find(params[:id]) | ||
41 | |||
42 | if @puzzle.latest? | ||
43 | if @session_puzzles[@puzzle.category]["id"] == @puzzle.id | ||
44 | @playable = !(@session_puzzles[@puzzle.category]["solved"]) | ||
45 | @already_started = @session_puzzles[@puzzle.category]["started"] | ||
46 | |||
47 | unless @playable | ||
48 | @solution = @session_puzzles[@puzzle.category]["path"] | ||
49 | end | ||
50 | else | ||
51 | @playable = true | ||
52 | @already_started = false | ||
53 | end | ||
54 | else | ||
55 | @playable = false | ||
56 | @already_started = false | ||
57 | @solution = @puzzle.solved_data | ||
58 | end | ||
59 | end | ||
60 | |||
61 | def start | ||
62 | @puzzle = Puzzle.find(params[:id]) | ||
63 | |||
64 | if @session_puzzles[@puzzle.category]["id"] != @puzzle.id | ||
65 | @session_puzzles[@puzzle.category] = { "id" => @puzzle.id } | ||
66 | end | ||
67 | |||
68 | @session_puzzles[@puzzle.category]["started"] = true | ||
69 | end | ||
70 | |||
71 | def solve | ||
72 | @puzzle = Puzzle.find(params[:id]) | ||
73 | |||
74 | raise ActiveRecord::RecordNotFound unless @puzzle.latest? | ||
75 | |||
76 | if @puzzle.solved_data.nil? | ||
77 | @puzzle.solved_data = params[:solved] | ||
78 | @puzzle.save! | ||
79 | end | ||
80 | |||
81 | @time = (params.include? :time) ? params[:time] : nil | ||
82 | |||
83 | if @session_puzzles[@puzzle.category]["id"] != @puzzle.id | ||
84 | @session_puzzles[@puzzle.category] = { "id" => @puzzle.id } | ||
85 | end | ||
86 | |||
87 | @session_puzzles[@puzzle.category]["solved"] = true | ||
88 | @session_puzzles[@puzzle.category]["path"] = params[:solved] | ||
89 | end | ||
90 | |||
91 | def submit | ||
92 | @puzzle = Puzzle.find(params[:id]) | ||
93 | |||
94 | raise ActiveRecord::RecordNotFound unless @puzzle.latest? | ||
95 | |||
96 | @puzzle.scores.create(name: params[:name], ip: request.ip, seconds_taken: (params.include? :time) ? params[:time] : nil) | ||
97 | |||
98 | redirect_to @puzzle | ||
99 | end | ||
100 | |||
101 | private | ||
102 | |||
103 | def prepare_session | ||
104 | if cookies.encrypted[:puzzles].nil? | ||
105 | @session_puzzles = { "normal" => { id: nil }, "hard" => { id: nil }, "expert" => { id: nil } } | ||
106 | else | ||
107 | @session_puzzles = JSON.parse(cookies.encrypted[:puzzles]) | ||
108 | end | ||
109 | |||
110 | # Temporary hack | ||
111 | if session.has_key? :puzzle_solutions | ||
112 | session[:puzzle_solutions].clear() | ||
113 | end | ||
114 | end | ||
115 | |||
116 | def commit_session | ||
117 | cookies.encrypted[:puzzles] = JSON.generate(@session_puzzles) | ||
118 | end | ||
119 | end | ||
120 | end | ||
diff --git a/test/dummy/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..de6be79 100644 --- a/test/dummy/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb | |||
diff --git a/app/helpers/puzzles_helper.rb b/app/helpers/puzzles_helper.rb new file mode 100644 index 0000000..ded1e8d --- /dev/null +++ b/app/helpers/puzzles_helper.rb | |||
@@ -0,0 +1,7 @@ | |||
1 | module PuzzlesHelper | ||
2 | |||
3 | def humanize_interval(seconds) | ||
4 | "#{(seconds / 60).to_s.rjust(2, '0')}:#{(seconds % 60).to_s.rjust(2, '0')}" | ||
5 | end | ||
6 | |||
7 | end | ||
diff --git a/app/helpers/wittle/application_helper.rb b/app/helpers/wittle/application_helper.rb deleted file mode 100644 index 8fcb2c9..0000000 --- a/app/helpers/wittle/application_helper.rb +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | module Wittle | ||
2 | module ApplicationHelper | ||
3 | end | ||
4 | end | ||
diff --git a/app/helpers/wittle/puzzles_helper.rb b/app/helpers/wittle/puzzles_helper.rb deleted file mode 100644 index 64364c6..0000000 --- a/app/helpers/wittle/puzzles_helper.rb +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | module Wittle | ||
2 | module PuzzlesHelper | ||
3 | |||
4 | def humanize_interval(seconds) | ||
5 | "#{(seconds / 60).to_s.rjust(2, '0')}:#{(seconds % 60).to_s.rjust(2, '0')}" | ||
6 | end | ||
7 | |||
8 | end | ||
9 | end | ||
diff --git a/test/dummy/app/jobs/application_job.rb b/app/jobs/application_job.rb index d394c3d..d394c3d 100644 --- a/test/dummy/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb | |||
diff --git a/app/jobs/wittle/application_job.rb b/app/jobs/wittle/application_job.rb deleted file mode 100644 index b0ab02e..0000000 --- a/app/jobs/wittle/application_job.rb +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | module Wittle | ||
2 | class ApplicationJob < ActiveJob::Base | ||
3 | end | ||
4 | end | ||
diff --git a/test/dummy/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 3c34c81..3c34c81 100644 --- a/test/dummy/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb | |||
diff --git a/app/mailers/wittle/application_mailer.rb b/app/mailers/wittle/application_mailer.rb deleted file mode 100644 index 5a563c4..0000000 --- a/app/mailers/wittle/application_mailer.rb +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | module Wittle | ||
2 | class ApplicationMailer < ActionMailer::Base | ||
3 | default from: "from@example.com" | ||
4 | layout "mailer" | ||
5 | end | ||
6 | end | ||
diff --git a/test/dummy/app/models/application_record.rb b/app/models/application_record.rb index b63caeb..b63caeb 100644 --- a/test/dummy/app/models/application_record.rb +++ b/app/models/application_record.rb | |||
diff --git a/app/models/puzzle.rb b/app/models/puzzle.rb new file mode 100644 index 0000000..4f57d9c --- /dev/null +++ b/app/models/puzzle.rb | |||
@@ -0,0 +1,14 @@ | |||
1 | class Puzzle < ApplicationRecord | ||
2 | extend Enumerize | ||
3 | |||
4 | has_many :scores | ||
5 | |||
6 | validates :data, presence: true | ||
7 | |||
8 | validates :category, presence: true | ||
9 | enumerize :category, in: [:normal, :hard, :expert], scope: :shallow | ||
10 | |||
11 | def latest? | ||
12 | Puzzle.where(category: category).order(created_at: :desc).first.id == id | ||
13 | end | ||
14 | end | ||
diff --git a/app/models/score.rb b/app/models/score.rb new file mode 100644 index 0000000..1958389 --- /dev/null +++ b/app/models/score.rb | |||
@@ -0,0 +1,7 @@ | |||
1 | class Score < ApplicationRecord | ||
2 | belongs_to :puzzle | ||
3 | |||
4 | validates :name, presence: true | ||
5 | validates :ip, presence: true | ||
6 | validates_uniqueness_of :name, scope: :puzzle_id | ||
7 | end | ||
diff --git a/app/models/wittle/application_record.rb b/app/models/wittle/application_record.rb deleted file mode 100644 index be1dfe5..0000000 --- a/app/models/wittle/application_record.rb +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | module Wittle | ||
2 | class ApplicationRecord < ActiveRecord::Base | ||
3 | self.abstract_class = true | ||
4 | end | ||
5 | end | ||
diff --git a/app/models/wittle/puzzle.rb b/app/models/wittle/puzzle.rb deleted file mode 100644 index f9009bc..0000000 --- a/app/models/wittle/puzzle.rb +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | module Wittle | ||
2 | class Puzzle < ApplicationRecord | ||
3 | extend Enumerize | ||
4 | |||
5 | has_many :scores | ||
6 | |||
7 | validates :data, presence: true | ||
8 | |||
9 | validates :category, presence: true | ||
10 | enumerize :category, in: [:normal, :hard, :expert], scope: :shallow | ||
11 | |||
12 | def latest? | ||
13 | Puzzle.where(category: category).order(created_at: :desc).first.id == id | ||
14 | end | ||
15 | end | ||
16 | end | ||
diff --git a/app/models/wittle/score.rb b/app/models/wittle/score.rb deleted file mode 100644 index 54d2b89..0000000 --- a/app/models/wittle/score.rb +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | module Wittle | ||
2 | class Score < ApplicationRecord | ||
3 | belongs_to :puzzle | ||
4 | |||
5 | validates :name, presence: true | ||
6 | validates :ip, presence: true | ||
7 | validates_uniqueness_of :name, scope: :puzzle_id | ||
8 | end | ||
9 | end | ||
diff --git a/app/views/layouts/wittle/application.html.haml b/app/views/layouts/application.html.haml index 1226d79..cae8de9 100644 --- a/app/views/layouts/wittle/application.html.haml +++ b/app/views/layouts/application.html.haml | |||
@@ -4,8 +4,8 @@ | |||
4 | %title Wittle | 4 | %title Wittle |
5 | = csrf_meta_tags | 5 | = csrf_meta_tags |
6 | = csp_meta_tag | 6 | = csp_meta_tag |
7 | = stylesheet_link_tag "wittle/application", media: "all" | 7 | = stylesheet_link_tag "application", "data-turbo-track": "reload" |
8 | = javascript_include_tag "wittle/application" | 8 | = javascript_include_tag "application" |
9 | %body | 9 | %body |
10 | #wrap | 10 | #wrap |
11 | %header#banner | 11 | %header#banner |
diff --git a/test/dummy/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 3aac900..3aac900 100644 --- a/test/dummy/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb | |||
diff --git a/test/dummy/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 37f0bdd..37f0bdd 100644 --- a/test/dummy/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb | |||
diff --git a/app/views/wittle/puzzles/_handle_puzzle.html.erb b/app/views/puzzles/_handle_puzzle.html.erb index f0e3227..f0e3227 100644 --- a/app/views/wittle/puzzles/_handle_puzzle.html.erb +++ b/app/views/puzzles/_handle_puzzle.html.erb | |||
diff --git a/app/views/wittle/puzzles/_submission.html.haml b/app/views/puzzles/_submission.html.haml index a3d0740..a3d0740 100644 --- a/app/views/wittle/puzzles/_submission.html.haml +++ b/app/views/puzzles/_submission.html.haml | |||
diff --git a/app/views/wittle/puzzles/about.html.haml b/app/views/puzzles/about.html.haml index f1f7aa0..f1f7aa0 100644 --- a/app/views/wittle/puzzles/about.html.haml +++ b/app/views/puzzles/about.html.haml | |||
diff --git a/app/views/wittle/puzzles/index.html.haml b/app/views/puzzles/index.html.haml index fe497e4..fe497e4 100644 --- a/app/views/wittle/puzzles/index.html.haml +++ b/app/views/puzzles/index.html.haml | |||
diff --git a/app/views/wittle/puzzles/show.html.haml b/app/views/puzzles/show.html.haml index 47db8f2..47db8f2 100644 --- a/app/views/wittle/puzzles/show.html.haml +++ b/app/views/puzzles/show.html.haml | |||
diff --git a/app/views/wittle/puzzles/solve.js.erb b/app/views/puzzles/solve.js.erb index 2aa22e9..2aa22e9 100644 --- a/app/views/wittle/puzzles/solve.js.erb +++ b/app/views/puzzles/solve.js.erb | |||
diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..42c7fd7 --- /dev/null +++ b/bin/bundle | |||
@@ -0,0 +1,109 @@ | |||
1 | #!/usr/bin/env ruby | ||
2 | # frozen_string_literal: true | ||
3 | |||
4 | # | ||
5 | # This file was generated by Bundler. | ||
6 | # | ||
7 | # The application 'bundle' is installed as part of a gem, and | ||
8 | # this file is here to facilitate running it. | ||
9 | # | ||
10 | |||
11 | require "rubygems" | ||
12 | |||
13 | m = Module.new do | ||
14 | module_function | ||
15 | |||
16 | def invoked_as_script? | ||
17 | File.expand_path($0) == File.expand_path(__FILE__) | ||
18 | end | ||
19 | |||
20 | def env_var_version | ||
21 | ENV["BUNDLER_VERSION"] | ||
22 | end | ||
23 | |||
24 | def cli_arg_version | ||
25 | return unless invoked_as_script? # don't want to hijack other binstubs | ||
26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` | ||
27 | bundler_version = nil | ||
28 | update_index = nil | ||
29 | ARGV.each_with_index do |a, i| | ||
30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN | ||
31 | bundler_version = a | ||
32 | end | ||
33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ | ||
34 | bundler_version = $1 | ||
35 | update_index = i | ||
36 | end | ||
37 | bundler_version | ||
38 | end | ||
39 | |||
40 | def gemfile | ||
41 | gemfile = ENV["BUNDLE_GEMFILE"] | ||
42 | return gemfile if gemfile && !gemfile.empty? | ||
43 | |||
44 | File.expand_path("../Gemfile", __dir__) | ||
45 | end | ||
46 | |||
47 | def lockfile | ||
48 | lockfile = | ||
49 | case File.basename(gemfile) | ||
50 | when "gems.rb" then gemfile.sub(/\.rb$/, ".locked") | ||
51 | else "#{gemfile}.lock" | ||
52 | end | ||
53 | File.expand_path(lockfile) | ||
54 | end | ||
55 | |||
56 | def lockfile_version | ||
57 | return unless File.file?(lockfile) | ||
58 | lockfile_contents = File.read(lockfile) | ||
59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ | ||
60 | Regexp.last_match(1) | ||
61 | end | ||
62 | |||
63 | def bundler_requirement | ||
64 | @bundler_requirement ||= | ||
65 | env_var_version || | ||
66 | cli_arg_version || | ||
67 | bundler_requirement_for(lockfile_version) | ||
68 | end | ||
69 | |||
70 | def bundler_requirement_for(version) | ||
71 | return "#{Gem::Requirement.default}.a" unless version | ||
72 | |||
73 | bundler_gem_version = Gem::Version.new(version) | ||
74 | |||
75 | bundler_gem_version.approximate_recommendation | ||
76 | end | ||
77 | |||
78 | def load_bundler! | ||
79 | ENV["BUNDLE_GEMFILE"] ||= gemfile | ||
80 | |||
81 | activate_bundler | ||
82 | end | ||
83 | |||
84 | def activate_bundler | ||
85 | gem_error = activation_error_handling do | ||
86 | gem "bundler", bundler_requirement | ||
87 | end | ||
88 | return if gem_error.nil? | ||
89 | require_error = activation_error_handling do | ||
90 | require "bundler/version" | ||
91 | end | ||
92 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) | ||
93 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" | ||
94 | exit 42 | ||
95 | end | ||
96 | |||
97 | def activation_error_handling | ||
98 | yield | ||
99 | nil | ||
100 | rescue StandardError, LoadError => e | ||
101 | e | ||
102 | end | ||
103 | end | ||
104 | |||
105 | m.load_bundler! | ||
106 | |||
107 | if m.invoked_as_script? | ||
108 | load Gem.bin_path("bundler", "bundle") | ||
109 | end | ||
diff --git a/bin/rails b/bin/rails index dc13199..efc0377 100755 --- a/bin/rails +++ b/bin/rails | |||
@@ -1,14 +1,4 @@ | |||
1 | #!/usr/bin/env ruby | 1 | #!/usr/bin/env ruby |
2 | # This command will automatically be run when you run "rails" with Rails gems | 2 | APP_PATH = File.expand_path("../config/application", __dir__) |
3 | # installed from the root of your application. | 3 | require_relative "../config/boot" |
4 | 4 | require "rails/commands" | |
5 | ENGINE_ROOT = File.expand_path("..", __dir__) | ||
6 | ENGINE_PATH = File.expand_path("../lib/wittle/engine", __dir__) | ||
7 | APP_PATH = File.expand_path("../test/dummy/config/application", __dir__) | ||
8 | |||
9 | # Set up gems listed in the Gemfile. | ||
10 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) | ||
11 | require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) | ||
12 | |||
13 | require "rails/all" | ||
14 | require "rails/engine/commands" | ||
diff --git a/test/dummy/bin/rake b/bin/rake index 4fbf10b..4fbf10b 100755 --- a/test/dummy/bin/rake +++ b/bin/rake | |||
diff --git a/test/dummy/bin/setup b/bin/setup index 3cd5a9d..3cd5a9d 100755 --- a/test/dummy/bin/setup +++ b/bin/setup | |||
diff --git a/test/dummy/config.ru b/config.ru index 4a3c09a..4a3c09a 100644 --- a/test/dummy/config.ru +++ b/config.ru | |||
diff --git a/test/dummy/config/application.rb b/config/application.rb index 67cc140..095566e 100644 --- a/test/dummy/config/application.rb +++ b/config/application.rb | |||
@@ -6,12 +6,10 @@ require "rails/all" | |||
6 | # you've limited to :test, :development, or :production. | 6 | # you've limited to :test, :development, or :production. |
7 | Bundler.require(*Rails.groups) | 7 | Bundler.require(*Rails.groups) |
8 | 8 | ||
9 | module Dummy | 9 | module Wittle |
10 | class Application < Rails::Application | 10 | class Application < Rails::Application |
11 | config.load_defaults Rails::VERSION::STRING.to_f | 11 | # Initialize configuration defaults for originally generated Rails version. |
12 | 12 | config.load_defaults 7.1 | |
13 | # For compatibility with applications that use this config | ||
14 | config.action_controller.include_all_helpers = false | ||
15 | 13 | ||
16 | # Please, add to the `ignore` list any other `lib` subdirectories that do | 14 | # Please, add to the `ignore` list any other `lib` subdirectories that do |
17 | # not contain `.rb` files, or that should not be reloaded or eager loaded. | 15 | # not contain `.rb` files, or that should not be reloaded or eager loaded. |
diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..988a5dd --- /dev/null +++ b/config/boot.rb | |||
@@ -0,0 +1,4 @@ | |||
1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) | ||
2 | |||
3 | require "bundler/setup" # Set up gems listed in the Gemfile. | ||
4 | require "bootsnap/setup" # Speed up boot time by caching expensive operations. | ||
diff --git a/test/dummy/config/cable.yml b/config/cable.yml index 98367f8..46d6557 100644 --- a/test/dummy/config/cable.yml +++ b/config/cable.yml | |||
@@ -7,4 +7,4 @@ test: | |||
7 | production: | 7 | production: |
8 | adapter: redis | 8 | adapter: redis |
9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> | 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> |
10 | channel_prefix: dummy_production | 10 | channel_prefix: wittle_production |
diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc new file mode 100644 index 0000000..494d15d --- /dev/null +++ b/config/credentials.yml.enc | |||
@@ -0,0 +1 @@ | |||
80HLuAOBpfETFq58hHZxQQI9DcvkqZzwx5TDwXZ5JPvjIzrj4lOuhFCnd/QfqHsKOyearjd1Ot0+VzmN8pi3dr3sgRaVrqE37F6fBlUW5XxDE02GWmKQk8MTIkVJyLjI+AfiGAEn+W9LoKK1drqsJFnQDYVRIXpKjUTyYYiA8i3M+CqSNJCb41tOsXgVbfORUAEJGncJVGCkHey6alRGWoJioByUe5jPIVnSFNUAz7kOajbB2l7laqxvTVRFXzOOryh44pXeNiJRVmLAlJGfdfTZcB1cD+OjEd0QOfyIrchyGHcGexmV4qrirN+5gVqeJ75D1M9SWVPms/w2RFSlq+miEjnUIYq6LyrLEwQxYSG8ontWMuVpdfdgJrdb6aaPYyVzFxk968BUpjWU9asXsE1sVqK7--q8zHjMUiCIKcGKVK--s/ilfRd7l7AUvTXruie3LA== \ No newline at end of file | |||
diff --git a/test/dummy/config/database.yml b/config/database.yml index 796466b..796466b 100644 --- a/test/dummy/config/database.yml +++ b/config/database.yml | |||
diff --git a/test/dummy/config/environment.rb b/config/environment.rb index cac5315..cac5315 100644 --- a/test/dummy/config/environment.rb +++ b/config/environment.rb | |||
diff --git a/test/dummy/config/environments/development.rb b/config/environments/development.rb index 2e7fb48..2e7fb48 100644 --- a/test/dummy/config/environments/development.rb +++ b/config/environments/development.rb | |||
diff --git a/test/dummy/config/environments/production.rb b/config/environments/production.rb index 714394b..77a44b1 100644 --- a/test/dummy/config/environments/production.rb +++ b/config/environments/production.rb | |||
@@ -13,17 +13,18 @@ Rails.application.configure do | |||
13 | config.eager_load = true | 13 | config.eager_load = true |
14 | 14 | ||
15 | # Full error reports are disabled and caching is turned on. | 15 | # Full error reports are disabled and caching is turned on. |
16 | config.consider_all_requests_local = false | 16 | config.consider_all_requests_local = false |
17 | config.action_controller.perform_caching = true | 17 | config.action_controller.perform_caching = true |
18 | 18 | ||
19 | # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment | 19 | # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment |
20 | # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). | 20 | # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). |
21 | # config.require_master_key = true | 21 | # config.require_master_key = true |
22 | 22 | ||
23 | # Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it). | 23 | # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. |
24 | config.public_file_server.enabled = true | 24 | # config.public_file_server.enabled = false |
25 | 25 | ||
26 | # Compress CSS using a preprocessor. | 26 | # Compress CSS using a preprocessor. |
27 | config.assets.js_compressor = :terser | ||
27 | # config.assets.css_compressor = :sass | 28 | # config.assets.css_compressor = :sass |
28 | 29 | ||
29 | # Do not fallback to assets pipeline if a precompiled asset is missed. | 30 | # Do not fallback to assets pipeline if a precompiled asset is missed. |
@@ -68,8 +69,8 @@ Rails.application.configure do | |||
68 | # config.cache_store = :mem_cache_store | 69 | # config.cache_store = :mem_cache_store |
69 | 70 | ||
70 | # Use a real queuing backend for Active Job (and separate queues per environment). | 71 | # Use a real queuing backend for Active Job (and separate queues per environment). |
71 | # config.active_job.queue_adapter = :resque | 72 | # config.active_job.queue_adapter = :resque |
72 | # config.active_job.queue_name_prefix = "dummy_production" | 73 | # config.active_job.queue_name_prefix = "wittle_production" |
73 | 74 | ||
74 | config.action_mailer.perform_caching = false | 75 | config.action_mailer.perform_caching = false |
75 | 76 | ||
diff --git a/test/dummy/config/environments/test.rb b/config/environments/test.rb index 0dda9f9..adbb4a6 100644 --- a/test/dummy/config/environments/test.rb +++ b/config/environments/test.rb | |||
@@ -24,11 +24,11 @@ Rails.application.configure do | |||
24 | } | 24 | } |
25 | 25 | ||
26 | # Show full error reports and disable caching. | 26 | # Show full error reports and disable caching. |
27 | config.consider_all_requests_local = true | 27 | config.consider_all_requests_local = true |
28 | config.action_controller.perform_caching = false | 28 | config.action_controller.perform_caching = false |
29 | config.cache_store = :null_store | 29 | config.cache_store = :null_store |
30 | 30 | ||
31 | # Raise exceptions instead of rendering exception templates. | 31 | # Render exception templates for rescuable exceptions and raise for other exceptions. |
32 | config.action_dispatch.show_exceptions = :rescuable | 32 | config.action_dispatch.show_exceptions = :rescuable |
33 | 33 | ||
34 | # Disable request forgery protection in test environment. | 34 | # Disable request forgery protection in test environment. |
diff --git a/test/dummy/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef96..2eeef96 100644 --- a/test/dummy/config/initializers/assets.rb +++ b/config/initializers/assets.rb | |||
diff --git a/test/dummy/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index b3076b3..b3076b3 100644 --- a/test/dummy/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb | |||
diff --git a/test/dummy/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index c2d89e2..c2d89e2 100644 --- a/test/dummy/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb | |||
diff --git a/test/dummy/config/initializers/inflections.rb b/config/initializers/inflections.rb index 3860f65..3860f65 100644 --- a/test/dummy/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb | |||
diff --git a/test/dummy/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 7db3b95..7db3b95 100644 --- a/test/dummy/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb | |||
diff --git a/test/dummy/config/locales/en.yml b/config/locales/en.yml index 6c349ae..6c349ae 100644 --- a/test/dummy/config/locales/en.yml +++ b/config/locales/en.yml | |||
diff --git a/test/dummy/config/puma.rb b/config/puma.rb index afa809b..afa809b 100644 --- a/test/dummy/config/puma.rb +++ b/config/puma.rb | |||
diff --git a/config/routes.rb b/config/routes.rb index 346315e..3a93d2a 100644 --- a/config/routes.rb +++ b/config/routes.rb | |||
@@ -1,4 +1,4 @@ | |||
1 | Wittle::Engine.routes.draw do | 1 | Rails.application.routes.draw do |
2 | root to: 'puzzles#about' | 2 | root to: 'puzzles#about' |
3 | get 'archive' => 'puzzles#index' | 3 | get 'archive' => 'puzzles#index' |
4 | get ':id' => 'puzzles#show', as: 'puzzle' | 4 | get ':id' => 'puzzles#show', as: 'puzzle' |
diff --git a/test/dummy/config/storage.yml b/config/storage.yml index 4942ab6..4942ab6 100644 --- a/test/dummy/config/storage.yml +++ b/config/storage.yml | |||
diff --git a/db/migrate/20231028205751_create_wittle_puzzles.rb b/db/migrate/20231130173455_create_puzzles.rb index ebe0bf7..548473a 100644 --- a/db/migrate/20231028205751_create_wittle_puzzles.rb +++ b/db/migrate/20231130173455_create_puzzles.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreateWittlePuzzles < ActiveRecord::Migration[7.1] | 1 | class CreatePuzzles < ActiveRecord::Migration[7.1] |
2 | def change | 2 | def change |
3 | create_table :wittle_puzzles do |t| | 3 | create_table :puzzles do |t| |
4 | t.text :data | 4 | t.text :data |
5 | t.text :solved_data | 5 | t.text :solved_data |
6 | t.string :category | 6 | t.string :category |
diff --git a/db/migrate/20231028210722_create_wittle_scores.rb b/db/migrate/20231130173513_create_scores.rb index aa49a13..953ba8d 100644 --- a/db/migrate/20231028210722_create_wittle_scores.rb +++ b/db/migrate/20231130173513_create_scores.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreateWittleScores < ActiveRecord::Migration[7.1] | 1 | class CreateScores < ActiveRecord::Migration[7.1] |
2 | def change | 2 | def change |
3 | create_table :wittle_scores do |t| | 3 | create_table :scores do |t| |
4 | t.references :puzzle, null: false | 4 | t.references :puzzle, null: false |
5 | t.string :name | 5 | t.string :name |
6 | t.string :ip | 6 | t.string :ip |
diff --git a/test/dummy/db/schema.rb b/db/schema.rb index 3b8bd7f..73725c5 100644 --- a/test/dummy/db/schema.rb +++ b/db/schema.rb | |||
@@ -10,8 +10,8 @@ | |||
10 | # | 10 | # |
11 | # It's strongly recommended that you check this file into your version control system. | 11 | # It's strongly recommended that you check this file into your version control system. |
12 | 12 | ||
13 | ActiveRecord::Schema[7.1].define(version: 2023_10_28_210722) do | 13 | ActiveRecord::Schema[7.1].define(version: 2023_11_30_173513) do |
14 | create_table "wittle_puzzles", force: :cascade do |t| | 14 | create_table "puzzles", force: :cascade do |t| |
15 | t.text "data" | 15 | t.text "data" |
16 | t.text "solved_data" | 16 | t.text "solved_data" |
17 | t.string "category" | 17 | t.string "category" |
@@ -19,14 +19,14 @@ ActiveRecord::Schema[7.1].define(version: 2023_10_28_210722) do | |||
19 | t.datetime "updated_at", null: false | 19 | t.datetime "updated_at", null: false |
20 | end | 20 | end |
21 | 21 | ||
22 | create_table "wittle_scores", force: :cascade do |t| | 22 | create_table "scores", force: :cascade do |t| |
23 | t.integer "puzzle_id", null: false | 23 | t.integer "puzzle_id", null: false |
24 | t.string "name" | 24 | t.string "name" |
25 | t.string "ip" | 25 | t.string "ip" |
26 | t.integer "seconds_taken" | 26 | t.integer "seconds_taken" |
27 | t.datetime "created_at", null: false | 27 | t.datetime "created_at", null: false |
28 | t.datetime "updated_at", null: false | 28 | t.datetime "updated_at", null: false |
29 | t.index ["puzzle_id"], name: "index_wittle_scores_on_puzzle_id" | 29 | t.index ["puzzle_id"], name: "index_scores_on_puzzle_id" |
30 | end | 30 | end |
31 | 31 | ||
32 | end | 32 | end |
diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..4fbd6ed --- /dev/null +++ b/db/seeds.rb | |||
@@ -0,0 +1,9 @@ | |||
1 | # This file should ensure the existence of records required to run the application in every environment (production, | ||
2 | # development, test). The code here should be idempotent so that it can be executed at any point in every environment. | ||
3 | # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). | ||
4 | # | ||
5 | # Example: | ||
6 | # | ||
7 | # ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| | ||
8 | # MovieGenre.find_or_create_by!(name: genre_name) | ||
9 | # end | ||
diff --git a/test/dummy/app/assets/images/.keep b/lib/assets/.keep index e69de29..e69de29 100644 --- a/test/dummy/app/assets/images/.keep +++ b/lib/assets/.keep | |||
diff --git a/test/dummy/app/controllers/concerns/.keep b/lib/tasks/.keep index e69de29..e69de29 100644 --- a/test/dummy/app/controllers/concerns/.keep +++ b/lib/tasks/.keep | |||
diff --git a/lib/tasks/wittle_tasks.rake b/lib/tasks/wittle_tasks.rake index b9300c7..1be45e2 100644 --- a/lib/tasks/wittle_tasks.rake +++ b/lib/tasks/wittle_tasks.rake | |||
@@ -1,8 +1,10 @@ | |||
1 | namespace :wittle do | 1 | namespace :wittle do |
2 | desc "Generate new puzzles for the day" | 2 | desc "Generate new puzzles for the day" |
3 | task :generate_puzzles => :environment do | 3 | task :generate_puzzles => :environment do |
4 | Wittle::Puzzle.create(data: WittleGenerator.new.generate_easy, category: :normal) | 4 | require "wittle_generator" |
5 | Wittle::Puzzle.create(data: WittleGenerator.new.generate_medium, category: :hard) | 5 | |
6 | Wittle::Puzzle.create(data: WittleGenerator.new.generate_expert, category: :expert) | 6 | Puzzle.create(data: WittleGenerator.new.generate_easy, category: :normal) |
7 | Puzzle.create(data: WittleGenerator.new.generate_medium, category: :hard) | ||
8 | Puzzle.create(data: WittleGenerator.new.generate_expert, category: :expert) | ||
7 | end | 9 | end |
8 | end | 10 | end |
diff --git a/lib/wittle.rb b/lib/wittle.rb deleted file mode 100644 index 44bfc3f..0000000 --- a/lib/wittle.rb +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | require "wittle/version" | ||
2 | require "wittle/engine" | ||
3 | |||
4 | module Wittle | ||
5 | # Your code goes here... | ||
6 | end | ||
diff --git a/lib/wittle/engine.rb b/lib/wittle/engine.rb deleted file mode 100644 index 13b8d2b..0000000 --- a/lib/wittle/engine.rb +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | require "enumerize" | ||
2 | require "haml" | ||
3 | require "jquery-rails" | ||
4 | require "sassc-rails" | ||
5 | require "wittle_generator" | ||
6 | |||
7 | module Wittle | ||
8 | class Engine < ::Rails::Engine | ||
9 | isolate_namespace Wittle | ||
10 | end | ||
11 | end | ||
diff --git a/lib/wittle/version.rb b/lib/wittle/version.rb deleted file mode 100644 index a1538e2..0000000 --- a/lib/wittle/version.rb +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | module Wittle | ||
2 | VERSION = "0.1.0" | ||
3 | end | ||
diff --git a/test/dummy/app/models/concerns/.keep b/log/.keep index e69de29..e69de29 100644 --- a/test/dummy/app/models/concerns/.keep +++ b/log/.keep | |||
diff --git a/test/dummy/public/404.html b/public/404.html index 2be3af2..2be3af2 100644 --- a/test/dummy/public/404.html +++ b/public/404.html | |||
diff --git a/test/dummy/public/422.html b/public/422.html index c08eac0..c08eac0 100644 --- a/test/dummy/public/422.html +++ b/public/422.html | |||
diff --git a/test/dummy/public/500.html b/public/500.html index 78a030a..78a030a 100644 --- a/test/dummy/public/500.html +++ b/public/500.html | |||
diff --git a/test/dummy/public/apple-touch-icon-precomposed.png b/public/apple-touch-icon-precomposed.png index e69de29..e69de29 100644 --- a/test/dummy/public/apple-touch-icon-precomposed.png +++ b/public/apple-touch-icon-precomposed.png | |||
diff --git a/test/dummy/public/apple-touch-icon.png b/public/apple-touch-icon.png index e69de29..e69de29 100644 --- a/test/dummy/public/apple-touch-icon.png +++ b/public/apple-touch-icon.png | |||
diff --git a/test/dummy/public/favicon.ico b/public/favicon.ico index e69de29..e69de29 100644 --- a/test/dummy/public/favicon.ico +++ b/public/favicon.ico | |||
diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..c19f78a --- /dev/null +++ b/public/robots.txt | |||
@@ -0,0 +1 @@ | |||
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file | |||
diff --git a/test/dummy/lib/assets/.keep b/storage/.keep index e69de29..e69de29 100644 --- a/test/dummy/lib/assets/.keep +++ b/storage/.keep | |||
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb new file mode 100644 index 0000000..d19212a --- /dev/null +++ b/test/application_system_test_case.rb | |||
@@ -0,0 +1,5 @@ | |||
1 | require "test_helper" | ||
2 | |||
3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase | ||
4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400] | ||
5 | end | ||
diff --git a/test/channels/application_cable/connection_test.rb b/test/channels/application_cable/connection_test.rb new file mode 100644 index 0000000..6340bf9 --- /dev/null +++ b/test/channels/application_cable/connection_test.rb | |||
@@ -0,0 +1,13 @@ | |||
1 | require "test_helper" | ||
2 | |||
3 | module ApplicationCable | ||
4 | class ConnectionTest < ActionCable::Connection::TestCase | ||
5 | # test "connects with cookies" do | ||
6 | # cookies.signed[:user_id] = 42 | ||
7 | # | ||
8 | # connect | ||
9 | # | ||
10 | # assert_equal connection.user_id, "42" | ||
11 | # end | ||
12 | end | ||
13 | end | ||
diff --git a/test/controllers/puzzles_controller_test.rb b/test/controllers/puzzles_controller_test.rb new file mode 100644 index 0000000..1d6b8ea --- /dev/null +++ b/test/controllers/puzzles_controller_test.rb | |||
@@ -0,0 +1,7 @@ | |||
1 | require "test_helper" | ||
2 | |||
3 | class PuzzlesControllerTest < ActionDispatch::IntegrationTest | ||
4 | # test "the truth" do | ||
5 | # assert true | ||
6 | # end | ||
7 | end | ||
diff --git a/test/controllers/wittle/puzzles_controller_test.rb b/test/controllers/wittle/puzzles_controller_test.rb deleted file mode 100644 index d1a3ca7..0000000 --- a/test/controllers/wittle/puzzles_controller_test.rb +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | require "test_helper" | ||
2 | |||
3 | module Wittle | ||
4 | class PuzzlesControllerTest < ActionDispatch::IntegrationTest | ||
5 | include Engine.routes.url_helpers | ||
6 | |||
7 | test "should get index" do | ||
8 | get puzzles_index_url | ||
9 | assert_response :success | ||
10 | end | ||
11 | end | ||
12 | end | ||
diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile deleted file mode 100644 index 9a5ea73..0000000 --- a/test/dummy/Rakefile +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | # Add your own tasks in files placed in lib/tasks ending in .rake, | ||
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
3 | |||
4 | require_relative "config/application" | ||
5 | |||
6 | Rails.application.load_tasks | ||
diff --git a/test/dummy/app/assets/config/manifest.js b/test/dummy/app/assets/config/manifest.js deleted file mode 100644 index f482c48..0000000 --- a/test/dummy/app/assets/config/manifest.js +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | //= link_tree ../images | ||
2 | //= link_directory ../stylesheets .css | ||
3 | //= link wittle_manifest.js | ||
diff --git a/test/dummy/app/views/layouts/application.html.erb b/test/dummy/app/views/layouts/application.html.erb deleted file mode 100644 index f72b4ef..0000000 --- a/test/dummy/app/views/layouts/application.html.erb +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>Dummy</title> | ||
5 | <meta name="viewport" content="width=device-width,initial-scale=1"> | ||
6 | <%= csrf_meta_tags %> | ||
7 | <%= csp_meta_tag %> | ||
8 | |||
9 | <%= stylesheet_link_tag "application" %> | ||
10 | </head> | ||
11 | |||
12 | <body> | ||
13 | <%= yield %> | ||
14 | </body> | ||
15 | </html> | ||
diff --git a/test/dummy/bin/rails b/test/dummy/bin/rails deleted file mode 100755 index efc0377..0000000 --- a/test/dummy/bin/rails +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #!/usr/bin/env ruby | ||
2 | APP_PATH = File.expand_path("../config/application", __dir__) | ||
3 | require_relative "../config/boot" | ||
4 | require "rails/commands" | ||
diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb deleted file mode 100644 index 116591a..0000000 --- a/test/dummy/config/boot.rb +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # Set up gems listed in the Gemfile. | ||
2 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__) | ||
3 | |||
4 | require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) | ||
5 | $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__) | ||
diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb deleted file mode 100644 index 2e69726..0000000 --- a/test/dummy/config/routes.rb +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | Rails.application.routes.draw do | ||
2 | mount Wittle::Engine => "/wittle" | ||
3 | end | ||
diff --git a/test/fixtures/wittle/puzzles.yml b/test/fixtures/puzzles.yml index 75f9eab..75f9eab 100644 --- a/test/fixtures/wittle/puzzles.yml +++ b/test/fixtures/puzzles.yml | |||
diff --git a/test/fixtures/wittle/scores.yml b/test/fixtures/scores.yml index 1f21c4c..1f21c4c 100644 --- a/test/fixtures/wittle/scores.yml +++ b/test/fixtures/scores.yml | |||
diff --git a/test/integration/navigation_test.rb b/test/models/puzzle_test.rb index ebbc098..6736bf6 100644 --- a/test/integration/navigation_test.rb +++ b/test/models/puzzle_test.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | require "test_helper" | 1 | require "test_helper" |
2 | 2 | ||
3 | class NavigationTest < ActionDispatch::IntegrationTest | 3 | class PuzzleTest < ActiveSupport::TestCase |
4 | # test "the truth" do | 4 | # test "the truth" do |
5 | # assert true | 5 | # assert true |
6 | # end | 6 | # end |
diff --git a/test/models/score_test.rb b/test/models/score_test.rb new file mode 100644 index 0000000..eeb5563 --- /dev/null +++ b/test/models/score_test.rb | |||
@@ -0,0 +1,7 @@ | |||
1 | require "test_helper" | ||
2 | |||
3 | class ScoreTest < ActiveSupport::TestCase | ||
4 | # test "the truth" do | ||
5 | # assert true | ||
6 | # end | ||
7 | end | ||
diff --git a/test/models/wittle/puzzle_test.rb b/test/models/wittle/puzzle_test.rb deleted file mode 100644 index f826aa3..0000000 --- a/test/models/wittle/puzzle_test.rb +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | require "test_helper" | ||
2 | |||
3 | module Wittle | ||
4 | class PuzzleTest < ActiveSupport::TestCase | ||
5 | # test "the truth" do | ||
6 | # assert true | ||
7 | # end | ||
8 | end | ||
9 | end | ||
diff --git a/test/models/wittle/score_test.rb b/test/models/wittle/score_test.rb deleted file mode 100644 index 0d5e4a3..0000000 --- a/test/models/wittle/score_test.rb +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | require "test_helper" | ||
2 | |||
3 | module Wittle | ||
4 | class ScoreTest < ActiveSupport::TestCase | ||
5 | # test "the truth" do | ||
6 | # assert true | ||
7 | # end | ||
8 | end | ||
9 | end | ||
diff --git a/lib/keep b/test/system/.keep index e69de29..e69de29 100644 --- a/lib/keep +++ b/test/system/.keep | |||
diff --git a/test/test_helper.rb b/test/test_helper.rb index 9d47a1b..0c22470 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb | |||
@@ -1,15 +1,15 @@ | |||
1 | # Configure Rails Environment | 1 | ENV["RAILS_ENV"] ||= "test" |
2 | ENV["RAILS_ENV"] = "test" | 2 | require_relative "../config/environment" |
3 | |||
4 | require_relative "../test/dummy/config/environment" | ||
5 | ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] | ||
6 | ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __dir__) | ||
7 | require "rails/test_help" | 3 | require "rails/test_help" |
8 | 4 | ||
9 | # Load fixtures from the engine | 5 | module ActiveSupport |
10 | if ActiveSupport::TestCase.respond_to?(:fixture_paths=) | 6 | class TestCase |
11 | ActiveSupport::TestCase.fixture_paths = [File.expand_path("fixtures", __dir__)] | 7 | # Run tests in parallel with specified workers |
12 | ActionDispatch::IntegrationTest.fixture_paths = ActiveSupport::TestCase.fixture_paths | 8 | parallelize(workers: :number_of_processors) |
13 | ActiveSupport::TestCase.file_fixture_path = File.expand_path("fixtures", __dir__) + "/files" | 9 | |
14 | ActiveSupport::TestCase.fixtures :all | 10 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. |
11 | fixtures :all | ||
12 | |||
13 | # Add more helper methods to be used by all tests here... | ||
14 | end | ||
15 | end | 15 | end |
diff --git a/test/wittle_test.rb b/test/wittle_test.rb deleted file mode 100644 index e28a047..0000000 --- a/test/wittle_test.rb +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | require "test_helper" | ||
2 | |||
3 | class WittleTest < ActiveSupport::TestCase | ||
4 | test "it has a version number" do | ||
5 | assert Wittle::VERSION | ||
6 | end | ||
7 | end | ||
diff --git a/tmp/.keep b/tmp/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tmp/.keep | |||
diff --git a/tmp/pids/.keep b/tmp/pids/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tmp/pids/.keep | |||
diff --git a/tmp/storage/.keep b/tmp/storage/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tmp/storage/.keep | |||
diff --git a/vendor/.keep b/vendor/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vendor/.keep | |||
diff --git a/vendor/javascript/.keep b/vendor/javascript/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vendor/javascript/.keep | |||
diff --git a/wittle.gemspec b/wittle.gemspec deleted file mode 100644 index 38741ba..0000000 --- a/wittle.gemspec +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | require_relative "lib/wittle/version" | ||
2 | |||
3 | Gem::Specification.new do |s| | ||
4 | s.name = 'wittle' | ||
5 | s.version = Wittle::VERSION | ||
6 | s.date = '2023-10-27' | ||
7 | s.summary = 'Wittle puzzles generator' | ||
8 | s.authors = ['hatkirby', 'Sigma144', 'jbzdarkid'] | ||
9 | s.email = ['fefferburbia@gmail.com'] | ||
10 | s.licenses = ['MIT'] | ||
11 | s.homepage = 'https://code.fourisland.com/wittle-generator' | ||
12 | s.extensions = ['ext/wittle_generator/extconf.rb'] | ||
13 | s.require_paths = ['lib'] | ||
14 | s.files = Dir.chdir(File.expand_path(__dir__)) do | ||
15 | Dir["{app,config,db,lib,ext}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] | ||
16 | end | ||
17 | |||
18 | s.add_dependency "rails", ">= 7.1.1" | ||
19 | s.add_dependency "rice" | ||
20 | s.add_dependency "haml" | ||
21 | s.add_dependency "enumerize" | ||
22 | s.add_dependency 'sassc-rails' | ||
23 | s.add_dependency 'jquery-rails' | ||
24 | end | ||