-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
Notify a new release on running danger-swift
#505
Conversation
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.
Thank you very much for this PR :) Great idea!
Just few minor comments:
} | ||
} | ||
|
||
static func fetchLatestVersion() -> 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.
I think this can be private
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.
fixed!
} | ||
|
||
extension VersionChecker { | ||
static let logger = Logger() |
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 Logger won't have the right set up, which is made based on the parameters passed to Danger Swift, not a big deal, but would be nice to get it from the runner if possible (is created at line 25)
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.
#505 (comment) may also resove it 😁
import Foundation | ||
|
||
public enum VersionChecker { | ||
public static func checkForUpdate(current currentVersionString: 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.
Can inject ShellExecutor and Logger (which anyway can be needed), so that we can also have some tests for this logic?
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.
Fixed VersionChecker
enum to class, which make it injectable 😄.
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.
If you merge master CI should pass.
import Version | ||
import Foundation | ||
|
||
public class VersionChecker { |
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.
Nitpick:
Can this be a struct? I prefer having structs if possible, following the Apple's suggested approach
Consider the following recommendations to help choose which option makes sense when adding a new data type to your app.
Use structures by default.
Use classes when you need Objective-C interoperability.
Use classes when you need to control the identity of the data you're modeling.
Use structures along with protocols to adopt behavior by sharing implementations.
from https://developer.apple.com/documentation/swift/choosing_between_structures_and_classes
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.
fixed!
public init( | ||
shellExecutor: ShellExecutor = .init(), | ||
logger: Logger | ||
) { |
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.
Given this is now injectable, can we also add some tests for this please?
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.
done!
Co-authored-by: Franco Meloni <franco.meloni91@gmail.com>
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.
🚀
Some tools (e.g.
carthage
,gh
, etc...) notify when new version is released.I added a version checker to fetch a latest release in GitHub, and notify if running version is older than latest.