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:
parent
84ae7a5df9
commit
d0897e3f3a
2 changed files with 2 additions and 7 deletions
|
@ -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"]
|
||||
|
||||
|
|
|
@ -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('.')
|
||||
|
|
Loading…
Reference in a new issue