Sha256: be26f76b44ee40287093af69f94aded6a716dc697370cd70297bf88fda74d8c8

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

require 'rake'
require 'rake/clean'
require 'rake/testtask'

desc "Clean the build files for the sys-uname source for UNIX systems"
task :clean do
   FileUtils.rm_rf('sys') if File.exists?('sys')

   Dir.chdir('ext') do
      unless RUBY_PLATFORM.match('mswin')
         FileUtils.rm_rf('sys') if File.exists?('sys')
         build_file = 'uname.' + Config::CONFIG['DLEXT']
         sh 'make distclean' if File.exists?(build_file)
      end
   end
end

desc "Build the sys-uname package on UNIX systems (but don't install it)"
task :build => [:clean] do
   Dir.chdir('ext') do
      unless RUBY_PLATFORM.match('mswin')
         ruby 'extconf.rb'
         sh 'make'
         build_file = 'uname.' + Config::CONFIG['DLEXT']
         Dir.mkdir('sys') unless File.exists?('sys')
         FileUtils.cp(build_file, 'sys')
      end
   end
end

desc "Run the example program"
task :example => [:build] do
   Dir.mkdir('sys') unless File.exists?('sys')
   if RUBY_PLATFORM.match('mswin')
      sh 'ruby -Ilib examples/uname_test.rb'
   else
      sh 'ruby -Iext examples/uname_test.rb'
   end
end

if RUBY_PLATFORM.match('mswin')
   desc "Install the sys-uname package (non-gem)"
   task :install do
      sh 'ruby install.rb'
   end
else
   desc "Install the sys-uname package"
   task :install => [:build] do
      Dir.chdir('ext') do
         sh 'make install'
      end
   end
end

desc "Install the sys-uname package as a gem"
task :install_gem do
   ruby 'sys-uname.gemspec'
   file = Dir['sys-uname*.gem'].first
   sh "gem install #{file}"
end

desc "Run the test suite"
Rake::TestTask.new("test") do |t|
   if RUBY_PLATFORM.match('mswin')
      t.libs << 'lib'
   else
      task :test => :build
      t.libs << 'ext'
      t.libs.delete('lib')
   end
   t.test_files = FileList['test/tc_uname.rb']
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sys-uname-0.8.0 Rakefile