require 'rubygems' require 'rake' require 'rake/testtask' # TODO require 'rake/rdoctask' require 'rake/packagetask' require 'rake/gempackagetask' # TODO require 'rake/contrib/rubyforgepublisher' require File.join(File.dirname(__FILE__), 'lib', 'luruju', 'version') PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' PKG_NAME = 'luruju' PKG_VERSION = Luruju::VERSION::STRING + PKG_BUILD PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" Rake::TestTask.new('test') do |t| t.libs << "test" t.pattern = "test/**/*_test.rb" # t.warning = true end # Create compressed packages dist_dirs = [ "lib", "test" ] spec = Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = PKG_NAME s.version = PKG_VERSION s.summary = "A library for coordinating with Ruby And JUDE." # TODO s.description = %q{} s.author = "Shuhei Nomura" # TODO s.email = "david@loudthinking.com" s.rubyforge_project = PKG_NAME s.homepage = "http://luruju.com" s.has_rdoc = false # TODO # TODO s.extra_rdoc_files = ["README"] s.requirements << 'JUDE Community' s.add_dependency('activesupport', '= 1.4.2' + PKG_BUILD) s.require_path = 'lib' s.autorequire = 'luruju' s.files = [ "LICENSE", "Rakefile"] # TODO s.files << "CHANGELOG" # TODO s.files << "README" dist_dirs.each do |dir| s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |i| (/^\.svn/ =~ i) or (/\~\z/) =~ i } end end Rake::GemPackageTask.new(spec) do |p| p.gem_spec = spec p.need_tar = true p.need_zip = true end task :lines do lines, codelines, total_lines, total_codelines = 0, 0, 0, 0 for file_name in FileList["lib/**/*.rb"] next if file_name =~ /vendor/ f = File.open(file_name) while line = f.gets lines += 1 next if line =~ /^\s*$/ next if line =~ /^\s*#/ codelines += 1 end puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}" total_lines += lines total_codelines += codelines lines, codelines = 0, 0 end puts "Total: Lines #{total_lines}, LOC #{total_codelines}" end