Skip to content

Instantly share code, notes, and snippets.

View luislavena's full-sized avatar

Luis Lavena luislavena

View GitHub Profile
@luislavena
luislavena / rfc-rubyinstaller-devkit-and-challenges.md
Created August 9, 2014 15:30
RFC: RubyInstaller, DevKit and their challenges

Hello,

Over the past months I've been thinking on ways to improve current RubyInstaller experience for users -- including DevKit -- aiming to make it more Windows-friendly.

While RubyInstaller in its current form has fulfilled my personal needs, I acknowledge that, for newcomers or Windows-centric developers, its usage is problematic and sometimes cryptic.

Below are the common list of complaints I often hear (via Twitter rants,

require 'fiddle'
module FFI
module Library
def ffi_lib *libs
libs.each { |lib| Fiddle.dlopen lib }
end
def attach_function name, arg_types, return_type
f = Fiddle::Function.new(
* Shotgun no funciona, toca reiniciar el servidor después de cada cambio en el código.
* No pudimos poner a correr Sinatra bajo Ruby 1.8.6 en Windows (en otros S.O. funciona bien).
* DataMapper moría usualmente debido a problemas por "falta de memoria" (aunque el sistema tuviera recursos suficientes).
* Los usuarios de Windows 7 con RubyInstaller 1.8.7 veían problemas con mkmf al intentar instalar los gems para los adaptadores de bases de datos.
* El tener que mover DLLs (como SQLite3) en los directorios no es precisamente lo que buscas después de decirles que con "gem install [foo]" tendrán la gema Foo funcionando perfectamente.
Me hubiera gustado subir gists de los errores, pero no me siento capaz de decirle primero a un usuario que Ruby y Sinatra son una maravilla y luego tener que pedirles que creen un bug report para algo tan básico como poner a correr un "Hola Mundo".
Me siento frustrado al leer tweets como: http://twitter.com/christianrojas/status/17539066568, había muchos interesados en conocer Sina
@jonforums
jonforums / dk.rb
Created July 16, 2010 21:21
DevKit install helper script
require 'win32/registry'
require 'yaml'
require 'fileutils'
module DevKitInstaller
DEVKIT_ROOT = File.expand_path(File.dirname(__FILE__))
REG_KEYS = [
'Software\RubyInstaller\MRI',
@dasch
dasch / compl1.rb
Created September 10, 2010 17:59 — forked from antirez/compl1.rb
Redis auto-completion
# compl1.rb - Redis autocomplete example
# download female-names.txt from http://antirez.com/misc/female-names.txt
require 'rubygems'
require 'redis'
r = Redis.new
# Create the completion sorted set
if !r.exists(:compl)
@luislavena
luislavena / bench_erb_erubis_haml_slim.rb
Created October 16, 2010 21:49
Measure Ruby template engines
require 'benchmark'
require 'erb'
require 'erubis'
#gem 'haml', '3.0.21'
gem 'haml', '3.1.0.alpha.14'
require 'haml'
# 0.6.0 beta automatically escapes html
@vertiginous
vertiginous / gist:772895
Created January 10, 2011 15:27
Installing oniguruma on windows with devkit.

NOTE: If you use ansicon make sure it is not loaded

Download the Oniguruma library.

I have had good luck with 5.9.1 and 5.9.2.

Extract it to a temporary folder.

I used C:\Users\gthiesfeld\Work\repo\onig-5.9.2.

@luislavena
luislavena / Rakefile
Created May 2, 2011 23:20
Proof of concept on building extensions that links against executable (as shared library) - To implement Rubinius rbx on Windows
require 'rake/clean'
CLEAN.include '*.{a,o,def,exe,so}'
file 'vm.exe' => ['main.c', 'interface.h'] do |t|
cfiles = t.prerequisites.reject { |f| f !~ /\.c$/ }
cfiles.each do |f|
sh "gcc -c #{f} -o #{f.ext('.o')} -DRBX_WINDOWS -DRBX_BUILDING_VM"
end
@luislavena
luislavena / gist:954581
Created May 4, 2011 01:12
VS2010 (x64) vs GCC 4.5.1 (x86), GCC 4.5.3 (x86) and GCC 4.5.3 (x64) - Pointless microbenchmarks
# i386-mingw32: RubyInstaller
# x64-mswin64_100: Arton's NougakuDo (http://www.artonx.org/data/nougakudo/index.html)
# x64-mingw32: Experimental 64bits RubyInstaller
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
time elapsed: 10.772616 sec.
time elapsed: 10.782617 sec.
time elapsed: 10.796617 sec.
time elapsed: 10.754615 sec.
time elapsed: 10.824619 sec.
C:\Users\Luis\Projects\_sandbox\ruby-perf>ruby -v require_benchmark.rb
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
user system total real
500 requires 0.078000 0.202000 0.280000 ( 0.283016)
1000 requires 0.187000 0.375000 0.562000 ( 0.575033)
1500 requires 0.265000 0.624000 0.889000 ( 0.900051)
2000 requires 0.515000 0.780000 1.295000 ( 1.292074)
2500 requires 0.686000 1.076000 1.762000 ( 1.773102)
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]