rusty_json_schema 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd6b9fde168fe809a7285e76360ae1a87c55c3e0603d4e4901b76f1b4c101674
4
- data.tar.gz: '08b4831a5dff32132d473d17470fc992c4b6a453472366eca4f7b511b84fea2a'
3
+ metadata.gz: 817092f70e5c85ce436572e1906c6af05da905499a743db1da6d6e5903def2d6
4
+ data.tar.gz: 1693e48e350045cefb6114a491291143205c419f9c760fd44e8f14046cafed87
5
5
  SHA512:
6
- metadata.gz: 7b45b35d8d14862cf402215993c2075885ad014a2c80a41394bf9959495a4ecb5993d17bb31d479260f83746325e6c1b3527dfaa630af8967a884f4413ef9f5f
7
- data.tar.gz: a70e61c95d6f55d66da0848fa4edc0a78dad1fa08da140eca8c2f0af8d0365f51eff7f8ee7dfdb855ffe6de1488b0c1499b0bddf3a357a9e34e89a0c4b414404
6
+ metadata.gz: 473b1be704fae2edf7c475d6c98ff545b6206472d51ddb7c98fe4f99604c126d14b4551c81ed583773d48e1dd54e41ca8f60113d6cd8e8eb09f62d17daeaf0a8
7
+ data.tar.gz: 4c43b2a45914901105008d8d80d5d60cc9378bc4d49df4882819e309b843a7b805d8e8f722515a5083e896403e249407b29bbc0f8505c567133b2a80972e0ac7
data/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "json_schema"
3
- version = "0.1.0"
3
+ version = "0.3.0"
4
4
  authors = ["Leszek Zalewski <leszekzalewski@fastmail.fm>"]
5
5
  edition = "2018"
6
6
 
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thermite/tasks"
4
+ require_relative "../lib/tasks/thermite_dir_patch"
5
+
6
+ project_dir = File.dirname(File.dirname(__FILE__))
7
+ thermite = Thermite::Tasks.new(cargo_project_path: project_dir,
8
+ ruby_project_path: project_dir,
9
+ optional_rust_extension: true)
10
+
11
+ namespace :thermite do
12
+ desc "Try to build extension if cargo is available or setup default lib"
13
+ task :build_or_default do
14
+ default_ext_path = "#{thermite.config.ruby_extension_path}.#{Gem::Platform.local}.default"
15
+
16
+ if thermite.cargo
17
+ profile = ENV.fetch("CARGO_PROFILE", "release")
18
+ thermite.run_cargo_rustc(profile)
19
+
20
+ FileUtils.cp(thermite.config.cargo_target_path(profile, thermite.config.cargo_shared_library),
21
+ thermite.config.ruby_extension_path)
22
+ elsif File.exist?(default_ext_path)
23
+ puts "NOTE: Defaults to pre-build binary #{default_ext_path.inspect} => your mileage may vary."
24
+
25
+ FileUtils.mv(default_ext_path,
26
+ thermite.config.ruby_extension_path)
27
+
28
+ thermite.inform_user_about_cargo
29
+ else
30
+ # Prebuild binary is not available for a given platform, install cargo to
31
+ # compile the gem
32
+ raise thermite.cargo_required_msg
33
+ end
34
+ end
35
+
36
+ desc "Cleanup cargo artifacts"
37
+ task :cargo_clean do
38
+ thermite.run_cargo_if_exists "clean", *thermite.cargo_manifest_path_args
39
+ end
40
+ end
41
+
42
+ task default: %w[thermite:build_or_default thermite:cargo_clean]
@@ -9,13 +9,7 @@ module RustyJSONSchema
9
9
 
10
10
  extend FFI::Library
11
11
 
12
- lib_name =
13
- case ::FFI::Platform::LIBSUFFIX
14
- when "so", "dylib" then "libjson_schema"
15
- when "dll" then "json_schema"
16
- end
17
-
18
- ffi_lib File.expand_path("../ext/#{lib_name}.#{::FFI::Platform::LIBSUFFIX}", __dir__)
12
+ ffi_lib File.expand_path("../../ext/json_schema.so", __dir__)
19
13
 
