3 require 'rake/gempackagetask'
4 require 'rake/rdoctask'
5 require 'rake/testtask'
12 EXT_DIR = "ext/ohcount_native"
13 EXT_DL = "#{EXT_DIR}/ohcount_native.#{CONFIG['DLEXT']}"
14 ARCH_DIR = "lib/#{::Config::CONFIG['arch']}"
15 ARCH_DL = "#{ARCH_DIR}/ohcount_native.#{CONFIG['DLEXT']}"
17 CLEAN.include FileList["#{EXT_DIR}/*.{so,bundle,#{CONFIG['DLEXT']}}"],
18 FileList["#{EXT_DIR}/*.o"],
19 FileList["#{EXT_DIR}/Makefile"]
21 RDOC_OPTS = ['--quiet', '--title', 'Ohcount Reference', '--main', 'README', '--inline-source']
23 PKG_FILES = %w(README Rakefile lib/ohcount.rb) +
24 Dir.glob("ext/ohcount_native/*.{h,c,rb}") +
25 Dir.glob("ext/ohcount_native/glots/*.rb") +
26 Dir.glob("lib/ohcount/*.rb") +
30 Gem::Specification.new do |s|
33 s.platform = Gem::Platform::RUBY
35 s.rdoc_options += RDOC_OPTS
36 s.summary = "The Ohloh source code line counter"
37 s.description = s.summary
38 s.author = "Ohloh Corporation"
39 s.email = "info@ohloh.net"
40 s.homepage = "http://www.ohloh.net"
42 s.require_paths = ["lib", ARCH_DIR]
43 s.extensions << 'ext/ohcount_native/extconf.rb'
45 s.executables = ['ohcount']
48 Rake::GemPackageTask.new(SPEC) do |p|
53 task :install => :package do
54 `sudo gem install pkg/#{NAME}-#{VERS}`
57 file ARCH_DL => EXT_DL do
62 file EXT_DL => FileList["#{EXT_DIR}/Makefile", "#{EXT_DIR}/*.{c,h,rb}"] do
68 file "#{EXT_DIR}/Makefile" => "#{EXT_DIR}/extconf.rb" do
71 ruby 'extconf.rb', 'debug'
78 file "#{EXT_DIR}/polyglots.c" => FileList["#{EXT_DIR}/*.rb", "#{EXT_DIR}/glots/*.rb"] do
84 Rake::RDocTask.new do |rdoc|
86 rdoc.options += RDOC_OPTS
87 rdoc.rdoc_files.add ['README' ,'COPYING', 'lib/**/*.rb', 'ext/**/*.rb']
90 Rake::TestTask.new :ohcount_unit_tests => ARCH_DL do |t|
91 puts File.dirname(__FILE__) + '/test/unit/*_test.rb'
92 t.test_files = FileList[File.dirname(__FILE__) + '/test/unit/*_test.rb']
96 task :default => :ohcount_unit_tests