diff options
| author | Jon <[email protected]> | 2013-01-23 00:23:13 -0500 |
|---|---|---|
| committer | Jon <[email protected]> | 2013-01-23 00:23:13 -0500 |
| commit | 7f095534fdaad8dc6f378c1ea6c513c08a42ec01 (patch) | |
| tree | 4da05159cf757ef606fe0e3d14b80afaf63e9b52 /tasks | |
| parent | 26f353d8078f0cfee621dde14a76952dcbab72c3 (diff) | |
| download | mruby-7f095534fdaad8dc6f378c1ea6c513c08a42ec01.tar.gz mruby-7f095534fdaad8dc6f378c1ea6c513c08a42ec01.zip | |
Refine pretty-print indenting
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/mruby_build_commands.rake | 2 | ||||
| -rw-r--r-- | tasks/ruby_ext.rake | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake index f25d0d662..533f0fe62 100644 --- a/tasks/mruby_build_commands.rake +++ b/tasks/mruby_build_commands.rake @@ -214,7 +214,7 @@ module MRuby @command ||= @build.mrbcfile IO.popen("#{filename @command} #{@compile_options % {:funcname => funcname}}", 'r+') do |io| [infiles].flatten.each do |f| - _pp " MRBC", "#{f}" + _pp "MRBC", "#{f}", nil, :indent => 2 io.write IO.read(f) end io.close_write diff --git a/tasks/ruby_ext.rake b/tasks/ruby_ext.rake index 2cc1738c3..6817f6018 100644 --- a/tasks/ruby_ext.rake +++ b/tasks/ruby_ext.rake @@ -57,6 +57,10 @@ else $pp_show = false if $verbose end -def _pp(cmd, src, tgt=nil) - puts '%-5s %s %s' % [cmd, src, tgt ? "-> #{tgt}" : nil] if $pp_show +def _pp(cmd, src, tgt=nil, options={}) + return unless $pp_show + + width = 5 + template = options[:indent] ? "%#{width*options[:indent]}s %s %s" : "%-#{width}s %s %s" + puts template % [cmd, src, tgt ? "-> #{tgt}" : nil] end |
