Sha256: 1b88f18b1986a724b36e7e944ee00c2ec0498b81cc67585fc62e761a3790b1f5

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

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

CLEAN.include(
  '**/*.gem',                # Gem files
  '**/*.rbc',                # Rubinius
  '**/*.o',                  # C object file
  '**/*.log',                # Ruby extension build log
  '**/Makefile',             # C Makefile
  '**/conftest.dSYM',        # OS X build directory
  "**/*.#{CONFIG['DLEXT']}", # C shared object
  'tmp'                      # Rake compiler
)

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

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

Rake::ExtensionTask.new('socket') do |t|
  t.ext_dir = 'ext/sctp'
  t.lib_dir = 'lib/sctp'
end

desc "Create dummy IP addresses to use for testing"
task :create_dummy_links do
  if RbConfig::CONFIG['host_os'] =~ /linux/i
    system('sudo ip link add dummy1 type dummy')
    system('sudo ip link add dummy2 type dummy')
    system('sudo ip addr add 1.1.1.1/24 dev dummy1')
    system('sudo ip addr add 1.1.1.2/24 dev dummy2')
    system('sudo ip link set dummy1 up')
    system('sudo ip link set dummy2 up')
    system('ip link show')
  else
    system("sudo ifconfig lo1 create")
    system("sudo ifconfig lo1 1.1.1.1/24 up")
    system("sudo ifconfig lo2 create")
    system("sudo ifconfig lo2 1.1.1.2/24 up")
    system("sudo ifconfig -a")
  end
end

RSpec::Core::RakeTask.new

task :spec => :compile
task :default => [:clean, :spec]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sctp-socket-0.1.3 Rakefile