get rid of cakefile
This commit is contained in:
parent
aa4f2d2c48
commit
09ff7b4800
24
Cakefile
24
Cakefile
|
@ -1,24 +0,0 @@
|
|||
# todo: move inside executable
|
||||
|
||||
require "log"
|
||||
require "dotenv"
|
||||
require "sqlite3"
|
||||
require "migrate"
|
||||
|
||||
Dotenv.load
|
||||
|
||||
desc "Migrate database to the latest version"
|
||||
task :dbmigrate do
|
||||
migrator = Migrate::Migrator.new(
|
||||
DB.open(ENV["DATABASE_URL"])
|
||||
)
|
||||
migrator.to_latest
|
||||
end
|
||||
|
||||
desc "Migrate database a single version down"
|
||||
task :dbmigratedown do
|
||||
migrator = Migrate::Migrator.new(
|
||||
DB.open(ENV["DATABASE_URL"])
|
||||
)
|
||||
migrator.down
|
||||
end
|
25
README.md
25
README.md
|
@ -1,10 +1,16 @@
|
|||
# crystal-gauntlet
|
||||
<h1 style="vertical-align:center">
|
||||
<center>
|
||||
<img src="./docs/crystal-gauntlet-icon.png" width="auto" height="32"> crystal-gauntlet
|
||||
</center>
|
||||
</h1>
|
||||
|
||||
among balls
|
||||
a [Geometry Dash](https://store.steampowered.com/app/322170/Geometry_Dash/) server reimplementation in [Crystal](https://crystal-lang.org/), focusing on speed and 1:1 recreations of vanilla GD features
|
||||
|
||||
_this project is still in its very early stages. you can see a rough estimate of the current progress in [this issue](https://git.oat.zone/oat/crystal-gauntlet/issues/1)._
|
||||
|
||||
## build
|
||||
|
||||
`shards build`
|
||||
`shards install` && `shards build`
|
||||
|
||||
you may need to head into `lib/` to fix deps. i'm Very sorry
|
||||
|
||||
|
@ -12,12 +18,19 @@ you may need to head into `lib/` to fix deps. i'm Very sorry
|
|||
|
||||
copy `.env.example` to `.env` and fill it out, same for `config.example.toml` -> `config.toml`
|
||||
|
||||
run `cake db:migrate` (must have [cake](https://github.com/axvm/cake/))
|
||||
run `bin/crystal-gauntlet migrate` (or `shards run -- migrate`)
|
||||
|
||||
**schemas are highly unstable so you will be offered 0 support in migrating databases for now**, however in the future you'll want to run this each time you update
|
||||
|
||||
then `bin/crystal-gauntlet` (or `shards run`)
|
||||
then `bin/crystal-gauntlet` (or `shards run`) to start the server
|
||||
|
||||
### real
|
||||
## attributions & credits
|
||||
|
||||
- [Jill "oatmealine" Monoids](https://git.oat.zone/oat) and [winter](https://git.oat.zone/wint0r): main developers
|
||||
- a lot of the implementation specifics were taken from [Cvolton's private server](https://github.com/Cvolton/GMDprivateServer) and [matcool's pygdps](https://github.com/matcool/pygdps/); [TeamHax's GDDocs](https://github.com/TeamHaxGD/GDDocs/tree/master/endpoints) and [GD Programming Discord's GDDocs](https://docs.gdprogra.me/#/) were also frequently referenced
|
||||
|
||||
## real
|
||||
|
||||
real
|
||||
|
||||
![real](docs/crystal-gauntlet.jpg)
|
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
|
@ -6,6 +6,8 @@ require "migrate"
|
|||
require "dotenv"
|
||||
require "toml"
|
||||
require "colorize"
|
||||
require "option_parser"
|
||||
require "migrate"
|
||||
|
||||
require "./enums"
|
||||
require "./lib/hash"
|
||||
|
@ -125,25 +127,50 @@ module CrystalGauntlet
|
|||
end
|
||||
|
||||
def self.run()
|
||||
server = HTTP::Server.new([
|
||||
HTTP::LogHandler.new,
|
||||
HTTP::StaticFileHandler.new("data/", fallthrough: true, directory_listing: false),
|
||||
CrystalGauntlet::GDHandler.new
|
||||
])
|
||||
|
||||
listen_on = URI.parse(ENV["LISTEN_ON"]? || "http://localhost:8080").normalize
|
||||
|
||||
case listen_on.scheme
|
||||
when "http"
|
||||
server.bind_tcp(listen_on.hostname.not_nil!, listen_on.port.not_nil!)
|
||||
when "unix"
|
||||
server.bind_unix(listen_on.to_s.sub("unix://",""))
|
||||
end
|
||||
|
||||
Log.setup_from_env(backend: Log::IOBackend.new(formatter: CrystalGauntletFormat))
|
||||
|
||||
LOG.notice { "Listening on #{listen_on.to_s}" }
|
||||
server.listen
|
||||
migrate = false
|
||||
|
||||
parser = OptionParser.new do |parser|
|
||||
parser.banner = "Usage: crystal-gauntlet [command] [arguments]"
|
||||
|
||||
parser.on("migrate", "Migrate the database") do
|
||||
migrate = true
|
||||
parser.banner = "Usage: crystal-gauntlet migrate [arguments]"
|
||||
end
|
||||
parser.on("-h", "--help", "Show this help") do
|
||||
puts parser
|
||||
exit
|
||||
end
|
||||
end
|
||||
|
||||
parser.parse
|
||||
|
||||
if migrate
|
||||
LOG.info { "Migrating #{ENV["DATABASE_URL"].colorize(:white)}..." }
|
||||
migrator = Migrate::Migrator.new(
|
||||
DATABASE
|
||||
)
|
||||
migrator.to_latest
|
||||
else
|
||||
server = HTTP::Server.new([
|
||||
HTTP::LogHandler.new,
|
||||
HTTP::StaticFileHandler.new("data/", fallthrough: true, directory_listing: false),
|
||||
CrystalGauntlet::GDHandler.new
|
||||
])
|
||||
|
||||
listen_on = URI.parse(ENV["LISTEN_ON"]? || "http://localhost:8080").normalize
|
||||
|
||||
case listen_on.scheme
|
||||
when "http"
|
||||
server.bind_tcp(listen_on.hostname.not_nil!, listen_on.port.not_nil!)
|
||||
when "unix"
|
||||
server.bind_unix(listen_on.to_s.sub("unix://",""))
|
||||
end
|
||||
|
||||
LOG.notice { "Listening on #{listen_on.to_s.colorize(:white)}" }
|
||||
server.listen
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue