From 1bb22e03694c15d57d2bfa0b8f9a9a8abb672315 Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Thu, 1 Feb 2024 12:48:10 +0000 Subject: [PATCH 1/3] Add Ruby Gemfile and Gemfile.lock for version 3.3 --- compiled_starters/ruby/Gemfile | 9 +++++++++ compiled_starters/ruby/Gemfile.lock | 15 +++++++++++++++ compiled_starters/ruby/codecrafters.yml | 4 ++-- compiled_starters/ruby/spawn_redis_server.sh | 2 +- dockerfiles/ruby-3.3.Dockerfile | 7 +++++++ solutions/ruby/01-init/code/Gemfile | 9 +++++++++ solutions/ruby/01-init/code/Gemfile.lock | 15 +++++++++++++++ solutions/ruby/01-init/code/codecrafters.yml | 4 ++-- solutions/ruby/01-init/code/spawn_redis_server.sh | 2 +- starter-repository-definitions.yml | 4 ++++ starter_templates/codecrafters.yml | 4 ++-- starter_templates/ruby/Gemfile | 9 +++++++++ starter_templates/ruby/Gemfile.lock | 15 +++++++++++++++ starter_templates/ruby/spawn_redis_server.sh | 2 +- 14 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 compiled_starters/ruby/Gemfile create mode 100644 compiled_starters/ruby/Gemfile.lock create mode 100644 dockerfiles/ruby-3.3.Dockerfile create mode 100644 solutions/ruby/01-init/code/Gemfile create mode 100644 solutions/ruby/01-init/code/Gemfile.lock create mode 100644 starter_templates/ruby/Gemfile create mode 100644 starter_templates/ruby/Gemfile.lock diff --git a/compiled_starters/ruby/Gemfile b/compiled_starters/ruby/Gemfile new file mode 100644 index 00000000..74705b57 --- /dev/null +++ b/compiled_starters/ruby/Gemfile @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Add gems here if you need to use them. +# Make sure to run `bundle install` before running tests / pushing to GitHub. + +# Helps with declaratively parsing binary data. +gem "bindata", "~> 2.4" diff --git a/compiled_starters/ruby/Gemfile.lock b/compiled_starters/ruby/Gemfile.lock new file mode 100644 index 00000000..2c8c7286 --- /dev/null +++ b/compiled_starters/ruby/Gemfile.lock @@ -0,0 +1,15 @@ +GEM + remote: https://rubygems.org/ + specs: + bindata (2.4.15) + +PLATFORMS + aarch64-linux-musl + arm64-darwin-21 + x86_64-linux + +DEPENDENCIES + bindata (~> 2.4) + +BUNDLED WITH + 2.4.18 diff --git a/compiled_starters/ruby/codecrafters.yml b/compiled_starters/ruby/codecrafters.yml index 3cee60de..b3ef8176 100644 --- a/compiled_starters/ruby/codecrafters.yml +++ b/compiled_starters/ruby/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Ruby version used to run your code # on Codecrafters. # -# Available versions: ruby-3.2 -language_pack: ruby-3.2 +# Available versions: ruby-3.3 +language_pack: ruby-3.3 diff --git a/compiled_starters/ruby/spawn_redis_server.sh b/compiled_starters/ruby/spawn_redis_server.sh index 50c6b799..70a9e42c 100755 --- a/compiled_starters/ruby/spawn_redis_server.sh +++ b/compiled_starters/ruby/spawn_redis_server.sh @@ -5,4 +5,4 @@ # CodeCrafters uses this file to test your code. Don't make any changes here! # # DON'T EDIT THIS! -exec ruby app/server.rb "$@" +exec bundle exec ruby app/server.rb "$@" diff --git a/dockerfiles/ruby-3.3.Dockerfile b/dockerfiles/ruby-3.3.Dockerfile new file mode 100644 index 00000000..cf87fb63 --- /dev/null +++ b/dockerfiles/ruby-3.3.Dockerfile @@ -0,0 +1,7 @@ +FROM ruby:3.3-alpine + +ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Gemfile,Gemfile.lock" +WORKDIR /app + +COPY Gemfile Gemfile.lock ./ +RUN bundle install \ No newline at end of file diff --git a/solutions/ruby/01-init/code/Gemfile b/solutions/ruby/01-init/code/Gemfile new file mode 100644 index 00000000..74705b57 --- /dev/null +++ b/solutions/ruby/01-init/code/Gemfile @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Add gems here if you need to use them. +# Make sure to run `bundle install` before running tests / pushing to GitHub. + +# Helps with declaratively parsing binary data. +gem "bindata", "~> 2.4" diff --git a/solutions/ruby/01-init/code/Gemfile.lock b/solutions/ruby/01-init/code/Gemfile.lock new file mode 100644 index 00000000..2c8c7286 --- /dev/null +++ b/solutions/ruby/01-init/code/Gemfile.lock @@ -0,0 +1,15 @@ +GEM + remote: https://rubygems.org/ + specs: + bindata (2.4.15) + +PLATFORMS + aarch64-linux-musl + arm64-darwin-21 + x86_64-linux + +DEPENDENCIES + bindata (~> 2.4) + +BUNDLED WITH + 2.4.18 diff --git a/solutions/ruby/01-init/code/codecrafters.yml b/solutions/ruby/01-init/code/codecrafters.yml index 3cee60de..b3ef8176 100644 --- a/solutions/ruby/01-init/code/codecrafters.yml +++ b/solutions/ruby/01-init/code/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Ruby version used to run your code # on Codecrafters. # -# Available versions: ruby-3.2 -language_pack: ruby-3.2 +# Available versions: ruby-3.3 +language_pack: ruby-3.3 diff --git a/solutions/ruby/01-init/code/spawn_redis_server.sh b/solutions/ruby/01-init/code/spawn_redis_server.sh index 50c6b799..70a9e42c 100755 --- a/solutions/ruby/01-init/code/spawn_redis_server.sh +++ b/solutions/ruby/01-init/code/spawn_redis_server.sh @@ -5,4 +5,4 @@ # CodeCrafters uses this file to test your code. Don't make any changes here! # # DON'T EDIT THIS! -exec ruby app/server.rb "$@" +exec bundle exec ruby app/server.rb "$@" diff --git a/starter-repository-definitions.yml b/starter-repository-definitions.yml index f9227ce4..4ec42d8b 100644 --- a/starter-repository-definitions.yml +++ b/starter-repository-definitions.yml @@ -142,6 +142,10 @@ target: spawn_redis_server.sh - source: starter_templates/.gitattributes target: .gitattributes + - source: starter_templates/ruby/Gemfile + target: Gemfile + - source: starter_templates/ruby/Gemfile.lock + target: Gemfile.lock template_attributes: required_executable: "ruby (2.7)" user_editable_file: "app/server.rb" diff --git a/starter_templates/codecrafters.yml b/starter_templates/codecrafters.yml index e6296001..5201ea57 100644 --- a/starter_templates/codecrafters.yml +++ b/starter_templates/codecrafters.yml @@ -32,8 +32,8 @@ language_pack: nodejs-18 language_pack: c-9.2 {{/ language_is_c }} {{# language_is_ruby }} -# Available versions: ruby-3.2 -language_pack: ruby-3.2 +# Available versions: ruby-3.3 +language_pack: ruby-3.3 {{/ language_is_ruby }} {{# language_is_rust }} # Available versions: rust-1.70 diff --git a/starter_templates/ruby/Gemfile b/starter_templates/ruby/Gemfile new file mode 100644 index 00000000..74705b57 --- /dev/null +++ b/starter_templates/ruby/Gemfile @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Add gems here if you need to use them. +# Make sure to run `bundle install` before running tests / pushing to GitHub. + +# Helps with declaratively parsing binary data. +gem "bindata", "~> 2.4" diff --git a/starter_templates/ruby/Gemfile.lock b/starter_templates/ruby/Gemfile.lock new file mode 100644 index 00000000..2c8c7286 --- /dev/null +++ b/starter_templates/ruby/Gemfile.lock @@ -0,0 +1,15 @@ +GEM + remote: https://rubygems.org/ + specs: + bindata (2.4.15) + +PLATFORMS + aarch64-linux-musl + arm64-darwin-21 + x86_64-linux + +DEPENDENCIES + bindata (~> 2.4) + +BUNDLED WITH + 2.4.18 diff --git a/starter_templates/ruby/spawn_redis_server.sh b/starter_templates/ruby/spawn_redis_server.sh index 50c6b799..70a9e42c 100755 --- a/starter_templates/ruby/spawn_redis_server.sh +++ b/starter_templates/ruby/spawn_redis_server.sh @@ -5,4 +5,4 @@ # CodeCrafters uses this file to test your code. Don't make any changes here! # # DON'T EDIT THIS! -exec ruby app/server.rb "$@" +exec bundle exec ruby app/server.rb "$@" From 9292da780f26a1825caec8061796ed51a7f473f9 Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Thu, 1 Feb 2024 12:48:26 +0000 Subject: [PATCH 2/3] Update bundle install command with verbose flag --- dockerfiles/ruby-3.3.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/ruby-3.3.Dockerfile b/dockerfiles/ruby-3.3.Dockerfile index cf87fb63..37ff3fbf 100644 --- a/dockerfiles/ruby-3.3.Dockerfile +++ b/dockerfiles/ruby-3.3.Dockerfile @@ -4,4 +4,4 @@ ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Gemfile,Gemfile.lock" WORKDIR /app COPY Gemfile Gemfile.lock ./ -RUN bundle install \ No newline at end of file +RUN bundle install --verbose \ No newline at end of file From d26abaa20ec6fb3b2bc53da91f7486796529bbd7 Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Thu, 1 Feb 2024 12:52:15 +0000 Subject: [PATCH 3/3] Update Gemfile comments --- compiled_starters/ruby/Gemfile | 2 +- solutions/ruby/01-init/code/Gemfile | 2 +- starter_templates/ruby/Gemfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiled_starters/ruby/Gemfile b/compiled_starters/ruby/Gemfile index 74705b57..fd73dd7a 100644 --- a/compiled_starters/ruby/Gemfile +++ b/compiled_starters/ruby/Gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" # Add gems here if you need to use them. -# Make sure to run `bundle install` before running tests / pushing to GitHub. +# Make sure to run `bundle install` before running tests or submitting your code. # Helps with declaratively parsing binary data. gem "bindata", "~> 2.4" diff --git a/solutions/ruby/01-init/code/Gemfile b/solutions/ruby/01-init/code/Gemfile index 74705b57..fd73dd7a 100644 --- a/solutions/ruby/01-init/code/Gemfile +++ b/solutions/ruby/01-init/code/Gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" # Add gems here if you need to use them. -# Make sure to run `bundle install` before running tests / pushing to GitHub. +# Make sure to run `bundle install` before running tests or submitting your code. # Helps with declaratively parsing binary data. gem "bindata", "~> 2.4" diff --git a/starter_templates/ruby/Gemfile b/starter_templates/ruby/Gemfile index 74705b57..fd73dd7a 100644 --- a/starter_templates/ruby/Gemfile +++ b/starter_templates/ruby/Gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" # Add gems here if you need to use them. -# Make sure to run `bundle install` before running tests / pushing to GitHub. +# Make sure to run `bundle install` before running tests or submitting your code. # Helps with declaratively parsing binary data. gem "bindata", "~> 2.4"