DESCRIPTION Used local runner to perform the following tasks on my Arch Linux dev machine 1. Check if apache is installed on arch 2. Check if httpd service is enabled and running 3. Check if port 80 is listening COMMENTS Limited capabilities but seems to have support for basic testing on mulitple environments: local, SSH and Docker API using multiple configuration management tools like Puppet and Ansible. REFERENCES [0]: https://serverspec.org/tutorial.html [1]: https://serverspec.org/resource_types.html
27 lines
685 B
Ruby
27 lines
685 B
Ruby
require 'rake'
|
|
require 'rspec/core/rake_task'
|
|
|
|
task :spec => 'spec:all'
|
|
task :default => :spec
|
|
|
|
namespace :spec do
|
|
targets = []
|
|
Dir.glob('./spec/*').each do |dir|
|
|
next unless File.directory?(dir)
|
|
target = File.basename(dir)
|
|
target = "_#{target}" if target == "default"
|
|
targets << target
|
|
end
|
|
|
|
task :all => targets
|
|
task :default => :all
|
|
|
|
targets.each do |target|
|
|
original_target = target == "_default" ? target[1..-1] : target
|
|
desc "Run serverspec tests to #{original_target}"
|
|
RSpec::Core::RakeTask.new(target.to_sym) do |t|
|
|
ENV['TARGET_HOST'] = original_target
|
|
t.pattern = "spec/#{original_target}/*_spec.rb"
|
|
end
|
|
end
|
|
end
|