Community website to share Dyson Sphere Program blueprints.
Official website: https://www.dysonsphereblueprints.com
Look at our list of issues to get an idea
- Added Simplified Chinese (zh-CN) internationalization support (#97)
Find the rest in the CHANGELOG
Pull requests are always welcome, if you want a copy of the production or staging database for development purposes (meaning all emails and passwords will be randomized, I am not just gonna give away personal information to whoever wants them), just send me an email or open a ticket and we'll see to that.
Install ruby dependencies
bundle install
Install node dependencies
yarn
Then set up the database, either using docker or your own postgresql instance. Once done, you can run the migrations and create the database:
rails db:create db:migrate db:seed
If migrations are failing the first time, just re-run them again.
You should then be able to run the application:
rails s
The main thing you'll need to setup is to create a GameVersion for the blueprints. A GameVersion contains a field versions which is a JSON like this:
{
"0.8.19.7662" => {
"uuid4" => "0.8.19.7662-1627063708",
"breaking"=>true,
"created_at"=>"2021-07-23T18:08:28.644+00:00"
}
}breaking is used for the display of blueprints compatibility from one game version to another.
You can also go in lib/tasks/game_version.rake and have a look at the tasks, those tasks were used to seed the game versions in staging and production:
noglob rake 'game_version:fetch_latest[0.8.19.7662]' # Forces a game version to be added
noglob rake 'game_version:fetch_latest' # Fetches the latest game versions from the Steam News API
noglob rake 'game_version:flag_breaking[0.8.19.7662]'
For proper development, you also will need a .env file at the root of the project. It needs to have the following environment variables:
DISCORD_CLIENT_ID=XXX
DISCORD_CLIENT_SECRET=XXX
AWS_S3_ACCESS_ID_KEY=XXX
AWS_S3_ACCESS_SECRET_KEY=XXX
AWS_S3_REGION=eu-west-1
AWS_S3_BUCKET=dyson-sphere-blueprints
AWS_CLOUDFRONT_URL=https://XYZ.cloudfront.net
Most of those are not needed to be able to work on most features, but if you want images to display and be able to upload images for instance you will need to setup an AWS S3 and Cloudfront.
An example can be found in .env.sample
You can also build a development environment with docker compose.
Using the docker-compose.yml, will start the following services:
- PostgreSQL
- Redis
- AWS S3 (localstack)
- SMTP (mailhog)
$ docker compose up -dto connect each service, use these credentials:
- PostgreSQL
- User:
dev - Password:
password - Host:
127.0.0.1 - Database:
dspblueprints_development
- User:
- Redis
- URL:
redis://127.0.0.1:6379/0
- URL:
- AWS S3
- Access key:
XXX(some non-empty string) - Secret key:
XXX(some non-empty string) - Region:
eu-west-1 - Bucket:
dyson-sphere-blueprints - Endpoint:
http://localhost:4566
- Access key:
- SMTP
- SMTP Server:
localhost:1025 - HTTP Server:
localhost:8025(You can see the emails you have sent with WebUI)
- SMTP Server:
The above configuration is written in .env.sample.
You can simply copy it and it should be enough.
$ cp .env.sample .envAn anonymized production database dump is available in the latest GitHub release. This dump contains production data with all emails and passwords randomized for development purposes.
Prerequisites:
- Docker compose services must be running (
docker compose up -d) - You have downloaded the
dspblueprints.dump.gzfile from the latest GitHub release
Steps:
- Download the dump file from the latest GitHub release and place it in the
db/directory:
# The file should be at db/dspblueprints.dump.gz- Restore the compressed dump using the rake task:
rake db:drop db:create
rake db:restore_compressedThis task will automatically:
- Drop the existing development database
- Create a fresh database
- Restore the compressed dump
Note: You do NOT need to run rails db:migrate after restoring a dump, as the dump already contains the complete schema and data. Just start your Rails server with rails s.
There are a few rake tasks that you can use:
rake game_version:fetch_latest[PATCH] # creates a new version in the DB, use like this: rake 'game_version:fetch_latest[0.8.19.7662]'
rake blueprint:recompute_data # updates all blueprints summary if you have made any changes to it
The project has a comprehensive test suite covering models, controllers, policies, and system tests.
Running tests:
# Run all tests
rails test
# Run a specific test file
rails test test/models/blueprint_test.rb
# Run a specific test by line number
rails test test/models/blueprint_test.rb:10
# Run system tests (requires Chrome/Chromium)
rails test:systemTest structure:
test/models/- Model unit teststest/controllers/- Controller teststest/policies/- Pundit authorization policy teststest/system/- End-to-end browser tests
This project uses i18n-tasks to manage translations and ensure consistency across locales.
Important: Due to Ruby 3.2 compatibility issues with ActiveSupport, you must prefix all i18n-tasks commands with RUBYOPT="-rlogger":
# Normalize translation files
RUBYOPT="-rlogger" i18n-tasks normalize
# Find missing translations
RUBYOPT="-rlogger" i18n-tasks missing
# Find unused translations
RUBYOPT="-rlogger" i18n-tasks unused
# Check for inconsistent interpolations
RUBYOPT="-rlogger" i18n-tasks check-consistent-interpolationsThis ensures the logger gem is loaded before ActiveSupport, which is required for Ruby 3.2 compatibility.
This project uses GitHub Actions for CI. Every push and pull request triggers automated tests.
The CI workflow:
- Runs on Ubuntu with PostgreSQL and Redis services
- Executes RuboCop for code style checks
- Runs the full test suite
- Compiles assets to catch any frontend issues
Before submitting a PR:
- Make sure all tests pass locally:
rails test - Check code style:
rubocop(orrubocop -ato auto-fix) - If you've added new functionality, please add corresponding tests
You can see the CI status on any PR or check the badge at the top of this README.
- Waylon - Checkout Waylon's project, We Care Tucson, a non-profit organization that refurbishes donated computers to resell at discounted prices to the community!
- Sho918
- Juo Nuevo
- Sho918, code cleanup, docker setup and many incredible features and improvements
- Brokenmass, Wrote the 3D Preview renderer (as well as the original blueprint mod).
- LRFalk01, DSP Blueprint Parser library and integration in the project
- RandyCarrero, Help page and new tags for Mass construction
- Glouel, Fixed some typos
- David Westerink, blueprint collections bulk download
This project is currently hosted on Heroku.
Notes to self:
rubocop-daemon start
Make sure the Gemfile has the proper platforms set:
$ bundle lock --add-platform x86_64-linux
Copy prod DB to staging
heroku pg:backups:restore `heroku pg:backups:url --app dyson-sphere-blueprints` DATABASE_URL --app dyson-sphere-blueprints-stage
Important: this license only applies to the logic and application in itself and does not pertain to any data or assets coming from the game Dyson Sphere Program which is the intellectual property of Youthcat Studio.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004
Copyright (C) 2004 Sam Hocevar sam@hocevar.net
Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
You just DO WHAT THE FUCK YOU WANT TO.