Create a gist now

Instantly share code, notes, and snippets.

@chriseidhof /app.rb Secret
Last active Oct 7, 2016

What would you like to do?
CocoaPods webserver
require 'sinatra'
require 'pathname'
require 'cocoapods'
require 'cocoapods-core'
require 'colored'
require 'active_support/all'
# This expects the CocoaPods Specs repository to be in the same directory as the app.
SPECS = []
Dir.glob('Specs/**/*.podspec') do |spec_path|
spec = Pod::Spec.from_file(spec_path)
SPECS << spec if spec.safe_to_hash?
NUMBER_OF_PAGES = (SPECS.count.to_f / PAGE_SIZE).ceil
get '/specs' do
page = [params[:page].to_i, 0].max
start_range = page * PAGE_SIZE
end_range = start_range + PAGE_SIZE
{ :result => SPECS[start_range..end_range],
:number_of_pages => NUMBER_OF_PAGES

liuzh commented May 28, 2014


mr-v commented Dec 11, 2014

If anybody reads it now :)

CocoaPods specs filename formatting changed to: 'Specs/*/.podspec.json'

Also I've recreated demo in Swift for exercise, made some changes and added a few tests. Maybe someone will find it useful:

mr-v thanks for putting in the work to do that. I was actually going to do it myself but you beat me to it!

You need to change Dir.glob('Specs/*/.podspec.json') do |spec_path|

It seems to have changed the api, anyone can give a new url?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment