Skip to content

Commit

Permalink
Initial version of methods to check that the Debug-GC build is up-to-…
Browse files Browse the repository at this point in the history
…date.

These are currently based on the flawed assumption that _only_ the
latest build (by date) is up-to-date.  The checks are disabled until this
is fixed.
  • Loading branch information
chapados committed Dec 25, 2008
1 parent a9454a6 commit dd78bfc
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Ruby/Rakefile
Expand Up @@ -7,14 +7,49 @@

desc "Open a macirb session preloaded with Git framework"
task :console do
# update_warning_exit unless latest_cocoagit_build("Debug-GC")
sh "./bin/macirb -rubygems -r lib/cocoagit.rb"
end

desc "Run test suite"
task :test do
# update_warning_exit unless latest_cocoagit_build("Debug-GC")
sh "bin/macruby test/suite.rb"
end

def update_warning_exit
warning = <<END
MacRuby requires a garbage-collection aware framework, and therefore
uses the Debug-GC build of cocoagit.
It appears that your Debug-GC build of Git.framework might be out of date.
Rebuild the Debug-GC target in xcode to make sure you are using your latest changes
END
puts warning
exit 1
end

# Not correct - can't just use the date
def latest_cocoagit_build(target)
build_dir = File.join(File.dirname(__FILE__), '..', 'build')
projects = %w[Debug Debug-GC Release Release-GC]
project_dates =
projects.map do |p|
project_file = File.join(build_dir, p, "Git.framework", "Git")
date = File.exist?(project_file) && File.mtime(project_file)
if date
{:project => p, :date => date}
else
nil
end
end.compact
project_dates.sort! { |a, b| a[:date] <=> b[:date] }
target == project_dates.last[:project]
end


# MacRuby management tasks

namespace :macruby do
MACRUBY_SRC = "macruby-src"
MACRUBY_LIB = File.join(MACRUBY_SRC, "libmacruby.1.9.0.dylib")
Expand Down

0 comments on commit dd78bfc

Please sign in to comment.