Compare commits
1 Commits
main
...
2884b94b7f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2884b94b7f |
@@ -1,27 +1,16 @@
|
|||||||
FROM ruby:3.4-slim
|
FROM ruby:3.4
|
||||||
|
|
||||||
# 1. Install essential build tools for gems like 'pg' or 'sqlite3'
|
RUN gem install bundler
|
||||||
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
|
||||||
|
|
||||||
# 2. Set environment variables for the Gem volume we discussed
|
COPY Gemfile Gemfile.l*ck ./
|
||||||
ENV BUNDLE_PATH=/usr/local/bundle \
|
|
||||||
BUNDLE_BIN=/usr/local/bundle/bin \
|
|
||||||
PATH=/usr/local/bundle/bin:$PATH
|
|
||||||
|
|
||||||
# 3. Copy Gemfile first to leverage layer caching
|
RUN bundle check || bundle install
|
||||||
COPY Gemfile Gemfile.lock ./
|
|
||||||
RUN bundle install
|
RUN gem install rake
|
||||||
|
|
||||||
# 4. Copy the application code
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
# 5. Make sure your entrypoint script is executable
|
|
||||||
RUN chmod +x entrypoints/dev.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Run the migrations to make sure the DB is up-to-date
|
if [ ! -f ./data/gamedata.db ]; then
|
||||||
echo 'Checking database status...'
|
|
||||||
rake db:migrate
|
rake db:migrate
|
||||||
|
fi
|
||||||
|
|
||||||
# Start the HTTP server
|
|
||||||
echo 'Starting development server...'
|
|
||||||
rake server:dev
|
rake server:dev
|
||||||
|
|||||||
@@ -59,10 +59,11 @@ 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.id],
|
'test_benchmarks[]': [@benchmark_profile.id],
|
||||||
test_description: 'Test for testing'
|
test_description: 'Test for testing'
|
||||||
}
|
}
|
||||||
post '/test/add', request_data
|
post '/test/add', request_data
|
||||||
@@ -93,11 +94,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.benchmarks.length).to(eq(1))
|
expect(Test.first.benchmark_profiles.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.benchmarks[0].id).to(eq(@benchmark.id))
|
expect(Test.first.benchmark_profiles[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
|
||||||
@@ -110,12 +111,13 @@ 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(@benchmark)
|
@test.add_benchmark_profile(@benchmark_profile)
|
||||||
get "/test/#{@test.id}"
|
get "/test/#{@test.id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -141,12 +143,13 @@ 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(@benchmark)
|
@test.add_benchmark_profile(@benchmark_profile)
|
||||||
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_profile_id: params[:result_benchmark],
|
benchmark_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_id)
|
def benchmark?(benchmark_profile_id)
|
||||||
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_id).any?
|
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_profile_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 %>"><%= bp.display_name %></option>
|
<option value="<%= bp.id %>"><%= b.display_name() %></option>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -71,8 +71,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% test.benchmark_profiles.each do |bp| %>
|
<% test.benchmark_profiles.each do |benchmark| %>
|
||||||
<tr data-benchmark-id="<%= bp.id %>"></tr>
|
<tr data-benchmark-id="<%= benchmark.id %>"></tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user