public

exec rails_best_practices on "rails3 rake" for jenkins plot plugin

  • Download Gist
rails_best_practices.rake
Ruby
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
namespace :rails_best_practices do
desc "run rails best practices"
task :jenkins_plot_plugin => :environment do
 
cd Rails.root do
 
OUTDIR = "#{Rails.root}/reports"
mkdir OUTDIR unless FileTest.exist? OUTDIR
OUTFILE = "#{OUTDIR}/rails_best_practices.properties"
 
Tempfile.open('rails_best_practices.XXXXXX', OUTDIR) do |file|
TMPFILE = file.path
 
sh <<EOL
bundle exec rails_best_practices > #{TMPFILE}; ¥
if [ $? -eq 0 ]; ¥
then ¥
echo "YVALUE=0" > #{OUTFILE}; ¥
else ¥
NUM=`awk '/^Found [0-9]+ [a-zA-Z]+s/{ print $2; }' < #{TMPFILE}` ;
echo "YVALUE=$NUM" > #{OUTFILE}; ¥
fi;
cat #{TMPFILE};
EOL
end
 
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.