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

package resource: Fix brew package detection #2730

Merged
merged 2 commits into from
Feb 23, 2018
Merged

Conversation

jerryaldrichiii
Copy link
Contributor

This allows for package detection via brew to handle cases where a
particular package formula exists but is not installed.

This allows for package detection via `brew` to handle cases where a
particular package formula exists but is not installed.

Signed-off-by: Jerry Aldrich <[email protected]>
Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

Great improvement, but we can be more idiomatically correct Ruby-wise.

}
# If package exists but is not installed, then `brew` output will not
# contain `pkg['installed'][0]['version']
unless pkg.dig('installed', 0, 'version')
Copy link
Contributor

Choose a reason for hiding this comment

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

unless...else is really frowned-upon in Rubyland.

Let's just make this:

return {} unless pkg.dig('installed', 0, 'version')

# the package is installed, so we build up our pkg info hash
{
  name: ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like that much more. Implemented in latest commit.

Thanks

@jerryaldrichiii jerryaldrichiii added the Type: Bug Feature not working as expected label Feb 23, 2018
Copy link
Contributor

@jquick jquick left a comment

Choose a reason for hiding this comment

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

Thanks @jerryaldrichiii !

@jquick jquick merged commit 448eeb4 into master Feb 23, 2018
@jquick jquick deleted the ja/fix-osx-package branch February 23, 2018 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants