From 9be3295d53b6fd9f8a3ad8157aa0655b1976d8ac Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Sun, 22 Dec 2019 19:40:32 -0500 Subject: [PATCH] [ruby/ostruct] Create OpenStruct::VERSION --- lib/ostruct.rb | 3 +++ lib/ostruct/ostruct.gemspec | 11 +++++++++-- lib/ostruct/version.rb | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 lib/ostruct/version.rb diff --git a/lib/ostruct.rb b/lib/ostruct.rb index 4d1f0ce4de..c40c897ff6 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -72,6 +72,9 @@ # the objects that are created, as there is much more overhead in the setting # of these properties compared to using a Hash or a Struct. # + +require_relative 'ostruct/version' + class OpenStruct # diff --git a/lib/ostruct/ostruct.gemspec b/lib/ostruct/ostruct.gemspec index 4faf5b84aa..4f8507045e 100644 --- a/lib/ostruct/ostruct.gemspec +++ b/lib/ostruct/ostruct.gemspec @@ -1,8 +1,15 @@ # frozen_string_literal: true +begin + require_relative "lib/ostruct/version" +rescue LoadError + # for Ruby core repository + require_relative "version" +end + Gem::Specification.new do |spec| spec.name = "ostruct" - spec.version = "0.1.0" + spec.version = OpenStruct::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/ostruct" spec.license = "BSD-2-Clause" - spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/ostruct.rb", "ostruct.gemspec"] + spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "lib/ostruct.rb", "lib/ostruct/version.rb", "ostruct.gemspec"] spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] diff --git a/lib/ostruct/version.rb b/lib/ostruct/version.rb new file mode 100644 index 0000000000..4e26af9909 --- /dev/null +++ b/lib/ostruct/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class OpenStruct + VERSION = "0.1.0" +end