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

Refactor polish and weld #224

Merged
merged 5 commits into from
Dec 18, 2024
Merged

Refactor polish and weld #224

merged 5 commits into from
Dec 18, 2024

Conversation

mullermp
Copy link
Contributor

Pulls model out of plan, so that polish and welding can accept plan, and at various steps, would not have incomplete models or mismatched types.

Copy link
Contributor

@alextwoods alextwoods left a comment

Choose a reason for hiding this comment

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

Nice - I like the approach!

Comment on lines +13 to +19
Welds.load!(self)
@welds = Welds.for(model)
Polishes.load!(self)
@polishes = Polishes.for(model)

@welds.each { |weld| weld.preprocess(model) }
@model = Vise::Model.new(model)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! I like this.

gems/smithy/lib/smithy/plan.rb Outdated Show resolved Hide resolved

module Smithy
# @api private
module Polishes
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming discussion. Polishes reads a little weirdly to me - it almost feels like this should be Polishers. Ie, a Polisher can take the polish action, eg: @polishers.each { |p| p.polish }.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Polishes is the plural of polish. We can think about changing this.

def smith(plan)
artifact = Smithy::Forge.forge(plan)
Smithy::Polish.descendants.each { |p| p.new(plan).polish(artifact) }
plan.polishes.each { |polish| polish.polish(artifact) }
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm struggling a little bit with why we have separate Welds and Polishes. Why are these separate extension points - couldn't "polish" just be a hook on a weld?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Polish required instances because it uses Thor actions. Weld now has instances but doesn't include thor. I'm not sure if we should keep the distinction anymore or not.

@mullermp mullermp merged commit ec4def3 into decaf Dec 18, 2024
3 checks passed
@mullermp mullermp deleted the polish-weld-refactor branch December 18, 2024 19:56
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.

2 participants