-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Extract project creation and preparation into new object #8243
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
Extract project creation and preparation into new object #8243
Conversation
726db29
to
63487df
Compare
Here's an example of your CHANGELOG entry: * Extract project creation and preparation into new object
[sebastianv1](https://github.com/sebastianv1)
[#issue_number](https://github.com/CocoaPods/CocoaPods/issues/issue_number) note: There are two invisible spaces after the entry's text. Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome!
object_version = @aggregate_targets.map(&:user_project).compact.map { |p| p.object_version.to_i }.min | ||
project_generator = ProjectGenerator.new(@sandbox, project_path, @pod_targets, build_configurations, | ||
platforms, object_version, @config.podfile_path) | ||
@project = project_generator.generate! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the project need to be stored in the generator if its included in the generation result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch. No it doesn't.
c692722
to
72e0ba1
Compare
72e0ba1
to
bc8da6b
Compare
@@ -59,7 +60,15 @@ def initialize(sandbox, aggregate_targets, pod_targets, analysis_result, install | |||
end | |||
|
|||
def generate! | |||
project = prepare | |||
project_path = sandbox.project_path | |||
build_configurations = @analysis_result.all_user_build_configurations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont have to use the ivars here at all. You can remove the @
for most of these
# | ||
attr_reader :sandbox | ||
|
||
# @return [#to_s] path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was it [#to_s]
before? Can be String
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah String
is probably better
# | ||
def generate! | ||
project = create_project(@path, @object_version) | ||
prepare(@sandbox, project, @pod_targets, @build_configurations, @platforms, @podfile_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here you can use sandbox
and pod_targets
etc no ivar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, other than using methods instead of ivar access
83d16e0
to
05783d3
Compare
The object `ProjectGenerator` is repsonsible for creating a new `Pod::Project` and preparing it's structure from the build configurations, platforms, and pod targets.
05783d3
to
51cc044
Compare
The object
ProjectGenerator
is now repsonsible for creating a newPod::Project
and preparing it's structure from the build configurations, platforms, and pod targets.