Last active
October 27, 2015 17:14
-
-
Save pwelch/9d4a1a6fc287a48f1a83 to your computer and use it in GitHub Desktop.
Rake tasks for testing .rb or .json files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Testing tasks | |
namespace :test do | |
desc 'Runs ruby or jq syntax check on roles' | |
task :roles do | |
puts '===== Running ruby syntax check on roles' | |
Dir.foreach('roles/') do |file| | |
if file =~ /.rb$/ | |
sh "ruby -c roles/#{file}" | |
elsif file =~ /.json$/ | |
sh "cat roles/#{file} | jq . > /dev/null" | |
end | |
end | |
end | |
desc 'Runs ruby or jq syntax check on environments' | |
task :environments do | |
puts '===== Running ruby syntax check on environments' | |
Dir.foreach('environments/') do |file| | |
if file =~ /.rb$/ | |
sh "ruby -c environments/#{file}" | |
elsif file =~ /.json$/ | |
sh "cat environments/#{file} | jq . > /dev/null" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment