From 21087983e1081cf6639b43551d39acf6be9bf144 Mon Sep 17 00:00:00 2001 From: Paul Jeremiah Mugaya <35077129+paulgrammer@users.noreply.github.com> Date: Sun, 28 Jan 2024 15:42:15 +0300 Subject: [PATCH] build (#2) --- .gitignore | 1 + Gemfile.lock | 20 +++++--------------- lib/mtn_open_api.rb | 5 +++-- lib/mtn_open_api/version.rb | 3 ++- mtn_open_api.gemspec | 13 +++++++------ 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 9106b2a..f6216f2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /pkg/ /spec/reports/ /tmp/ +*.gem diff --git a/Gemfile.lock b/Gemfile.lock index 0321758..4ce6e9b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - mtn_open_api (3.0.0) + mtn_open_api (0.0.1) json json-schema yaml @@ -9,32 +9,22 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.1.3) - base64 - bigdecimal + activesupport (6.1.7.4) concurrent-ruby (~> 1.0, >= 1.0.2) - connection_pool (>= 2.2.5) - drb i18n (>= 1.6, < 2) minitest (>= 5.1) - mutex_m tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) - base64 (0.2.0) - bigdecimal (3.1.6) concurrent-ruby (1.2.3) - connection_pool (2.4.1) diff-lcs (1.5.0) - drb (2.2.0) - ruby2_keywords i18n (1.14.1) concurrent-ruby (~> 1.0) json (2.7.1) json-schema (4.1.1) addressable (>= 2.8) minitest (5.21.2) - mutex_m (0.2.0) public_suffix (5.0.4) rake (13.1.0) rspec (3.12.0) @@ -50,17 +40,17 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - ruby2_keywords (0.0.5) tzinfo (2.0.6) concurrent-ruby (~> 1.0) yaml (0.3.0) + zeitwerk (2.6.12) PLATFORMS arm64-darwin-22 ruby DEPENDENCIES - activesupport (>= 6.0.0) + activesupport (~> 6.0) mtn_open_api! rake (~> 13.0) rspec (~> 3.2) diff --git a/lib/mtn_open_api.rb b/lib/mtn_open_api.rb index 530e225..73d9b9e 100644 --- a/lib/mtn_open_api.rb +++ b/lib/mtn_open_api.rb @@ -46,8 +46,9 @@ def self.schemas end def self.load_schema(filename) - YAML.load(File.read("schemas/#{filename}.yaml")) - rescue + gem_root = Gem::Specification.find_by_name(NAME).gem_dir + yaml_path = File.expand_path("schemas/#{filename}.yaml", gem_root) + YAML.load(File.read(yaml_path)) end # Dynamically define classes based on schemas diff --git a/lib/mtn_open_api/version.rb b/lib/mtn_open_api/version.rb index 47f8553..ad0c81b 100644 --- a/lib/mtn_open_api/version.rb +++ b/lib/mtn_open_api/version.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true module MtnOpenApi - VERSION = "3.0.0" + VERSION = "0.0.1" + NAME = 'mtn_open_api' end diff --git a/mtn_open_api.gemspec b/mtn_open_api.gemspec index 77942e6..03e6879 100644 --- a/mtn_open_api.gemspec +++ b/mtn_open_api.gemspec @@ -3,10 +3,10 @@ require_relative "lib/mtn_open_api/version" Gem::Specification.new do |spec| - spec.name = "mtn_open_api" + spec.name = MtnOpenApi::NAME spec.version = MtnOpenApi::VERSION spec.authors = ["Paul Jeremiah Mugaya"] - spec.email = ["paulmugaya@live.com"] + spec.email = ["paulgrammer@koodeyo.com"] spec.summary = 'MTN Open API Ruby Gem' spec.description = 'A Ruby gem for interacting with MTN Open API.' @@ -26,16 +26,17 @@ Gem::Specification.new do |spec| f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile]) end end + spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "yaml" - spec.add_dependency "json" - spec.add_dependency 'json-schema' + spec.add_dependency "yaml", "~> 0.3.0" + spec.add_dependency "json", "~> 2.7.1" + spec.add_dependency 'json-schema', "~> 4.1.1" spec.add_development_dependency "rspec", "~> 3.2" - spec.add_development_dependency 'activesupport', '>= 6.0.0' + spec.add_development_dependency 'activesupport', '~> 6.0' end