Skip to content

Commit 2ed2a63

Browse files
committed
Get default target ruby version for standardrb from .ruby-version file
1 parent 0f1221b commit 2ed2a63

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/cc/engine/standard.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,18 @@ def files_to_inspect
4646
end
4747

4848
def builds_config
49-
@_builds_config ||= ::Standard::BuildsConfig.new.call([])
49+
@_builds_config ||= begin
50+
override_default_ruby_version
51+
::Standard::BuildsConfig.new.call([])
52+
end
53+
end
54+
55+
def override_default_ruby_version
56+
ruby_version = ".ruby-version"
57+
if File.exist?(ruby_version)
58+
project_ruby_version = `cat #{ruby_version}`
59+
::Standard::LoadsYamlConfig.const_set(:RUBY_VERSION, project_ruby_version)
60+
end
5061
end
5162
end
5263
end

0 commit comments

Comments
 (0)