Sha256: aa9be4ce8607e68da8721cb2e7effd8a03b39af2fd0a9f1ee555267da869802d

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

begin
  require 'bundler/gem_tasks'
rescue LoadError
  puts 'Could not load bundler/gem_tasks'
end

begin
  require 'rspec/core/rake_task'
  RSpec::Core::RakeTask.new(:spec)
rescue LoadError
  puts 'Could not load rspec/core/rake_tas'
end


task default: :compile

require 'ffi'

task default: :compile

desc 'Compile drafter'
task :compile do
  prefix = FFI::Platform.mac? ? '' : 'lib.target/'
  path = File.expand_path("ext/drafter/build/out/Release/#{prefix}libdrafter.#{FFI::Platform::LIBSUFFIX}", File.dirname(__FILE__))
  puts "Path to the compiled drafter library: #{path}"
  if !File.exist?(path) || ENV['RECOMPILE']
    puts 'The library does not exist, lets compile it'
    unless File.directory?(File.expand_path('ext/drafter/ext/snowcrash/src'))
      puts 'Initializing submodules as they are not checked out...'
      `git submodule update --init --recursive`
    end
    puts 'Compiling...'
    `cd #{File.expand_path('ext/drafter/')} && ./configure --shared && make drafter`
    status = $CHILD_STATUS.to_i
    if status == 0
      puts 'Compiling done.'
    else
      raise 'Compiling error, exiting.'
    end
  else
    puts 'Extension already compiled. To recompile set env variable RECOMPILE=true.'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lounge_lizard-0.1.4 Rakefile
lounge_lizard-0.1.3 Rakefile