svg2img 0.1.0-x86_64-linux → 0.2.0-x86_64-linux
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 +4 -4
- data/README.md +6 -1
- data/lib/svg2img/3.2/svg2img.so +0 -0
- data/lib/svg2img/3.3/svg2img.so +0 -0
- data/lib/svg2img/version.rb +1 -1
- data/lib/svg2img.rb +8 -1
- metadata +1 -10
- data/.envrc +0 -1
- data/.rspec +0 -1
- data/.ruby-version +0 -1
- data/CHANGELOG.md +0 -5
- data/Rakefile +0 -16
- data/flake.lock +0 -99
- data/flake.nix +0 -62
- data/package.sh +0 -8
- data/sig/svg2img.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb45feae53bf81f067ebf6594892164044ee6c892406d5bef31ff651294ae2ba
|
4
|
+
data.tar.gz: f2336c48fc8487b51e322194ebd7ec1cd1064b9e4c07521f9c437547812ebd3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c90f8f7858bb5f8d46325c6f1c516449c19769f00467a1a65387e2de9a8ead140fcec6f4e7ac2105bc9b2ea01aade8efee38120ce67d23fca1f97061da39679f
|
7
|
+
data.tar.gz: c3f89496e7cc5ae490630468e549ade5354ce37eed37b4cb8529497a7b471191cbd44594071e0774841ee337b743197d2ee4c8fce166db4afeb1a6309be786cb
|
data/README.md
CHANGED
@@ -55,7 +55,7 @@ png_path = Svg2Img.process_svg(circle_svg, output_format: :png)
|
|
55
55
|
|
56
56
|
# Rails example
|
57
57
|
data = Rails.cache.fetch([some, deps]) do
|
58
|
-
png_path = Svg2Img.process_svg(circle_svg, output_format: :png)
|
58
|
+
png_path = Svg2Img.process_svg(circle_svg, output_format: :png, size: proc {|_svg_width, _svg_height| [256, 256]})
|
59
59
|
png_data = File.binread(png_path)
|
60
60
|
File.delete(png_path)
|
61
61
|
png_data
|
@@ -63,6 +63,11 @@ end
|
|
63
63
|
send_data(png_data, type: 'image/png', disposition: 'inline')
|
64
64
|
```
|
65
65
|
|
66
|
+
### Options
|
67
|
+
|
68
|
+
- `output_format` - output format, one of `:png`, `:jpg`, `:webp`, `:gif`
|
69
|
+
- `size` - size of the output image as a proc that receives the width and height of the SVG and returns an array with the width and height of the output image. If the provides size has a different aspect ratio than the SVG, the image will be resized to fit in the center of the provided size. If not provided, the output image will have the same size as the SVG.
|
70
|
+
|
66
71
|
## Development
|
67
72
|
|
68
73
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/svg2img/3.2/svg2img.so
CHANGED
Binary file
|
data/lib/svg2img/3.3/svg2img.so
CHANGED
Binary file
|
data/lib/svg2img/version.rb
CHANGED
data/lib/svg2img.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "svg2img/version"
|
4
|
-
|
4
|
+
|
5
|
+
begin
|
6
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
7
|
+
require "svg2img/#{Regexp.last_match(1)}/svg2img"
|
8
|
+
rescue LoadError
|
9
|
+
require 'svg2img/svg2img'
|
10
|
+
end
|
11
|
+
|
5
12
|
|
6
13
|
module Svg2Img
|
7
14
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svg2img
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Orvar Segerström
|
@@ -17,21 +17,12 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- ".envrc"
|
21
|
-
- ".rspec"
|
22
|
-
- ".ruby-version"
|
23
|
-
- CHANGELOG.md
|
24
20
|
- LICENSE.txt
|
25
21
|
- README.md
|
26
|
-
- Rakefile
|
27
|
-
- flake.lock
|
28
|
-
- flake.nix
|
29
22
|
- lib/svg2img.rb
|
30
23
|
- lib/svg2img/3.2/svg2img.so
|
31
24
|
- lib/svg2img/3.3/svg2img.so
|
32
25
|
- lib/svg2img/version.rb
|
33
|
-
- package.sh
|
34
|
-
- sig/svg2img.rbs
|
35
26
|
homepage: https://github.com/0rvar/svg2img-rb
|
36
27
|
licenses:
|
37
28
|
- MIT
|
data/.envrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
use_flake . --impure
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--require spec_helper
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.3.2
|
data/CHANGELOG.md
DELETED
data/Rakefile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/gem_tasks"
|
4
|
-
require "rb_sys/extensiontask"
|
5
|
-
|
6
|
-
task build: :compile
|
7
|
-
|
8
|
-
GEMSPEC = Gem::Specification.load("svg2img.gemspec")
|
9
|
-
|
10
|
-
RbSys::ExtensionTask.new("svg2img", GEMSPEC) do |ext|
|
11
|
-
ext.lib_dir = "lib/svg2img"
|
12
|
-
|
13
|
-
ext.cross_compile = true
|
14
|
-
end
|
15
|
-
|
16
|
-
task default: :compile
|
data/flake.lock
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"nodes": {
|
3
|
-
"flake-compat": {
|
4
|
-
"flake": false,
|
5
|
-
"locked": {
|
6
|
-
"lastModified": 1696426674,
|
7
|
-
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
8
|
-
"owner": "edolstra",
|
9
|
-
"repo": "flake-compat",
|
10
|
-
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
11
|
-
"type": "github"
|
12
|
-
},
|
13
|
-
"original": {
|
14
|
-
"owner": "edolstra",
|
15
|
-
"repo": "flake-compat",
|
16
|
-
"type": "github"
|
17
|
-
}
|
18
|
-
},
|
19
|
-
"flake-utils": {
|
20
|
-
"inputs": {
|
21
|
-
"systems": "systems"
|
22
|
-
},
|
23
|
-
"locked": {
|
24
|
-
"lastModified": 1694529238,
|
25
|
-
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
26
|
-
"owner": "numtide",
|
27
|
-
"repo": "flake-utils",
|
28
|
-
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
29
|
-
"type": "github"
|
30
|
-
},
|
31
|
-
"original": {
|
32
|
-
"owner": "numtide",
|
33
|
-
"repo": "flake-utils",
|
34
|
-
"type": "github"
|
35
|
-
}
|
36
|
-
},
|
37
|
-
"nixpkgs": {
|
38
|
-
"locked": {
|
39
|
-
"lastModified": 1709961763,
|
40
|
-
"narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=",
|
41
|
-
"owner": "NixOS",
|
42
|
-
"repo": "nixpkgs",
|
43
|
-
"rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34",
|
44
|
-
"type": "github"
|
45
|
-
},
|
46
|
-
"original": {
|
47
|
-
"owner": "NixOS",
|
48
|
-
"ref": "nixos-unstable",
|
49
|
-
"repo": "nixpkgs",
|
50
|
-
"type": "github"
|
51
|
-
}
|
52
|
-
},
|
53
|
-
"nixpkgs-ruby": {
|
54
|
-
"inputs": {
|
55
|
-
"flake-compat": "flake-compat",
|
56
|
-
"flake-utils": "flake-utils",
|
57
|
-
"nixpkgs": [
|
58
|
-
"nixpkgs"
|
59
|
-
]
|
60
|
-
},
|
61
|
-
"locked": {
|
62
|
-
"lastModified": 1722577194,
|
63
|
-
"narHash": "sha256-nWLATuXQYs/AHFxC9mi/uo6mVUz6nFYcWNd6flGCxVk=",
|
64
|
-
"owner": "bobvanderlinden",
|
65
|
-
"repo": "nixpkgs-ruby",
|
66
|
-
"rev": "b2ac79f24e50faac5d4ce3a878b7a9f0270fa2bd",
|
67
|
-
"type": "github"
|
68
|
-
},
|
69
|
-
"original": {
|
70
|
-
"owner": "bobvanderlinden",
|
71
|
-
"repo": "nixpkgs-ruby",
|
72
|
-
"type": "github"
|
73
|
-
}
|
74
|
-
},
|
75
|
-
"root": {
|
76
|
-
"inputs": {
|
77
|
-
"nixpkgs": "nixpkgs",
|
78
|
-
"nixpkgs-ruby": "nixpkgs-ruby"
|
79
|
-
}
|
80
|
-
},
|
81
|
-
"systems": {
|
82
|
-
"locked": {
|
83
|
-
"lastModified": 1681028828,
|
84
|
-
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
85
|
-
"owner": "nix-systems",
|
86
|
-
"repo": "default",
|
87
|
-
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
88
|
-
"type": "github"
|
89
|
-
},
|
90
|
-
"original": {
|
91
|
-
"owner": "nix-systems",
|
92
|
-
"repo": "default",
|
93
|
-
"type": "github"
|
94
|
-
}
|
95
|
-
}
|
96
|
-
},
|
97
|
-
"root": "root",
|
98
|
-
"version": 7
|
99
|
-
}
|
data/flake.nix
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
{
|
2
|
-
description = "Devshell with all the dependencies needed to develop and build the project";
|
3
|
-
|
4
|
-
inputs = {
|
5
|
-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
6
|
-
nixpkgs-ruby.url = "github:bobvanderlinden/nixpkgs-ruby";
|
7
|
-
nixpkgs-ruby.inputs.nixpkgs.follows = "nixpkgs";
|
8
|
-
};
|
9
|
-
|
10
|
-
|
11
|
-
outputs = { self, nixpkgs, nixpkgs-ruby }:
|
12
|
-
let
|
13
|
-
# Boilerplate function for generating attributes for all systems
|
14
|
-
forAllSystems = function:
|
15
|
-
nixpkgs.lib.genAttrs [
|
16
|
-
"x86_64-linux"
|
17
|
-
"aarch64-linux"
|
18
|
-
"x86_64-darwin"
|
19
|
-
"aarch64-darwin"
|
20
|
-
]
|
21
|
-
(system:
|
22
|
-
(function (import nixpkgs {
|
23
|
-
inherit system;
|
24
|
-
})) system);
|
25
|
-
in
|
26
|
-
{
|
27
|
-
packages = forAllSystems (pkgs: system:
|
28
|
-
let
|
29
|
-
ruby = nixpkgs-ruby.lib.packageFromRubyVersionFile {
|
30
|
-
file = ./.ruby-version;
|
31
|
-
inherit system;
|
32
|
-
};
|
33
|
-
tools = [ ruby ] ++ (with pkgs; [
|
34
|
-
nodejs_20
|
35
|
-
yarn
|
36
|
-
mprocs
|
37
|
-
]);
|
38
|
-
gemDependencies = with pkgs; [
|
39
|
-
zstd
|
40
|
-
libxml2
|
41
|
-
libxslt
|
42
|
-
imagemagick
|
43
|
-
];
|
44
|
-
root = builtins.getEnv "PWD";
|
45
|
-
in
|
46
|
-
{
|
47
|
-
default = pkgs.mkShell {
|
48
|
-
buildInputs = tools ++ gemDependencies;
|
49
|
-
shellHook = ''
|
50
|
-
# https://github.com/sass/sassc-ruby/issues/148#issuecomment-644450274
|
51
|
-
bundle config build.sassc --disable-lto
|
52
|
-
export BUNDLE_BUILD__SASSC="--disable-lto"
|
53
|
-
|
54
|
-
export GEM_HOME="${root}/.bundle"
|
55
|
-
export GEM_PATH="${root}/.bundle"
|
56
|
-
export PATH="${root}/.bundle/bin:$PATH"
|
57
|
-
export RUBY_YJIT_ENABLE=1
|
58
|
-
'';
|
59
|
-
};
|
60
|
-
});
|
61
|
-
};
|
62
|
-
}
|
data/package.sh
DELETED
data/sig/svg2img.rbs
DELETED