diff --git a/lib/matrix.rb b/lib/matrix.rb index 34602f5c40..b8139b547f 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -14,6 +14,8 @@ require "e2mmap" +require_relative "matrix/version" + module ExceptionForMatrix # :nodoc: extend Exception2MessageMapper def_e2message(TypeError, "wrong argument type %s (expected %s)") diff --git a/lib/matrix/matrix.gemspec b/lib/matrix/matrix.gemspec index c94e8b7cf2..75f6b69a98 100644 --- a/lib/matrix/matrix.gemspec +++ b/lib/matrix/matrix.gemspec @@ -1,8 +1,15 @@ # frozen_string_literal: true +begin + require_relative "lib/matrix/version" +rescue LoadError + # for Ruby core repository + require_relative "version" +end + Gem::Specification.new do |spec| spec.name = "matrix" - spec.version = "0.1.0" + spec.version = Matrix::VERSION spec.authors = ["Marc-Andre Lafortune"] spec.email = ["ruby-core@marc-andre.ca"] @@ -11,7 +18,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/ruby/matrix" spec.license = "BSD-2-Clause" - spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/matrix.rb", "lib/matrix/eigenvalue_decomposition.rb", "lib/matrix/lup_decomposition.rb", "matrix.gemspec"] + spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/matrix.rb", "lib/matrix/eigenvalue_decomposition.rb", "lib/matrix/lup_decomposition.rb", "lib/matrix/version.rb", "matrix.gemspec"] spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] diff --git a/lib/matrix/version.rb b/lib/matrix/version.rb new file mode 100644 index 0000000000..f88bf38d96 --- /dev/null +++ b/lib/matrix/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class Matrix + VERSION = "0.1.0" +end