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
pod spec create
to use s.version.to_s
as the git tag when possible
#4564
Conversation
Why is this preferable? |
Common (best?) practice is to avoid duplicating the version string in podspecs, and instead refer to that string in the tag. When manually updating a podspec, it's one less thing to update. Example of redundant version string literal: s.version = "1.2.3"
s.source = { :git => 'https://github.com/Ashton-W/CRToast.git', :tag => "1.2.3" } |
Ah. I've always used |
Right, that works if your tags are prefixed with I didn't handle the case of |
I prefer the string interpolation route personally. Would also be awesome to add a test for this |
Rubocop didn't like me writing |
@@ -60,7 +60,7 @@ def default_data_for_template(name) | |||
data[:author_email] = `git config --get user.email`.strip | |||
data[:source_url] = "http://EXAMPLE/#{name}.git" | |||
data[:ref_type] = ':tag' | |||
data[:ref] = '0.0.1' | |||
data[:ref] = '#{s.version}' |
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.
This does not work as expected. Single quoted strings do not interpolate.
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.
It is intentional (see last comment in PR). The non interpolated string will be used in the generated podspec.
👍 |
Cool |
`pod spec create` to use `s.version.to_s` as the git tag when possible
Changes to make
pod spec create
produce podspecs withs.version.to_s
as the git tag when possibleIf there are no tags or the tags contain extra characters (eg:
v1.4
) a string with the tag is used (current behaviour).