Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: trunk
Fetching contributors…

Cannot retrieve contributors at this time

210 lines (179 sloc) 5.935 kB
directory "gems"
task :reset do
system "git reset HEAD; git checkout ."
rm_rf "gems"
end
mv_cmd = "mv" # TODO: cp for first few passes
projects = ["cgi*", "English.rb", "abbrev.rb", "base64.rb",
"benchmark.rb", "cmath.rb", "complex.rb", "csv.rb",
"debug.rb", "delegate.rb", "drb*", "e2mmap.rb", "erb.rb",
"fileutils.rb", "find.rb", "forwardable.rb",
"getoptlong.rb", "gserver.rb", "ipaddr.rb", "irb*",
"logger.rb", "mathn.rb", "matrix*", "minitest", "mkmf.rb",
"monitor.rb", "mutex_m.rb", "net", "observer.rb",
"open-uri.rb", "open3.rb", "optparse*", "ostruct.rb",
"pp.rb prettyprint.rb", "prime.rb", "profile*",
"pstore.rb", "rational.rb", "rbconfig", "resolv*",
"rexml", "rinda", "rss*", "scanf.rb", "securerandom.rb",
"set.rb", "shellwords.rb", "shell*", "singleton.rb",
"sync.rb", "tempfile.rb", "test", "thread.rb",
"thwait.rb", "time.rb", "timeout.rb", "tmpdir.rb",
"tracer.rb", "tsort.rb", "un.rb", "uri*", "weakref.rb",
"webrick*", "xmlrpc", "yaml*"]
desc "create gems of stdlib"
task :gemify => :gems do
Dir.chdir "gems" do
projects.each do |lib|
files = lib.split(/\s+/).map { |s| "../lib/#{s}" }
dir = File.basename(files.first, ".rb").sub(/\*$/, '')
sh "sow -s rubycore #{dir}"
sh "#{mv_cmd} #{files.join(" ")} #{dir}/lib"
sh "(cd #{dir}; rake check_manifest | patch)"
end
end
rm_rf Dir["lib/{README,racc,rake*,rdoc*}"]
end
task :deps do
require "rubygems"
$: << File.expand_path("~/Work/p4/zss/src/graph/dev/lib")
require "graph"
files = {}
class String
def remove_suffix suffix
sub(/#{Regexp.escape suffix}$/, "")
end
end
deps = nil
Dir.chdir "gems" do
Dir["*"].each do |proj|
Dir.chdir "#{proj}/lib" do
Dir["**/*.rb"].each do |file|
files[file.remove_suffix(".rb")] = proj
end
end
end
deps = `grep -r ^require */lib`
end
digraph do
deps.each_line do |line|
if line =~ /^([^:]+):require\s+['"]([^'"]+)['"]/ then
file, req = $1, $2.remove_suffix(".rb")
proj = file.split(/\//).first
dep = files[req]
if dep then
next if proj == dep
edge proj, dep
else
p file => req unless dep
end
else
warn "unparsable line: #{line.inspect}"
end
end
# quick little hack to color top level nodes blue
require 'dep_analyzer'
x = Hash.new { |h,k| h[k] = [] }
edges.each do |from, h|
h.keys.each do |to|
x[from] << to
end
end
(x.keys - x.minvert.keys).each do |k|
blue << self[k]
end
rotate
save "deps", "pdf"
end
end
############################################################
# My normal stuff for importing our gems into stdlib, building,
# running tests, etc.
def add_to_top(path, string)
tmp_path = "#{path}.tmp"
File.open(tmp_path, 'w') do |f|
f.puts string
f.puts
f.write File.read(path)
end
File.rename tmp_path, path
end
def add_warning(project, name, *paths)
paths.flatten.each do |path|
warn "Adding warning to #{path}"
add_to_top path, <<-EOM.gsub(/^\s+/, '').strip
######################################################################
# This file is imported from the #{project} project.
# DO NOT make modifications in this repo. They _will_ be reverted!
# File a patch instead and assign it to #{name}.
######################################################################
EOM
end
end
namespace :ryan do
namespace :update do
desc "copy over miniunit"
task :minitest do
v = ENV['VERSION'] || 'dev'
d = "~/Work/p4/zss/src/minitest/#{v}"
sh "find #{d} -name \\*.rbc -exec rm {} \\;"
sh "find #{d} -name \\*~ -exec rm {} \\;"
sh "rsync -avP #{d}/README.txt lib/minitest"
sh "rsync -avP #{d}/lib/minitest lib"
sh "rsync -avP #{d}/test/ test/minitest"
sh "chmod -R +w lib/minitest test/minitest"
add_warning("minitest", "Ryan Davis", *Dir["lib/minitest/*.rb"])
add_warning("minitest", "Ryan Davis", *Dir["test/minitest/*.rb"])
end
desc "copy over rubygems"
task :rubygems do
d = "~/Work/git/rubygems"
sh "find #{d} -name \\*.rbc -exec rm {} \\;"
sh "find #{d} -name \\*~ -exec rm {} \\;"
f = "-rvCP"
sh "rsync #{f} --delete --exclude gauntlet\* #{d}/lib/*ubygems* lib"
sh "rsync #{f} --delete #{d}/test/rubygems test"
sh "rsync #{f} #{d}/lib/rbconfig/datadir.rb lib/rbconfig"
sh "rsync #{f} #{d}/bin/gem bin"
who = "Ryan Davis or Eric Hodel"
add_warning("rubygems", who, *Dir["lib/rubygems.rb"])
add_warning("rubygems", who, *Dir["lib/rubygems/**/*.rb"])
add_warning("rubygems", who, *Dir["test/rubygems/**/*.rb"])
end
end
end
desc "run irb"
task :irb do
sh "./miniruby -I./lib ./tool/runruby.rb --extout=.ext -- bin/irb"
end
task :default => :testall
desc "haha"
task :make => "Makefile" do
sh "make"
end
def new_logfile
b, d, x = "test", File.basename(Dir.pwd), "txt"
n = Dir["#{b}.#{d}.*.#{x}"].map { |s| s[/\d+/].to_i }.max + 1 rescue 1
"#{b}.#{d}.#{n}.#{x}"
end
desc "run the tests"
task :test => "Makefile" do
sh "make test TESTS=-v 2>&1 | tee #{new_logfile}"
end
desc "run the extended tests"
task :testall => "Makefile" do
sh "make test-all TESTS=-v 2>&1 | tee #{new_logfile}"
end
desc "run the minitest tests"
task :testmt => "Makefile" do
sh "make test-all TESTS=minitest 2>&1 | tee #{new_logfile}"
end
desc "run the rubygems tests"
task :testgem => "Makefile" do
sh "make test-all TESTS=rubygems 2>&1 | tee #{new_logfile}"
end
file "Makefile" => "configure" do
sh "./configure --program-suffix=19"
end
file "configure" do
sh "autoconf"
end
Jump to Line
Something went wrong with that request. Please try again.