20
14
  attach_function :new, :validator_new, [:string], Validator
21
15
  attach_function :free, :validator_free, [Validator], :void
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RustyJSONSchema
4
4
 
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.1"
6
6
 
7
7
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Update where this option is configurable
4
+ # is not yet released
5
+ module ThermiteDirPatch
6
+
7
+ def ruby_extension_path
8
+ ruby_path("ext", shared_library)
9
+ end
10
+
11
+ end
12
+
13
+ Thermite::Config.prepend(ThermiteDirPatch)
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "lib/rusty_json_schema/version"
4
4
 
5
- Gem::Specification.new do |spec|
5
+ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
6
6
  spec.name = "rusty_json_schema"
7
7
  spec.version = RustyJSONSchema::VERSION
8
8
  spec.authors = ["Leszek Zalewski"]
@@ -23,10 +23,22 @@ Gem::Specification.new do |spec|
23
23
  spec.metadata["source_code_uri"] = spec.homepage
24
24
  spec.metadata["changelog_uri"] = "https://github.com/driv3r/rusty_json_schema/blob/main/CHANGELOG.md"
25
25
 
26
- spec.files = Dir["lib/**/*", "src/**/*.rs", "rusty_json_schema.gemspec", "Cargo.toml", "LICENSE", "README.md"]
26
+ spec.files = Dir[
27
+ "lib/**/*",
28
+ "src/**/*.rs",
29
+ "rusty_json_schema.gemspec",
30
+ "Cargo.toml",
31
+ "LICENSE",
32
+ "README.md",
33
+ "ext/Rakefile",
34
+ "ext/*.default"
35
+ ]
27
36
 
28
37
  spec.require_paths = ["lib"]
29
38
 
39
+ spec.extensions << "ext/Rakefile"
40
+ spec.add_runtime_dependency "thermite", "~> 0"
41
+
30
42
  # Uncomment to register a new dependency of your gem
31
43
  spec.add_dependency "ffi", "~> 1.14"
32
44
  spec.add_dependency "json", ">= 1.0"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rusty_json_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leszek Zalewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-30 00:00:00.000000000 Z
11
+ date: 2021-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thermite
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: ffi
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -45,24 +59,22 @@ description: |2
45
59
  email:
46
60
  - leszekzalewski@fastmail.fm
47
61
  executables: []
48
- extensions: []
62
+ extensions:
63
+ - ext/Rakefile
49
64
  extra_rdoc_files: []
50
65
  files:
51
66
  - Cargo.toml
52
67
  - README.md
53
- - lib/ext/json_schema.d
54
- - lib/ext/json_schema.dll
55
- - lib/ext/json_schema.dll.exp
56
- - lib/ext/json_schema.dll.lib
57
- - lib/ext/json_schema.pdb
58
- - lib/ext/libjson_schema.d
59
- - lib/ext/libjson_schema.dylib
60
- - lib/ext/libjson_schema.so
68
+ - ext/Rakefile
69
+ - ext/json_schema.so.x64-mingw32.default
70
+ - ext/json_schema.so.x86_64-darwin-19.default
71
+ - ext/json_schema.so.x86_64-linux.default
61
72
  - lib/rusty_json_schema.rb
62
73
  - lib/rusty_json_schema/binding.rb
63
74
  - lib/rusty_json_schema/nodes_array.rb
64
75
  - lib/rusty_json_schema/validator.rb
65
76
  - lib/rusty_json_schema/version.rb
77
+ - lib/tasks/thermite_dir_patch.rb
66
78
  - rusty_json_schema.gemspec
67
79
  - src/lib.rs
68
80
  homepage: https://github.com/driv3r/rusty_json_schema
@@ -1 +0,0 @@
1
- D:\a\rusty_json_schema\rusty_json_schema\target\x86_64-pc-windows-msvc\release\json_schema.dll: D:\a\rusty_json_schema\rusty_json_schema\src\lib.rs
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- /home/runner/work/rusty_json_schema/rusty_json_schema/target/x86_64-unknown-linux-gnu/release/libjson_schema.so: /home/runner/work/rusty_json_schema/rusty_json_schema/src/lib.rs
Binary file