Skip to content

Use current Foobara version in generated gemspec - #7

Merged
azimux merged 4 commits into
foobara:mainfrom
zhephyn:enhancement/default-foobara-minimum-to-the-current-version-of-foobara
Sep 23, 2026
Merged

azimux merged 4 commits into
foobara:mainfrom
zhephyn:enhancement/default-foobara-minimum-to-the-current-version-of-foobara

Conversation

@zhephyn

@zhephyn zhephyn commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #2

@zhephyn

zhephyn commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Maybe we could do a bit of refactoring and put this Gem.loaded_specs["foobara"].version code in a generator method somewhere OR its current location is fine by you? wdyt?

@azimux

azimux commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Maybe we could do a bit of refactoring and put this Gem.loaded_specs["foobara"].version code in a generator method somewhere OR its current location is fine by you? wdyt?

Yeah that could be good to relocate it. If wanting to clean it up a bit you could move it to a method in https://github.com/foobara/empty-ruby-project-generator/blob/main/src/generators/gemspec_generator.rb

Maybe something like current_foobara_version and then you can just call that method directly in the template. You could look at how current_ruby_version is implemented to see an example.

@zhephyn

zhephyn commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

sure thing. gonna proceed with that

@azimux

azimux commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

LGTM! Though there's interestingly a merge conflict

@zhephyn

zhephyn commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

gonna take a look and find out why

@zhephyn

zhephyn commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

done fixing the conflict

gemspec_path = result.keys.find { |path| path.end_with?(".gemspec") }

expect(result.fetch(gemspec_path)).to include(">= #{current_version}")
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still a bit skeptical about this test but mostly harmless I think so I'll merge it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could submit another PR to improve it. Though I'm curious what the improvement could be. maybe an idea i have is that the test is currently testing for just this part ">= #{current_foobara_version}". Maybe it could be improved to test this entire line ">= #{current_foobara_version}", "<2.0.0". Though i wonder if that would make the test a bit more rigid because what it we go past the 2.0.0 version in the future?

@azimux

azimux commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Thanks!!

@azimux
azimux merged commit cd1d999 into foobara:main Sep 23, 2026
2 checks passed
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.

Default foobara's minimum to the current version of foobara

2 participants