Sha256: 20724ea95114730f2d7dbb3447e60592047323c5b948dfbb3a32475572d4a0b0

Contents?: true

Size: 1.94 KB

Versions: 2

Compression:

Stored size: 1.94 KB

Contents

dir = File.dirname(__FILE__)
require 'rubygems'
require 'rake'
#$LOAD_PATH.unshift(File.join(dir, 'vendor', 'rspec', 'lib'))
require 'rspec/core'
require 'rspec/core/rake_task'

#Gem::manage_gems
#require 'rake/gempackagetask'

task :default => :spec

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

ruby_version = RUBY_VERSION.split('.')[0..1].join('').to_i


begin
  require 'jeweler'
  Jeweler::Tasks.new do |gem|
    gem.name = ruby_version < 19 ? "biodiversity" : "biodiversity19"
    gem.summary = 'Parser of scientific names'
    gem.description = 'Tools for biodiversity informatics'
    gem.email = "dmozzherin@gmail.com"
    gem.homepage = "http://github.com/GlobalNamesArchitecture/biodiversity"
    gem.authors = ["Dmitry Mozzherin"]
    gem.has_rdoc = false
    gem.bindir = 'bin'
    gem.executables = ['nnparse', 'parserver']
    gem.add_dependency('treetop')
    gem.add_dependency('parallel')
    gem.add_dependency('json') if ruby_version < 19
    gem.add_development_dependency "rspec"
    # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
  end
rescue LoadError
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end

task :tt do
  ['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

2 entries across 2 versions & 1 rubygems

Version Path
biodiversity19-2.1.0 Rakefile
biodiversity19-2.0.0 Rakefile