Sha256: ac2b485ef543c0199edb9e552c9122bbef2dfb84e3bf919312271c13bdd5c0f8

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'rake'
require 'rake/clean'
require 'rbconfig'
require 'rspec/core/rake_task'
include RbConfig

CLEAN.include('**/*.gem', '**/*.rbc', '**/*.rbx', '**/*.lock')

namespace 'gem' do
  desc "Create the sys-cpu gem"
  task :create => [:clean] do
    require 'rubygems/package'
    spec = eval(IO.read('sys-cpu.gemspec'))
    spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
    Gem::Package.build(spec, true)
  end

  desc "Install the sys-cpu gem"
  task :install => [:create] do
    file = Dir["*.gem"].first
    sh "gem install -l #{file}"
  end
end

desc "Run the example program"
task :example => [:clean] do
  case CONFIG['host_os']
  when /bsd|darwin|osx/i
    file = "examples/example_sys_cpu_bsd.rb"
    sh "ruby -Ilib/unix #{file}"
  when /hpux/i
    file = "examples/example_sys_cpu_hpux.rb"
    sh "ruby -Ilib/unix #{file}"
  when /linux/i
    file = "examples/example_sys_cpu_linux.rb"
    sh "ruby -Ilib/linux #{file}"
  when /windows|win32|cygwin|mingw|dos/i
    file = "examples/example_sys_cpu_windows.rb"
    sh "ruby -Ilib/windows #{file}"
  when /sunos|solaris/i
    file = "examples/example_sys_cpu_sunos.rb"
    sh "ruby -Ilib/unix #{file}"
  end

end

desc "Run the test suite"
RSpec::Core::RakeTask.new(:spec)

task :default => :spec

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sys-cpu-1.0.0 Rakefile