Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd pkgin package provider #199
Conversation
pkgin is a binary package manager for pkgsrc as used by Joyent on their SmartMachines. This is a package provider for pkgin with the standard installable and uninstallable features.
|
|
||
| has_feature :installable, :uninstallable | ||
|
|
||
| def self.parse(package, force_status=nil) |
This comment has been minimized.
This comment has been minimized.
jhelwig
Dec 12, 2011
Contributor
Not a major thing, but unless self.parse needs to exist for the type/provider system here, it might be better to have a method name with a bit more semantic meaning. Something along the lines of parse_pkgin_line?
| matching_package = properties if properties && resource[:name] == properties[:name] | ||
| end | ||
|
|
||
| matching_package |
This comment has been minimized.
This comment has been minimized.
jhelwig
Dec 13, 2011
Contributor
matching_package isn't really needed here. #detect will return the first element where the block returns true, so this could be written as:
packages.detect do |package|
properties = self.class.parse(package)
properties && resource[:name] == properties[:name]
endWhere this is the last thing in def query.
This comment has been minimized.
This comment has been minimized.
mudge
Dec 14, 2011
Author
Contributor
The problem here is that what needs to be returned is properties, not the original package so detect alone won't be enough. If we separate out the detection from the parsing, it'll mean parsing twice instead of once, e.g.
matching_package = packages.detect do |package|
properties = self.class.parse(package)
properties && resource[:name] == properties[:name]
end
self.class.parse(matching_package) if matching_package| describe "Puppet provider interface" do | ||
| it { respond_to(:install) } | ||
| it { respond_to(:uninstall) } | ||
| it { respond_to(:query) } |
This comment has been minimized.
This comment has been minimized.
jhelwig
Dec 13, 2011
Contributor
These three are really unnecessary given that the later tests will fail if any of these methods are missing. We're usually removing tests like this as we encounter them since they don't really provide any extra coverage.
This comment has been minimized.
This comment has been minimized.
|
Paul, Thanks for working on this provider. Sorry for taking so long to get around to reviewing it. I had a few comments, but nothing major. Let me know if you won't have time to address them. It's all stuff that can easily be addressed when merging in the pull request, if you're busy. |
This comment has been minimized.
This comment has been minimized.
|
Hey Jacob, Thanks for the review; I've renamed |
This comment has been minimized.
This comment has been minimized.
|
I completely glossed over the return of I've squashed the two commits down into one, and merged it into the master branch in 9b7c73a. |
Typo fix
(maint) Remove unused env variables from Rakefile
mudge commentedNov 8, 2011
pkgin is a binary package manager for pkgsrc as used by Joyent on their SmartMachines. This is a package provider for pkgin with the standard installable and uninstallable features.
My Puppet Labs Redmine account can be found at http://projects.puppetlabs.com/users/3814