emf2svg 0.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f40393f8fd1ee8fac3c0bac60dd57cdffa37e7c29fe4c84654a1c09fd3eddc6
4
- data.tar.gz: 1177ab6679786bfaa7ee08dec8c38ac52cf7c9367c83a2c8197569950266c7df
3
+ metadata.gz: 2ebbbe5dc469180c1e2285aac506e24e1138dee6093002731715a8e36e427891
4
+ data.tar.gz: 6e5aa5c69d96ab761c2e5dbf2e51291582e27173be26734ef0a4a58d15f8b1d4
5
5
  SHA512:
6
- metadata.gz: a969bc6a4061541d00b0385951622f0d640d96f2d03a5a9081e9b583b4b60e4527e331ea88c287a9049ace569e85f9473bfaca9d029a5ed0122091ef43778f5c
7
- data.tar.gz: 688381d0362f87e799bbe26a18d673a3eda30f2eaa4e7c2e39d3e925f90304726d97b32d5d8e195c6fd1493c0dddc5643e08e1a0973d710eb3e1dbe2512690f3
6
+ metadata.gz: c922cb24fa99821013676059192859595077ed78f48dd767196ac976446a698af5e96656f045b01dbf80c4e3b87ee38da36b1dff890a69a256c3e9e2dbcb3a44
7
+ data.tar.gz: 3d4f558acde1ac4b8a0c9ccbaf9803c592e493f8b97a35558dc0cd2264a12587d551c4a4ac753079a9334fe8eb01ba4f3cd687e598169aa891c2d91709bc49d4
@@ -2,68 +2,162 @@ name: main
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ main, master ]
5
+ branches: [ main ]
6
6
  pull_request:
7
+ workflow_dispatch:
7
8
 
8
9
  jobs:
9
10
  test:
10
11
  runs-on: ${{ matrix.os }}
11
12
  strategy:
13
+ max-parallel: 3
12
14
  fail-fast: false
13
15
  matrix:
14
- os: [ ubuntu-latest, windows-latest, macos-latest ]
16
+ os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
17
+ ruby-version: [ '2.7' ]
18
+ include:
19
+ - os: windows-latest
20
+ ruby-version: '3.1'
15
21
  steps:
16
22
  - uses: actions/checkout@v2
17
23
 
18
24
  - uses: ruby/setup-ruby@v1
19
25
  with:
20
- ruby-version: 2.6.6
21
26
  bundler-cache: true
27
+ ruby-version: ${{ matrix.ruby-version }}
22
28
 
23
29
  - run: bundle exec rake
24
30
 
25
- build-gem:
26
- runs-on: ubuntu-18.04
31
+ build:
32
+ runs-on: ${{ matrix.os }}
33
+ strategy:
34
+ max-parallel: 3
35
+ fail-fast: false
36
+ matrix:
37
+ include:
38
+ - os: ubuntu-18.04
39
+ platform: any
40
+ ruby-version: '2.7'
41
+ - os: ubuntu-18.04
42
+ platform: x86_64-linux
43
+ ruby-version: '2.7'
44
+ - os: windows-latest
45
+ platform: x64-mingw32
46
+ ruby-version: '2.7'
47
+ - os: windows-latest
48
+ platform: x64-mingw-ucrt
49
+ ruby-version: '3.1'
50
+ - os: macos-latest
51
+ platform: x86_64-darwin
52
+ ruby-version: '2.7'
27
53
  steps:
28
54
  - uses: actions/checkout@v2
29
55
 
30
56
  - uses: ruby/setup-ruby@v1
31
57
  with:
32
- ruby-version: '2.6'
58
+ ruby-version: ${{ matrix.ruby-version }}
59
+ bundler-cache: true
33
60
 
34
- - run: bundle config set path 'vendor/bundle'
35
-
36
- - run: bundle install --jobs 4 --retry 3
37
-
38
- - run: bundle exec rake build
61
+ - run: bundle exec rake gem:native:${{ matrix.platform }}
39
62
 
