=begin Copyright 2020 Alex Douckas , Tasos Laskos This file is part of the Engine Framework project and is subject to redistribution and commercial restrictions. Please see the Engine Framework web site for more information on licensing and terms of use. =end require File.expand_path(File.dirname(__FILE__)) + '/lib/cuboid' begin require 'rspec' require 'rspec/core/rake_task' namespace :spec do desc 'Run core library tests.' RSpec::Core::RakeTask.new( :core ) do |t| t.pattern = FileList[ 'spec/cuboid/**/*_spec.rb' ] end desc 'Run plugin tests.' RSpec::Core::RakeTask.new( :plugins ) do |t| t.pattern = FileList[ 'spec/components/plugins/**/*_spec.rb' ] end end RSpec::Core::RakeTask.new rescue LoadError puts 'If you want to run the tests please install rspec first:' puts ' gem install rspec' end desc 'Generate docs.' task :docs do outdir = "../cuboid-docs" sh "rm -rf #{outdir}" sh "mkdir -p #{outdir}" sh "yardoc -o #{outdir}" sh "rm -rf .yardoc" end desc 'Remove reporter and log files.' task :clean do files = %w(error.log *.crf *.csf *.yaml *.json *.marshal *.gem pkg/*.gem reports/*.crf snapshots/*.csf logs/*.log spec/support/logs/*.log spec/support/reports/*.crf spec/support/snapshots/*.csf ).map { |file| Dir.glob( file ) }.flatten next if files.empty? puts 'Removing:' files.each { |file| puts " * #{file}" } FileUtils.rm files end desc 'Build the gem.' task build: [ :clean ] do sh "gem build cuboid.gemspec" end desc 'Build and install the gem.' task install: [ :build ] do sh "gem install cuboid-#{Cuboid::VERSION}.gem" end desc 'Push a new version to Rubygems' task publish: [ :build ] do sh "git tag -a v#{Cuboid::VERSION} -m 'Version #{Cuboid::VERSION}'" sh "gem push cuboid-#{Cuboid::VERSION}.gem" end task release: [ :publish ]