From 98622a1c291277ff124a586929c675e9ae67692e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 18 Apr 2010 21:33:40 -0700 Subject: use the excellent `isolate' gem for dev It should make life easier when dealing with and testing complex dependencies, especially ones like Cramp which depend on prerelease versions of gems. --- .gitignore | 1 + GNUmakefile | 7 +++++++ Rakefile | 7 +++++++ config/.gitignore | 1 + config/isolate.rb | 24 ++++++++++++++++++++++++ local.mk.sample | 35 ++++++++++++----------------------- 6 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 config/.gitignore create mode 100644 config/isolate.rb diff --git a/.gitignore b/.gitignore index a9cb887..d20450a 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ pkg/ /.manifest /GIT-VERSION-FILE /man +/tmp diff --git a/GNUmakefile b/GNUmakefile index b11ecf9..42c2162 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,6 +3,7 @@ all:: RUBY = ruby RAKE = rake GIT_URL = git://git.bogomips.org/rainbows.git +ISOLATE_CONFIG = config/isolate.rb GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @./GIT-VERSION-GEN @@ -15,6 +16,12 @@ ifeq ($(RUBY_VERSION),) RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION') endif +# rake takes forever to start +isolate: tmp/gems/$(RUBY_VERSION)/.isolate +tmp/gems/$(RUBY_VERSION)/.isolate: $(ISOLATE_CONFIG) + ISOLATE_CONFIG=$(ISOLATE_CONFIG) $(RAKE) isolate + > $@ + base_bins := rainbows bins := $(addprefix bin/, $(base_bins)) man1_bins := $(addsuffix .1, $(base_bins)) diff --git a/Rakefile b/Rakefile index 219744a..cb4cae0 100644 --- a/Rakefile +++ b/Rakefile @@ -183,3 +183,10 @@ task :fm_update do p http.post(uri.path, req, {'Content-Type'=>'application/json'}) end end + +desc 'isolate gems for development' +task :isolate do + require 'isolate' + Isolate.gems "tmp/gems/#{RUBY_VERSION}", + :file => ENV['ISOLATE_CONFIG'] +end diff --git a/config/.gitignore b/config/.gitignore new file mode 100644 index 0000000..0aaed9f --- /dev/null +++ b/config/.gitignore @@ -0,0 +1 @@ +/isolate_*.rb diff --git a/config/isolate.rb b/config/isolate.rb new file mode 100644 index 0000000..3ac1af5 --- /dev/null +++ b/config/isolate.rb @@ -0,0 +1,24 @@ +# this the default config file used by John Barnette's isolate gem +# you can create a config/isolate_local.rb file to override this +# See the corresponding tasks in Rakefile and GNUmakefile +# `rake isolate' or (faster in the unmodified case, `make isolate') + +gem 'rack', '1.1.0' +gem 'unicorn', '0.97.0' + +gem 'iobuffer', '0.1.3' +gem 'rev', '0.3.2' + +gem 'eventmachine', '0.12.10' + +gem 'sinatra', '0.9.4' +gem 'async_sinatra', '0.1.5' + +gem 'neverblock', '0.1.6.2' + +if defined?(::Fiber) + gem 'case', '0.5' + gem 'revactor', '0.1.5' +end + +gem 'cramp', '0.10' diff --git a/local.mk.sample b/local.mk.sample index af12efb..1bd8832 100644 --- a/local.mk.sample +++ b/local.mk.sample @@ -6,39 +6,28 @@ RSYNC = rsync DLEXT := so -gems := rack-1.1.0 -# gems += unicorn-0.96.0 # installed via setup.rb -gems += rev-0.3.2 -gems += iobuffer-0.1.3 -gems += eventmachine-0.12.10 -gems += async_sinatra-0.1.5 sinatra-0.9.4 -gems += neverblock-0.1.6.2 - -# Cramp isn't enabled by default since it depends on several prerelease gems -ifdef CRAMP - gems += cramp-0.7 - gems += activesupport-3.0.pre - gems += activemodel-3.0.pre - gems += arel-0.2.pre - gems += usher-0.6.2 - gems += fuzzyhash-0.0.11 - gems += mysqlplus-0.1.1 -endif # Avoid loading rubygems to speed up tests because gmake is # fork+exec heavy with Ruby. prefix = $(HOME) + ifeq ($(r19),) RUBY := $(prefix)/bin/ruby - gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.8/gems/,$(gems)) else prefix := $(prefix)/ruby-1.9 export PATH := $(prefix)/bin:$(PATH) RUBY := $(prefix)/bin/ruby --disable-gems - gems += case-0.5 revactor-0.1.5 - gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.9.1/gems/,$(gems)) endif +ifndef NO_ISOLATE + x := $(shell test -d t/ && NO_ISOLATE=T $(MAKE) -s isolate RUBY:="$(RUBY)") +endif + +RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION') + +updir := $(shell git rev-parse --show-cdup) +gem_paths := $(wildcard $(updir)tmp/gems/$(RUBY_VERSION)/gems/*-*) + ifdef gem_paths sp := sp += @@ -55,9 +44,9 @@ TRACER = /usr/bin/time -v -o $(t_pfx).time full-test: test-18 test-19 test-18: - $(MAKE) test 2>&1 | sed -u -e 's!^!1.8 !' + $(MAKE) test 2>&1 | sed -e 's!^!1.8 !' test-19: - $(MAKE) test r19=t 2>&1 | sed -u -e 's!^!1.9 !' + $(MAKE) test r19=T 2>&1 | sed -e 's!^!1.9 !' latest: NEWS @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' < $< -- cgit v1.2.3-24-ge0c7