Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Reviews are required by
#
# - @pennylane-hq/germany-core as main usage of this gem is for this team

* @pennylane-hq/germany-core
24 changes: 24 additions & 0 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Specs

on:
push:
pull_request:

jobs:
license_checks:
name: License checks
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run license checks
run: |
bundle exec license_finder || (cat <<-END && exit 1)

You seem to be introducing a new license into our stack, please reach out to
#licenses-tech-stack on slack to get guidance on the topic.
END
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.3.0
ruby 3.4.2
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
source 'https://rubygems.org'

ruby '3.3.0'
ruby '3.4.2'

# Specify your gem's dependencies in liberic.gemspec
gemspec

group :test, :development do
gem 'license_finder', require: false
end
188 changes: 188 additions & 0 deletions doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
---
################################################################################
#
# IMPORTANT: This file includes some important legal decisions that were
# made by the legal team so before making changes, reach out to the slack
# channel #licenses-tech-stack to ask around and get more context.
#
################################################################################

########################################
#
# LICENSES WE CAN USE WITHOUT CONCERN
#
########################################

- [permit, 2-clause BSDL]
- [permit, Apache 2.0]
- [permit, Apache License (2.0)]
- [permit, BlueOak-1.0.0]
- [permit, BSD Zero Clause License]
- [permit, BSD]
- [permit, Hippocratic-2.1]
- [permit, ISC]
- [permit, MIT or MPL-2.0]
- [permit, MIT]
- [permit, MIT-0]
- [permit, New BSD]
- [permit, Public Domain]
- [permit, Python-2.0]
- [permit, ruby]
- [permit, Simplified BSD]
- [permit, Unlicense]
- [permit, WTFPL]
- [permit, Zlib]
- [permit, CC0 1.0 Universal]
- - :approve
- Pennylane
- :why: Our own software
- - :approve
- pennylane
- :why: Our own software
- - :approve
- '.'
- :why: Our own software

########################################
#
# NOT IDEAL BUT NON-BLOCKING
# we want to manually review and approve software using those licenses on
# a case-by-case approach because it's debatable setup
#
# Those licenses notably include:
# - Creative Commons versions (CC-BY is generally OK, but needs double-checking)
# - LGPL, which is confusing between Lesser GPL and Library GPL and its many versions.
# - Mozilla Public License (MPL) which is generally OK as well, but let's be conservative
#
########################################

- - :approve
- caniuse-lite
- :why: >
Using CC-BY-4.0 which is permissive:
https://github.com/browserslist/caniuse-lite?tab=CC-BY-4.0-1-ov-file#readme

- - :approve
- llhttp-ffi
- :why: Mozilla Public License 2.0 is fine

- - :approve
- mdn-data
- :why: >
Using CC0-1.0 which is permissive:
https://github.com/mdn/data?tab=CC0-1.0-1-ov-file#readme

- - :approve
- postcss-values-parser
- :why: Mozilla Public License 2.0 is fine

- - :approve
- lightningcss
- :why: Mozilla Public License 2.0 is fine

########################################
#
# MISDOCUMENTED VALID LICENSES
#
########################################

- - :approve
- aws_cf_signer
- :why: MIT license https://github.com/dylanvaughn/aws_cf_signer?tab=MIT-1-ov-file#readme
- - :approve
- '@segment/facade'
- :why: MIT license https://github.com/segmentio/facade?tab=MIT-1-ov-file
- - :approve
- '@segment/isodate'
- :why: MIT license https://github.com/segmentio/isodate?tab=MIT-1-ov-file
- - :approve
- '@segment/isodate-traverse'
- :why: MIT license https://github.com/segmentio/isodate-traverse?tab=MIT-1-ov-file
- - :approve
- brakeman
- :why: https://github.com/presidentbeef/brakeman/blob/main/LICENSE.md
- - :approve
- color-convert
- :why: MIT license https://github.com/Qix-/color-convert#MIT-1-ov-file
- - :approve
- decko
- :why: MIT license https://github.com/developit/decko?tab=MIT-1-ov-file
- - :approve
- exif-parser
- :why: MIT license https://github.com/bwindels/exif-parser?tab=MIT-1-ov-file
- - :approve
- khroma
- :why: MIT license https://github.com/fabiospampinato/khroma?tab=MIT-1-ov-file
- - :approve
- new-date
- :why: MIT license https://github.com/segmentio/new-date?tab=MIT-1-ov-file
- - :approve
- stickyfill
- :why: MIT license https://github.com/webmodules/stickyfill?tab=MIT-1-ov-file
- - :approve
- tosource
- :why: Zlib license https://github.com/marcello3d/node-tosource?tab=Zlib-1-ov-file
- - :approve
- uuid-v4
- :why: MIT license https://www.npmjs.com/package/uuid-v4
- - :approve
- pdf-core
- :why: Matz' Ruby license https://github.com/prawnpdf/pdf-core?tab=License-1-ov-file
- - :approve
- prawn
- :why: Matz' Ruby license https://github.com/prawnpdf/prawn?tab=License-1-ov-file
- - :approve
- ttfunk
- :why: Matz' Ruby license https://github.com/prawnpdf/ttfunk?tab=License-1-ov-file
- - :approve
- '@typescript-eslint/parser'
- :why: MIT license https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/LICENSE
- - :approve
- 'atomically'
- :why: MIT license https://github.com/fabiospampinato/atomically/blob/master/license
- - :approve
- 'when-exit'
- :why: MIT license https://github.com/fabiospampinato/when-exit/blob/master/license
- - :approve
- 'stubborn-fs'
- :why: MIT license https://github.com/fabiospampinato/stubborn-fs/blob/master/license
- - :approve
- '@auth0/xmldom'
- :why: MIT license https://github.com/auth0/xmldom/blob/master/LICENSE
- - :approve
- 'valid-url'
- :why: MIT license https://github.com/ogt/valid-url/blob/master/LICENSE
- - :approve
- 'front_matter_parser'
- :why: MIT license https://github.com/waiting-for-dev/front_matter_parser/blob/main/LICENSE.txt
- - :approve
- customerio-gist-web
- :why: >
MIT license; see LICENSE file in package
https://unpkg.com/browse/customerio-gist-web@3.16.10/LICENSE
########################################
#
# NOT IDEAL BUT NOT A BLOCKER
#
########################################

