Sha256: 1c248fa6beaf7d4146685505916ac47e348bad32084b834f749232d52760c593
Contents?: true
Size: 1.87 KB
Versions: 4
Compression:
Stored size: 1.87 KB
Contents
dir = File.dirname(__FILE__) require 'rubygems' require 'rake' #$LOAD_PATH.unshift(File.join(dir, 'vendor', 'rspec', 'lib')) require 'spec/rake/spectask' #Gem::manage_gems #require 'rake/gempackagetask' task :default => :spec Spec::Rake::SpecTask.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/dimus/biodiversity" gem.authors = ["Dmitry Mozzherin"] gem.has_rdoc = false gem.bindir = 'bin' gem.executables = ['nnparse', 'parserver'] gem.add_dependency('treetop') 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
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
biodiversity-0.7.1 | Rakefile |
biodiversity19-0.7.1 | Rakefile |
biodiversity-0.7.0 | Rakefile |
biodiversity19-0.7.0 | Rakefile |