Refactor benchmark and showing code

This commit is contained in:
Takashi Kokubun 2015-10-31 21:46:09 +09:00
parent 4f4fd9e962
commit 5a542ec527
2 changed files with 5 additions and 3 deletions

View File

@ -52,11 +52,13 @@ end
class Bench < Thor
desc 'bench HAML', 'Benchmark haml template'
option :show_code, type: :boolean, aliases: ['-c']
def bench(file)
puts "#{?= * 49}\n Compilation: #{file}\n#{?= * 49}"
bench_compile(file)
puts "#{?= * 49}\n Rendering: #{file}\n#{?= * 49}"
bench_render(file)
code(file) if options[:show_code]
end
desc 'code HAML', 'Show compiled code'

View File

@ -4,13 +4,13 @@ build:
- bundle-install
- script:
name: old_attributes.haml
code: bin/bench benchmark/old_attributes.haml && bin/bench code benchmark/old_attributes.haml
code: bin/bench bench -c benchmark/old_attributes.haml
- script:
name: attribute_builder.haml
code: bin/bench benchmark/attribute_builder.haml && bin/bench code benchmark/attribute_builder.haml
code: bin/bench bench -c benchmark/attribute_builder.haml
- script:
name: basic.haml
code: bin/bench benchmark/basic.haml && bin/bench code benchmark/basic.haml
code: bin/bench bench -c benchmark/basic.haml
- script:
name: minitest
code: bundle exec rake test