Sha256: 8cd312aedb28cebc0810464538aa122f58cb24b14e02d980413acf7888316305

Contents?: true

Size: 1.24 KB

Versions: 19

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

19 entries across 19 versions & 2 rubygems

Version Path
biodiversity-3.5.1 Rakefile
biodiversity-3.5.0 Rakefile
biodiversity-3.4.6 Rakefile
biodiversity-3.4.5 Rakefile
biodiversity-3.4.4 Rakefile
biodiversity-3.4.3 Rakefile
biodiversity-3.4.2 Rakefile
biodiversity-3.4.1 Rakefile
biodiversity-3.4.0 Rakefile
biodiversity-3.3.0 Rakefile
biodiversity-3.2.1 Rakefile
biodiversity-3.2.0 Rakefile
biodiversity-3.1.10 Rakefile
biodiversity-3.1.9 Rakefile
biodiversity-3.1.8 Rakefile
biodiversity19-3.1.7 Rakefile
biodiversity-3.1.7 Rakefile
biodiversity19-3.1.6 Rakefile
biodiversity-3.1.6 Rakefile