mirror of
https://github.com/hanzoai/pack.git
synced 2026-09-30 23:43:13 +00:00
fix: use mise for idiomatic ruby file parsing (#429)
* fix: remove custom .ruby-version parsing * test: assert against specific ruby 2 version makes sure .ruby-version is properly being parsed * test: add ruby version output to ruby server tests * docs: some future ruby TODOs
This commit is contained in:
@@ -249,10 +249,6 @@ func (p *RubyProvider) InstallMisePackages(ctx *generate.GenerateContext, miseSt
|
||||
miseStep.Version(ruby, envVersion, varName)
|
||||
}
|
||||
|
||||
if versionFile, err := ctx.App.ReadFile(".ruby-version"); err == nil {
|
||||
miseStep.Version(ruby, utils.ExtractSemverVersion(string(versionFile)), ".ruby-version")
|
||||
}
|
||||
|
||||
if gemfileVersion := parseVersionFromGemfile(ctx); gemfileVersion != "" {
|
||||
miseStep.Version(ruby, gemfileVersion, "Gemfile")
|
||||
}
|
||||
@@ -261,9 +257,12 @@ func (p *RubyProvider) InstallMisePackages(ctx *generate.GenerateContext, miseSt
|
||||
|
||||
miseStep.AddSupportingAptPackage("libyaml-dev")
|
||||
miseStep.AddSupportingAptPackage("libjemalloc-dev")
|
||||
// TODO this does not take into account the mise-specified version of ruby, we should pull the resolved version via Mise
|
||||
version := p.getRubyVersion(ctx)
|
||||
version = utils.ExtractSemverVersion(version)
|
||||
semver, err := utils.ParseSemver(version)
|
||||
|
||||
// TODO we should install these via mise, not apt
|
||||
// YJIT in Ruby 3.1+ requires rustc to install
|
||||
if err == nil && semver != nil && semver.Major >= 3 && semver.Minor > 1 {
|
||||
miseStep.AddSupportingAptPackage("rustc")
|
||||
|
||||
@@ -1 +1 @@
|
||||
puts "Hello from Ruby 2"
|
||||
puts "Hello from Ruby: #{RUBY_VERSION}"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[
|
||||
{
|
||||
"expectedOutput": "Hello from Ruby 2"
|
||||
"expectedOutput": "Hello from Ruby: 2.6.6"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class WelcomeController < ApplicationController
|
||||
def index
|
||||
message = "Hello from Rails"
|
||||
message = "Hello from Ruby: #{RUBY_VERSION}"
|
||||
render plain: message, content_type: "text/plain"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"path": "/",
|
||||
"expected": 200,
|
||||
"internalPort": 3000,
|
||||
"expectedOutput": "Hello from Rails"
|
||||
"expectedOutput": "Hello from Ruby: 3.1.2"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Rails.application.routes.draw do
|
||||
get "/" => lambda { |_env| [200, {}, ["OK"]] }
|
||||
get "/" => lambda { |_env| [200, {}, ["Hello from Ruby: #{RUBY_VERSION}"]] }
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"path": "/",
|
||||
"expected": 200,
|
||||
"internalPort": 3000,
|
||||
"expectedOutput": "OK"
|
||||
"expectedOutput": "Hello from Ruby: 3.2.1"
|
||||
},
|
||||
"envs": {
|
||||
"DATABASE_URL": "postgresql://rails_user:rails_password@postgres:5432/rails_db"
|
||||
|
||||
Reference in New Issue
Block a user