r_to_d2 0.0.2-aarch64-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 +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +34 -0
- data/Rakefile +8 -0
- data/lib/r_to_d2/converter.rb +20 -0
- data/lib/r_to_d2/d2_binary.rb +45 -0
- data/lib/r_to_d2/version.rb +3 -0
- data/lib/r_to_d2.rb +16 -0
- data/vendor/linux/arm64/d2 +0 -0
- metadata +51 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ab1dc48c3c926e85083a5e0d83ffc157ba5fa0441f51828687949e2e5b9824b9
|
|
4
|
+
data.tar.gz: c39ebf2594abe3155a8c65b4cabab939516951eeba8845f20e437b943d82a25a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d57d9a521516857f3df58d568e3c1dc8eb4efbcde70ad032fb27a5f63c4075f7632687d8da21a193cce57a0c99f846b96e94a577fe16d365e1cff90f8d8b173f
|
|
7
|
+
data.tar.gz: f0fa188680f6baf2582f82d1ccb4365e5f4ceda73b75be40568036f8e71a2ae1d2bdee434406a002732e2f3354aec75fdd57272d3899f3ef898c27837344166e
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Klaus Weidinger
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# r_to_d2
|
|
2
|
+
|
|
3
|
+
THIS IS AN ALPHA RELEASE. USE AT YOUR OWN RISK.
|
|
4
|
+
|
|
5
|
+
THIS SHIPS WITH GO BINARIES FOR ALL SUPPORTED PLATFORMS. IT'S AN 800MB DOWNLOAD!
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bundle add r_to_d2
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
gem install r_to_d2
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
svg_string = R2D2.to_svg('a -> b')
|
|
25
|
+
File.open('test.svg', 'w').write(svg_string)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Contributing
|
|
29
|
+
|
|
30
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dunkelziffer/r_to_d2.
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require_relative "d2_binary"
|
|
2
|
+
require "open3"
|
|
3
|
+
|
|
4
|
+
module RToD2
|
|
5
|
+
class Converter
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
def to_svg(text)
|
|
9
|
+
stdout_str, stderr_str, status = Open3.capture3(RToD2::D2Binary.absolute_path, '-', '-', stdin_data: text)
|
|
10
|
+
|
|
11
|
+
if status.success?
|
|
12
|
+
stdout_str
|
|
13
|
+
else
|
|
14
|
+
warn "Error: #{stderr_str}"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module RToD2
|
|
2
|
+
class D2Binary
|
|
3
|
+
D2_VERSION = "0.7.1"
|
|
4
|
+
PLATFORM = Gem::Platform.new(ENV.fetch("GEM_PLATFORM")).freeze
|
|
5
|
+
|
|
6
|
+
class UnsupportedPlatform < StandardError; end
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
def cpu
|
|
10
|
+
case PLATFORM.cpu
|
|
11
|
+
when /x86_64|x64/ then "amd64"
|
|
12
|
+
when /arm64|aarch64/ then "arm64"
|
|
13
|
+
else
|
|
14
|
+
raise UnsupportedPlatform, "Unsupported CPU `#{PLATFORM.cpu}`! Supported are: arm64, aarch64, x86_64, x64"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def os
|
|
19
|
+
case PLATFORM.os
|
|
20
|
+
when /linux/ then "linux"
|
|
21
|
+
when /darwin/ then "macos"
|
|
22
|
+
when /mswin|mingw/ then "windows"
|
|
23
|
+
else
|
|
24
|
+
raise UnsupportedPlatform, "Unsupported OS `#{PLATFORM.os}`! Supported are: darwin, linux, mswin, mingw"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def executable
|
|
29
|
+
case os
|
|
30
|
+
when "windows" then "d2.exe"
|
|
31
|
+
else "d2"
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def relative_path
|
|
36
|
+
"vendor/#{os}/#{cpu}/#{executable}"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def absolute_path
|
|
40
|
+
RToD2.root.join(relative_path)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
end
|
data/lib/r_to_d2.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative "r_to_d2/version"
|
|
2
|
+
require_relative "r_to_d2/d2_binary"
|
|
3
|
+
require_relative "r_to_d2/converter"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
module RToD2
|
|
7
|
+
|
|
8
|
+
def self.root
|
|
9
|
+
Pathname.new(File.expand_path("..", __dir__))
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.to_svg(text)
|
|
13
|
+
RToD2::Converter.to_svg(text)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
Binary file
|
metadata
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: r_to_d2
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
platform: aarch64-linux
|
|
6
|
+
authors:
|
|
7
|
+
- Klaus Weidinger
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Ruby to D2. Convert diagrams to SVG and PNG via the compiled D2 binary.
|
|
13
|
+
email:
|
|
14
|
+
- weidkl@gmx.de
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- LICENSE.txt
|
|
20
|
+
- README.md
|
|
21
|
+
- Rakefile
|
|
22
|
+
- lib/r_to_d2.rb
|
|
23
|
+
- lib/r_to_d2/converter.rb
|
|
24
|
+
- lib/r_to_d2/d2_binary.rb
|
|
25
|
+
- lib/r_to_d2/version.rb
|
|
26
|
+
- vendor/linux/arm64/d2
|
|
27
|
+
homepage: https://github.com/dunkelziffer/r_to_d2
|
|
28
|
+
licenses:
|
|
29
|
+
- MIT
|
|
30
|
+
metadata:
|
|
31
|
+
source_code_uri: https://github.com/dunkelziffer/r_to_d2
|
|
32
|
+
homepage_uri: https://github.com/dunkelziffer/r_to_d2
|
|
33
|
+
rubygems_mfa_required: 'true'
|
|
34
|
+
rdoc_options: []
|
|
35
|
+
require_paths:
|
|
36
|
+
- lib
|
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: 3.2.0
|
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
requirements: []
|
|
48
|
+
rubygems_version: 4.0.8
|
|
49
|
+
specification_version: 4
|
|
50
|
+
summary: Ruby to D2. Convert diagrams to SVG and PNG via the compiled D2 binary.
|
|
51
|
+
test_files: []
|