From a1842bdcae5f237b6b61484ed859540effabf9c7 Mon Sep 17 00:00:00 2001 From: Leszek Zalewski Date: Thu, 14 Jan 2021 15:58:16 +0100 Subject: [PATCH 1/3] Strip platform from version Especially for Mac, extension should be built to support all Macs since version 10.7 anyway. --- Rakefile | 6 ++++-- ext/Rakefile | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index f2ef554..e6bd12e 100644 --- a/Rakefile +++ b/Rakefile @@ -18,9 +18,11 @@ task build: ["thermite:build"] do next end - puts "Make #{thermite.config.ruby_extension_path} a #{Gem::Platform.local} default implementation" + platform = "#{Gem::Platform.local.cpu}-#{Gem::Platform.local.os}" + + puts "Make #{thermite.config.ruby_extension_path} a #{platform} default implementation" FileUtils.cp(thermite.config.ruby_extension_path, - "#{thermite.config.ruby_extension_path}.#{Gem::Platform.local}.default") + "#{thermite.config.ruby_extension_path}.#{platform}.default") end task default: %i[build thermite:test spec rubocop] diff --git a/ext/Rakefile b/ext/Rakefile index 3524cb5..20e1bb7 100644 --- a/ext/Rakefile +++ b/ext/Rakefile @@ -11,7 +11,8 @@ thermite = Thermite::Tasks.new(cargo_project_path: project_dir, namespace :thermite do desc "Try to build extension if cargo is available or setup default lib" task :build_or_default do - default_ext_path = "#{thermite.config.ruby_extension_path}.#{Gem::Platform.local}.default" + platform = "#{Gem::Platform.local.cpu}-#{Gem::Platform.local.os}" + default_ext_path = "#{thermite.config.ruby_extension_path}.#{platform}.default" if thermite.cargo profile = ENV.fetch("CARGO_PROFILE", "release") From d91b142c4e2de2a88e1687d957298a47b288bb04 Mon Sep 17 00:00:00 2001 From: Leszek Zalewski Date: Thu, 14 Jan 2021 15:59:16 +0100 Subject: [PATCH 2/3] Reduce installed gem size After installation all default prebuild binaries were still in the gem folder, causing unnecessary memory bloat. New task should clean those up after gem installation, saving almost ~20mb compared to previous versions. --- ext/Rakefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ext/Rakefile b/ext/Rakefile index 20e1bb7..490b2e3 100644 --- a/ext/Rakefile +++ b/ext/Rakefile @@ -9,6 +9,14 @@ thermite = Thermite::Tasks.new(cargo_project_path: project_dir, optional_rust_extension: true) namespace :thermite do + desc "Clean up default binaries" + task :clean_binnaries do + puts "Cleaning up" + Dir["#{thermite.config.ruby_extension_path}.*.default"].each do |file| + FileUtils.rm(file) + end + end + desc "Try to build extension if cargo is available or setup default lib" task :build_or_default do platform = "#{Gem::Platform.local.cpu}-#{Gem::Platform.local.os}" @@ -40,4 +48,4 @@ namespace :thermite do end end -task default: %w[thermite:build_or_default thermite:cargo_clean] +task default: %w[thermite:build_or_default thermite:cargo_clean thermite:clean_binnaries] From ceba320948b96e1a8d9c5d402c709958fc4a46b0 Mon Sep 17 00:00:00 2001 From: Leszek Zalewski Date: Thu, 14 Jan 2021 16:05:59 +0100 Subject: [PATCH 3/3] Bump version and changelog --- CHANGELOG.md | 5 +++++ README.md | 2 ++ ext/Rakefile | 2 +- lib/rusty_json_schema/version.rb | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cfd244..eb00987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.2] +### Changed +- Support broader range of MacOS systems with prebuild binaries +- Cleanup default prebuild binaries after gem installation to reduce used disc space + ## [0.3.1] ### Changed - Package pre-build binaries together diff --git a/README.md b/README.md index a1f868d..4b12baf 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Currently during heavy development. ## Installation +> **NOTE**: Compilation requires openssl-dev / openssl-devel package + Add this line to your application's Gemfile: ```ruby diff --git a/ext/Rakefile b/ext/Rakefile index 490b2e3..db13c65 100644 --- a/ext/Rakefile +++ b/ext/Rakefile @@ -8,7 +8,7 @@ thermite = Thermite::Tasks.new(cargo_project_path: project_dir, ruby_project_path: project_dir, optional_rust_extension: true) -namespace :thermite do +namespace :thermite do # rubocop:disable Metrics/BlockLength desc "Clean up default binaries" task :clean_binnaries do puts "Cleaning up" diff --git a/lib/rusty_json_schema/version.rb b/lib/rusty_json_schema/version.rb index f9d43a4..c55362c 100644 --- a/lib/rusty_json_schema/version.rb +++ b/lib/rusty_json_schema/version.rb @@ -2,6 +2,6 @@ module RustyJSONSchema - VERSION = "0.3.1" + VERSION = "0.3.2" end