Skip to content

Commit

Permalink
Improved rake file for rspec-puppet-init
Browse files Browse the repository at this point in the history
Closes #66
  • Loading branch information
rodjek committed Feb 26, 2013
1 parent 1f3b716 commit 185a7e3
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions lib/rspec-puppet/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,34 @@ def self.safe_make_symlink(source, target)
end

def self.safe_create_rakefile
content = <<-EOF
content = <<-'EOF'
require 'rake'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*/*_spec.rb'
desc "Run all RSpec code examples"
RSpec::Core::RakeTask.new(:rspec) do |t|
t.rspec_opts = File.read("spec/spec.opts").chomp || ""
end
SPEC_SUITES = (Dir.entries('spec') - ['.', '..','fixtures']).select {|e| File.directory? "spec/#{e}" }
namespace :rspec do
SPEC_SUITES.each do |suite|
desc "Run #{suite} RSpec code examples"
RSpec::Core::RakeTask.new(suite) do |t|
t.pattern = "spec/#{suite}/**/*_spec.rb"
t.rspec_opts = File.read("spec/spec.opts").chomp || ""
end
end
end
task :default => :rspec
begin
if Gem::Specification::find_by_name('puppet-lint')
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
task :default => [:rspec, :lint]
end
rescue Gem::LoadError
end
EOF
if File.exists? 'Rakefile'
Expand Down

0 comments on commit 185a7e3

Please sign in to comment.