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

rework forge API handling #527

Merged
merged 2 commits into from
Dec 27, 2018
Merged

rework forge API handling #527

merged 2 commits into from
Dec 27, 2018

Conversation

bastelfreak
Copy link
Member

No description provided.

@bastelfreak
Copy link
Member Author

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Probably good to add it to Gemfile.

while not mods.next_url.nil?
mods = mods.next
puts "we discovered another #{mods.count} modules on the forge" if DEBUG
forge_releases.concat(mods.map{|mod| mod.slug })
Copy link
Member

Choose a reason for hiding this comment

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

Can also be written as mods.map(&:slug)

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

This also suggests the Github API needs proper pagination.


vp = PuppetForge::User.find('puppet')
mods = vp.modules
forge_releases = mods
Copy link
Member

Choose a reason for hiding this comment

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

https://github.com/puppetlabs/forge-ruby#paginated-collections suggests you can also iterate automatically:

forge_releases = vp.modules.unpaginated.map(&:slug)

@bastelfreak bastelfreak merged commit ab9bfc9 into voxpupuli:master Dec 27, 2018
@bastelfreak bastelfreak deleted the bla branch December 27, 2018 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants