9 Commits
v0.2.0 ... main

Author SHA1 Message Date
3f0efce0d8 Fixed a few lints; changed rake task name to test:lint
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-08-12 23:56:46 -04:00
eeedc57cd3 Overhauled configuration so that it's a bit more useful in more spots; configuration now properly loads an environment config as well as defaults; updated some woodpecker config
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-08-12 23:47:38 -04:00
164eea1bde Updated Woodpecker config for 3.x
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
2025-08-12 21:59:59 -04:00
85fe3b0b38 Removing broken ruby test versions for now
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-08-12 21:55:03 -04:00
519955e57a Fixing unit tests
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-08-12 21:30:17 -04:00
96b746822c Fixing unit tests
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-08-12 21:27:17 -04:00
eac833fd6d Adding db:migrate step to tests; adding two new versions of Ruby to test against
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-08-12 20:29:57 -04:00
ad391c84a4 Fixing ruby 3.4 test
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-08-12 20:23:50 -04:00
641c9315bc Adding Ruby 3.4 testing to Woodpecker
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-08-12 20:03:20 -04:00
12 changed files with 69 additions and 23 deletions

3
.gitignore vendored
View File

@ -65,3 +65,6 @@ node_modules/
# Compiled assets
public/css/
public/js/
# Ignore production configuration files to protect against credential leaks
config/production.yaml

View File

@ -1,11 +1,32 @@
pipeline:
steps:
setup:
image: ruby:3.4
env:
RACK_ENV: testing
commands:
- gem install rake
- bundle config set --local path "vendor/bundle"
- bundle install
- rake db:migrate
test_ruby34:
image: ruby:3.4
env:
RACK_ENV: testing
commands:
- gem install rake
- bundle config set --local path "vendor/bundle"
- rake test:unit
group: tests
style:
image: ruby:3.4
env:
RACK_ENV: testing
commands:
- 'gem install rake'
- 'bundle config set --local path "vendor/bundle"'
- 'bundle install'
- 'rake test:rubocop'
- gem install rake
- bundle config set --local path "vendor/bundle"
- rake test:lint
gitea_release:
image: plugins/gitea-release
@ -15,5 +36,5 @@ pipeline:
base_url: https://git.metaunix.net
title: "${CI_COMMIT_TAG}"
when:
event: tag
event:
- tag

View File

@ -3,18 +3,22 @@ require 'bundler/setup'
namespace :db do
desc 'Run migrations'
task :migrate, [:version] do |t, args|
require "sequel/core"
require 'sequel/core'
# load configuration
require_relative 'src/config'
conf = Config.new()
Sequel.extension :migration
version = args[:version].to_i if args[:version]
Sequel.connect('sqlite://data/gamedata.db') do |db|
Sequel::Migrator.run(db, "db/migrations", target: version)
Sequel.connect(adapter: conf.get('database.adapter'), database: conf.get('database.database')) do |db|
Sequel::Migrator.run(db, 'db/migrations', target: version)
end
end
end
namespace :server do
task :start do
ENV['APP_ENV'] = 'production'
ENV['RACK_ENV'] = 'production'
system("puma")
end
@ -28,8 +32,7 @@ namespace :test do
system("rspec")
end
task :rubocop do
task :lint do
system("rubocop src/ spec/")
end
end

View File

@ -1,6 +1,6 @@
database:
adapter: 'sqlite'
database: 'data/gamedata.db'
server:
host: '0.0.0.0'
port: '9292'
testing:
minimum_results_required: 3

3
config/development.yaml Normal file
View File

@ -0,0 +1,3 @@
database:
adapter: 'sqlite'
database: 'data/gamedata.db'

View File

@ -3,7 +3,9 @@ directory app_dir
environment ENV.fetch('RACK_ENV', 'development')
bind 'tcp://0.0.0.0:9292'
require_relative '../src/config'
conf = Config.new()
bind "tcp://#{conf.get('server.host')}:#{conf.get('server.port')}"
workers 2
threads 1, 5

3
config/testing.yaml Normal file
View File

@ -0,0 +1,3 @@
database:
adapter: 'sqlite'
database: 'data/gamedata_testing.db'

View File

@ -7,8 +7,11 @@ RSpec.describe(BenchmarkController) do
describe 'GET /benchmark' do
before { get '/benchmark' }
it 'Benchmark base route redirects to /benchmark/list' do
it 'Benchmark base route is a redirect' do
expect(last_response).to(be_redirect)
end
it 'Benchmark base route Location header points to /benchmark/list' do
expect(last_response['Location']).to(eq("#{BASE_URL}/benchmark/list"))
end
end

View File

@ -7,8 +7,11 @@ RSpec.describe(HardwareController) do
describe 'GET /hardware' do
before { get '/hardware' }
it 'Hardware base route redirects to /hardware/list' do
it 'Hardware base route is a redirect' do
expect(last_response).to(be_redirect)
end
it 'Hardware base route Location header points to /hardware/list' do
expect(last_response['Location']).to(eq("#{BASE_URL}/hardware/list"))
end
end

View File

@ -7,8 +7,11 @@ RSpec.describe(TestController) do
describe 'GET /test' do
before { get '/test' }
it 'Test base route redirects to /test/list' do
it 'Test base route is a redirect' do
expect(last_response).to(be_redirect)
end
it 'Test base route Location header points to /test/list' do
expect(last_response['Location']).to(eq("#{BASE_URL}/test/list"))
end
end

View File

@ -6,8 +6,9 @@ require 'yaml'
class Config
DEFAULT_CONFIG = 'config/defaults.yaml'
ENVIRONMENT_CONFIG = ENV.fetch('RACK_ENV', 'development')
def initialize(config_path)
def initialize(config_path = "config/#{ENVIRONMENT_CONFIG}.yaml")
@data = YAML.load_file(DEFAULT_CONFIG)
# merge in user-defined configuration if it exists

View File

@ -6,7 +6,8 @@ require 'sqlite3'
require_relative 'config'
$conf = Config.new(File.join(__dir__, 'config/defaults.yaml'))
# Load configuration from environment config file
$conf = Config.new()
# Load the Sequel timestamps plugin
Sequel::Model.plugin(:timestamps)