From 22a1d8b3f57cc5be840a46b9b0766cfea9c50322 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sun, 22 Nov 2015 20:34:52 +0900 Subject: [PATCH] Show code on benchmark --- bin/bench | 2 ++ wercker.yml | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/bench b/bin/bench index 2008bf21..fdf1ab28 100755 --- a/bin/bench +++ b/bin/bench @@ -9,6 +9,7 @@ require 'hamlit1' if File.exist?('hamlit1') class Bench < Thor class_option :with_hamlit1, type: :boolean, aliases: ['-w'] + class_option :show_template, type: :boolean, aliases: ['-t'] desc 'bench HAML', 'Benchmark haml template' option :compile, type: :boolean, aliases: ['-c'] @@ -37,6 +38,7 @@ class Bench < Thor def render(file) puts "#{?= * 49}\n Rendering: #{file}\n#{?= * 49}" haml = File.read(file) + puts haml + "\n" if options[:show_template] object = Object.new ruby_file = file.gsub(/\.haml\z/, '.rb') if File.exist?(ruby_file) diff --git a/wercker.yml b/wercker.yml index f16f04bb..e59464f8 100644 --- a/wercker.yml +++ b/wercker.yml @@ -14,22 +14,22 @@ build: code: bin/clone - script: name: "[benchmark] static attributes" - code: bin/bench bench -w benchmark/boolean_attribute.haml benchmark/class_attribute.haml benchmark/id_attribute.haml benchmark/data_attribute.haml benchmark/common_attribute.haml + code: bin/bench bench -w -t benchmark/boolean_attribute.haml benchmark/class_attribute.haml benchmark/id_attribute.haml benchmark/data_attribute.haml benchmark/common_attribute.haml - script: name: "[benchmark] dynamic attributes" - code: bin/bench bench -w benchmark/dynamic_attributes/boolean_attribute.haml benchmark/dynamic_attributes/class_attribute.haml benchmark/dynamic_attributes/id_attribute.haml benchmark/dynamic_attributes/data_attribute.haml benchmark/dynamic_attributes/common_attribute.haml + code: bin/bench bench -w -t benchmark/dynamic_attributes/boolean_attribute.haml benchmark/dynamic_attributes/class_attribute.haml benchmark/dynamic_attributes/id_attribute.haml benchmark/dynamic_attributes/data_attribute.haml benchmark/dynamic_attributes/common_attribute.haml - script: name: "[benchmark] plain text" - code: bin/bench bench -w benchmark/plain.haml + code: bin/bench bench -w -t benchmark/plain.haml - script: name: "[benchmark] script" - code: bin/bench bench -w benchmark/script.haml + code: bin/bench bench -w -t benchmark/script.haml - script: name: "[benchmark] attribute_builder bench by faml" - code: bin/bench bench -w benchmark/etc/attribute_builder.haml + code: bin/bench bench -w -t benchmark/etc/attribute_builder.haml - script: name: "[benchmark] slim-template/slim/benchmarks" code: bundle exec ruby benchmark/slim/run-benchmarks.rb - script: name: "[benchmark] static analyzer" - code: bin/bench bench -w benchmark/etc/static_analyzer.haml + code: bin/bench bench -w -t benchmark/etc/static_analyzer.haml