File: Rakefile

package info (click to toggle)
ruby-mixlib-install 3.11.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 167,588 kB
  • sloc: ruby: 3,776; sh: 675; makefile: 3
file content (56 lines) | stat: -rw-r--r-- 1,361 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
45
46
47
48
49
50
51
52
53
54
55
56
require "bundler/gem_tasks"
require "rspec/core/rake_task"

[:unit, :functional].each do |type|
  RSpec::Core::RakeTask.new(type) do |t|
    t.pattern = "spec/#{type}/**/*_spec.rb"
    t.rspec_opts = [].tap do |a|
      a.push("--color")
      a.push("--format progress")
    end.join(" ")
  end
end

begin
  require "chefstyle"
  require "rubocop/rake_task"
  RuboCop::RakeTask.new(:chefstyle) do |task|
    task.options << "--display-cop-names"
  end
rescue LoadError
  puts "chefstyle gem is not installed"
end

namespace :travis do
  desc "Run tests on Travis CI"
  task ci: %w{chefstyle unit functional}
end

desc "Render product matrix documentation"
task "matrix" do
  require "mixlib/install/product"

  doc_file = File.join(File.dirname(__FILE__), "PRODUCT_MATRIX.md")
  puts "Updating doc file at: #{doc_file}"

  File.open(doc_file, "w+") do |f|
    f.puts("| Product | Product Key  |")
    f.puts("| ------- | ------------ |")
    PRODUCT_MATRIX.products.sort.each do |p_key|
      product = PRODUCT_MATRIX.lookup(p_key)
      f.puts("| #{product.product_name} | #{p_key} |")
    end
    f.puts("")
    f.puts("Do not modify this file manually. It is automatically rendered via a rake task.")
  end
end

task :console do
  require "irb"
  require "irb/completion"
  require "mixlib/install"
  ARGV.clear
  IRB.start
end

task default: %w{travis:ci}