File: Rakefile

package info (click to toggle)
ruby-digest-crc 0.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 912 kB
  • sloc: ansic: 2,136; ruby: 1,269; makefile: 4
file content (57 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download
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
56
57
require 'rubygems'

begin
  require 'bundler/setup'
rescue LoadError => e
  abort e.message
end

require 'rake'
require 'rubygems/tasks'
Gem::Tasks.new

namespace :build do
  desc "Builds the C extensions"
  task :c_exts do
    Dir.chdir('ext/digest') { sh 'rake' }
  end
end

require 'rake/clean'
CLEAN.include('ext/digest/crc*/extconf.h')
CLEAN.include('ext/digest/crc*/Makefile')
CLEAN.include('ext/digest/crc*/*.o')
CLEAN.include('ext/digest/crc*/*.so')

file 'spec/integration/docker/digest-crc.gem' do |t|
  sh "gem build -o #{t.name} digest-crc.gemspec"
end

require 'rspec/core/rake_task'
namespace :spec do
  RSpec::Core::RakeTask.new(:pure) do |t|
    t.exclude_pattern = 'spec/integration/*_spec.rb'
  end
  task :pure => :clean

  if RUBY_ENGINE == 'ruby'
    RSpec::Core::RakeTask.new(:c_exts) do |t|
      t.exclude_pattern = 'spec/integration/*_spec.rb'
    end
    task :c_exts => 'build:c_exts'
  end

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

task :spec => 'spec:pure'
task :spec => 'spec:c_exts' if RUBY_ENGINE == 'ruby'

task :test => :spec
task :default => :spec

require 'yard'
YARD::Rake::YardocTask.new
task :doc => :yard