rakefile 2.0 KB
Newer Older
M
Mark VanderVoord 已提交
1 2 3 4 5 6 7
# ==========================================
#   Unity Project - A Test Framework for C
#   Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
#   [Released under MIT License. Please refer to license.txt for details]
# ==========================================

UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/'
8
$verbose = false
M
Mark VanderVoord 已提交
9 10 11 12

require 'rake'
require 'rake/clean'
require UNITY_ROOT + 'rakefile_helper'
13
require 'rspec/core/rake_task'
M
Mark VanderVoord 已提交
14 15

TEMP_DIRS = [
16 17
	File.join(UNITY_ROOT, 'build'),
	File.join(UNITY_ROOT, 'sandbox')
M
Mark VanderVoord 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
]

TEMP_DIRS.each do |dir|
  directory(dir)
  CLOBBER.include(dir)
end

task :prepare_for_tests => TEMP_DIRS

include RakefileHelpers

# Load proper GCC as defult configuration
DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml'
configure_toolchain(DEFAULT_CONFIG_FILE)

desc "Test unity with its own unit tests"
task :unit => [:prepare_for_tests] do
  run_tests get_unit_test_files
end

desc "Test unity's helper scripts"
task :scripts => [:prepare_for_tests] do
  Dir['tests/test_*.rb'].each do |scriptfile|
    require "./"+scriptfile
  end
end

45 46 47 48 49
desc "Run all rspecs"
RSpec::Core::RakeTask.new(:spec) do |t|
  t.pattern = 'spec/**/*_spec.rb'
end

M
Mark VanderVoord 已提交
50 51 52 53 54 55
desc "Generate test summary"
task :summary do
  report_summary
end

desc "Build and test Unity"
56
task :all => [:clean, :prepare_for_tests, :scripts, :unit, :style, :summary]
M
Mark VanderVoord 已提交
57 58 59 60 61 62 63 64 65 66 67 68
task :default => [:clobber, :all]
task :ci => [:no_color, :default]
task :cruise => [:no_color, :default]

desc "Load configuration"
task :config, :config_file do |t, args|
  configure_toolchain(args[:config_file])
end

task :no_color do
  $colour_output = false
end
69 70 71 72

task :verbose do
  $verbose = true
end
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

namespace :style do
  desc "Check style"
  task :check do
    `rubocop ../`
    report "Style Checked."
  end

  desc "Attempt to Autocorrect style"
  task :auto do
    `rubocop ../ --auto-correct`
    report "Autocorrected What We Could."
  end

  desc "Update style todo list"
  task :todo do
    `rubocop ../ --auto-gen-config`
    report "Updated Style TODO List."
  end
end

task :style => ['style:check']