- - :approve
- mini_exiftool
- :why: >
This is LGPL-2.1, a weak copyleft license that we can use as long as we
comply with some requirements available here:
https://pennylane-org.slack.com/archives/C04HEQLHDTQ/p1732882347125169?thread_ts=1732882100.984249&cid=C04HEQLHDTQ

- - :approve
- rchardet
- :why: >
This is LGPL-2.1, a weak copyleft license that we can use as long as we
comply with some requirements available here:
https://pennylane-org.slack.com/archives/C04HEQLHDTQ/p1732882347125169?thread_ts=1732882100.984249&cid=C04HEQLHDTQ

- - :approve
- epics
- :why: >
This is LGPL-2.1, a weak copyleft license that we can use as long as we
comply with some requirements available here:
https://pennylane-org.slack.com/archives/C04HEQLHDTQ/p1741249208399559
17 changes: 17 additions & 0 deletions lib/liberic/helpers/invocation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ def with_result_buffer(raise_on_error = true, &block)
SDK::API.rueckgabepuffer_freigeben(handle)
result
end

def with_local_and_server_result_buffers(&block)
local_handle = SDK::API.rueckgabepuffer_erzeugen
server_handle = SDK::API.rueckgabepuffer_erzeugen

error_code = yield(local_handle, server_handle)

local_result = Liberic::SDK::API.rueckgabepuffer_inhalt(local_handle)
server_result = Liberic::SDK::API.rueckgabepuffer_inhalt(server_handle)

return {
error_code: error_code,
error_message: SDK::Fehlercodes::CODES[error_code],
local_result: local_result,
server_result: server_result
}
end
end
end
end
13 changes: 4 additions & 9 deletions lib/liberic/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def execute(options = {})
eric_action = ACTIONS[action] || (raise ExecutionError.new("Invalid action: #{action}. Valid actions are #{ACTIONS.keys.join(', ')}"))
is_printing = %w[submit print_and_submit print_and_submit_auth].include?(action.to_s)
print_params = create_print_params(options)
server_buffer = SDK::API.rueckgabepuffer_erzeugen
result = Helpers::Invocation.with_result_buffer(false) do |local_buffer|

result = Helpers::Invocation.with_local_and_server_result_buffers do |local_buffer, server_buffer|
SDK::API.bearbeite_vorgang(@xml, @type,
eric_action,
(action == :submit ? nil : print_params),
Expand All @@ -70,13 +70,8 @@ def execute(options = {})
local_buffer,
server_buffer)
end
server_result = SDK::API.rueckgabepuffer_inhalt(server_buffer)
SDK::API.rueckgabepuffer_freigeben(server_buffer)
print_params.pointer.free
{
result: result,
server_result: server_result
}
result
end

private
Expand All @@ -93,7 +88,7 @@ def create_print_params(options)
params = SDK::Types::DruckParameter.new
params[:version] = 4
params[:duplexDruck] = options[:duplex] ? 1 : 0
params[:vorschau] = options.has_key?(:draft) ? (options[:draft] ? 1 : 0) : 1
params[:vorschau] = options.has_key?(:draft) ? (options[:draft] ? 1 : 0) : 0
{pdfName: :filename,
fussText: :footer}.each do |eric_param, ruby_param|
if options[ruby_param]
Expand Down
Loading