public
Description: My .vim directory as well as my dev tool scripts
Homepage: http://blog.paulbetts.org/index.php/2007/03/06/my-awesome-vimrc-open-source-libraries-ctags-intellisense-1-for-linux/
Clone URL: git://github.com/xpaulbettsx/vimrc.git
vimrc / eval_erb.rb
100755 18 lines (13 sloc) 0.352 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/ruby
 
require 'erb'
require 'CGI'
 
exit 1 unless ARGV.size == 2 or
              (ARGV.size == 1 and ARGV[0] =~ /\.eruby/)
 
if (ARGV.size == 2)
    (infile, outfile) = ARGV
else
    (infile, outfile) = [ARGV[0], ARGV[0].gsub(".eruby", '')]
end
 
File.open(outfile, 'w') do |out|
    out.puts(ERB.new(File.read(infile)).result(binding()))
end