liberic 1.3.1 → 1.4.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: 83dd8a212d558bc873ecfd27cfb34224c36c2b05f6f9dc69d153a272d6b02750
4
- data.tar.gz: a92deb083fa435b2926999985d67c8f514dfa359405e179dad85055c4c832cce
3
+ metadata.gz: 60c2b8eacdd374d04d1787cf96528eea5e6cebd95d38ce40ad2cc8cdbc873138
4
+ data.tar.gz: 01c4dc70e934959771d9d29955ef120df344dbd361dc50468bce4755f58a1b40
5
5
  SHA512:
6
- metadata.gz: eb67a7e9957753fbb0d92a61a10191dd9e45c2be05b0059bd04918691e0e352e1857c85a8da271d524ff710cb67a7c013009ef1e215d299c428aa40ad5b25492
7
- data.tar.gz: 2c82dcd752f24193639040130a93f22875b513513c8b436e2687555180bc554f0fe124957f9a937d77917f02b99134156bd61d78b28b3f0c81625f8e35a255c0
6
+ metadata.gz: 6b582f18aed6ff5eb77928ca2a998fab60156fd75020013469b4249b1832c3665db31eed58fe83bea1c69a7925cdc53abe8365be5ba56b2c14e5d1242f21c666
7
+ data.tar.gz: 2ead3024a3ee0d1d2c651fd3af3a78f1d2a84410503f42087f26219a7373e0e1c78f26e5ec7c96c0c4b725087d7b5af5f9649022a76417b1fccceac41b555204
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "bundler"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,39 @@
1
+ name: Release gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ release:
10
+ name: Push gem to RubyGems.org
11
+ runs-on: ubuntu-latest
12
+ environment: release
13
+
14
+ permissions:
15
+ contents: write
16
+ id-token: write
17
+
18
+ steps:
19
+ - name: Check out repository
20
+ uses: actions/checkout@v5
21
+ with:
22
+ persist-credentials: false
23
+
24
+ - name: Set up Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: "3.3.0"
28
+ bundler-cache: true
29
+
30
+ - name: Verify tag matches gem version
31
+ run: |
32
+ version="$(ruby -Ilib -rliberic/version -e 'print Liberic::VERSION')"
33
+ if [ "$GITHUB_REF_NAME" != "v$version" ]; then
34
+ echo "Tag $GITHUB_REF_NAME does not match gem version $version" >&2
35
+ exit 1
36
+ fi
37
+
38
+ - name: Release gem
39
+ uses: rubygems/release-gem@v1
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /.eric/
2
3
  /.yardoc
3
4
  /Gemfile.lock
4
5
  /_yardoc/
data/CHANGELOG.md CHANGED
@@ -5,9 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.3.1]
8
+ ## [1.4.1]
9
9
 
10
- - Fix version check for ERIC SDK
10
+ ### Changed
11
+
12
+ - Require Ruby 3.3 or newer and update gem dependencies.
13
+
14
+ ## [1.4.0]
15
+
16
+ Support for ERIC 43.5.4.0.
17
+
18
+ ### Added
19
+
20
+ - ERIC 43 error codes and installed-SDK compatibility coverage.
21
+ - A reusable prompt for future ERIC SDK upgrades.
22
+
23
+ ### Changed
24
+
25
+ - Updated the version-4 print parameter layout for PDF callbacks.
26
+ - Updated the SDK installer for ELSTER's current download paths and artifacts.
11
27
 
12
28
  ## [1.3.0]
13
29
 
