Skip to content

Commit

Permalink
Merge pull request #88 from codecrafters-io/your-program
Browse files Browse the repository at this point in the history
Use your_program.sh
  • Loading branch information
rohitpaulk authored Jul 19, 2024
2 parents c6f6e5a + 55ddcbf commit 2f92264
Show file tree
Hide file tree
Showing 143 changed files with 1,124 additions and 334 deletions.
12 changes: 12 additions & 0 deletions compiled_starters/cpp/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions compiled_starters/cpp/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion compiled_starters/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
add_executable(exe ${SOURCE_FILES})
2 changes: 1 addition & 1 deletion compiled_starters/cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 0 additions & 12 deletions compiled_starters/cpp/your_grep.sh

This file was deleted.

25 changes: 25 additions & 0 deletions compiled_starters/cpp/your_program.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
11 changes: 11 additions & 0 deletions compiled_starters/csharp/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions compiled_starters/csharp/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion compiled_starters/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 0 additions & 8 deletions compiled_starters/csharp/your_grep.sh

This file was deleted.

24 changes: 24 additions & 0 deletions compiled_starters/csharp/your_program.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
11 changes: 11 additions & 0 deletions compiled_starters/gleam/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions compiled_starters/gleam/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -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 -- "$@"
2 changes: 1 addition & 1 deletion compiled_starters/gleam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 0 additions & 8 deletions compiled_starters/gleam/your_grep.sh

This file was deleted.

24 changes: 24 additions & 0 deletions compiled_starters/gleam/your_program.sh
Original file line number Diff line number Diff line change
@@ -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 -- "$@"
11 changes: 11 additions & 0 deletions compiled_starters/go/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions compiled_starters/go/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion compiled_starters/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion compiled_starters/go/cmd/mygrep/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"unicode/utf8"
)

// Usage: echo <input_text> | your_grep.sh -E <pattern>
// Usage: echo <input_text> | your_program.sh -E <pattern>
func main() {
if len(os.Args) < 3 || os.Args[1] != "-E" {
fmt.Fprintf(os.Stderr, "usage: mygrep -E <pattern>\n")
Expand Down
15 changes: 0 additions & 15 deletions compiled_starters/go/your_grep.sh

This file was deleted.

24 changes: 24 additions & 0 deletions compiled_starters/go/your_program.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
12 changes: 12 additions & 0 deletions compiled_starters/haskell/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions compiled_starters/haskell/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion compiled_starters/haskell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 0 additions & 8 deletions compiled_starters/haskell/your_grep.sh

This file was deleted.

24 changes: 24 additions & 0 deletions compiled_starters/haskell/your_program.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
11 changes: 11 additions & 0 deletions compiled_starters/javascript/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 11 additions & 0 deletions compiled_starters/javascript/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
Loading

0 comments on commit 2f92264

Please sign in to comment.