File: Rakefile

package info (click to toggle)
ruby-amq-protocol 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 476 kB
  • sloc: ruby: 5,153; python: 248; makefile: 3
file content (55 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require "bundler"
Bundler.setup

require "rake"
require "rspec/core/rake_task"

$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "amq/protocol/version"

task :gem => :build
task :build do
  system "gem build amq-protocol.gemspec"
end

task :install => :build do
  system "gem install amq-protocol-#{AMQ::Protocol::VERSION}.gem"
end

def extension
  RUBY_PLATFORM =~ /darwin/ ? "bundle" : "so"
end

def compile!
  puts "Compiling native extensions..."
  Dir.chdir(Pathname(__FILE__).dirname + "ext/") do
    `bundle exec ruby extconf.rb`
    `make`
    `cp client.#{extension} ../lib/amq/protocol/native/`
  end
end

RSpec::Core::RakeTask.new("spec") do |spec|
  spec.pattern = "spec/**/*_spec.rb"
end

RSpec::Core::RakeTask.new("clean_spec") do |spec|
  spec.pattern = "spec/**/*_spec.rb"
end

task :compile do
  compile!
end

task :clean do
  puts "Cleaning out native extensions..."
  begin
    Dir.chdir(Pathname(__FILE__).dirname + "lib/amq-protocol/native") do
      `rm client.#{extension}`
    end
  rescue Exception => e
    puts e.message
  end
end

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