1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/bigdecimal] Improve extconf to allow using bigdecimal as a git gem

e.g.
```
gem "bigdecimal", github: "ruby/bigdecimal"
```

It would fail because bundler regenerates the `gemspec`,
so `bigdecimal_version` is gone.

https://github.com/ruby/bigdecimal/commit/bccaa66f2c
This commit is contained in:
Jean Boussier 2021-12-02 12:02:21 +01:00 committed by Kenta Murata
parent 84ae7a5df9
commit d0897e3f3a
No known key found for this signature in database
GPG key ID: CEFE8AFB6081B062
2 changed files with 2 additions and 7 deletions

View file

@ -1,10 +1,8 @@
# coding: utf-8
bigdecimal_version = '3.1.0.dev'
Gem::Specification.new do |s|
s.name = "bigdecimal"
s.version = bigdecimal_version
s.version = "3.1.0.dev"
s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"]
s.email = ["mrkn@mrkn.jp"]

View file

@ -3,10 +3,7 @@ require 'mkmf'
def check_bigdecimal_version(gemspec_path)
message "checking RUBY_BIGDECIMAL_VERSION... "
bigdecimal_version =
IO.readlines(gemspec_path)
.grep(/\Abigdecimal_version\s+=\s+/)[0][/\'([^\']+)\'/, 1]
bigdecimal_version = File.read(gemspec_path).match(/^\s*s\.version\s+=\s+['"]([^'"]+)['"]\s*$/)[1]
version_components = bigdecimal_version.split('.')
bigdecimal_version = version_components[0, 3].join('.')