@@ -0,0 +1,16 @@
1
+ # ERIC SDK Upgrade Prompt
2
+
3
+ Use this prompt for future upgrades, replacing `<VERSION>` with the complete ERIC release version.
4
+
5
+ ```text
6
+ Upgrade this repository to ERIC SDK <VERSION> end to end.
7
+
8
+ 1. Inspect the repository, its current git status, release history, SDK installer, supported-version configuration, FFI declarations, wrappers, tests, README, changelog, and gem version before editing. Preserve unrelated worktree changes.
9
+ 2. Set the installer release to <VERSION> and run `ERIC_VERSION=<VERSION> bundle exec rake eric:install`. Do not guess when a download fails: verify ELSTER's current `eric_<major>` directory and exact SDK, documentation, and schema-documentation artifact names, update the installer and its tests, then rerun the task.
10
+ 3. Treat the downloaded SDK headers as the source of truth. Compare `ericapi.h`, `eric_types.h`, and `eric_fehlercodes.h` with all Ruby FFI functions, parameter and return types, callbacks, enum values, struct members, struct versions, and error-code mappings. Check exported symbols by loading the gem against the real shared library. Keep compatibility constants only where existing gem consumers may rely on them.
11
+ 4. Make the smallest compatible gem changes. Pay special attention to native handle widths, pointer fields, callback fields, alignment, and struct size; an unchanged struct version does not guarantee that an old Ruby layout is complete.
12
+ 5. Improve tests so the next upgrade detects drift automatically. Keep fast tests independent of an SDK, and add installed-SDK tests that load every attached symbol, call safe native functions such as `EricVersion` and `EricSystemCheck`, compare every header error code with the Ruby map, and compile a small C layout probe to compare `sizeof`/`offsetof` with FFI struct sizes and offsets. Tests requiring the SDK should skip clearly when it is absent.
13
+ 6. Run the installer a second time to verify idempotence. Run the full specs against the installed SDK, build the gem, and inspect the packaged file list. Resolve all failures and warnings caused by the upgrade.
14
+ 7. Update installation documentation, the changelog, and the reusable upgrade prompt with generic lessons only. Bump the gem version according to semantic versioning; normally use a minor bump for support for a new ERIC release unless compatibility requires a major bump.
15
+ 8. Before committing, inspect `git status`, the complete diff, and recent commits. Stage only intended files, excluding downloaded SDK files and unrelated changes. Create one concise commit describing the ERIC upgrade and report the version, commit hash, verification commands, and any residual risks. Do not tag, push, or publish unless explicitly requested.
16
+ ```
data/README.md CHANGED
@@ -26,13 +26,50 @@ Or install it yourself (not possible yet) as:
26
26
 
27
27
  $ gem install liberic
28
28
 