40
63
  - uses: actions/upload-artifact@v2
41
64
  with:
42
65
  name: pkg
43
66
  path: pkg/*.gem
44
67
 
45
- test-gem:
46
- needs: build-gem
68
+ - name: Install gem
69
+ run: gem install -b pkg/emf2svg-*.gem
70
+
71
+ - name: Test conversion
72
+ run: |
73
+ ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
74
+
75
+ test-build:
76
+ needs: build
47
77
  runs-on: ${{ matrix.os }}
48
78
  strategy:
79
+ max-parallel: 3
49
80
  fail-fast: false
50
81
  matrix:
51
- os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
82
+ include:
83
+ - os: ubuntu-latest
84
+ platform: any
85
+ ruby-version: '2.7'
86
+ - os: windows-latest
87
+ platform: any
88
+ ruby-version: '2.7'
89
+ - os: macos-latest
90
+ platform: any
91
+ ruby-version: '2.7'
92
+ - os: ubuntu-18.04
93
+ platform: x86_64-linux
94
+ ruby-version: '2.7'
95
+ - os: ubuntu-latest
96
+ platform: x86_64-linux
97
+ ruby-version: '2.7'
98
+ - os: windows-latest
99
+ platform: x64-mingw32
100
+ ruby-version: '2.7'
101
+ - os: windows-latest
102
+ platform: x64-mingw-ucrt
103
+ ruby-version: '3.1'
104
+ - os: macos-latest
105
+ platform: x86_64-darwin
106
+ ruby-version: '2.7'
107
+
52
108
  steps:
53
109
  - uses: actions/checkout@v2
54
110
 
111
+ - uses: ruby/setup-ruby@v1
112
+ with:
113
+ ruby-version: ${{ matrix.ruby-version }}
114
+
55
115
  - uses: actions/download-artifact@v2
56
116
  with:
57
117
  name: pkg
58
118
  path: pkg
59
119
 
60
- - uses: ruby/setup-ruby@v1
61
- with:
62
- ruby-version: '2.6'
120
+ - name: Install native gem
121
+ if: matrix.platform == 'any'
122
+ run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION").gem
63
123
 
64
- - name: Install gem
65
- run: gem install --no-document pkg/emf2svg-*.gem
124
+ - name: Install binary gem
125
+ if: matrix.platform != 'any'
126
+ run: gem install -b pkg/emf2svg-*-${{ matrix.platform }}.gem
66
127
 
67
128
  - name: Test conversion
68
129
  run: |
69
130
  ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
131
+
132
+ cross:
133
+ runs-on: ${{ matrix.os }}
134
+ strategy:
135
+ max-parallel: 3
136
+ fail-fast: false
137
+ matrix:
138
+ include:
139
+ - os: ubuntu-18.04
140
+ platform: arm64-linux
141
+ ruby-version: '2.7'
142
+ steps:
143
+ - uses: actions/checkout@v2
144
+
145
+ - name: Install packages
146
+ run: |
147
+ sudo apt-get update
148
+ sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
149
+
150
+ - uses: ruby/setup-ruby@v1
151
+ with:
152
+ ruby-version: ${{ matrix.ruby-version }}
153
+ bundler-cache: true
154
+
155
+ - run: bundle exec rake gem:native:${{ matrix.platform }}
156
+
157
+ - uses: actions/upload-artifact@v2
158
+ with:
159
+ name: pkg
160
+ path: pkg/*.gem
161
+
162
+ - name: Install gem
163
+ run: gem install -b pkg/emf2svg-*.gem
@@ -6,31 +6,110 @@ on:
6
6
  - 'v*'
7
7
 
8
8
  jobs:
9
- release:
10
- runs-on: ubuntu-18.04
9
+ build:
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ max-parallel: 3
13
+ fail-fast: false
14
+ matrix:
15
+ include:
16
+ - os: ubuntu-18.04
17
+ platform: any
18
+ ruby-version: '2.7'
19
+ - os: ubuntu-18.04
20
+ platform: x86_64-linux
21
+ ruby-version: '2.7'
22
+ - os: windows-latest
23
+ platform: x64-mingw32
24
+ ruby-version: '2.7'
25
+ - os: windows-latest
26
+ platform: x64-mingw-ucrt
27
+ ruby-version: '3.1'
28
+ - os: macos-latest
29
+ platform: x86_64-darwin
30
+ ruby-version: '2.7'
11
31
  steps:
12
- - uses: actions/checkout@v1
32
+ - uses: actions/checkout@v2
13
33
 
14
34
  - uses: ruby/setup-ruby@v1
15
35
  with:
16
- ruby-version: '2.6'
36
+ ruby-version: ${{ matrix.ruby-version }}
37
+ bundler-cache: true
17
38
 
18
- - run: bundle config set path 'vendor/bundle'
39
+ - run: bundle exec rake gem:native:${{ matrix.platform }}
19
40
 
20
- - run: bundle install --jobs 4 --retry 3
41
+ - uses: actions/upload-artifact@v2
42
+ with:
43
+ name: pkg
44
+ path: pkg/*.gem
45
+
46
+ - name: Install gem
47
+ run: gem install -b pkg/emf2svg-*.gem
48
+
49
+ - name: Test conversion
50
+ run: |
51
+ ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
52
+
53
+ cross:
54
+ runs-on: ${{ matrix.os }}
55
+ strategy:
56
+ max-parallel: 3
57
+ fail-fast: false
58
+ matrix:
59
+ include:
60
+ - os: ubuntu-18.04
61
+ platform: arm64-linux
62
+ ruby-version: '2.7'
63
+ steps:
64
+ - uses: actions/checkout@v2
65
+
66
+ - name: Install packages
67
+ run: |
68
+ sudo apt-get update
69
+ sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
70
+
71
+ - uses: ruby/setup-ruby@v1
72
+ with:
73
+ ruby-version: ${{ matrix.ruby-version }}
74
+ bundler-cache: true
21
75
 
22
- - run: bundle exec rake
76
+ - run: bundle exec rake gem:native:${{ matrix.platform }}
77
+
78
+ - uses: actions/upload-artifact@v2
79
+ with:
80
+ name: pkg
81
+ path: pkg/*.gem
82
+
83
+ - name: Install gem
84
+ run: gem install -b pkg/emf2svg-*.gem
85
+
86
+ publish:
87
+ needs: [ build, cross ]
88
+ runs-on: ubuntu-latest
89
+ steps:
90
+ - uses: actions/checkout@v2
91
+
92
+ - uses: ruby/setup-ruby@v1
93
+ with:
94
+ ruby-version: '2.7'
95
+ bundler-cache: true
96
+
97
+ - uses: actions/download-artifact@v2
98
+ with:
99
+ name: pkg
100
+ path: pkg
23
101
 
24
102
  - name: Publish to rubygems.org
25
103
  env:
26
104
  RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
27
105
  run: |
28
- gem install gem-release
106
+ mkdir -p ~/.gem
29
107
  touch ~/.gem/credentials
30
108
  cat > ~/.gem/credentials << EOF
31
109
  ---
32
110
  :rubygems_api_key: ${RUBYGEMS_API_KEY}
33
111
  EOF
34
112
  chmod 0600 ~/.gem/credentials
35
- git status
36
- gem release
113
+ gem signin
114
+ ls -l pkg/
115
+ for gem in pkg/*.gem; do gem push -V $gem; done
data/.rubocop.yml CHANGED
@@ -2,4 +2,8 @@ inherit_from:
2
2
  - 'https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml'
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.5
5
+ TargetRubyVersion: 2.7
6
+ SuggestExtensions: false
7
+
8
+ Gemspec/RequireMFA:
9
+ Enabled: false
data/Rakefile CHANGED
@@ -15,3 +15,53 @@ task :compile do
15
15
  require_relative "ext/extconf"
16
16
  end
17
17
  task spec: :compile
18
+
19
+ desc "Build install-compilation gem"
20
+ task "gem:native:any" do
21
+ sh "rake platform:any gem"
22
+ end
23
+
24
+ require "rubygems/package_task"
25
+
26
+ desc "Define the gem task to build on any platform (compile on install)"
27
+ task "platform:any" do
28
+ spec = Gem::Specification::load("emf2svg.gemspec").dup
29
+ task = Gem::PackageTask.new(spec)
30
+ task.define
31
+ end
32
+
33
+ platforms = [
34
+ "x64-mingw32",
35
+ "x64-mingw-ucrt",
36
+ "x86_64-linux",
37
+ "arm64-linux",
38
+ "x86_64-darwin",
39
+ ]
40
+
41
+ platforms.each do |platform|
42
+ desc "Build pre-compiled gem for the #{platform} platform"
43
+ task "gem:native:#{platform}" do
44
+ sh "rake compile platform:#{platform} gem target_platform=#{platform}"
45
+ end
46
+
47
+ desc "Define the gem task to build on the #{platform} platform (binary gem)"
48
+ task "platform:#{platform}" do
49
+ spec = Gem::Specification::load("emf2svg.gemspec").dup
50
+ spec.platform = Gem::Platform.new(platform)
51
+ spec.files += Dir.glob("lib/emf2svg/*.{dll,so,dylib}")
52
+ spec.extensions = []
53
+ spec.dependencies.reject! { |d| d.name == "mini_portile2" }
54
+
55
+ task = Gem::PackageTask.new(spec)
56
+ task.define
57
+ end
58
+ end
59
+
60
+ require "rake/clean"
61
+
62
+ CLOBBER.include("pkg")
63
+ CLEAN.include("ports",
64
+ "tmp",
65
+ "lib/emf2svg/*.dll",
66
+ "lib/emf2svg/*.dylib",
67
+ "lib/emf2svg/*.so")
data/emf2svg.gemspec CHANGED
@@ -9,9 +9,9 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["open.source@ribose.com"]
10
10
 
11
11
  spec.summary = "Ruby interface to libemf2svg."
12
- # spec.description = "TODO: Write a longer description or delete this line."
13
12
  spec.homepage = "https://github.com/metanorma/emf2svg-ruby"
14
- spec.required_ruby_version = ">= 2.5.0"
13
+ spec.license = "BSD-2-Clause"
14
+ spec.required_ruby_version = ">= 2.7.0"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
  spec.metadata["source_code_uri"] = "https://github.com/metanorma/emf2svg-ruby"
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_runtime_dependency "mini_portile2", "~> 2.6"
31
31
 
32
32
  spec.add_development_dependency "rubocop", "1.5.2"
33
- spec.add_development_dependency "rubocop-performance"
34
- spec.add_development_dependency "rubocop-rails"
33
+ spec.add_development_dependency "rubocop-performance", "~> 1.0"
34
+ spec.add_development_dependency "rubocop-rails", "~> 2.0"
35
35
 
36
36
  spec.extensions = ["ext/extconf.rb"]
37
37
  end
@@ -1,3 +1,4 @@
1
+ require "rbconfig"
1
2
  require "mini_portile2"
2
3
  require "pathname"
3
4
  require "tmpdir"
@@ -7,11 +8,11 @@ module Emf2svg
7
8
  ROOT = Pathname.new(File.expand_path("../..", __dir__))
8
9
 
9
10
  def initialize
10
- super("libemf2svg", "1.3.0")
11
+ super("libemf2svg", "1.4.0")
11
12
 
12
13
  @files << {
13
- url: "https://github.com/metanorma/libemf2svg/releases/download/1.3.0/libemf2svg.tar.gz",
14
- sha256: "aacbf001701e3f863e97c6c117146ee710636283851d866b715de653fb79343e", # rubocop:disable Layout/LineLength
14
+ url: "https://github.com/metanorma/libemf2svg/releases/download/v1.4.0/libemf2svg.tar.gz",
15
+ sha256: "e05081986a0ec6c5bd494068825c7b55dd21fa1814942a61293b225af2d957d2", # rubocop:disable Layout/LineLength
15
16
  }
16
17
 
17
18
  @target = ROOT.join(@target).to_s
@@ -28,8 +29,42 @@ module Emf2svg
28
29
  FileUtils.touch(checkpoint)
29
30
  end
30
31
 
32
+ # rubocop:disable Metrics/MethodLength
33
+ # rubocop:disable Metrics/CyclomaticComplexity
34
+ def host_platform
35
+ @host_platform ||=
36
+ case @host
37
+ when /\Ax86_64.*mingw32/
38
+ "x64-mingw32"
39
+ when /\Ai[3-6]86.*mingw32/
40
+ "x86-mingw32"
41
+ when /\Ax86_64.*linux/
42
+ "x86_64-linux"
43
+ when /\Aarm64.*linux/
44
+ "xarm64-linux"
45
+ when /\Ai[3-6]86.*linux/
46
+ "x86-linux"
47
+ when /\Ax86_64.*darwin/
48
+ "x86_64-darwin"
49
+ when /\Aarm64.*darwin/
50
+ "arm64-darwin"
51
+ else
52
+ raise "CrossRuby.platform: unsupported host: #{@host}"
53
+ end
54
+ end
55
+ # rubocop:enable Metrics/CyclomaticComplexity
56
+ # rubocop:enable Metrics/MethodLength
57
+
58
+ def target_platform
59
+ @target_platform = ENV["target_platform"] || host_platform
60
+ end
61
+
62
+ def cross_compiling?
63
+ not host_platform.eql? target_platform
64
+ end
65
+
31
66
  def checkpoint
32
- File.join(@target, "#{name}-#{version}-#{host}.installed")
67
+ File.join(@target, "#{name}-#{version}-#{target_platform}.installed")
33
68
  end
34
69
 
35
70
  def configure_defaults
@@ -37,9 +72,13 @@ module Emf2svg
37
72
 
38
73
  opts << "-DCMAKE_BUILD_TYPE=Release"
39
74
 
40
- if MiniPortile.windows?
75
+ if MiniPortile.windows? || cross_compiling?
41
76
  opts << "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
42
- opts << "-GVisual Studio 16 2019"
77
+ end
78
+
79
+ if cross_compiling? && (not MiniPortile.windows?)
80
+ message("Cross-compiling on #{host_platform} for #{target_platform}\n")
81
+ opts << "-DVCPKG_TARGET_TRIPLET=#{target_platform}"
43
82
  end
44
83
 
45
84
  opts
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Emf2svg
4
- VERSION = "0.1.1"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emf2svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-03 00:00:00.000000000 Z
11
+ date: 2022-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -56,30 +56,30 @@ dependencies:
56
56
  name: rubocop-performance
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '2.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '2.0'
83
83
  description:
84
84
  email:
85
85
  - open.source@ribose.com
@@ -109,7 +109,8 @@ files:
109
109
  - lib/emf2svg/recipe.rb
110
110
  - lib/emf2svg/version.rb
111
111
  homepage: https://github.com/metanorma/emf2svg-ruby
112
- licenses: []
112
+ licenses:
113
+ - BSD-2-Clause
113
114
  metadata:
114
115
  homepage_uri: https://github.com/metanorma/emf2svg-ruby
115
116
  source_code_uri: https://github.com/metanorma/emf2svg-ruby
@@ -122,14 +123,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
123
  requirements:
123
124
  - - ">="
124
125
  - !ruby/object:Gem::Version
125
- version: 2.5.0
126
+ version: 2.7.0
126
127
  required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  requirements:
128
129
  - - ">="
129
130
  - !ruby/object:Gem::Version
130
131
  version: '0'
131
132
  requirements: []
132
- rubygems_version: 3.0.3.1
133
+ rubygems_version: 3.1.6
133
134
  signing_key:
134
135
  specification_version: 4
135
136
  summary: Ruby interface to libemf2svg.