Compare commits
2 Commits
2884b94b7f
...
d526fa30f4
| 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
|
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
|
# 3. Copy Gemfile first to leverage layer caching
|
||||||
|
COPY Gemfile Gemfile.lock ./
|
||||||
RUN gem install rake
|
RUN bundle install
|
||||||
|
|
||||||
|
# 4. Copy the application code
|
||||||
COPY . ./
|
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
|
#!/bin/bash
|
||||||
|
|
||||||
if [ ! -f ./data/gamedata.db ]; then
|
# Run the migrations to make sure the DB is up-to-date
|
||||||
rake db:migrate
|
echo 'Checking database status...'
|
||||||
fi
|
rake db:migrate
|
||||||
|
|
||||||
|
# Start the HTTP server
|
||||||
|
echo 'Starting development server...'
|
||||||
rake server:dev
|
rake server:dev
|
||||||
|
|||||||
@@ -59,11 +59,10 @@ RSpec.describe(TestController) do
|
|||||||
before do
|
before do
|
||||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
|
||||||
request_data = {
|
request_data = {
|
||||||
test_name: 'Test Test',
|
test_name: 'Test Test',
|
||||||
test_hardware: @hardware.id,
|
test_hardware: @hardware.id,
|
||||||
'test_benchmarks[]': [@benchmark_profile.id],
|
'test_benchmarks[]': [@benchmark.id],
|
||||||
test_description: 'Test for testing'
|
test_description: 'Test for testing'
|
||||||
}
|
}
|
||||||
post '/test/add', request_data
|
post '/test/add', request_data
|
||||||
@@ -94,11 +93,11 @@ RSpec.describe(TestController) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'Test add POST route created test has benchmarks.' do
|
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
|
end
|
||||||
|
|
||||||
it 'Test add POST route created test\'s benchmark can be read.' do
|
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
|
end
|
||||||
|
|
||||||
it 'Test add POST route created test has description.' do
|
it 'Test add POST route created test has description.' do
|
||||||
@@ -111,13 +110,12 @@ RSpec.describe(TestController) do
|
|||||||
before do
|
before do
|
||||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
|
||||||
@test = Test.create(
|
@test = Test.create(
|
||||||
name: 'Test Test',
|
name: 'Test Test',
|
||||||
hardware_id: @hardware.id,
|
hardware_id: @hardware.id,
|
||||||
description: 'Test for testing'
|
description: 'Test for testing'
|
||||||
)
|
)
|
||||||
@test.add_benchmark_profile(@benchmark_profile)
|
@test.add_benchmark(@benchmark)
|
||||||
get "/test/#{@test.id}"
|
get "/test/#{@test.id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -143,13 +141,12 @@ RSpec.describe(TestController) do
|
|||||||
before do
|
before do
|
||||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
|
||||||
@test = Test.create(
|
@test = Test.create(
|
||||||
name: 'Test Test',
|
name: 'Test Test',
|
||||||
hardware_id: @hardware.id,
|
hardware_id: @hardware.id,
|
||||||
description: 'Test for testing'
|
description: 'Test for testing'
|
||||||
)
|
)
|
||||||
@test.add_benchmark_profile(@benchmark_profile)
|
@test.add_benchmark(@benchmark)
|
||||||
get "/test/#{@test.id}/edit"
|
get "/test/#{@test.id}/edit"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ResultController < BaseController
|
|||||||
|
|
||||||
Result.create(
|
Result.create(
|
||||||
test_id: params[:result_test],
|
test_id: params[:result_test],
|
||||||
benchmark_id: params[:result_benchmark],
|
benchmark_profile_id: params[:result_benchmark],
|
||||||
avg_score: params[:result_average],
|
avg_score: params[:result_average],
|
||||||
min_score: result_minimum,
|
min_score: result_minimum,
|
||||||
max_score: result_maximum
|
max_score: result_maximum
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ class Test < Sequel::Model
|
|||||||
many_to_one :hardware
|
many_to_one :hardware
|
||||||
many_to_many :benchmark_profiles
|
many_to_many :benchmark_profiles
|
||||||
|
|
||||||
def benchmark?(benchmark_profile_id)
|
def benchmark?(benchmark_id)
|
||||||
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_profile_id).any?
|
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_id).any?
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
|
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
|
||||||
<% for b in benchmarks %>
|
<% for b in benchmarks %>
|
||||||
<% for bp in b.benchmark_profiles %>
|
<% for bp in b.benchmark_profiles %>
|
||||||
<option value="<%= bp.id %>"><%= b.display_name() %></option>
|
<option value="<%= bp.id %>"><%= bp.display_name %></option>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -71,8 +71,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% test.benchmark_profiles.each do |benchmark| %>
|
<% test.benchmark_profiles.each do |bp| %>
|
||||||
<tr data-benchmark-id="<%= benchmark.id %>"></tr>
|
<tr data-benchmark-id="<%= bp.id %>"></tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user