Sha256: 1f5206c481f396951c5516d1a700df6b3a685e8d3371a62af5a0ef710f5e5164

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

require 'bundler'
Bundler::GemHelper.install_tasks

begin
  Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
  $stderr.puts e.message
  $stderr.puts 'Run `bundle install` to install missing gems'
  exit e.status_code
end

require 'rspec/core'
require 'rspec/core/rake_task'
require 'rake/dsl_definition'
require 'rake'
require 'rspec'
require 'rspec/core/rake_task'


task :default => :spec

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

task :tt do
  dir = File.dirname(__FILE__)
  ['scientific_name_clean',
   'scientific_name_dirty',
   'scientific_name_canonical'].each do |f|
    file = "#{dir}/lib/biodiversity/parser/#{f}"
    FileUtils.rm("#{file}.rb") if FileTest.exist?("#{file}.rb")
    system("tt #{file}.treetop")
    rf = "#{file}.rb"
    rfn = open(rf + '.tmp', 'w')
    skip_head = false
    f = open(rf)
    # getting around a bug in treetop which prevents setting
    # UTF-8 encoding in ruby19
    f.each_with_index do |l, i|
      skip_head = l.match(/^# Autogenerated/) if i == 0
      if skip_head && (l.strip == '' || l.match(/^# Autogenerated/))
        next
      else
        skip_head = false
        rfn.write(l)
      end
    end
    rfn.close
    f.close
    `mv #{rf}.tmp #{rf}`
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
biodiversity19-3.1.5 Rakefile
biodiversity-3.1.5 Rakefile
biodiversity19-3.1.4 Rakefile
biodiversity-3.1.4 Rakefile
biodiversity19-3.1.3 Rakefile
biodiversity-3.1.3 Rakefile