Skip to content

Instantly share code, notes, and snippets.

Currently the RubyGems index is stored as a Gzip file that is a marshalled array. Whenever Bundler needs to install a gem that is not yet installed it downloads the index, gunzips it and unmarshals it. It then looks for dependencies that are described in another file that is also a gzipped and marshalled file. There are several issues that arise from this setup:

  • The full index must be downloaded and parsed, but does not contain dependency data, which must then be downloaded and parsed. This is a relatively time consuming process.
  • The index must be centralized.

Additionally the gems themselves are currently centralized since there is nothing in the meta data that indicates where the gem should be downloaded from. However in order to allow this it is important to find ways of keeping the index from being poisoned (is this an issue in the centralized system?)

Dependency Resolution

Currently the RubyGems index is stored as a Gzip file that is a marshalled array. Whenever Bundler needs to install a gem that is not yet installed it downloads the index, gunzips it and unmarshals it. It then looks for dependencies that are described in another file that is also a gzipped and marshalled file. There are several issues that arise from this setup:

  • The full index must be downloaded and parsed, but does not contain dependency data, which must then be downloaded and parsed. This is a relatively time consuming process.
  • The index must be centralized.

Additionally the gems themselves are currently centralized since there is nothing in the meta data that indicates where the gem should be downloaded from. However in order to allow this it is important to find ways of keeping the index from being poisoned (is this an issue in the centralized system?)

Dependency Resolution

@copiousfreetime
copiousfreetime / handler_pattern.rb
Created August 10, 2011 21:22 — forked from bruce/handler_pattern.rb
An explicit plugin registry approach (instead of implicit descendant tracking)
class Handler
def self.handles(ext = nil, &block)
if ext
check = -> (file) { File.extname(file.path) == ".#{ext}" }
else
check = block
end
Handler.registry[check] = self
end
#!/usr/bin/env ruby
# encoding: utf-8
# gem install 'amqp'
# ruby -rubygems 'this file'
require 'amqp'
require "amqp/extensions/rabbitmq"
EventMachine.run do
@copiousfreetime
copiousfreetime / exporter.rb
Created February 26, 2012 20:18 — forked from chad/exporter.rb
Export ActiveRecord Tables to CSV
#!/usr/bin/env ruby
# Completely untested method to dump a set of postgres tables to CSV
require 'yaml'
export_tables = %w[ invoice invoice_item item merchant transaction user ]
destination_folder = 'tmp'
db_config_file = 'config/database.yml'
db = YAML.load( db_config_file )[:production]
specs.4.8
prerelease_specs.4.8
versions.list
names.list
specs
deps
gems
@copiousfreetime
copiousfreetime / sql.rb
Last active March 17, 2016 22:01 — forked from zerowidth/sql.md
# https://gist.github.com/zerowidth/9696463
#
# GitHub::SQL - a helping hand for SQL in a rails app.
#
# Built for MySQL, adaptations and updates welcome.
#
# Authors/maintainers: @jbarnette, @zerowidth, et. al.
#
# The MIT License (MIT)
#
#!/usr/bin/env ruby
require 'rake/clean'
require 'rake/testtask'
task :default => [:spec, :test]
task :spec do
sh "rspec ."
end
source 'https://rubygems.org'
gem 'rack'
gem 'grape'