diff --git a/compiled_starters/cpp/.codecrafters/compile.sh b/compiled_starters/cpp/.codecrafters/compile.sh new file mode 100755 index 0000000..9da226b --- /dev/null +++ b/compiled_starters/cpp/.codecrafters/compile.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake +cmake --build ./build diff --git a/compiled_starters/cpp/.codecrafters/run.sh b/compiled_starters/cpp/.codecrafters/run.sh new file mode 100755 index 0000000..4059f64 --- /dev/null +++ b/compiled_starters/cpp/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec ./build/exe "$@" diff --git a/compiled_starters/cpp/CMakeLists.txt b/compiled_starters/cpp/CMakeLists.txt index 190fc63..1ad76fb 100755 --- a/compiled_starters/cpp/CMakeLists.txt +++ b/compiled_starters/cpp/CMakeLists.txt @@ -6,4 +6,4 @@ set(CMAKE_CXX_STANDARD 23) # Enable the C++23 standard file(GLOB_RECURSE SOURCE_FILES src/*.cpp src/*.hpp) -add_executable(server ${SOURCE_FILES}) \ No newline at end of file +add_executable(exe ${SOURCE_FILES}) \ No newline at end of file diff --git a/compiled_starters/cpp/README.md b/compiled_starters/cpp/README.md index 6f92c86..b13e4bf 100644 --- a/compiled_starters/cpp/README.md +++ b/compiled_starters/cpp/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `cmake` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `src/Server.cpp`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/cpp/your_grep.sh b/compiled_starters/cpp/your_grep.sh deleted file mode 100755 index 4b8635d..0000000 --- a/compiled_starters/cpp/your_grep.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -set -e -# vcpkg & cmake are required. -cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake -cmake --build ./build -exec ./build/server "$@" \ No newline at end of file diff --git a/compiled_starters/cpp/your_program.sh b/compiled_starters/cpp/your_program.sh new file mode 100755 index 0000000..844a7e8 --- /dev/null +++ b/compiled_starters/cpp/your_program.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake + cmake --build ./build +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec ./build/exe "$@" diff --git a/compiled_starters/csharp/.codecrafters/compile.sh b/compiled_starters/csharp/.codecrafters/compile.sh new file mode 100755 index 0000000..4a2e031 --- /dev/null +++ b/compiled_starters/csharp/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +dotnet build --configuration Release --output /tmp/codecrafters-build-grep-csharp codecrafters-grep.csproj diff --git a/compiled_starters/csharp/.codecrafters/run.sh b/compiled_starters/csharp/.codecrafters/run.sh new file mode 100755 index 0000000..bf34673 --- /dev/null +++ b/compiled_starters/csharp/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-build-grep-csharp/codecrafters-grep "$@" \ No newline at end of file diff --git a/compiled_starters/csharp/README.md b/compiled_starters/csharp/README.md index adcb3ac..b4ea28f 100644 --- a/compiled_starters/csharp/README.md +++ b/compiled_starters/csharp/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `dotnet (8.0)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `src/Program.cs`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/csharp/your_grep.sh b/compiled_starters/csharp/your_grep.sh deleted file mode 100755 index cd2efe5..0000000 --- a/compiled_starters/csharp/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec dotnet run --project . --configuration Release -- "$@" diff --git a/compiled_starters/csharp/your_program.sh b/compiled_starters/csharp/your_program.sh new file mode 100755 index 0000000..44ae083 --- /dev/null +++ b/compiled_starters/csharp/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + dotnet build --configuration Release --output /tmp/codecrafters-build-grep-csharp codecrafters-grep.csproj +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec /tmp/codecrafters-build-grep-csharp/codecrafters-grep "$@" diff --git a/compiled_starters/gleam/.codecrafters/compile.sh b/compiled_starters/gleam/.codecrafters/compile.sh new file mode 100755 index 0000000..0f4122e --- /dev/null +++ b/compiled_starters/gleam/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +gleam build diff --git a/compiled_starters/gleam/.codecrafters/run.sh b/compiled_starters/gleam/.codecrafters/run.sh new file mode 100755 index 0000000..5f0daba --- /dev/null +++ b/compiled_starters/gleam/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec gleam run -- "$@" diff --git a/compiled_starters/gleam/README.md b/compiled_starters/gleam/README.md index 33ba3ae..63f34a0 100644 --- a/compiled_starters/gleam/README.md +++ b/compiled_starters/gleam/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `gleam (1.0)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `src/grep.gleam`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/gleam/your_grep.sh b/compiled_starters/gleam/your_grep.sh deleted file mode 100755 index 9fd98a5..0000000 --- a/compiled_starters/gleam/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec gleam run -- "$@" \ No newline at end of file diff --git a/compiled_starters/gleam/your_program.sh b/compiled_starters/gleam/your_program.sh new file mode 100755 index 0000000..0eeb6fc --- /dev/null +++ b/compiled_starters/gleam/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + gleam build +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec gleam run -- "$@" diff --git a/compiled_starters/go/.codecrafters/compile.sh b/compiled_starters/go/.codecrafters/compile.sh new file mode 100755 index 0000000..3b3e7d6 --- /dev/null +++ b/compiled_starters/go/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go diff --git a/compiled_starters/go/.codecrafters/run.sh b/compiled_starters/go/.codecrafters/run.sh new file mode 100755 index 0000000..9ccdd71 --- /dev/null +++ b/compiled_starters/go/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-build-grep-go "$@" diff --git a/compiled_starters/go/README.md b/compiled_starters/go/README.md index 94456de..ec01b60 100644 --- a/compiled_starters/go/README.md +++ b/compiled_starters/go/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `go (1.19)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `cmd/mygrep/main.go`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/go/cmd/mygrep/main.go b/compiled_starters/go/cmd/mygrep/main.go index 982c43d..9ead653 100644 --- a/compiled_starters/go/cmd/mygrep/main.go +++ b/compiled_starters/go/cmd/mygrep/main.go @@ -9,7 +9,7 @@ import ( "unicode/utf8" ) -// Usage: echo | your_grep.sh -E +// Usage: echo | your_program.sh -E func main() { if len(os.Args) < 3 || os.Args[1] != "-E" { fmt.Fprintf(os.Stderr, "usage: mygrep -E \n") diff --git a/compiled_starters/go/your_grep.sh b/compiled_starters/go/your_grep.sh deleted file mode 100755 index c6635d9..0000000 --- a/compiled_starters/go/your_grep.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -set -e - -tmpFile=$(mktemp) - -( cd $(dirname "$0") && - go build -o "$tmpFile" ./cmd/mygrep ) - -exec "$tmpFile" "$@" diff --git a/compiled_starters/go/your_program.sh b/compiled_starters/go/your_program.sh new file mode 100755 index 0000000..39364f8 --- /dev/null +++ b/compiled_starters/go/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec /tmp/codecrafters-build-grep-go "$@" diff --git a/compiled_starters/haskell/.codecrafters/compile.sh b/compiled_starters/haskell/.codecrafters/compile.sh new file mode 100755 index 0000000..06c8816 --- /dev/null +++ b/compiled_starters/haskell/.codecrafters/compile.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# This compiles the program into $(stack path --local-install-root)/bin/hs-grep-clone-exe. +stack build diff --git a/compiled_starters/haskell/.codecrafters/run.sh b/compiled_starters/haskell/.codecrafters/run.sh new file mode 100755 index 0000000..9481402 --- /dev/null +++ b/compiled_starters/haskell/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec $(stack path --local-install-root)/bin/hs-grep-clone-exe "$@" \ No newline at end of file diff --git a/compiled_starters/haskell/README.md b/compiled_starters/haskell/README.md index 1811226..2704e58 100644 --- a/compiled_starters/haskell/README.md +++ b/compiled_starters/haskell/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `stack` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/Main.hs`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/haskell/your_grep.sh b/compiled_starters/haskell/your_grep.sh deleted file mode 100755 index e436f07..0000000 --- a/compiled_starters/haskell/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec stack run --silent -- "$@" diff --git a/compiled_starters/haskell/your_program.sh b/compiled_starters/haskell/your_program.sh new file mode 100755 index 0000000..c1af605 --- /dev/null +++ b/compiled_starters/haskell/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + stack build +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec $(stack path --local-install-root)/bin/hs-grep-clone-exe "$@" diff --git a/compiled_starters/javascript/.codecrafters/compile.sh b/compiled_starters/javascript/.codecrafters/compile.sh new file mode 100755 index 0000000..e13a8a7 --- /dev/null +++ b/compiled_starters/javascript/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since JavaScript programs don't use a compile step) diff --git a/compiled_starters/javascript/.codecrafters/run.sh b/compiled_starters/javascript/.codecrafters/run.sh new file mode 100755 index 0000000..66bbd82 --- /dev/null +++ b/compiled_starters/javascript/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec node app/main.js "$@" diff --git a/compiled_starters/javascript/README.md b/compiled_starters/javascript/README.md index a19674d..90b80bc 100644 --- a/compiled_starters/javascript/README.md +++ b/compiled_starters/javascript/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `node (21)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/main.js`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/javascript/your_grep.sh b/compiled_starters/javascript/your_grep.sh deleted file mode 100755 index 388c8c2..0000000 --- a/compiled_starters/javascript/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec node app/main.js "$@" diff --git a/compiled_starters/javascript/your_program.sh b/compiled_starters/javascript/your_program.sh new file mode 100755 index 0000000..8b264da --- /dev/null +++ b/compiled_starters/javascript/your_program.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec node app/main.js "$@" diff --git a/compiled_starters/python/.codecrafters/compile.sh b/compiled_starters/python/.codecrafters/compile.sh new file mode 100755 index 0000000..c6e646f --- /dev/null +++ b/compiled_starters/python/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since Python programs don't use a compile step) diff --git a/compiled_starters/python/.codecrafters/run.sh b/compiled_starters/python/.codecrafters/run.sh new file mode 100755 index 0000000..4b29480 --- /dev/null +++ b/compiled_starters/python/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec pipenv run python3 -m app.main "$@" diff --git a/compiled_starters/python/README.md b/compiled_starters/python/README.md index 01c3393..2a0ce5f 100644 --- a/compiled_starters/python/README.md +++ b/compiled_starters/python/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `python (3.11)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/main.py`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/python/your_grep.sh b/compiled_starters/python/your_grep.sh deleted file mode 100755 index 7409ad8..0000000 --- a/compiled_starters/python/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec pipenv run python3 -m app.main "$@" diff --git a/compiled_starters/python/your_program.sh b/compiled_starters/python/your_program.sh new file mode 100755 index 0000000..0fa36a5 --- /dev/null +++ b/compiled_starters/python/your_program.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec pipenv run python3 -m app.main "$@" diff --git a/compiled_starters/ruby/.codecrafters/compile.sh b/compiled_starters/ruby/.codecrafters/compile.sh new file mode 100755 index 0000000..0cf2143 --- /dev/null +++ b/compiled_starters/ruby/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since Ruby programs don't use a compile step) diff --git a/compiled_starters/ruby/.codecrafters/run.sh b/compiled_starters/ruby/.codecrafters/run.sh new file mode 100755 index 0000000..619aa01 --- /dev/null +++ b/compiled_starters/ruby/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec bundle exec ruby app/main.rb "$@" diff --git a/compiled_starters/ruby/README.md b/compiled_starters/ruby/README.md index 93879a3..9fd62a9 100644 --- a/compiled_starters/ruby/README.md +++ b/compiled_starters/ruby/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `ruby (3.3)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/main.rb`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/ruby/your_grep.sh b/compiled_starters/ruby/your_grep.sh deleted file mode 100755 index 698b1d0..0000000 --- a/compiled_starters/ruby/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec ruby app/main.rb "$@" diff --git a/compiled_starters/ruby/your_program.sh b/compiled_starters/ruby/your_program.sh new file mode 100755 index 0000000..fcb2853 --- /dev/null +++ b/compiled_starters/ruby/your_program.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec bundle exec ruby app/main.rb "$@" diff --git a/compiled_starters/rust/.codecrafters/compile.sh b/compiled_starters/rust/.codecrafters/compile.sh new file mode 100755 index 0000000..2bac4e7 --- /dev/null +++ b/compiled_starters/rust/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +cargo build --release --target-dir=/tmp/codecrafters-grep-target --manifest-path Cargo.toml diff --git a/compiled_starters/rust/.codecrafters/run.sh b/compiled_starters/rust/.codecrafters/run.sh new file mode 100755 index 0000000..b56170f --- /dev/null +++ b/compiled_starters/rust/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-grep-target/release/grep-starter-rust "$@" \ No newline at end of file diff --git a/compiled_starters/rust/README.md b/compiled_starters/rust/README.md index 4809393..3646f69 100644 --- a/compiled_starters/rust/README.md +++ b/compiled_starters/rust/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `cargo (1.62)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `src/main.rs`. This command compiles your Rust project, so it might be slow the first time you run it. Subsequent runs will be fast. 1. Commit your changes and run `git push origin master` to submit your solution diff --git a/compiled_starters/rust/src/main.rs b/compiled_starters/rust/src/main.rs index 5127fab..44cd655 100644 --- a/compiled_starters/rust/src/main.rs +++ b/compiled_starters/rust/src/main.rs @@ -10,7 +10,7 @@ fn match_pattern(input_line: &str, pattern: &str) -> bool { } } -// Usage: echo | your_grep.sh -E +// Usage: echo | your_program.sh -E fn main() { // You can use print statements as follows for debugging, they'll be visible when running tests. println!("Logs from your program will appear here!"); diff --git a/compiled_starters/rust/your_grep.sh b/compiled_starters/rust/your_grep.sh deleted file mode 100755 index 73917eb..0000000 --- a/compiled_starters/rust/your_grep.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec cargo run \ - --quiet \ - --release \ - --target-dir=/tmp/codecrafters-grep-target \ - --manifest-path $(dirname $0)/Cargo.toml -- "$@" diff --git a/compiled_starters/rust/your_program.sh b/compiled_starters/rust/your_program.sh new file mode 100755 index 0000000..1c6d73e --- /dev/null +++ b/compiled_starters/rust/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + cargo build --release --target-dir=/tmp/codecrafters-grep-target --manifest-path Cargo.toml +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec /tmp/codecrafters-grep-target/release/grep-starter-rust "$@" diff --git a/compiled_starters/typescript/.codecrafters/compile.sh b/compiled_starters/typescript/.codecrafters/compile.sh new file mode 100755 index 0000000..d8b7a95 --- /dev/null +++ b/compiled_starters/typescript/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since TypeScript programs don't use a compile step) diff --git a/compiled_starters/typescript/.codecrafters/run.sh b/compiled_starters/typescript/.codecrafters/run.sh new file mode 100755 index 0000000..c3c6b1e --- /dev/null +++ b/compiled_starters/typescript/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec bun run app/main.ts "$@" diff --git a/compiled_starters/typescript/README.md b/compiled_starters/typescript/README.md index 1de7b6c..79a07e7 100644 --- a/compiled_starters/typescript/README.md +++ b/compiled_starters/typescript/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `bun (1.1)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/main.ts`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/typescript/your_grep.sh b/compiled_starters/typescript/your_grep.sh deleted file mode 100755 index ba9d177..0000000 --- a/compiled_starters/typescript/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec bun run app/main.ts "$@" diff --git a/compiled_starters/typescript/your_program.sh b/compiled_starters/typescript/your_program.sh new file mode 100755 index 0000000..45031bb --- /dev/null +++ b/compiled_starters/typescript/your_program.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec bun run app/main.ts "$@" diff --git a/course-definition.yml b/course-definition.yml index 8f5c0f3..88ead61 100644 --- a/course-definition.yml +++ b/course-definition.yml @@ -73,7 +73,7 @@ stages: Your program will be executed like this: ```bash - $ echo "apple" | ./your_grep.sh -E "a" + $ echo "apple" | ./your_program.sh -E "a" ``` The `-E` flag instructs `grep` to interprets patterns as extended regular expressions (with support @@ -105,7 +105,7 @@ stages: Your program will be executed like this: ```bash - $ echo "apple123" | ./your_grep.sh -E "\d" + $ echo "apple123" | ./your_program.sh -E "\d" ``` You program must exit with 0 if a digit is found in the string, and 1 if not. @@ -137,7 +137,7 @@ stages: Your program will be executed like this: ```bash - $ echo "alpha-num3ric" | ./your_grep.sh -E "\w" + $ echo "alpha-num3ric" | ./your_program.sh -E "\w" ``` You program must exit with 0 if an alphanumeric character is found in the string, and 1 if not. @@ -168,7 +168,7 @@ stages: Your program will be executed like this: ```bash - $ echo "apple" | ./your_grep.sh -E "[abc]" + $ echo "apple" | ./your_program.sh -E "[abc]" ``` You program must exit with 0 if an any of the characters are found in the string, and 1 if not. @@ -198,7 +198,7 @@ stages: Your program will be executed like this: ```bash - $ echo "apple" | ./your_grep.sh -E "[^abc]" + $ echo "apple" | ./your_program.sh -E "[^abc]" ``` You program must exit with 0 if the input contains characters that aren't part of the negative character group, and 1 if not. @@ -238,7 +238,7 @@ stages: Your program will be executed like this: ```bash - $ echo "1 apple" | ./your_grep.sh -E "\d apple" + $ echo "1 apple" | ./your_program.sh -E "\d apple" ``` You program must exit with 0 if the pattern matches the input, and 1 if not. @@ -271,7 +271,7 @@ stages: Your program will be executed like this: ```bash - $ echo "log" | ./your_grep.sh -E "^log" + $ echo "log" | ./your_program.sh -E "^log" ``` You program must exit with 0 if the input starts with the given pattern, and 1 if not. @@ -301,7 +301,7 @@ stages: Your program will be executed like this: ```bash - $ echo "dog" | ./your_grep.sh -E "dog$" + $ echo "dog" | ./your_program.sh -E "dog$" ``` You program must exit with 0 if the input matches the given pattern, and 1 if not. @@ -329,7 +329,7 @@ stages: Your program will be executed like this: ```bash - $ echo "caats" | ./your_grep.sh -E "ca+ts" + $ echo "caats" | ./your_program.sh -E "ca+ts" ``` You program must exit with 0 if the input matches the given pattern, and 1 if not. @@ -355,7 +355,7 @@ stages: Your program will be executed like this: ```bash - $ echo "dogs" | ./your_grep.sh -E "dogs?" + $ echo "dogs" | ./your_program.sh -E "dogs?" ``` You program must exit with 0 if the input matches the given pattern, and 1 if not. @@ -381,7 +381,7 @@ stages: Your program will be executed like this: ```bash - $ echo "dog" | ./your_grep.sh -E "d.g" + $ echo "dog" | ./your_program.sh -E "d.g" ``` You program must exit with 0 if the input matches the given pattern, and 1 if not. @@ -407,7 +407,7 @@ stages: Your program will be executed like this: ```bash - $ echo "cat" | ./your_grep.sh -E "(cat|dog)" + $ echo "cat" | ./your_program.sh -E "(cat|dog)" ``` You program must exit with 0 if the input matches the given pattern, and 1 if not. @@ -442,7 +442,7 @@ stages: Your program will be executed like this: ``` - $ echo "" | ./your_grep.sh -E "" + $ echo "" | ./your_program.sh -E "" ``` Your program must exit with 0 if the input matches the given pattern, and 1 if not. @@ -467,7 +467,7 @@ stages: Your program will be executed like this: ``` - $ echo "" | ./your_grep.sh -E "" + $ echo "" | ./your_program.sh -E "" ``` Your program must exit with 0 if the input matches the given pattern, and 1 if not. @@ -488,7 +488,7 @@ stages: Your program will be executed like this: ``` - $ echo "" | ./your_grep.sh -E "" + $ echo "" | ./your_program.sh -E "" ``` Your program must exit with 0 if the input matches the given pattern, and 1 if not. @@ -497,4 +497,3 @@ stages: **Example:** - `('(cat) and \2') is the same as \1` should match "'cat and cat' is the same as 'cat and cat'". - diff --git a/solutions/cpp/01-cq2/code/.codecrafters/compile.sh b/solutions/cpp/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..9da226b --- /dev/null +++ b/solutions/cpp/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake +cmake --build ./build diff --git a/solutions/cpp/01-cq2/code/.codecrafters/run.sh b/solutions/cpp/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..4059f64 --- /dev/null +++ b/solutions/cpp/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec ./build/exe "$@" diff --git a/solutions/cpp/01-cq2/code/CMakeLists.txt b/solutions/cpp/01-cq2/code/CMakeLists.txt index 190fc63..1ad76fb 100755 --- a/solutions/cpp/01-cq2/code/CMakeLists.txt +++ b/solutions/cpp/01-cq2/code/CMakeLists.txt @@ -6,4 +6,4 @@ set(CMAKE_CXX_STANDARD 23) # Enable the C++23 standard file(GLOB_RECURSE SOURCE_FILES src/*.cpp src/*.hpp) -add_executable(server ${SOURCE_FILES}) \ No newline at end of file +add_executable(exe ${SOURCE_FILES}) \ No newline at end of file diff --git a/solutions/cpp/01-cq2/code/README.md b/solutions/cpp/01-cq2/code/README.md index 6f92c86..b13e4bf 100644 --- a/solutions/cpp/01-cq2/code/README.md +++ b/solutions/cpp/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `cmake` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `src/Server.cpp`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/cpp/01-cq2/code/your_grep.sh b/solutions/cpp/01-cq2/code/your_grep.sh deleted file mode 100755 index 4b8635d..0000000 --- a/solutions/cpp/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -set -e -# vcpkg & cmake are required. -cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake -cmake --build ./build -exec ./build/server "$@" \ No newline at end of file diff --git a/solutions/cpp/01-cq2/code/your_program.sh b/solutions/cpp/01-cq2/code/your_program.sh new file mode 100755 index 0000000..844a7e8 --- /dev/null +++ b/solutions/cpp/01-cq2/code/your_program.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake + cmake --build ./build +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec ./build/exe "$@" diff --git a/solutions/csharp/01-cq2/code/.codecrafters/compile.sh b/solutions/csharp/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..4a2e031 --- /dev/null +++ b/solutions/csharp/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +dotnet build --configuration Release --output /tmp/codecrafters-build-grep-csharp codecrafters-grep.csproj diff --git a/solutions/csharp/01-cq2/code/.codecrafters/run.sh b/solutions/csharp/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..bf34673 --- /dev/null +++ b/solutions/csharp/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-build-grep-csharp/codecrafters-grep "$@" \ No newline at end of file diff --git a/solutions/csharp/01-cq2/code/README.md b/solutions/csharp/01-cq2/code/README.md index adcb3ac..b4ea28f 100644 --- a/solutions/csharp/01-cq2/code/README.md +++ b/solutions/csharp/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `dotnet (8.0)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `src/Program.cs`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/csharp/01-cq2/code/your_grep.sh b/solutions/csharp/01-cq2/code/your_grep.sh deleted file mode 100755 index cd2efe5..0000000 --- a/solutions/csharp/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec dotnet run --project . --configuration Release -- "$@" diff --git a/solutions/csharp/01-cq2/code/your_program.sh b/solutions/csharp/01-cq2/code/your_program.sh new file mode 100755 index 0000000..44ae083 --- /dev/null +++ b/solutions/csharp/01-cq2/code/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + dotnet build --configuration Release --output /tmp/codecrafters-build-grep-csharp codecrafters-grep.csproj +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec /tmp/codecrafters-build-grep-csharp/codecrafters-grep "$@" diff --git a/solutions/gleam/01-cq2/code/.codecrafters/compile.sh b/solutions/gleam/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..0f4122e --- /dev/null +++ b/solutions/gleam/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +gleam build diff --git a/solutions/gleam/01-cq2/code/.codecrafters/run.sh b/solutions/gleam/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..5f0daba --- /dev/null +++ b/solutions/gleam/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec gleam run -- "$@" diff --git a/solutions/gleam/01-cq2/code/README.md b/solutions/gleam/01-cq2/code/README.md index 33ba3ae..63f34a0 100644 --- a/solutions/gleam/01-cq2/code/README.md +++ b/solutions/gleam/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `gleam (1.0)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `src/grep.gleam`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/gleam/01-cq2/code/your_grep.sh b/solutions/gleam/01-cq2/code/your_grep.sh deleted file mode 100755 index 9fd98a5..0000000 --- a/solutions/gleam/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec gleam run -- "$@" \ No newline at end of file diff --git a/solutions/gleam/01-cq2/code/your_program.sh b/solutions/gleam/01-cq2/code/your_program.sh new file mode 100755 index 0000000..0eeb6fc --- /dev/null +++ b/solutions/gleam/01-cq2/code/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + gleam build +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec gleam run -- "$@" diff --git a/solutions/go/01-cq2/code/.codecrafters/compile.sh b/solutions/go/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..3b3e7d6 --- /dev/null +++ b/solutions/go/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go diff --git a/solutions/go/01-cq2/code/.codecrafters/run.sh b/solutions/go/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..9ccdd71 --- /dev/null +++ b/solutions/go/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-build-grep-go "$@" diff --git a/solutions/go/01-cq2/code/README.md b/solutions/go/01-cq2/code/README.md index 94456de..ec01b60 100644 --- a/solutions/go/01-cq2/code/README.md +++ b/solutions/go/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `go (1.19)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `cmd/mygrep/main.go`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/go/01-cq2/code/cmd/mygrep/main.go b/solutions/go/01-cq2/code/cmd/mygrep/main.go index 0724a6e..a7662ed 100644 --- a/solutions/go/01-cq2/code/cmd/mygrep/main.go +++ b/solutions/go/01-cq2/code/cmd/mygrep/main.go @@ -8,7 +8,7 @@ import ( "unicode/utf8" ) -// Usage: echo | your_grep.sh -E +// Usage: echo | your_program.sh -E func main() { if len(os.Args) < 3 || os.Args[1] != "-E" { fmt.Fprintf(os.Stderr, "usage: mygrep -E \n") diff --git a/solutions/go/01-cq2/code/your_grep.sh b/solutions/go/01-cq2/code/your_grep.sh deleted file mode 100755 index c6635d9..0000000 --- a/solutions/go/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -set -e - -tmpFile=$(mktemp) - -( cd $(dirname "$0") && - go build -o "$tmpFile" ./cmd/mygrep ) - -exec "$tmpFile" "$@" diff --git a/solutions/go/01-cq2/code/your_program.sh b/solutions/go/01-cq2/code/your_program.sh new file mode 100755 index 0000000..39364f8 --- /dev/null +++ b/solutions/go/01-cq2/code/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec /tmp/codecrafters-build-grep-go "$@" diff --git a/solutions/go/01-cq2/diff/cmd/mygrep/main.go.diff b/solutions/go/01-cq2/diff/cmd/mygrep/main.go.diff index e03f6cd..bfbef04 100644 --- a/solutions/go/01-cq2/diff/cmd/mygrep/main.go.diff +++ b/solutions/go/01-cq2/diff/cmd/mygrep/main.go.diff @@ -11,7 +11,7 @@ "unicode/utf8" ) - // Usage: echo | your_grep.sh -E + // Usage: echo | your_program.sh -E func main() { if len(os.Args) < 3 || os.Args[1] != "-E" { fmt.Fprintf(os.Stderr, "usage: mygrep -E \n") diff --git a/solutions/haskell/01-cq2/code/.codecrafters/compile.sh b/solutions/haskell/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..06c8816 --- /dev/null +++ b/solutions/haskell/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# This compiles the program into $(stack path --local-install-root)/bin/hs-grep-clone-exe. +stack build diff --git a/solutions/haskell/01-cq2/code/.codecrafters/run.sh b/solutions/haskell/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..9481402 --- /dev/null +++ b/solutions/haskell/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec $(stack path --local-install-root)/bin/hs-grep-clone-exe "$@" \ No newline at end of file diff --git a/solutions/haskell/01-cq2/code/README.md b/solutions/haskell/01-cq2/code/README.md index 1811226..2704e58 100644 --- a/solutions/haskell/01-cq2/code/README.md +++ b/solutions/haskell/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `stack` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/Main.hs`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/haskell/01-cq2/code/your_grep.sh b/solutions/haskell/01-cq2/code/your_grep.sh deleted file mode 100755 index e436f07..0000000 --- a/solutions/haskell/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec stack run --silent -- "$@" diff --git a/solutions/haskell/01-cq2/code/your_program.sh b/solutions/haskell/01-cq2/code/your_program.sh new file mode 100755 index 0000000..c1af605 --- /dev/null +++ b/solutions/haskell/01-cq2/code/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + stack build +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec $(stack path --local-install-root)/bin/hs-grep-clone-exe "$@" diff --git a/solutions/javascript/01-cq2/code/.codecrafters/compile.sh b/solutions/javascript/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..e13a8a7 --- /dev/null +++ b/solutions/javascript/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since JavaScript programs don't use a compile step) diff --git a/solutions/javascript/01-cq2/code/.codecrafters/run.sh b/solutions/javascript/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..66bbd82 --- /dev/null +++ b/solutions/javascript/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec node app/main.js "$@" diff --git a/solutions/javascript/01-cq2/code/README.md b/solutions/javascript/01-cq2/code/README.md index a19674d..90b80bc 100644 --- a/solutions/javascript/01-cq2/code/README.md +++ b/solutions/javascript/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `node (21)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/main.js`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/javascript/01-cq2/code/your_grep.sh b/solutions/javascript/01-cq2/code/your_grep.sh deleted file mode 100755 index 388c8c2..0000000 --- a/solutions/javascript/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec node app/main.js "$@" diff --git a/solutions/javascript/01-cq2/code/your_program.sh b/solutions/javascript/01-cq2/code/your_program.sh new file mode 100755 index 0000000..8b264da --- /dev/null +++ b/solutions/javascript/01-cq2/code/your_program.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec node app/main.js "$@" diff --git a/solutions/python/01-cq2/code/.codecrafters/compile.sh b/solutions/python/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..c6e646f --- /dev/null +++ b/solutions/python/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since Python programs don't use a compile step) diff --git a/solutions/python/01-cq2/code/.codecrafters/run.sh b/solutions/python/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..4b29480 --- /dev/null +++ b/solutions/python/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec pipenv run python3 -m app.main "$@" diff --git a/solutions/python/01-cq2/code/README.md b/solutions/python/01-cq2/code/README.md index 01c3393..2a0ce5f 100644 --- a/solutions/python/01-cq2/code/README.md +++ b/solutions/python/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `python (3.11)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/main.py`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/python/01-cq2/code/your_grep.sh b/solutions/python/01-cq2/code/your_grep.sh deleted file mode 100755 index 7409ad8..0000000 --- a/solutions/python/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec pipenv run python3 -m app.main "$@" diff --git a/solutions/python/01-cq2/code/your_program.sh b/solutions/python/01-cq2/code/your_program.sh new file mode 100755 index 0000000..0fa36a5 --- /dev/null +++ b/solutions/python/01-cq2/code/your_program.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec pipenv run python3 -m app.main "$@" diff --git a/solutions/ruby/01-cq2/code/.codecrafters/compile.sh b/solutions/ruby/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..0cf2143 --- /dev/null +++ b/solutions/ruby/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since Ruby programs don't use a compile step) diff --git a/solutions/ruby/01-cq2/code/.codecrafters/run.sh b/solutions/ruby/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..619aa01 --- /dev/null +++ b/solutions/ruby/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec bundle exec ruby app/main.rb "$@" diff --git a/solutions/ruby/01-cq2/code/README.md b/solutions/ruby/01-cq2/code/README.md index 93879a3..9fd62a9 100644 --- a/solutions/ruby/01-cq2/code/README.md +++ b/solutions/ruby/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `ruby (3.3)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/main.rb`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/ruby/01-cq2/code/your_grep.sh b/solutions/ruby/01-cq2/code/your_grep.sh deleted file mode 100755 index 698b1d0..0000000 --- a/solutions/ruby/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec ruby app/main.rb "$@" diff --git a/solutions/ruby/01-cq2/code/your_program.sh b/solutions/ruby/01-cq2/code/your_program.sh new file mode 100755 index 0000000..fcb2853 --- /dev/null +++ b/solutions/ruby/01-cq2/code/your_program.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec bundle exec ruby app/main.rb "$@" diff --git a/solutions/rust/01-cq2/code/.codecrafters/compile.sh b/solutions/rust/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..2bac4e7 --- /dev/null +++ b/solutions/rust/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +cargo build --release --target-dir=/tmp/codecrafters-grep-target --manifest-path Cargo.toml diff --git a/solutions/rust/01-cq2/code/.codecrafters/run.sh b/solutions/rust/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..b56170f --- /dev/null +++ b/solutions/rust/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-grep-target/release/grep-starter-rust "$@" \ No newline at end of file diff --git a/solutions/rust/01-cq2/code/README.md b/solutions/rust/01-cq2/code/README.md index 4809393..3646f69 100644 --- a/solutions/rust/01-cq2/code/README.md +++ b/solutions/rust/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `cargo (1.62)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `src/main.rs`. This command compiles your Rust project, so it might be slow the first time you run it. Subsequent runs will be fast. 1. Commit your changes and run `git push origin master` to submit your solution diff --git a/solutions/rust/01-cq2/code/src/main.rs b/solutions/rust/01-cq2/code/src/main.rs index 1507b50..11e20c2 100644 --- a/solutions/rust/01-cq2/code/src/main.rs +++ b/solutions/rust/01-cq2/code/src/main.rs @@ -10,7 +10,7 @@ fn match_pattern(input_line: &str, pattern: &str) -> bool { } } -// Usage: echo | your_grep.sh -E +// Usage: echo | your_program.sh -E fn main() { if env::args().nth(1).unwrap() != "-E" { println!("Expected first argument to be '-E'"); diff --git a/solutions/rust/01-cq2/code/your_grep.sh b/solutions/rust/01-cq2/code/your_grep.sh deleted file mode 100755 index 73917eb..0000000 --- a/solutions/rust/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec cargo run \ - --quiet \ - --release \ - --target-dir=/tmp/codecrafters-grep-target \ - --manifest-path $(dirname $0)/Cargo.toml -- "$@" diff --git a/solutions/rust/01-cq2/code/your_program.sh b/solutions/rust/01-cq2/code/your_program.sh new file mode 100755 index 0000000..1c6d73e --- /dev/null +++ b/solutions/rust/01-cq2/code/your_program.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/compile.sh +# +# - Edit this to change how your program compiles locally +# - Edit .codecrafters/compile.sh to change how your program compiles remotely +( + cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory + cargo build --release --target-dir=/tmp/codecrafters-grep-target --manifest-path Cargo.toml +) + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec /tmp/codecrafters-grep-target/release/grep-starter-rust "$@" diff --git a/solutions/rust/01-cq2/diff/src/main.rs.diff b/solutions/rust/01-cq2/diff/src/main.rs.diff index 3428062..fa01b7a 100644 --- a/solutions/rust/01-cq2/diff/src/main.rs.diff +++ b/solutions/rust/01-cq2/diff/src/main.rs.diff @@ -11,7 +11,7 @@ } } - // Usage: echo | your_grep.sh -E + // Usage: echo | your_program.sh -E fn main() { - // You can use print statements as follows for debugging, they'll be visible when running tests. - println!("Logs from your program will appear here!"); diff --git a/solutions/typescript/01-cq2/code/.codecrafters/compile.sh b/solutions/typescript/01-cq2/code/.codecrafters/compile.sh new file mode 100755 index 0000000..d8b7a95 --- /dev/null +++ b/solutions/typescript/01-cq2/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since TypeScript programs don't use a compile step) diff --git a/solutions/typescript/01-cq2/code/.codecrafters/run.sh b/solutions/typescript/01-cq2/code/.codecrafters/run.sh new file mode 100755 index 0000000..c3c6b1e --- /dev/null +++ b/solutions/typescript/01-cq2/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec bun run app/main.ts "$@" diff --git a/solutions/typescript/01-cq2/code/README.md b/solutions/typescript/01-cq2/code/README.md index 1de7b6c..79a07e7 100644 --- a/solutions/typescript/01-cq2/code/README.md +++ b/solutions/typescript/01-cq2/code/README.md @@ -33,7 +33,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `bun (1.1)` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `app/main.ts`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/typescript/01-cq2/code/your_grep.sh b/solutions/typescript/01-cq2/code/your_grep.sh deleted file mode 100755 index ba9d177..0000000 --- a/solutions/typescript/01-cq2/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec bun run app/main.ts "$@" diff --git a/solutions/typescript/01-cq2/code/your_program.sh b/solutions/typescript/01-cq2/code/your_program.sh new file mode 100755 index 0000000..45031bb --- /dev/null +++ b/solutions/typescript/01-cq2/code/your_program.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Use this script to run your program LOCALLY. +# +# Note: Changing this script WILL NOT affect how CodeCrafters runs your program. +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit early if any commands fail + +# Copied from .codecrafters/run.sh +# +# - Edit this to change how your program runs locally +# - Edit .codecrafters/run.sh to change how your program runs remotely +exec bun run app/main.ts "$@" diff --git a/starter_templates/all/code/README.md b/starter_templates/all/code/README.md index fe46176..66395cc 100644 --- a/starter_templates/all/code/README.md +++ b/starter_templates/all/code/README.md @@ -17,7 +17,7 @@ parsers/lexers work, and how regular expressions are evaluated. The entry point for your `grep` implementation is in `{{ user_editable_file }}`. Study and uncomment the relevant code, and push your changes to pass the first stage: -``` sh +```sh git add . git commit -m "pass 1st stage" # any msg git push origin master @@ -30,7 +30,7 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. 1. Ensure you have `{{ required_executable }}` installed locally -1. Run `./your_grep.sh` to run your program, which is implemented in +1. Run `./your_program.sh` to run your program, which is implemented in `{{ user_editable_file }}`.{{# language_is_rust }} This command compiles your Rust project, so it might be slow the first time you run it. Subsequent runs will be fast.{{/ language_is_rust}} diff --git a/starter_templates/cpp/code/.codecrafters/compile.sh b/starter_templates/cpp/code/.codecrafters/compile.sh new file mode 100755 index 0000000..9da226b --- /dev/null +++ b/starter_templates/cpp/code/.codecrafters/compile.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake +cmake --build ./build diff --git a/starter_templates/cpp/code/.codecrafters/run.sh b/starter_templates/cpp/code/.codecrafters/run.sh new file mode 100755 index 0000000..4059f64 --- /dev/null +++ b/starter_templates/cpp/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec ./build/exe "$@" diff --git a/starter_templates/cpp/code/CMakeLists.txt b/starter_templates/cpp/code/CMakeLists.txt index 190fc63..1ad76fb 100755 --- a/starter_templates/cpp/code/CMakeLists.txt +++ b/starter_templates/cpp/code/CMakeLists.txt @@ -6,4 +6,4 @@ set(CMAKE_CXX_STANDARD 23) # Enable the C++23 standard file(GLOB_RECURSE SOURCE_FILES src/*.cpp src/*.hpp) -add_executable(server ${SOURCE_FILES}) \ No newline at end of file +add_executable(exe ${SOURCE_FILES}) \ No newline at end of file diff --git a/starter_templates/cpp/code/your_grep.sh b/starter_templates/cpp/code/your_grep.sh deleted file mode 100755 index 4b8635d..0000000 --- a/starter_templates/cpp/code/your_grep.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -set -e -# vcpkg & cmake are required. -cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake -cmake --build ./build -exec ./build/server "$@" \ No newline at end of file diff --git a/starter_templates/csharp/code/.codecrafters/compile.sh b/starter_templates/csharp/code/.codecrafters/compile.sh new file mode 100755 index 0000000..4a2e031 --- /dev/null +++ b/starter_templates/csharp/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +dotnet build --configuration Release --output /tmp/codecrafters-build-grep-csharp codecrafters-grep.csproj diff --git a/starter_templates/csharp/code/.codecrafters/run.sh b/starter_templates/csharp/code/.codecrafters/run.sh new file mode 100755 index 0000000..bf34673 --- /dev/null +++ b/starter_templates/csharp/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-build-grep-csharp/codecrafters-grep "$@" \ No newline at end of file diff --git a/starter_templates/csharp/code/your_grep.sh b/starter_templates/csharp/code/your_grep.sh deleted file mode 100755 index cd2efe5..0000000 --- a/starter_templates/csharp/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec dotnet run --project . --configuration Release -- "$@" diff --git a/starter_templates/gleam/code/.codecrafters/compile.sh b/starter_templates/gleam/code/.codecrafters/compile.sh new file mode 100755 index 0000000..0f4122e --- /dev/null +++ b/starter_templates/gleam/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +gleam build diff --git a/starter_templates/gleam/code/.codecrafters/run.sh b/starter_templates/gleam/code/.codecrafters/run.sh new file mode 100755 index 0000000..5f0daba --- /dev/null +++ b/starter_templates/gleam/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec gleam run -- "$@" diff --git a/starter_templates/gleam/code/your_grep.sh b/starter_templates/gleam/code/your_grep.sh deleted file mode 100755 index 9fd98a5..0000000 --- a/starter_templates/gleam/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec gleam run -- "$@" \ No newline at end of file diff --git a/starter_templates/go/code/.codecrafters/compile.sh b/starter_templates/go/code/.codecrafters/compile.sh new file mode 100755 index 0000000..3b3e7d6 --- /dev/null +++ b/starter_templates/go/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go diff --git a/starter_templates/go/code/.codecrafters/run.sh b/starter_templates/go/code/.codecrafters/run.sh new file mode 100755 index 0000000..9ccdd71 --- /dev/null +++ b/starter_templates/go/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-build-grep-go "$@" diff --git a/starter_templates/go/code/cmd/mygrep/main.go b/starter_templates/go/code/cmd/mygrep/main.go index 982c43d..9ead653 100644 --- a/starter_templates/go/code/cmd/mygrep/main.go +++ b/starter_templates/go/code/cmd/mygrep/main.go @@ -9,7 +9,7 @@ import ( "unicode/utf8" ) -// Usage: echo | your_grep.sh -E +// Usage: echo | your_program.sh -E func main() { if len(os.Args) < 3 || os.Args[1] != "-E" { fmt.Fprintf(os.Stderr, "usage: mygrep -E \n") diff --git a/starter_templates/go/code/your_grep.sh b/starter_templates/go/code/your_grep.sh deleted file mode 100755 index c6635d9..0000000 --- a/starter_templates/go/code/your_grep.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -set -e - -tmpFile=$(mktemp) - -( cd $(dirname "$0") && - go build -o "$tmpFile" ./cmd/mygrep ) - -exec "$tmpFile" "$@" diff --git a/starter_templates/haskell/code/.codecrafters/compile.sh b/starter_templates/haskell/code/.codecrafters/compile.sh new file mode 100755 index 0000000..06c8816 --- /dev/null +++ b/starter_templates/haskell/code/.codecrafters/compile.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# This compiles the program into $(stack path --local-install-root)/bin/hs-grep-clone-exe. +stack build diff --git a/starter_templates/haskell/code/.codecrafters/run.sh b/starter_templates/haskell/code/.codecrafters/run.sh new file mode 100755 index 0000000..9481402 --- /dev/null +++ b/starter_templates/haskell/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec $(stack path --local-install-root)/bin/hs-grep-clone-exe "$@" \ No newline at end of file diff --git a/starter_templates/haskell/code/your_grep.sh b/starter_templates/haskell/code/your_grep.sh deleted file mode 100755 index e436f07..0000000 --- a/starter_templates/haskell/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec stack run --silent -- "$@" diff --git a/starter_templates/javascript/code/.codecrafters/compile.sh b/starter_templates/javascript/code/.codecrafters/compile.sh new file mode 100755 index 0000000..e13a8a7 --- /dev/null +++ b/starter_templates/javascript/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since JavaScript programs don't use a compile step) diff --git a/starter_templates/javascript/code/.codecrafters/run.sh b/starter_templates/javascript/code/.codecrafters/run.sh new file mode 100755 index 0000000..66bbd82 --- /dev/null +++ b/starter_templates/javascript/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec node app/main.js "$@" diff --git a/starter_templates/javascript/code/your_grep.sh b/starter_templates/javascript/code/your_grep.sh deleted file mode 100755 index 388c8c2..0000000 --- a/starter_templates/javascript/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec node app/main.js "$@" diff --git a/starter_templates/python/code/.codecrafters/compile.sh b/starter_templates/python/code/.codecrafters/compile.sh new file mode 100755 index 0000000..c6e646f --- /dev/null +++ b/starter_templates/python/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since Python programs don't use a compile step) diff --git a/starter_templates/python/code/.codecrafters/run.sh b/starter_templates/python/code/.codecrafters/run.sh new file mode 100755 index 0000000..4b29480 --- /dev/null +++ b/starter_templates/python/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec pipenv run python3 -m app.main "$@" diff --git a/starter_templates/python/code/your_grep.sh b/starter_templates/python/code/your_grep.sh deleted file mode 100755 index 7409ad8..0000000 --- a/starter_templates/python/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec pipenv run python3 -m app.main "$@" diff --git a/starter_templates/ruby/code/.codecrafters/compile.sh b/starter_templates/ruby/code/.codecrafters/compile.sh new file mode 100755 index 0000000..0cf2143 --- /dev/null +++ b/starter_templates/ruby/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since Ruby programs don't use a compile step) diff --git a/starter_templates/ruby/code/.codecrafters/run.sh b/starter_templates/ruby/code/.codecrafters/run.sh new file mode 100755 index 0000000..619aa01 --- /dev/null +++ b/starter_templates/ruby/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec bundle exec ruby app/main.rb "$@" diff --git a/starter_templates/ruby/code/your_grep.sh b/starter_templates/ruby/code/your_grep.sh deleted file mode 100755 index 698b1d0..0000000 --- a/starter_templates/ruby/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec ruby app/main.rb "$@" diff --git a/starter_templates/rust/code/.codecrafters/compile.sh b/starter_templates/rust/code/.codecrafters/compile.sh new file mode 100755 index 0000000..2bac4e7 --- /dev/null +++ b/starter_templates/rust/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +cargo build --release --target-dir=/tmp/codecrafters-grep-target --manifest-path Cargo.toml diff --git a/starter_templates/rust/code/.codecrafters/run.sh b/starter_templates/rust/code/.codecrafters/run.sh new file mode 100755 index 0000000..b56170f --- /dev/null +++ b/starter_templates/rust/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec /tmp/codecrafters-grep-target/release/grep-starter-rust "$@" \ No newline at end of file diff --git a/starter_templates/rust/code/src/main.rs b/starter_templates/rust/code/src/main.rs index 5127fab..44cd655 100644 --- a/starter_templates/rust/code/src/main.rs +++ b/starter_templates/rust/code/src/main.rs @@ -10,7 +10,7 @@ fn match_pattern(input_line: &str, pattern: &str) -> bool { } } -// Usage: echo | your_grep.sh -E +// Usage: echo | your_program.sh -E fn main() { // You can use print statements as follows for debugging, they'll be visible when running tests. println!("Logs from your program will appear here!"); diff --git a/starter_templates/rust/code/your_grep.sh b/starter_templates/rust/code/your_grep.sh deleted file mode 100755 index 73917eb..0000000 --- a/starter_templates/rust/code/your_grep.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec cargo run \ - --quiet \ - --release \ - --target-dir=/tmp/codecrafters-grep-target \ - --manifest-path $(dirname $0)/Cargo.toml -- "$@" diff --git a/starter_templates/typescript/code/.codecrafters/compile.sh b/starter_templates/typescript/code/.codecrafters/compile.sh new file mode 100755 index 0000000..d8b7a95 --- /dev/null +++ b/starter_templates/typescript/code/.codecrafters/compile.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to compile your program on CodeCrafters +# +# This runs before .codecrafters/run.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +# (This file is empty since TypeScript programs don't use a compile step) diff --git a/starter_templates/typescript/code/.codecrafters/run.sh b/starter_templates/typescript/code/.codecrafters/run.sh new file mode 100755 index 0000000..c3c6b1e --- /dev/null +++ b/starter_templates/typescript/code/.codecrafters/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script is used to run your program on CodeCrafters +# +# This runs after .codecrafters/compile.sh +# +# Learn more: https://codecrafters.io/program-interface + +set -e # Exit on failure + +exec bun run app/main.ts "$@" diff --git a/starter_templates/typescript/code/your_grep.sh b/starter_templates/typescript/code/your_grep.sh deleted file mode 100755 index ba9d177..0000000 --- a/starter_templates/typescript/code/your_grep.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# DON'T EDIT THIS! -# -# CodeCrafters uses this file to test your code. Don't make any changes here! -# -# DON'T EDIT THIS! -exec bun run app/main.ts "$@"