29
- The ERiC library files are not distributed with this gem. They must be
30
- obtained from the [ELSTER Downloads Page](https://www.elster.de/elsterweb/entwickler/infoseite/eric). (Requires your personal credentials which have to be requested from ELSTER).
29
+ The ERiC library files are not distributed with this gem. On Linux x86-64,
30
+ download and install the SDK and its documentation with:
31
31
 
32
- Follow the installation instructions from the ERiC documentation.
32
+ ```sh
33
+ bundle exec rake eric:install
34
+ ```
35
+
36
+ This installs ERiC `43.5.4.0` by default. To select another full release,
37
+ run:
38
+
39
+ ```sh
40
+ ERIC_VERSION=43.5.4.0 bundle exec rake eric:install
41
+ ```
42
+
43
+ The task derives the ELSTER `eric_<major>` download directory from the version's
44
+ first component. It caches completed archives in `.eric/downloads/` and extracts
45
+ them below `.eric/`, producing this SDK home for the default version:
46
+
47
+ ```text
48
+ .eric/ERiC-43.5.4.0/Linux-x86_64
49
+ ```
50
+
51
+ Allow at least 1.5 GB of free disk space for roughly 680 MB of downloads and
52
+ their extracted contents. Downloads use temporary `.part` files, can be reused
53
+ on later runs, and are not included in the repository or packaged gem. The
54
+ installer supports only the official Linux x86-64 SDK.
55
+
56
+ After installation, set the version-independent `ERIC_HOME` variable in the
57
+ shell where Liberic will run:
58
+
59
+ ```sh
60
+ export ERIC_HOME="$PWD/.eric/ERiC-43.5.4.0/Linux-x86_64"
61
+ ```
33
62
 
34
- After extracting the downloaded library files to a location of your choice, there should be a folder
35
- containing at least three subfolders:
63
+ The install task prints the exact command for the selected version. A Rake
64
+ process cannot permanently change the environment of its parent shell, so you
65
+ must run the command yourself or add it to your shell configuration.
66
+
67
+ For a manual or shared installation, obtain ERiC from the
68
+ [ELSTER Entwicklerbereich](https://www.elster.de/elsterweb/entwickler/infoseite/eric),
69
+ which requires developer credentials. You can also browse the public
70
+ [ELSTER developer information](https://www.elster.de/elsterweb/infoseite/entwickler).
71
+ Follow the official installation instructions and extract the SDK to a location
72
+ of your choice. It should contain at least these folders:
36
73
 
37
74
  ```
38
75
  bin/
@@ -40,16 +77,18 @@ include/
40
77
  lib/
41
78
  ```
42
79
 
43
- Currently, the environment variable `ERIC_HOME_40` needs to be set to this
44
- folder or the gem will not find the library files.
80
+ Set `ERIC_HOME` to that folder or the gem will not find the library files.
81
+ For compatibility with existing applications, `ERIC_HOME_40` remains a
82
+ fallback when `ERIC_HOME` is not set.
45
83
 
46
84
  For example:
47
85
 
48
86
  ```sh
49
- $ export ERIC_HOME_40=/opt/ERiC-40.3.4.0/Linux-x86_64
87
+ export ERIC_HOME=/opt/ERiC-43.5.4.0/Linux-x86_64
50
88
  ```
51
89
 
52
- The gem will raise an `Liberic::InitializationError` if the environment variable is not set.
90
+ The gem will raise a `Liberic::InitializationError` if neither environment
91
+ variable is set.
53
92
  In a Rails project this can interfere with running rake (for example
54
93
  when building the app in Docker). In this case, use `gem 'liberic', require: false` in your `Gemfile`.
55
94
  And require the gem later in your Rails code (for example a model) by
@@ -64,19 +103,19 @@ On *Mac OS X* you need to process the libraries to fix the interal paths
64
103
  (credits to @deviantbits):
65
104
 
66
105
  ```
67
- libs=`ls $ERIC_HOME_27/lib/*.dylib`
68
- plugins=`ls $ERIC_HOME_27/lib/plugins2/*.dylib`
106
+ libs=`ls $ERIC_HOME/lib/*.dylib`
107
+ plugins=`ls $ERIC_HOME/lib/plugins2/*.dylib`
69
108
 
70
109
  for target in $libs
71
110
  do
72
111
  for lib in $libs
73
112
  do
74
- install_name_tool -change "@rpath/"`basename $lib` "$ERIC_HOME_27/lib/"`basename $lib` $target
113
+ install_name_tool -change "@rpath/"`basename $lib` "$ERIC_HOME/lib/"`basename $lib` $target
75
114
  done
76
115
 
77
116
  for plugin in $plugins
78
117
  do
79
- install_name_tool -change "@rpath/plugins2/"`basename $plugin` "$ERIC_HOME_27/lib/plugins2/"`basename $plugin` $target
118
+ install_name_tool -change "@rpath/plugins2/"`basename $plugin` "$ERIC_HOME/lib/plugins2/"`basename $plugin` $target
80
119
  done
81
120
  done
82
121
 
@@ -84,7 +123,7 @@ for target in $plugins
84
123
  do
85
124
  for lib in $libs
86
125
  do
87
- install_name_tool -change "@rpath/"`basename $lib` "$ERIC_HOME_27/lib/"`basename $lib` $target
126
+ install_name_tool -change "@rpath/"`basename $lib` "$ERIC_HOME/lib/"`basename $lib` $target
88
127
  done
89
128
  done
90
129
  ```
@@ -92,7 +131,7 @@ done
92
131
  Check your settings by running:
93
132
 
94
133
  ```sh
95
- $ ls $ERIC_HOME_27/lib/libericapi.*
134
+ $ ls $ERIC_HOME/lib/libericapi.*
96
135
  ```
97
136
  This should list you one file with an operating system dependend suffix.
98
137
 
@@ -188,4 +227,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
188
227
  ## Contributing
189
228
 
190
229
  Bug reports and pull requests are welcome on GitHub at https://github.com/mpm/liberic. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
191
-
data/lib/liberic/boot.rb CHANGED
@@ -19,7 +19,12 @@ module Liberic
19
19
  File.expand_path("libericapi.#{suffix}", ERIC_LIB_FOLDER)
20
20
  end
21
21
 
22
- ERIC_HOME = ENV['ERIC_HOME_40'] || raise(InitializationError.new('ERIC_HOME_40 environment variable not found (set it to the path to the ERiC libraries)'))
22
+ ERIC_HOME = ENV['ERIC_HOME'] || ENV['ERIC_HOME_40'] || raise(
23
+ InitializationError.new(
24
+ 'ERIC_HOME or ERIC_HOME_40 environment variable not found ' \
25
+ '(set it to the ERiC SDK directory, or run `bundle exec rake eric:install`)'
26
+ )
27
+ )
23
28
  ERIC_LIB_FOLDER = File.expand_path('lib', ERIC_HOME)
24
29
 
25
30
  def check_eric_version!
@@ -89,7 +89,6 @@ module Liberic
89
89
  print_and_submit_auth: :sende_auth
90
90
  }
91
91
 
92
- # TODO: check for updates regarding version
93
92
  def create_print_params(options)
94
93
  params = SDK::Types::DruckParameter.new
95
94
  params[:version] = 4
@@ -212,7 +212,6 @@ module Liberic
212
212
  # EricFortschrittCallback funktion,
213
213
  # void* benutzerdaten);
214
214
 
215
- # check if this still works...
216
215
  # typedef void(STDCALL *EricLogCallback)(
217
216
  # const char* kategorie,
218
217
  # eric_log_level_t loglevel,
@@ -1,7 +1,7 @@
1
1
  module Liberic
2
2
  module SDK
3
3
  module Configuration
4
- LIBERICAPI_VERSION = %w(40.3.2.0)
4
+ LIBERICAPI_VERSION = %w(43.5.4.0)
5
5
  ENCODING = 'iso-8859-15'
6
6
  end
7
7
  end
@@ -121,6 +121,7 @@ module Liberic
121
121
  610101524 => 'ERIC_TRANSFER_EID_NPABLOCKIERT',
122
122
 
123
123
  610201016 => 'ERIC_CRYPT_ERROR_CREATE_KEY',
124
+ 610201017 => 'ERIC_CRYPT_OUT_OF_ENTROPY',
124
125
  610201101 => 'ERIC_CRYPT_E_INVALID_HANDLE',
125
126
  610201102 => 'ERIC_CRYPT_E_MAX_SESSION',
126
127
  610201103 => 'ERIC_CRYPT_E_BUSY',
@@ -151,6 +152,9 @@ module Liberic
151
152
  610201128 => 'ERIC_CRYPT_E_LOAD_DLL',
152
153
  610201129 => 'ERIC_CRYPT_E_NO_SERVICE',
153
154
  610201130 => 'ERIC_CRYPT_E_ESICL_EXCEPTION',
155
+ 610201140 => 'ERIC_CRYPT_E_ESIGNER_NICHT_GELADEN',
156
+ 610201141 => 'ERIC_CRYPT_E_INKOMPATIBLE_ESIGNER_VERSION',
157
+ 610201142 => 'ERIC_CRYPT_E_VERALTETE_ESIGNER_VERSION',
154
158
  610201144 => 'ERIC_CRYPT_E_TOKEN_TYPE_MISMATCH',
155
159
  610201146 => 'ERIC_CRYPT_E_P12_CREATE',
156
160
  610201147 => 'ERIC_CRYPT_E_VERIFY_CERT_CHAIN',
@@ -181,6 +185,12 @@ module Liberic
181
185
  610201225 => 'ERIC_CRYPT_E_SC_NO_ENC_CERT',
182
186
  610201226 => 'ERIC_CRYPT_E_SC_INIT_FAILED',
183
187
  610201227 => 'ERIC_CRYPT_E_SC_SIG_KEY',
188
+ 610201228 => 'ERIC_CRYPT_E_DATA_NOT_INITIALIZED',
189
+ 610201229 => 'ERIC_CRYPT_E_ASN1_READ_BUFFER_TOO_SMALL',
190
+ 610201230 => 'ERIC_CRYPT_E_ASN1_READ_DATA_INCOMPLETE',
191
+ 610201231 => 'ERIC_CRYPT_E_ASN1_NO_ENVELOPED_DATA',
192
+ 610201232 => 'ERIC_CRYPT_E_ASN1_NO_CONTENT_DATA',
193
+ 610201233 => 'ERIC_CRYPT_E_XML_VERIFY',
184
194
 
185
195
  610301001 => 'ERIC_IO_FEHLER',
186
196
  610301005 => 'ERIC_IO_DATEI_INKORREKT',
@@ -212,8 +222,10 @@ module Liberic
212
222
  610301190 => 'ERIC_IO_READER_ZU_VIELE_ANHAENGE',
213
223
  610301191 => 'ERIC_IO_READER_ANHANG_ZU_GROSS',
214
224
  610301192 => 'ERIC_IO_READER_ANHAENGE_ZU_GROSS',
225
+ 610301193 => 'ERIC_IO_READER_ANHANG_ZU_KLEIN',
215
226
  610301200 => 'ERIC_IO_READER_SCHEMA_VALIDIERUNGSFEHLER',
216
227
  610301201 => 'ERIC_IO_READER_UNBEKANNTE_XML_ENTITY',
228
+ 610301202 => 'ERIC_IO_TESTHERSTELLERID_GESPERRT',
217
229
  610301252 => 'ERIC_IO_DATENTEILNOTFOUND',
218
230
  610301253 => 'ERIC_IO_DATENTEILENDNOTFOUND',
219
231
  610301300 => 'ERIC_IO_UEBERGABEPARAMETER_FEHLERHAFT',
@@ -9,7 +9,8 @@ module Liberic
9
9
  :duplexDruck, :uint,
10
10
  :pdfName, :pointer,
11
11
  :fussText, :pointer,
12
- :ersteSeite, :uint
12
+ :pdfCallback, :pointer,
13
+ :pdfCallbackBenutzerdaten, :pointer
13
14
  end
14
15
 
15
16
  class VerschluesselungsParameter < FFI::Struct
@@ -1,3 +1,3 @@
1
1
  module Liberic
2
- VERSION = '1.3.1'
2
+ VERSION = '1.4.1'
3
3
  end
data/liberic.gemspec CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.bindir = "exe"
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
+ spec.required_ruby_version = ">= 3.3.0"
29
30
 
30
31
  spec.add_dependency "ffi", "~> 1.16"
31
32
  spec.add_dependency "nokogiri", "~> 1.16"
@@ -33,4 +34,5 @@ Gem::Specification.new do |spec|
33
34
  spec.add_development_dependency "bundler", "~> 2.5"
34
35
  spec.add_development_dependency "rake", "~> 13.1"
35
36
  spec.add_development_dependency "rspec", "~> 3.13"
37
+ spec.add_development_dependency "rubyzip", "~> 2.3"
36
38
  end
data/rakelib/eric.rake ADDED
@@ -0,0 +1,189 @@
1
+ require "fileutils"
2
+ require "net/http"
3
+ require "uri"
4
+ require_relative "../lib/liberic/sdk/configuration"
5
+
6
+ module Liberic
7
+ class EricInstaller
8
+ DEFAULT_VERSION = SDK::Configuration::LIBERICAPI_VERSION.last
9
+ BASE_URL = "https://download.elster.de/download/eric"
10
+ ARTIFACT_SUFFIXES = [
11
+ "Linux-x86_64.jar",
12
+ "Dokumentation.zip",
13
+ "Schemadokumentation.zip"
14
+ ].freeze
15
+
16
+ class InstallError < StandardError; end
17
+
18
+ attr_reader :version, :root
19
+
20
+ def initialize(version: DEFAULT_VERSION, root: File.expand_path("..", __dir__), output: $stdout)
21
+ @version = version
22
+ @root = root
23
+ @output = output
24
+ validate_version!
25
+ end
26
+
27
+ def major_version
28
+ version.split(".").first
29
+ end
30
+
31
+ def filenames
32
+ ARTIFACT_SUFFIXES.map { |suffix| "ERiC-#{version}-#{suffix}" }
33
+ end
34
+
35
+ def urls
36
+ filenames.map { |filename| "#{BASE_URL}/eric_#{major_version}/#{filename}" }
37
+ end
38
+
39
+ def install_root
40
+ File.join(root, ".eric")
41
+ end
42
+
43
+ def downloads_path
44
+ File.join(install_root, "downloads")
45
+ end
46
+
47
+ def sdk_home
48
+ File.join(install_root, "ERiC-#{version}", "Linux-x86_64")
49
+ end
50
+
51
+ def expected_library
52
+ File.join(sdk_home, "lib", "libericapi.so")
53
+ end
54
+
55
+ def install
56
+ check_platform!
57
+ FileUtils.mkdir_p(downloads_path)
58
+
59
+ if installed?
60
+ @output.puts "ERiC #{version} is already installed."
61
+ print_environment_setup
62
+ return sdk_home
63
+ end
64
+
65
+ archives = urls.zip(filenames).map do |url, filename|
66
+ path = File.join(downloads_path, filename)
67
+ download(url, path) unless File.file?(path)
68
+ path
69
+ end
70
+
71
+ archives.each { |archive| extract(archive) }
72
+ validate_installation!
73
+ File.write(installation_marker, "#{version}\n")
74
+
75
+ @output.puts "Installed ERiC #{version} in #{install_root}."
76
+ print_environment_setup
77
+ sdk_home
78
+ rescue InstallError
79
+ raise
80
+ rescue SystemCallError => error
81
+ raise InstallError, error.message
82
+ end
83
+
84
+ def download(url, destination, redirects: 5)
85
+ @output.puts "Downloading #{url}"
86
+ part = "#{destination}.part"
87
+ FileUtils.rm_f(part)
88
+
89
+ stream_download(URI(url), part, redirects)
90
+ File.rename(part, destination)
91
+ rescue StandardError => error
92
+ FileUtils.rm_f(part) if part
93
+ raise error if error.is_a?(InstallError)
94
+
95
+ raise InstallError, "download failed for #{url}: #{error.message}"
96
+ end
97
+
98
+ def extract(path)
99
+ if File.extname(path) == ".pdf"
100
+ FileUtils.cp(path, install_root)
101
+ return
102
+ end
103
+
104
+ require "zip"
105
+ destination_root = File.expand_path(install_root)
106
+
107
+ Zip::File.open(path) do |archive|
108
+ archive.each do |entry|
109
+ destination = File.expand_path(entry.name, destination_root)
110
+ unless destination == destination_root || destination.start_with?("#{destination_root}#{File::SEPARATOR}")
111
+ raise InstallError, "invalid archive #{path}: unsafe entry #{entry.name.inspect}"
112
+ end
113
+
114
+ FileUtils.mkdir_p(File.dirname(destination))
115
+ entry.extract(destination) { true }
116
+ end
117
+ end
118
+ rescue LoadError
119
+ raise InstallError, "rubyzip is required; run bundle install before eric:install"
120
+ rescue Zip::Error, Errno::ENOENT, Errno::EACCES => error
121
+ raise InstallError, "invalid archive #{path}: #{error.message}"
122
+ end
123
+
124
+ private
125
+
126
+ def installation_marker
127
+ File.join(install_root, ".installed-#{version}")
128
+ end
129
+
130
+ def installed?
131
+ File.file?(installation_marker) && File.file?(expected_library)
132
+ end
133
+
134
+ def validate_version!
135
+ return if version.match?(/\A\d+\.\d+\.\d+\.\d+\z/)
136
+
137
+ raise InstallError, "invalid ERIC_VERSION #{version.inspect}; expected a version such as 43.5.4.0"
138
+ end
139
+
140
+ def check_platform!
141
+ return if RUBY_PLATFORM.match?(/x86_64-linux/)
142
+
143
+ raise InstallError, "eric:install supports Linux x86-64 only (current platform: #{RUBY_PLATFORM})"
144
+ end
145
+
146
+ def validate_installation!
147
+ return if File.file?(expected_library)
148
+
149
+ raise InstallError, "installation is incomplete: expected #{expected_library}"
150
+ end
151
+
152
+ def stream_download(uri, destination, redirects)
153
+ request = Net::HTTP::Get.new(uri)
154
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
155
+ http.request(request) do |response|
156
+ case response
157
+ when Net::HTTPSuccess
158
+ File.open(destination, "wb") { |file| response.read_body { |chunk| file.write(chunk) } }
159
+ when Net::HTTPRedirection
160
+ raise InstallError, "too many redirects while downloading #{uri}" if redirects.zero?
161
+
162
+ location = response["location"]
163
+ raise InstallError, "redirect without a Location header while downloading #{uri}" unless location
164
+
165
+ stream_download(URI.join(uri, location), destination, redirects - 1)
166
+ else
167
+ raise InstallError, "download failed for #{uri}: HTTP #{response.code} #{response.message}"
168
+ end
169
+ end
170
+ end
171
+ end
172
+
173
+ def print_environment_setup
174
+ @output.puts
175
+ @output.puts "Set ERIC_HOME in your shell:"
176
+ @output.puts %(export ERIC_HOME="$PWD/.eric/ERiC-#{version}/Linux-x86_64")
177
+ @output.puts "Rake cannot permanently modify the environment of its parent shell."
178
+ end
179
+ end
180
+ end
181
+
182
+ namespace :eric do
183
+ desc "Download and install the ERiC Linux x86-64 SDK and documentation"
184
+ task :install do
185
+ Liberic::EricInstaller.new(version: ENV.fetch("ERIC_VERSION", Liberic::EricInstaller::DEFAULT_VERSION)).install
186
+ rescue Liberic::EricInstaller::InstallError => error
187
+ abort "eric:install failed: #{error.message}"
188
+ end
189
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liberic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Malte Münchert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-19 00:00:00.000000000 Z
11
+ date: 2026-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubyzip
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.3'
83
97
  description: Liberic is a ruby wrapper for ERiC, a C library to interact with German
84
98
  Tax Authority's ELSTER service.
85
99
  email:
@@ -88,12 +102,14 @@ executables: []
88
102
  extensions: []
89
103
  extra_rdoc_files: []
90
104
  files:
105
+ - ".github/dependabot.yml"
106
+ - ".github/workflows/release.yml"
91
107
  - ".gitignore"
92
108
  - ".rspec"
93
109
  - ".tool-versions"
94
- - ".travis.yml"
95
110
  - CHANGELOG.md
96
111
  - CODE_OF_CONDUCT.md
112
+ - ERIC_SDK_UPGRADE_PROMPT.md
97
113
  - Gemfile
98
114
  - LICENSE
99
115
  - README.md
@@ -120,6 +136,7 @@ files:
120
136
  - lib/liberic/sdk/types.rb
121
137
  - lib/liberic/version.rb
122
138
  - liberic.gemspec
139
+ - rakelib/eric.rake
123
140
  homepage: https://www.github.com/mpm/liberic-ruby
124
141
  licenses:
125
142
  - MIT
@@ -132,14 +149,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
149
  requirements:
133
150
  - - ">="
134
151
  - !ruby/object:Gem::Version
135
- version: '0'
152
+ version: 3.3.0
136
153
  required_rubygems_version: !ruby/object:Gem::Requirement
137
154
  requirements:
138
155
  - - ">="
139
156
  - !ruby/object:Gem::Version
140
157
  version: '0'
141
158
  requirements: []
142
- rubygems_version: 3.5.6
159
+ rubygems_version: 3.5.3
143
160
  signing_key:
144
161
  specification_version: 4
145
162
  summary: Ruby bindings for ELSTER/ERiC (German Tax Authority Service)
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.1
4
- before_install: gem install bundler -v 1.10.6