forked from ruby-amqp/amq-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
55 lines (44 loc) · 1.1 KB
/
Rakefile
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]