diff --git a/compiled_starters/crystal/.gitignore b/compiled_starters/crystal/.gitignore new file mode 100644 index 00000000..d1c60ad5 --- /dev/null +++ b/compiled_starters/crystal/.gitignore @@ -0,0 +1,2 @@ +lib/ +server \ No newline at end of file diff --git a/compiled_starters/crystal/codecrafters.yml b/compiled_starters/crystal/codecrafters.yml index ca372bd7..f17cfd9b 100644 --- a/compiled_starters/crystal/codecrafters.yml +++ b/compiled_starters/crystal/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Crystal version used to run your code # on Codecrafters. # -# Available versions: crystal-1.1 -language_pack: crystal-1.1 +# Available versions: crystal-1.12 +language_pack: crystal-1.12 diff --git a/compiled_starters/crystal/shard.lock b/compiled_starters/crystal/shard.lock new file mode 100644 index 00000000..fe8b8a0d --- /dev/null +++ b/compiled_starters/crystal/shard.lock @@ -0,0 +1,6 @@ +version: 2.0 +shards: + kiwi: + git: https://github.com/crystal-community/kiwi.git + version: 0.1.0 + diff --git a/compiled_starters/crystal/shard.yml b/compiled_starters/crystal/shard.yml new file mode 100644 index 00000000..c9fdaf03 --- /dev/null +++ b/compiled_starters/crystal/shard.yml @@ -0,0 +1,18 @@ +name: build-your-own-redis +version: 0.1.0 + +dependencies: + kiwi: + github: crystal-community/kiwi + version: ~> 0.1.0 + +authors: + - CodeCrafters + +targets: + server: + main: app/main.cr + +crystal: '>= 1.12.1' + +license: MIT diff --git a/compiled_starters/crystal/spawn_redis_server.sh b/compiled_starters/crystal/spawn_redis_server.sh index f4bd9370..81691a13 100755 --- a/compiled_starters/crystal/spawn_redis_server.sh +++ b/compiled_starters/crystal/spawn_redis_server.sh @@ -6,6 +6,5 @@ # # DON'T EDIT THIS! set -e -tmpfile=$(mktemp) -crystal build -o "$tmpfile" app/main.cr -exec "$tmpfile" "$@" +crystal build --progress --stats --time -o server app/main.cr +exec ./server "$@" diff --git a/dockerfiles/crystal-1.12.Dockerfile b/dockerfiles/crystal-1.12.Dockerfile new file mode 100644 index 00000000..fb4cd379 --- /dev/null +++ b/dockerfiles/crystal-1.12.Dockerfile @@ -0,0 +1,14 @@ +FROM crystallang/crystal:1.12-alpine + +ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="shard.yml,shard.lock" + +WORKDIR /app +COPY shard.yml shard.lock ./ + +RUN shards install --frozen + +RUN mkdir -p /app-cached/ +RUN if [ -d "/app/lib" ]; then mv /app/lib /app-cached/lib; fi + +RUN echo "cd \${CODECRAFTERS_SUBMISSION_DIR} && crystal build --progress --stats --time -o server app/main.cr && sed -i '/^crystal/ s/^/# /' ./spawn_redis_server.sh" > /codecrafters-precompile.sh +RUN chmod +x /codecrafters-precompile.sh diff --git a/solutions/crystal/01-init/code/.gitignore b/solutions/crystal/01-init/code/.gitignore new file mode 100644 index 00000000..d1c60ad5 --- /dev/null +++ b/solutions/crystal/01-init/code/.gitignore @@ -0,0 +1,2 @@ +lib/ +server \ No newline at end of file diff --git a/solutions/crystal/01-init/code/codecrafters.yml b/solutions/crystal/01-init/code/codecrafters.yml index ca372bd7..f17cfd9b 100644 --- a/solutions/crystal/01-init/code/codecrafters.yml +++ b/solutions/crystal/01-init/code/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Crystal version used to run your code # on Codecrafters. # -# Available versions: crystal-1.1 -language_pack: crystal-1.1 +# Available versions: crystal-1.12 +language_pack: crystal-1.12 diff --git a/solutions/crystal/01-init/code/shard.lock b/solutions/crystal/01-init/code/shard.lock new file mode 100644 index 00000000..fe8b8a0d --- /dev/null +++ b/solutions/crystal/01-init/code/shard.lock @@ -0,0 +1,6 @@ +version: 2.0 +shards: + kiwi: + git: https://github.com/crystal-community/kiwi.git + version: 0.1.0 + diff --git a/solutions/crystal/01-init/code/shard.yml b/solutions/crystal/01-init/code/shard.yml new file mode 100644 index 00000000..c9fdaf03 --- /dev/null +++ b/solutions/crystal/01-init/code/shard.yml @@ -0,0 +1,18 @@ +name: build-your-own-redis +version: 0.1.0 + +dependencies: + kiwi: + github: crystal-community/kiwi + version: ~> 0.1.0 + +authors: + - CodeCrafters + +targets: + server: + main: app/main.cr + +crystal: '>= 1.12.1' + +license: MIT diff --git a/solutions/crystal/01-init/code/spawn_redis_server.sh b/solutions/crystal/01-init/code/spawn_redis_server.sh index f4bd9370..81691a13 100755 --- a/solutions/crystal/01-init/code/spawn_redis_server.sh +++ b/solutions/crystal/01-init/code/spawn_redis_server.sh @@ -6,6 +6,5 @@ # # DON'T EDIT THIS! set -e -tmpfile=$(mktemp) -crystal build -o "$tmpfile" app/main.cr -exec "$tmpfile" "$@" +crystal build --progress --stats --time -o server app/main.cr +exec ./server "$@" diff --git a/starter-repository-definitions.yml b/starter-repository-definitions.yml index 203b80ac..39539225 100644 --- a/starter-repository-definitions.yml +++ b/starter-repository-definitions.yml @@ -52,6 +52,12 @@ target: codecrafters.yml - source: starter_templates/crystal/app/main.cr target: app/main.cr + - source: starter_templates/crystal/shard.yml + target: shard.yml + - source: starter_templates/crystal/shard.lock + target: shard.lock + - source: starter_templates/crystal/.gitignore + target: .gitignore - source: starter_templates/crystal/spawn_redis_server.sh target: spawn_redis_server.sh - source: starter_templates/.gitattributes diff --git a/starter_templates/codecrafters.yml b/starter_templates/codecrafters.yml index 840f183a..6e814402 100644 --- a/starter_templates/codecrafters.yml +++ b/starter_templates/codecrafters.yml @@ -60,8 +60,8 @@ language_pack: java-21 language_pack: nim-1.0 {{/ language_is_nim }} {{# language_is_crystal }} -# Available versions: crystal-1.1 -language_pack: crystal-1.1 +# Available versions: crystal-1.12 +language_pack: crystal-1.12 {{/ language_is_crystal }} {{#language_is_clojure}} # Available versions: clojure-1.10.3 diff --git a/starter_templates/crystal/.gitignore b/starter_templates/crystal/.gitignore new file mode 100644 index 00000000..d1c60ad5 --- /dev/null +++ b/starter_templates/crystal/.gitignore @@ -0,0 +1,2 @@ +lib/ +server \ No newline at end of file diff --git a/starter_templates/crystal/shard.lock b/starter_templates/crystal/shard.lock new file mode 100644 index 00000000..fe8b8a0d --- /dev/null +++ b/starter_templates/crystal/shard.lock @@ -0,0 +1,6 @@ +version: 2.0 +shards: + kiwi: + git: https://github.com/crystal-community/kiwi.git + version: 0.1.0 + diff --git a/starter_templates/crystal/shard.yml b/starter_templates/crystal/shard.yml new file mode 100644 index 00000000..c9fdaf03 --- /dev/null +++ b/starter_templates/crystal/shard.yml @@ -0,0 +1,18 @@ +name: build-your-own-redis +version: 0.1.0 + +dependencies: + kiwi: + github: crystal-community/kiwi + version: ~> 0.1.0 + +authors: + - CodeCrafters + +targets: + server: + main: app/main.cr + +crystal: '>= 1.12.1' + +license: MIT diff --git a/starter_templates/crystal/spawn_redis_server.sh b/starter_templates/crystal/spawn_redis_server.sh index f4bd9370..81691a13 100755 --- a/starter_templates/crystal/spawn_redis_server.sh +++ b/starter_templates/crystal/spawn_redis_server.sh @@ -6,6 +6,5 @@ # # DON'T EDIT THIS! set -e -tmpfile=$(mktemp) -crystal build -o "$tmpfile" app/main.cr -exec "$tmpfile" "$@" +crystal build --progress --stats --time -o server app/main.cr +exec ./server "$@"