Sha256: eecdaf465b2fb75ffd0b1dff5261d4c06ce77f99f9f4c80fd8db8e2f95c69ad8

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require 'rake/extensiontask'
require 'bundler/gem_tasks'

# Gem Spec
gem_spec = Gem::Specification.load('tree-sitter.gemspec')

# Ruby Extension
Rake::ExtensionTask.new('tree-sitter', gem_spec) do |ext|
  ext.name    = 'treesitter'
  ext.lib_dir = File.join('lib', 'tree-sitter')
end

desc 'Wipe project (including tree-sitter files)'
task :clean_hard do
  Rake::Task['clean'].invoke
  ext_dir = File.join(File.dirname(__FILE__), 'ext', 'tree-sitter')
  Dir.chdir(ext_dir) do
    FileUtils.rm_rf('out')
  end
end

# Testing
require 'rake/testtask'

Rake::TestTask.new('test:unit') do |t|
  t.libs << 'lib'
  t.libs << 'test'
  t.pattern = 'test/**/*test_*.rb'
  t.verbose = true
  t.warning = false
end

task 'test:unit' => :compile

desc 'Run unit and conformance tests'
task test: %w(test:unit)

require 'rubocop/rake_task'

RuboCop::RakeTask.new(:rubocop)

task :console do
  require 'pry'
  require 'tree-sitter'

  def reload!
    files = $LOADED_FEATURES.select { |feat| feat =~ /\/tree-sitter\// }
    files.each { |file| load file }
  end

  ARGV.clear
  Pry.start
end

desc 'Pretty format code'
task :format do
  puts `astyle -n --indent=spaces=2 --style=1tbs --keep-one-line-blocks \
        $(ack -n -f --type=cc ext/tree-sitter/)`
  puts `bundle exec rubocop -a`
end

task default: [:test]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tree-sitter-0.1.0 Rakefile