-
Notifications
You must be signed in to change notification settings - Fork 90
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
Return platform name that is lower case and underscored #228
Conversation
333521c
to
8a04b19
Compare
4a4d766
to
8bfd72d
Compare
Signed-off-by: Jared Quick <[email protected]>
8bfd72d
to
fb2ee9e
Compare
lib/train/platforms/platform.rb
Outdated
|
||
def clean_name | ||
name = (@platform[:name] || @name) | ||
# This is a history of name change being used upstream in inspec |
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 don't know what this comment means.
lib/train/platforms/platform.rb
Outdated
if name =~ /[A-Z ]/ | ||
@name_updated = [name] | ||
name = name.downcase.tr(' ', '_') | ||
@name_updated << name |
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.
What is @name_updated
used for?
lib/train/platforms/platform.rb
Outdated
@@ -25,7 +26,18 @@ def direct_families | |||
def name | |||
# Override here incase a updated name was set | |||
# during the detect logic | |||
@platform[:name] || @name | |||
@clean_name |
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's a bit confusing to me to have an instance_var named @clean_name
and a method named clean_name
and then use them in different ways.
Can we just default to using the clean_name
method, and memoize the cleaned_name in that method so we only do the translation once?
Signed-off-by: Jared Quick <[email protected]>
d5e1e41
to
eb7d1ec
Compare
This can be merged but we will want to wait on cutting a train release until we can aline it with the inspec name change. inspec/inspec#2397 |
This will break Windows checks, right? |
The inspec PR will keep it from breaking and just warn for now till inspec 2.0 |
@chris-rock this is totally a breaking change for Train, but SemVer-wise we're OK since this is still We've got an InSpec change in the pipeline that will gracefully handle it there, giving warnings for users as we initially discussed a month or so ago. We'll want to cut a Train release with this change, and then cut an InSpec release that pins on that with the deprecation handling @jquick is working on. |
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.
Great work and care to detail, kudos!! @jquick
Fixes #191
Fixes inspec/inspec#1732
This change is a remake of #192 with the updated platform work. This change sets platform names to always return downcase and underscored.
Signed-off-by: Jared Quick [email protected]