Skip to content

Instantly share code, notes, and snippets.

@bash0C7
Forked from holysugar/rbp-to-jenkins-plot.sh
Created May 19, 2012 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bash0C7/2730797 to your computer and use it in GitHub Desktop.
Save bash0C7/2730797 to your computer and use it in GitHub Desktop.
exec rails_best_practices on "padrino rake" for jenkins plot plugin
namespace :rails_best_practices do
desc "run rails best practices"
task :jenkins_plot_plugin => :environment do
cd Padrino.root do
OUTDIR = "#{Padrino.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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment