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

fix: remove randexp dependency #91

Merged
merged 5 commits into from
Sep 30, 2021

Conversation

naresh-hopin
Copy link
Contributor

Testing:

  • I have tested pact-support after removing the randexp from requirement and looks fine from my end.

@bethesque
Copy link
Member

The randexp gem is used to generate a concrete value from a regular expression. It's unfortunate that there is no test to cover that, but it's used in this line https://github.com/pact-foundation/pact-support/blob/master/lib/pact/reification.rb#L17

If you can grab the relevant method from the randexp gem and copy it into the codebase, you can remove the dependency.

@naresh-hopin
Copy link
Contributor Author

Got it. Thanks, @bethesque :)

I have replaced the randexp with expgen. They have There is a gem called Randexp which does much the same thing. Expgen differs from Randexp in two important ways. (1) It actually works. (2) It supports a much wider range of regexp syntax. in their readme file which made me believe that it's an apt replacement.

I have committed the code not sure how to trigger the unit tests to validate the change. Could you please help me with that?

@bethesque
Copy link
Member

I've actually found a test for it here: https://github.com/pact-foundation/pact-support/blob/master/spec/lib/pact/reification_spec.rb#L22

I don't know why it didn't fail when you removed the randexp dependency though 🤔

@naresh-hopin
Copy link
Contributor Author

Hey @bethesque Thanks much for your patience and response on this. I have made a change to the gem which is used for randexp with randomexp where the monkey patch for the Array.pick is removed. I have run the unit tests locally and I could see those tests are passing. Can you please take a look again and if possible could we merge and push this as a new version, please. We are waiting on this badly for a long time.

Thanks :)

Screenshot 2021-09-29 at 10 25 04 PM

@bethesque
Copy link
Member

Please revert this to what you had previously with the expgen gem, and just split out the when Term from the when <other classes> as I asked.

I'm very happy to help you get this fix out, but I won't be accepting a PR that uses a gem that you have copied, modified and then released without even publishing the source code. That's not a responsible decision as a maintainer.

@naresh-hopin
Copy link
Contributor Author

@bethesque Sorry for the confusion here. Changed as per your suggestion and updated the PR and I have validated the unit tests and they seem to be happy as well.

@bethesque bethesque merged commit 794fd4e into pact-foundation:master Sep 30, 2021
@bethesque
Copy link
Member

Perfect!

@bethesque
Copy link
Member

Gem is released - please update.

@naresh-hopin
Copy link
Contributor Author

Thanks much @bethesque

@naresh-hopin
Copy link
Contributor Author

@bethesque Can you also please take a look at this PR pact-foundation/pact-ruby#247 where I have made a change in gemspec file of pact-ruby to update the version of pact-support. 🙇

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

Successfully merging this pull request may close these issues.

3 participants