FI-3180 Remove examples, schema, and expansions from gem package#116
Conversation
Jammjammjamm
left a comment
There was a problem hiding this comment.
Add the ticket number to the PR title.
Models unit tests uses
requireinstead ofrequire_relative
If you look in the Gemfile, it says gemspec near the top, which tells bundler to load any local .gemspec files it finds. Bundler finds fhir_models.gemspec and loads it, so it knows that that the current repo is the source for fhir_models. So you can require 'fhir_models/some/arbitrary/path' to require the file lib/fhir_models/some/arbitrary/path.rb.
|
I've since made a file with all of the readme code snippets, and compared the outputs. I ran them outside of the fhir_models repo, and compared the outputs. There is no change in behavior except the published version does not have version modules, which is to be expected. Below is the script used that contained all of the readme examples. |
|
Let me know what other testing I should run before this is ready -- Can I force the unit tests to use the installed gem (is that even something we care about/want to do?) |
Jammjammjamm
left a comment
There was a problem hiding this comment.
I don't think any of these need to be in the gem:
".codeclimate.yml",
".gitattributes",
".github/workflows/ruby.yml",
".gitignore",
".rspec",
".rubocop.yml",
".rubocop_todo.yml",
".ruby-version",
".simplecov",
".tool-versions",
"Gemfile",
"Gemfile.lock",
"Guardfile",
"README.md",
"Rakefile",
"fhir_models.gemspec",
Also, what about these? I don't see them referenced anywhere that makes it look like they're used at runtime.
"lib/fhir_models/definitions/structures/extension-definitions.json",
"lib/fhir_models/definitions/structures/profiles-others.json",
"lib/fhir_models/definitions/structures/profiles-resources.json",
"lib/fhir_models/definitions/structures/profiles-types.json",
"lib/fhir_models/definitions/structures/search-parameters.json",
| spec.files.reject! { |file| file =~ /lib\/fhir_models\/examples|lib\/fhir_models\/definitions\/schema|lib\/fhir_models\/definitions\/valuesets/} | ||
| spec.files.reject! { |file| file =~ /lib\/fhir_models\/igs\/hl7.fhir.r4.core\/package_supplement\/expansions.json/} | ||
| spec.files.reject! { |file| file =~ /lib\/fhir_models\/igs\/hl7.fhir.r4b.core\/package_supplement\/expansions.json/} | ||
| spec.files.reject! { |file| file =~ /lib\/fhir_models\/igs\/hl7.fhir.r5.core\/package_supplement\/expansions.json/} |
There was a problem hiding this comment.
Could we do this so that it isn't hard coded and won't break when we add a new version?
There was a problem hiding this comment.
Changed the regex to be version agnostic.
I've also changed the initial file gathering to be limited to those in lib, so none of the ones listed above are included anymore.
There was a problem hiding this comment.
I think that looks good, but we should still include LICENSE.
a437e97 to
a570913
Compare
|
I just pushed up a commit which switches to lazily loading the FHIR packages. This gets the start time back in line with what it was before the multi-version update, and then users who don't need the functionality which requires those packages will never have to load them. CPU Time to load R4 FHIR models: |
|
Is there a reason why #119 (.tgz files) are not removed as well? |
Removes the following files from the gem package:
examplesdirectorydefinitions/schemadirectoryexpansions.jsonof each versionThe built gem has gone from 52MB -> 39 MB. Still a lot, but at least it is a reduction. It also built/installed a LOT faster than it has in the past for me.
I have built the gem, installed it, and ran the unit tests in both models and client. Models unit tests uses
requireinstead ofrequire_relative, so I believe it attempts to use the installed gem before the local repo, but I'm not familiar enough with ruby to confirm this. In any case, both pass, but I'm not sure if there is more that should be done to verify this isn't a breaking change.