Compare commits
2 Commits
2884b94b7f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d526fa30f4 | |||
| 3dbc11d294 |
@@ -1,16 +1,27 @@
|
||||
FROM ruby:3.4
|
||||
FROM ruby:3.4-slim
|
||||
|
||||
RUN gem install bundler
|
||||
# 1. Install essential build tools for gems like 'pg' or 'sqlite3'
|
||||
RUN apt-get update -qq && apt-get install -y \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
curl \
|
||||
git
|
||||
|
||||
WORKDIR /usr/src/game-data
|
||||
|
||||
COPY Gemfile Gemfile.l*ck ./
|
||||
# 2. Set environment variables for the Gem volume we discussed
|
||||
ENV BUNDLE_PATH=/usr/local/bundle \
|
||||
BUNDLE_BIN=/usr/local/bundle/bin \
|
||||
PATH=/usr/local/bundle/bin:$PATH
|
||||
|
||||
RUN bundle check || bundle install
|
||||
|
||||
RUN gem install rake
|
||||
# 3. Copy Gemfile first to leverage layer caching
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
RUN bundle install
|
||||
|
||||
# 4. Copy the application code
|
||||
COPY . ./
|
||||
|
||||
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
||||
# 5. Make sure your entrypoint script is executable
|
||||
RUN chmod +x entrypoints/dev.sh
|
||||
|
||||
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f ./data/gamedata.db ]; then
|
||||
# Run the migrations to make sure the DB is up-to-date
|
||||
echo 'Checking database status...'
|
||||
rake db:migrate
|
||||
fi
|
||||
|
||||
# Start the HTTP server
|
||||
echo 'Starting development server...'
|
||||
rake server:dev
|
||||
|
||||
@@ -59,11 +59,10 @@ RSpec.describe(TestController) do
|
||||
before do
|
||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
||||
request_data = {
|
||||
test_name: 'Test Test',
|
||||
test_hardware: @hardware.id,
|
||||
'test_benchmarks[]': [@benchmark_profile.id],
|
||||
'test_benchmarks[]': [@benchmark.id],
|
||||
test_description: 'Test for testing'
|
||||
}
|
||||
post '/test/add', request_data
|
||||
@@ -94,11 +93,11 @@ RSpec.describe(TestController) do
|
||||
end
|
||||
|
||||
it 'Test add POST route created test has benchmarks.' do
|
||||
expect(Test.first.benchmark_profiles.length).to(eq(1))
|
||||
expect(Test.first.benchmarks.length).to(eq(1))
|
||||
end
|
||||
|
||||
it 'Test add POST route created test\'s benchmark can be read.' do
|
||||
expect(Test.first.benchmark_profiles[0].id).to(eq(@benchmark.id))
|
||||
expect(Test.first.benchmarks[0].id).to(eq(@benchmark.id))
|
||||
end
|
||||
|
||||
it 'Test add POST route created test has description.' do
|
||||
@@ -111,13 +110,12 @@ RSpec.describe(TestController) do
|
||||
before do
|
||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
||||
@test = Test.create(
|
||||
name: 'Test Test',
|
||||
hardware_id: @hardware.id,
|
||||
description: 'Test for testing'
|
||||
)
|
||||
@test.add_benchmark_profile(@benchmark_profile)
|
||||
@test.add_benchmark(@benchmark)
|
||||
get "/test/#{@test.id}"
|
||||
end
|
||||
|
||||
@@ -143,13 +141,12 @@ RSpec.describe(TestController) do
|
||||
before do
|
||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
||||
@test = Test.create(
|
||||
name: 'Test Test',
|
||||
hardware_id: @hardware.id,
|
||||
description: 'Test for testing'
|
||||
)
|
||||
@test.add_benchmark_profile(@benchmark_profile)
|
||||
@test.add_benchmark(@benchmark)
|
||||
get "/test/#{@test.id}/edit"
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class ResultController < BaseController
|
||||
|
||||
Result.create(
|
||||
test_id: params[:result_test],
|
||||
benchmark_id: params[:result_benchmark],
|
||||
benchmark_profile_id: params[:result_benchmark],
|
||||
avg_score: params[:result_average],
|
||||
min_score: result_minimum,
|
||||
max_score: result_maximum
|
||||
|
||||
@@ -7,8 +7,8 @@ class Test < Sequel::Model
|
||||
many_to_one :hardware
|
||||
many_to_many :benchmark_profiles
|
||||
|
||||
def benchmark?(benchmark_profile_id)
|
||||
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_profile_id).any?
|
||||
def benchmark?(benchmark_id)
|
||||
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_id).any?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
|
||||
<% for b in benchmarks %>
|
||||
<% for bp in b.benchmark_profiles %>
|
||||
<option value="<%= bp.id %>"><%= b.display_name() %></option>
|
||||
<option value="<%= bp.id %>"><%= bp.display_name %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
|
||||
@@ -71,8 +71,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% test.benchmark_profiles.each do |benchmark| %>
|
||||
<tr data-benchmark-id="<%= benchmark.id %>"></tr>
|
||||
<% test.benchmark_profiles.each do |bp| %>
|
||||
<tr data-benchmark-id="<%= bp.id %>"></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user