require 'bundler/gem_tasks'
require 'rake/testtask'
require 'yard'
require 'beowulf'
require 'awesome_print'

Rake::TestTask.new(:test) do |t|
  t.libs << 'test'
  t.libs << 'lib'
  t.test_files = FileList['test/**/*_test.rb']
  t.ruby_opts << if ENV['HELL_ENABLED']
    '-W2'
  else
    '-W1'
  end
end

YARD::Rake::YardocTask.new do |t|
  t.files = ['lib/**/*.rb']
end

task default: :test

namespace :clean do
  desc 'Deletes test/fixtures/vcr_cassettes/*.yml so they can be rebuilt fresh.'
  task :vcr do |t|
    exec 'rm -v test/fixtures/vcr_cassettes/*.yml'
  end
end

desc 'Ruby console with beowulf already required.'
task :console do
  exec "irb -r beowulf -I ./lib"
end

desc 'Build a new version of the beowulf gem.'
task :build do
  exec 'gem build beowulf.gemspec'
end

desc 'Publish the current version of the beowulf gem.'
task :push do
  exec "gem push beowulf-ruby-#{Beowulf::VERSION}.gem"
end

# We're not going to yank on a regular basis, but this is how it's done if you
# really want a task for that for some reason.

# desc 'Yank the current version of the beowulf gem.'
# task :yank do
#   exec "gem yank beowulf -v #{Beowulf::VERSION}"
# end
