Join Slack
Powered by
Hey :wave: Is anyone here aware of the status of ...
# pact-plugins
j
Jordan Brooks
04/18/2023, 1:23 PM
Hey š Is anyone here aware of the status of plugins for pact ruby? I don't see it on the roadmap
https://github.com/pact-foundation/pact-ruby/blob/master/ROADMAP.md
and we have a use case for pact that would require us to be able to use plugins from ruby.
š 1
y
Yousaf Nabi (pactflow.io)
04/18/2023, 1:33 PM
Hi, It isn't currently on the roadmap (mainly due to maintainer capacity, rather than a lack of wanting to support it) but it is possible to write your own lanaguage implementation, by utilising the pact-reference core (written in rust) -
https://github.com/pact-foundation/pact-reference/blob/master/rust/pact_ffi/README.md
exposed via an FFI (c shared libraries) There are simple implementation examples in a few languages in the repo ā¢
https://github.com/pact-foundation/pact-reference/tree/master/javascript
ā¢
https://github.com/pact-foundation/pact-reference/tree/master/php
ā¢
https://github.com/pact-foundation/pact-reference/tree/master/ruby
I created my own examples a little while back
https://github.com/YOU54F/pact-ruby-ffi/blob/main/examples/area_calculator/spec/pactffi_create_plugin_pact_spec.rb
https://github.com/YOU54F/pact-ruby-ffi/blob/main/lib/pact_ruby_ffi.rb
Maybe you could use that as a source of inspiration to at least get you moving, and share it back with the community
thankyou
1
Yousaf Nabi (pactflow.io)
04/18/2023, 1:36 PM
There are some other examples of loading the shared libraries with Ruby here
https://github.com/YOU54F/hello_ffi/tree/main/ruby
and tested with GH actions here
https://github.com/YOU54F/hello_ffi/blob/6f36442dc52c0624d7c6e146426c50b233db210b/.github/workflows/action.yml#L9-L31
I fix to 2.7.6 of Ruby for gRPC support, as it currently isn't in Ruby 3.x The FFI libs worked with Ruby 3.x when I tested it last
Yousaf Nabi (pactflow.io)
04/18/2023, 1:38 PM
I also hacked about a ffi interface generator for Deno, to generate the same for Ruby
https://github.com/YOU54F/deno-ffigen/commit/52635a822339f3715e694b6f72806820fa2cebc9
which is pretty neat for being able to pull in the appropriate methods in a more automated fashion, than mapping manually
š 1
j
Jordan Brooks
04/18/2023, 1:46 PM
Awesome - thanks for the link, will see if we would be willing to go that route.
š 1
2
Views
Open in Slack
Previous
Next