Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Overhaul the Ruby library wrapping #91

Closed
mefellows opened this issue Sep 3, 2017 · 6 comments
Closed

Proposal: Overhaul the Ruby library wrapping #91

mefellows opened this issue Sep 3, 2017 · 6 comments
Assignees

Comments

@mefellows
Copy link
Member

mefellows commented Sep 3, 2017

Currently, to make an update to core behaviour in the Pact JS library, we depend on the following upstream NPM dependencies to be updated before they are made available to pact-js:

These libraries in one way or another wrap the underlying Ruby libraries that provide core Pact functionality.

These capabilities have been amalgamated into a single Ruby package: https://github.com/pact-foundation/pact-ruby-standalone/ for convenience of library authors.

Pact Python and Pact Go take the simpler approach of embedding this directly in the main repository and do away with extra dependencies.

Pact Go has the advantage of distributing as a releasable binary package, and thus can create OS specific packages at release time.

Python pulls in the correct OS at install time.

Pros and Cons of each approach

Advantages of separate repositories:

  • Modular, single-concerns, simplifies understanding of main code base
  • Re-usability: can create other libraries

Disadvantages

  • Maintenance overhead - it sounds trivial, but a minor update to a Ruby library requires a bunch of tiny updates to all of these libraries and has to be orchestrated in sequence, waiting for Travis builds to complete etc.
  • The use of optional dependencies in the upstream modules breaks the ability to use package-lock.json properly, as the optional dependency will lock in the incorrect OS. See Not finding linux pact mock service on centos 7 pact-js-core#42 for background
  • Barrier to entry for new contributors - having to wade through the 'dependency graph of hell', as it has been referred to

Options

  1. Convert the two upstream repositories (pact-provider-verifier-npm, pact-mock-service-npm) into a single standalone wrapper, which uses preinstall to dynamically install the correct ruby standalone and postinstall to validate the installation
  2. Do away with pact-provider-verifier-npm and pact-mock-service-npm and bring into pact-node
  3. Do aware with pact-provider-verifier-npm, pact-mock-service-npm and pact-node and move everything into pact-js
@bethesque
Copy link
Member

I'm all for going as flat as possible. Whichever model allows us to push out updates the most easily, I'm for.

@mefellows
Copy link
Member Author

As a starting point, I've just created a new repo to flatten the two npm repositories into one: https://github.com/pact-foundation/pact-standalone-npm.

As part of bringing this into pact-node, we'll transition over to using the service command (over start) which should start to resolve a number of Windows issues.

Stay tuned.

@mboudreau
Copy link
Contributor

@mefellows you can merge the mock service and verifier together, potentially from the ruby side to make it easier, but you can't merge pact-node and the pact-x-npm repos. The latter creates and deploys separate OS/Architecture specific binaries, while pact-node just downloads the one that meets the user's criteria.

Personally, I'd prefer to spend that time to actually get the rust implementation ready and just use that instead.

@bethesque
Copy link
Member

How's your Rust @mboudreau ;-)

@mefellows
Copy link
Member Author

OK, see https://github.com/pact-foundation/pact-standalone-npm and pact-foundation/pact-js-core#45. Things are moving.

Once this is done, I can pick back up some of the other key issues, namely #84, #81 and moving all commands to use 'service' to fix the windows forking issue.

mefellows added a commit to pact-foundation/pact-js-core that referenced this issue Sep 27, 2017
- Fixes Windows forking issue increasing compatibility
- See pact-foundation/pact-python#40
  and pact-foundation/pact-js#91 (comment)
- Pact Go and Pact Python have both implemented this
@mefellows
Copy link
Member Author

Closing - the upgrade to pact-node 5.x.x (not too far away) will address this.

See https://github.com/pact-foundation/pact-js/tree/feat/pact-node-5xx for WIP branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants