Class: Simp::Rake::Pupmod::Helpers
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Simp::Rake::Pupmod::Helpers
- Defined in:
- lib/simp/rake/pupmod/helpers.rb
Overview
Rake tasks for SIMP Puppet modules
Instance Method Summary collapse
- #define_tasks ⇒ Object
-
#initialize(base_dir = Dir.pwd) ⇒ Helpers
constructor
A new instance of Helpers.
Constructor Details
#initialize(base_dir = Dir.pwd) ⇒ Helpers
Returns a new instance of Helpers.
22 23 24 25 26 27 28 29 |
# File 'lib/simp/rake/pupmod/helpers.rb', line 22 def initialize( base_dir = Dir.pwd ) @base_dir = base_dir Dir[ File.join(File.dirname(__FILE__),'*.rb') ].each do |rake_file| next if rake_file == __FILE__ require rake_file end define_tasks end |
Instance Method Details
#define_tasks ⇒ Object
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/simp/rake/pupmod/helpers.rb', line 31 def define_tasks # These gems aren't always present, for instance # on Travis with --without development begin require 'puppet_blacksmith/rake_tasks' Blacksmith::RakeTask.new do |t| t.tag_pattern = "%s" # Use tage format "X.Y.Z" instead of "vX.Y.Z" end rescue LoadError end # Lint & Syntax exclusions exclude_paths = [ "bundle/**/*", "pkg/**/*", "dist/**/*", "vendor/**/*", "spec/**/*", ] PuppetSyntax.exclude_paths = exclude_paths # See: https://github.com/rodjek/puppet-lint/pull/397 Rake::Task[:lint].clear PuppetLint.configuration.ignore_paths = exclude_paths PuppetLint::RakeTask.new :lint do |config| config.ignore_paths = PuppetLint.configuration.ignore_paths end Simp::Rake::Fixtures.new( @base_dir ) Simp::Rake::Pkg.new( @base_dir ) do | t | t.clean_list << "#{t.base_dir}/spec/fixtures/hieradata/hiera.yaml" end Simp::Rake::Beaker.new( @base_dir ) desc "Run acceptance tests" RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end desc 'Populate CONTRIBUTORS file' task :contributors do system("git log --format='%aN' | sort -u > CONTRIBUTORS") end desc 'lint metadata.json' task :metadata do sh "metadata-json-lint metadata.json" end desc "Run syntax, lint, and spec tests." task :test => [ :syntax, :lint, :spec_parallel, :metadata, ] desc <<-EOM Run parallel spec tests. This will NOT run acceptance tests. Use env var `SPEC_clean=yes` to run `:spec_clean` after tests EOM task :spec_parallel do test_targets = ['spec/classes', 'spec/defines', 'spec/unit', 'spec/functions'] if ENV['SIMP_PARALLEL_TARGETS'] test_targets += ENV['SIMP_PARALLEL_TARGETS'].split end test_targets.delete_if{|dir| !File.directory?(dir)} Rake::Task[:spec_prep].invoke ParallelTests::CLI.new.run('--type test -t rspec'.split + test_targets) if ENV.fetch('SPEC_clean', 'no') == 'yes' Rake::Task[:spec_clean].invoke end end end |